Showing posts with label workaround. Show all posts
Showing posts with label workaround. Show all posts

Sunday, January 22, 2017

Uploading files via Firefox in Android 2.3

This is very much a quick-and-dirty post, so that I wouldn't forget about it. As my phone is also currently charging while off, I can't check out some information pertaining to this post. Some time after the phone will have charged, I'll update this post accordingly.

So, yesterday, I had this need to upload a file to a project in Github via Firefox in Android 2.3 Gingerbread.

Now, Github is quite a modern website, and in Android 2.3, the logical browser for visiting Github and other state-of-the-art sites is Firefox for Android or a derivative, such as GNU IceCat, Orfox, or Adblock Browser.

I have two browsers in my phone: GNU IceCat 38.8 and Firefox 44.0. Both have NoScript installed, and Github servers were whitelisted in both. Separate issues with uploading are covered at the end of this post.

The crux of the problem is having a filepicker that works.

Typically, an Android user gets a file activity dialog to pick an app through which to select a file; such as Gallery for photos and videos, or somesuch.

For a simple text file, things are a bit more complicated, but I've discovered two kinds of filepickers that I associated with after having installed two separate apps.

• One filepicker, "Choose file" with blue folder icons, seems to be related to VimTouch, a version of Vim for Android, because I noticed that filepicker after installing this great text editor.
• Another filepicker, "Find file" or "Find command" (I might err with its title) is adorned with the Terminal Emulator icon.

Both VimTouch (alternatively spelled 'Vim Touch') and Terminal Emulator were installed through F-Droid, a repository of free and open source apps for Android.

The filepicker that works, is the one I associate with Terminal Emulator.

Unfortunately, I don't know beyond my memory of my app installation activities, and beyond one app icon about how to find out which app or handler these two particular filepickers are actually associated with.

Upload issues.

Resolved on 28.04.2017.

With IceCat, there were issues relating to uploading files to GitHub, whereby file upload failed with an error. File upload to GitHub worked with Firefox for Android, but for some odd reason, did not work in IceCat.

Now, I use NoScript in Android Firefox and in IceCatMobile (based on Firefox with very small changes). Since both have slightly different NoScript whitelists, then I attributed the issue to an incomplete NoScript whitelist in IceCatMobile. But it was not at fault, and the problem was much simpler, though no less esoteric.

Turns out, that all other things being almost equal, GitHub does not recognise the Firefox-based GNU IceCat browser when uploading files, if an IceCat-only desktop user-agent (UA) string is used.

The solution is to change in IceCat's about:config page the Gecko-based user-agent override affecting the Github domain to that of Firefox, leaving the version number intact.

<Moot:> Possible issues wrt NoScript
The reason for that, is, that I edit NoScript whitelists in Vim Touch so as to get a very fine-grained whitelist on a subdomain level (3rd-level domains and below, such as sub.domain.tld ), because the browser extension in Android does not provide such functionality.

The rationale for subdomain-level whitelisting is, that my phone is rather underpowered, and subdomain-level whitelists in Firefox/derivatives make it possible to allow advanced site functionality, and at the same time, to block script-based ads and trackers. In addition, it's possible to switch off very resource-intensive site functionality by blocking certain subdomains of a website. Such features are impossible in the stock Android browser, the rendering engine of which dates back to 2011.

(I'm often contemplate writing a separate post about all that.)

So, the NoScript whitelist for IceCat is typically more fine-grained; yet oddly, file upload to Github actually worked with Firefox.

Friday, January 13, 2017

Posting URLs with multiple concurrent dots in YouTube comments

In a YouTube discussion under one of the Star Trek-related video clips, a commenter ha posted an address to a Memory Alpha page into the comments, but the address to the article was truncated, because it contained three concurrent dots:

Intended address:

http://memory-alpha.wikia.com/wiki/Star_Trek_is...

and as it turned out in truncated form:

http://memory-alpha.wikia.com/wiki/Star_Trek_is.

Note, that the two last dots are gone, and if the address is clicked on at YouTube comments, the browser is taken to a "404/Not found" page in Memory Alpha.

The article about what Star Trek is, actually does contain three dots at the end of its address, but the YouTube comments system doesn't like it, as I found this out through my Google+ notifications on the desktop and the (linked) comments at desktop YouTube.

The somewhat unorthodox solution to avoiding dots from being truncated is to insert the URL with those three ending dots and replace the two last-most dots with their percent-encoded representations. Case in point:

http://memory-alpha.wikia.com/wiki/Star_Trek_is.%2E%2E

That one dot there may remain.

The percent-encoded values are available from Windows Character Map, a similar program in UNIX/Linux, or through any Unicode character table available on the web.

One can also try with

http://memory-alpha.wikia.com/wiki/Star_Trek_is.%2E.

— with "typed dot | precent-encoded dot | typed dot" after "_is", but there cannot be any two or more concurrent normally-typed dots.

Truncation of characters in addresses pasted (or typed) into YouTube comments can also apply to other web addresses with multiple concurrent characters, but I do not know, which types of characters are more affected or less. I could lay a claim, that special and non-alphanumeric characters that are used in programming, are treated with a greater level of scrutiny.

Saturday, September 24, 2016

Postimehe otseblogi ja NoScript

Firefoxis on NoScript laiendus kasulik selleks, et blokeerida skripte ning säästa arvutiressursse — et arvuti oleks kiirem. See sobib olukorras, kus masin pole kõige uuem, kuid ajab asja ära.

Probleem seisnes selles, et Postimehe otseblogi miskipärast ei näidanud, ehkki NoScriptis olid kõik Postimehe/PMO domeenid lubatud.

Tegemist oli konkreetselt töölaua-Firefoxiga, kuid sama asi kehtib teiste Firefoxi- ja Gecko-põhiste lehitsejatega, sh SeaMonkey, GNU IceCat, Debian Iceweasel jt.

Selgus, et otseblogi laaditav failitüüp ei olnud Firefoxile sobilik (failitüübi kontroll ei lasknud faili läbi), ning otseblogi ei laadinud enam. See paistis silma lehitsejakonsoolis (Tööriistad > Veebiarendajale > Browser Console).

Lahendus:
  • Minna about:config lehele, otsida parameeter nimega
    noscript.inclusionTypeChecking.exceptions
  • Väärtusele lisada järgmine tekstiosa koos tühikuga alguses:
    http://f.pmo.ee/s/failid/live/*.liv
Otseblogiga artikkel tuleb uuesti laadida, ning nüüd peaks otseblogi töötama.

Väike ääremärkus, et Androidi-Firefoxi ja IceCatMobile lehitsejatega, kus ka NoScript peal, selliseid probleeme pole, sest nendes on NoScripti mobiiliversioon vähemfunktsionaalne.

Lahendus oli NoScripti foorumis.

Tuesday, March 29, 2016

Pisut kriitikat "Postimehe" uue "mobiilielamuse" aadressil ja paar lahendust aeglastele nutitelefonidele

Kiirelt kirjutet ja sõnakas postitus, nii et kes loeb, on hoiatatud.
    Tingimused:
  • Vanem nutitelefon, operatsioonisüsteemiks Android 2.3 Gingerbread.
    Igal Androidil on vaikimisi lehitseja, mille kokkuleppeline nimi on "Android Browser"; kasutajaliideses lihtsalt "Internet".

    Android 2.3-ga kaasas käiv lehitseja on tehnoloogiliselt ja moraalselt vananenud, ning ei esita modernseid lehekülgi enam õigesti.
  • Sellest johtuvalt on kaasaegsete mobiililehtede vaatamiseks peale pandud Firefox Androidile. Et see vanemal seadmel enam-vähem kasutatav oleks, on Firefoxi lehitsejas suurem osa ressursinõudlikke funktsioone välja lülitatud, samuti on peal laiendus NoScript Anywhere (edaspidi NoScript), mis blokeerib vaikimisi skriptid kõikidelt tundmatutelt saitidelt ja lubab käitada vaid kasutaja poolt hallatava valge nimekirja kaudu lubatud skripte. Väga mugav.
Kuni selle aasta märtsi mingi kuupäevani oli "Postimehe" (edaspidi PMO) mobiiliversioon enam-vähem kasutatav, ning selle ajani kehtinud PMO mobiili jaoks sobiva ja kasutatava disaini küljendajatele tuleb jagada ohtralt kiitust. Sest see Disain töötas hästi.

Kui anonüümne kommenteerimine oli võimalik, sai ka kommenteerida, ning artikleid sai samuti segamatult lugeda.

Siis tuli 2016.a. märtsi keskpaik ja natuke peale seda, kui PMO lugemiseks avaldati üks ressursimahukas äpp (õieti mobiiliversiooni uus wrapper), avaldati paar päeva hiljem ka sellele ekstra küljendatud spetsiaalne m.postimees.ee.

Lihtne oleks ju öelda, et juhe jooksis kokku.

Valesti läks see, et PMO uus versioon tehti automaatseks, mis uuendab sisu ise, mis omakorda on oma loomult päris ressursimahukas tegevus.

Tõepoolest — silmailu on, aga selle saavutamiseks on ohverdatud kasutatavust.

Tuleb nentida, et kasutatavuse huvides ei oleks mina m.postimees.ee varianti mobiilseadmete jaoks üldse käiku lasknud, sest u. 2016.a. märtsi teise pooleni üleval olnud ise-mitte-uuesti-laadiv lahendus töötas mobiili-Firefoxis hästi.

Niigi lülitati 2015. aastal välja Postimehe WAP/WML-versioon, mis oli ülikiire ja -mugav viis uudiste lugemiseks. Ma tõesti ei tea, mis WAP-versooni väljalülitamise põhjuseks võis olla, kuid kahtustan, et sellega oli võimalik lugeda ka selliseid artkleid, mis käisid tavapäraselt "Postimees Pluss" alla. Jaa, WAP (WML) eelised jõudsid kohale alles 10-15 aastat hiljem.

Lahendus

Erinevalt töölaua-Firefoxis olevast NoScriptist ei ole Androidi-Firefoxis võimalik NoScripti valget nimekirja detailselt toimetada. Samuti ei võimalda mobiilse NoScripti kasutajaliides konkreetselt alamdomeenide lubamist/mittelubamist.
26.04.2016: ^ Veidi täpsustatud sõnastust.
Niisiis: Firefoxis on about:config seadetest extensions.nsa.policy alt võimalik kopeerida JSON formaadis olevat valget/musta nimekirja, mida on küll võimalik teksti kujul toimetada, aga koodi iseärasuse tõttu saab seda teha ainult tekstiredaktoris.
(Firefoxile mõeldud NoScript-i ametlik nimetus on NoScript Anywhere, ehk NSA...)
Jama on selles, et see JSON-rida on pikk üherealine tekstijoru. (Õnneks on JSON formaat suhteliselt lihtsalt loetav.)

Selle toimetamiseks on niisiis vaja tekstiredaktorit; isiklikult soovitan kahte äppi:
  • VIM Touch-nimelist tekstiredaktorit, mis on väike, võimas, ja algajale suhteliselt keeruline selgeks saada. A kui selge on, on lihtsam.
  • Hacker's Keyboard, mis annab Samsung Keyboard vms asemel täieliku sõrmistiku kõigi vajalike nuppudega.


VIM-i tundjad tõenäoliselt teavad, mida selle JSON-joruga edasi teha; praegu pikemalt ei seleta kui vaid niipalju, et JSON rida tuli kopeerida ja asetada VIM-i, siis iga domeeen käsuga :s/\,/&^M/g eri reale, siis sorteerida, ning siis toimetada ja lisada domeeni järele 1 või 0; 1 vastavalt lubab, 0 keelab. Komad lõppu ka, v.a. kõigeviimane domeen. Ärge unustage tegemast varukoopiat.

Supp seisneb selles, et PMO uudiste normaalseks lugemiseks tuli mul blokeerida ära http://m.postimees.ee ja lubada http://www.postimees.ee .
Varem arvasin, et alamdomeene võis lubada ainult http:// prefiksiga ja et ilma polnud võimalik; kuid vähemalt alates NoScript versioonist 3.5a11 sai seegi lõpuks võimalikuks.

Siiski jäin endise praktika juurde, ning turvalised domeenid on vajadusel alati https:// prefiksiga: näiteks kõik Google'i domeenid.
m.postimees.ee tuli blokeerida selleks, et uudiseid vaid lugeda; www ja kõik teised alamdomeenid lubasin selleks, et uudiseid kommenteerida (teoreetiline võimalus on olemas ju), ning mis põhiline — et kommentaare saaks reitida (lisada + või – ).

pmo.ee teise taseme domen on vaikimisi lubatud, teised reklaami- ja muud domeenid mitte. Blokeeritud oli eraldi http://ads.postimees.ee . Sest akut peab säästma.

PMO temaatilised alamdomeenid on kontseptuaalselt iseenesest hea, kuid kuna neid on palju, siis NoScripti valge nimekirja toimetamisel on nende käsitsi lisamine ebamugav. Vähemalt pole edaspidi vaja neid lubada/blokeerida.

Reklaam ja reklaamiblokeerijad

Tõepoolest, "Postimees" elatub osaliselt ka reklaamirahast, kuid erinevalt kaasaegsetest PC-arvutitest on vanemate arvutite ja mobiilidega tihtipeale see lugu, et vähese võimsusega on ka sama vähe mõtet reklaame vaadata ja lugeda. Mobiil-interneti puhul tuleb arvestada ka sellega, et inimesed reklaamide tõmbamise eest tegelikult väga maksta ei taha.
Miks mitte lisada PMO tellimus telefoniarvele näiteks?
Võib ju väita, et vähevõimas nutitelefon on oma omaniku peegelpilt, aga niisuguseid inimesi on ka, ehk "üksteist peab hoidma," nagu ühes armsas laulus sõnat'.

Hästivarustatud tavakasutaja koos uusima nutimudeli ja põhimõtteliselt piiramatu mobiilsidega selliste asjade pärast eriti muretsema ei pea.

Kvaliteetväljaandena on Postimees Online on siiski üks väheseid, kus on huvitavaid ja informeerivaid reklaame, ning neile klikitakse/toksatakse vajadusel peale küll. Teadlik reklaamitarbija tõepoolest mõistab iga kliki/toksamise väärtust.

Tõsi küll, võimalik on kasutada ERR-i kui tasuta uudistekanalit.

Infoallikatena on PMO ja ERR mitmes mõttes asendamatud. Delfi kui uudisteallika väärtuse kohta 'ei kommentaari,' kuigi nene mobiilse veebi jaoks mõeldud lahendus paistab (pea) kõigist oma lugejaist hoolivat... või noh, oma lugejate mobiiltelefonidest... :>

Lõpuks töötasin välja parima lahenduse võimalikest. Aga sellest juba tulevases postituses.
Uuendatud 26.04.2016.

Sunday, March 27, 2016

Firefox for Android on slow phones. Some practical advice.

This one was supposed to be a quick post; I might update it later on. And then I got carried away, and spent about four to six hours writing the post's content and refining its wording.

* That Firefox for Android can render better than the aged native browser on Android 2.3, is great, but at the moment, I won't go into detail about that.
* This post is not about desktop Firefox. I might write about issues current in desktop Firefox in a future post.

Contents

* What happened
* My phone is slow now.
* What to do. Extensions to speed up Firefox

Until today, I have avoided that "What I Use" post, but every once in a while comes a time, when I am not afraid to write about what I use. Even if it's not the newest kit.

Why I downgraded

After Firefox 45.0 was released, one early and now resolved issue was connection misbehavior with Firefox 45.0 and NoScript 3.5a10. Very soon, NoScript 3.5a11 was released, which fixed the issue.

Then, after upgrading, I also discovered, that Firefox 45.0 turned to using the Firefox-native toolkit for its main menu, which is slower than the natively formatted main menu in Firefox 44.0.2 and earlier.

For this and then-the earlier issue, I decided to downgrade back to Firefox 44.0.2 from version 45.0. The slow and inefficient main menu became cause not to upgrade any further on my device—except for testing.
Note, that when upgrading or downgrading apps in Android, use the overwrite method when installing; Do not uninstall the existing app version to then install a different version, or this action will forever delete all your user data for the app.

Backround

Thus, it slowly dawned on me, that my phone is showing its age. It's a Samsung Galaxy Mini 2, which model was released four years ago,[as of March 2016] but I got it in late 2013 as a pass-me-down, after it had two nearly grave misadventures with its previous owner.

* The Galaxy Mini 2 has an 800 MHz Snapdragon S1 CPU (specifically, MSM7227A), which is on the lower end of processors built on the ARMv7-A architecture, and uses the ARM Cortex A5 processor core.
* The phone runs Android 2.3.6 "Gingerbread", and won't be upgraded to a newer offical Android version.
* The device has just enough minimum required RAM memory to run Firefox for Android.

This soup of specifications essentially shows what the minimum for running a very modern version of Firefox for Android can be.

That major apps — such as Facebook and games — are not present, is a given. I've also excised other apps that I did not deem necessary anymore: BBC, ERR, Postimees, and a local service provider's player app.

What to do

In Firefox settings, disable telemetry and plugins. The Privacy Settings extension will make it simple to turn off other stuff.

Extensions to speed up Firefox

The following details two extensions that I use in Firefox for Android to have a reasonably passable browsing experience.

NoScript Anywhere.
In my phone, NoScript Anywhere ("NSA") makes browsing with Firefox a usable experience:
NoScript blocks scripts and plugins from running, and users can use the NoScript menu item to create an internal domain-based whitelist of sites which won't work without scripts. With this, NoScript not only blocks scripts, but also advertisements generated by scripts.
Another thing that shows the phone's age, is that the local daily "Postimees" launched a redesign of their mobile experience this month, and now their site redirects to their brand-new mobile site, which, if JavaScript-enabled, updates every ten minutes with AJAX, and that slows down the experience and the phone, and presumably eats away at the battery, too.

The obvious solution was to forbid postimees.ee from running scripts, thus removing it from the allowed sites list. This mangled the design somewhat, but at least the site will display reasonably responsively. Yes, it's a simplistic workaround, but it makes it possible to read news there, even if the site is not functional. The functional part was the possibility to rate comments, but "Postimees" removed the ostensibly anonymous commenting functinality. Most people just don't care to create a burner account on social media, and neither do they care risking their primary social media/e-mail accounts.

Privacy Settings
Another Firefox extension that reduces resource usage, is Privacy Settings. It's available at the Mozilla Add-ons site. With Privacy Settings, it's possible to switch off components that I don't have any need for. There are some settings that I have kept on, as switching all things to 'secure' may break rendering or accessing places like Instagram. While Privacy Settings won't work on older Firefox versions that can still run on Android 2.2 or earlier, or on ARMv6 CPUs, the extension's website has a breakdown of some of the about:config settings that one can modify manually.

I'm also considering the Policy Control extension, as it would reduce resource usage even further, and introduce more fine-grained control over which website can use which resources.

Saturday, March 12, 2016

How to prevent gwx.exe from running

This affects Windows 7, Windows 8.x, and this post is only about the "Get Windows 10" nag message seen in the taskbar notification area.
04.04.2016 Update: Before even of this post, there have been more sophisticated efforts to keep Windows 10 from automatically installing itself on computers with Windows 7 and 8.x. Never10 is the latest effort. Computerworld article here.
  • This post assumes, that the user already knows how to change file permissions and attributes.
  • I wrote it from memory, because I used the below method on someone else's computer that had Windows 7 in it.
I won't vouch, that following the below steps will prevent drive-by installs of Windows 10, but in a computer I worked on, the nagging stopped.

There are also several updates that should be hidden, and which one would be smart not to install. Or, if they're there, to uninstall. Upon returning the computer, I instructed the user only to install critical updates from Windows Update, but not recommended updates.

* As Administrator or a user with admin rights, go to the location where gwx.exe is at;
* Go to its file properties and take ownership of the file. The default owner is TRUSTEDINSTALLER
* After that, change file permissions for all users so, that only you or the administrator can only read it.
* Repeat that with other executables in the same folder.


Writing to the file(s) should thus be forbidden, and also deleting it (them).

You or a designated administrator account should be the only ones who can change the file's attributes. I don't know, if prohibiting file attribute changes also affects changing whether rights to the file can be modified in the future.

In total, this should mean, that the file can't be executed and its attributes can't be changed by other users.

I also remember doing some changes at Windows Scheduler as to whether gwx.exe should run, and I remember disabling some of these items, too.

And then restart the computer. After that, the "Get Windows 10" notification did not appear anymore. #worksforme

Friday, January 22, 2016

File attachments in Android 2.3 and GMail


This post is about how to add attachments in GMail in Android 2.3.x from the file system.

Granted, many people are stuck with Android 2.3.x, so the post is specific to that branch of Android.

GMail app

This happened to me with the GMail app version 2.3.6 in Android 2.3.6 on a lower-end Samsung phone.

A few days ago (that was around 17.05.2015) I was trying to send two crash log files of a different app to its developer via Android's GMail app, and for some reason, sending the e-mail didn't work. I don't quite know why, and I lost the e-mail. One attachment was relatively small, and another was around 860 Kb (a bit large in some respects). I haven't investigated this issue online.

A day later, putting attachments in an e-mail in the Android GMail app and seeing that same letter as a draft in GMail on the web did work:
• If you insert attachments first in the GMail app, then do write some text into the message area, which unblocks the save-as-draft button; save the letter as draft and sync.

I haven't investigated how to do that in a browser in GMail, given that the GMail app method worked out for me.

Monday, January 18, 2016

Independence Day: Resurgence website and Firefox

A quick post: www.warof1996.com might not display in Firefox and other Gecko-based browsers.

The reason is that the site is based on WebGL, and Firefox blocks WebGL, if the GPU (video card) driver is out of date or does not support WebGL.

The solution in Windows is to update GPU drivers either through the computer manufacturer's website or through the site of the GPU supplier — one of Intel, nVidia, or AMD/ATI, but not limited to only these.

Thorough care should be taken to match the driver to the correct display adapter model.

If that doesn't work, the GPU is too old, or EOL'd.
I strongly recommend not to force Firefox to use WebGL, because this move can damage hardware.
The alternative is to use Google Chrome or Chromium, which probably uses a CPU-based workaround; but if either the graphics adapter or the CPU or both are too old, then rendering is unlikely to work, or is too slow.

> Explanation — contains minimum driver versions that support WebGL.

In addition, visit about:support in Firefox and the Graphics section therein, which also recommends the minimum driver version for WebGL (Direct2D, etc). The posting contains the same warnings about possible damage to hardware if Firefox were forced to use WebGL.

System requirements

This table is incomplete. I've only gotten to test the website on three computers (with some reservations), and gotten an external report about another.
PCHardware/software specifications
CPUGPURAMOSFxChromeNotes
ASUS K53SC notebookIntel Core i3 2310M @ 2.1 GHz, dual-corei:Intel HD Graphics 3000
d:nVidia GeForce GT 520MX
4 Gb DDR3, 665.1 MHzWindows 7 SP1YesYesRequired driver updates: I had to upgrade both Intel and nVidia drivers through downloading them from their respective websites.
ASUS U46SVIntel Core i5 2410M @ 2.3 GHz, dual-corei: Intel HD Graphics 30008 GbWindows 10 (build unknown)SlowNot testedWebsite opens, but performance is slow and jerky, and the fan began working intensely.
d:nVidia GeForce GT 540M
ThinkPad R60e (0657-3WG)Intel Core Duo T2400 (Centrino)Mobile Intel 945GM Express2 Gb DDR2
(an upgrade from just 512 Mb)
Windows XP SP3NoSlow / okRendering was slow, but the site was usable.
Chrome: 48.0.2564.109 32-bit; Blink 537.36 JavaScript: V8 4.8.271.19, (This version already announced that it's to be retired on Windows xp.)
Instead of OpenGL, Chrome's default renderer in Windows is ANGLE, which translates OpenGL ES to Direct3D, as it has better driver support. Thus, results for Chrome can differ.
hp dv5204ea notebookIntel Celeron M 410 @ 1.46 GHzMobile Intel 945GM Express1 Gb DDR2, 266 MHzWindows XP SP3NoToo slowWhile I did upgrade the driver, its version is still less than required: The latest Windows XP driver for this GPU is 6.14.10.4926 (15.02.2008), but Firefox wants at least version "6.1400.1000.5218".
PCCPUGPURAMOSFxChrome
All this does not yet indicate much as to what the titular website's actual system requirements are. In notebook computers, the default video card used by any program in Windows is the integrated adapter, while nVidia software provides an option to launch programs using its own GPU.

The Asus notebook with greater specifications falls below the threshold, whereas the Asus notebook with slightly lesser specs, an older operating system and updated video drivers shows the website nicely.

Friday, November 20, 2015

Synaptics touchpad erratic on Knoppix 7.x

The title is self-explanatory. I first discovered this issue with Knoppix 7.0.5 (IIRC), and it continued "well" into Knoppix 7.2 CD versions. I prefer to use CD versions of Knoppix, because of a lack of storage and download speeds. Yes! Mmh!!

Note, that to avoid fancy Compiz effects, I almost always use the no3d parameter at Knoppix startup.

The Synaptics touchpad is highly erratic (in Metacity), and until today, I had had nothing that would resemble workaround to make it less erratic. One of the symptoms in a browser, for example, is that text suddenly gets selected, and I can't release the selection. No, nothing helps. I could only use the keyboard to navigate, and LXDE/Metacity environments don't appear to have any keyboard shortcut to access the taskbar (start) menu.

Some of the workarounds:
  1. An immediate workaround is to restart X from the console via restartx
    One can have a non-minimised terminal window (uxterm) ready in the background, and then use extant keyboard and menu commands to close active apps. Another is to use Ctrl-Alt-F1 to revert to the text-only console. Restarting X is not a longer-term solution, because the problem might return again.
  2. Another is to fall back to Knoppix 6.7.1, which allows a stable pointer with the Synaptics touchpad, but this Knoppix release has outdated software (Iceweasel 6.0, for example).
  3. Yet another in Knoppix 7.x consists of adding the psmouse parameter into the Knoppix start-up command-line:
    knoppix no3d psmouse.proto=imps
    The imps somehow changes the pointer input device. At least on my machine, the immediate effect was that cursor tracking (movement) with the touchpad became slower.

    While the terrible and annoying erratic behaviour was not there as much, it still kept being somewhat erratic in other ways, albeit less so, and in a more manageable manner. Then I discovered the following:
  4. The thing is to never open the CompizConfig Settings Manager. — Because I noticed that it will start changing settings right after it's started or when a user changes settings on their own. That way, I have been able to evade issues that cause/d the pointer to misbehave so terribly.
  5. 04.08.2018 update:

    At some point, I realised, that since the touchpad is misbehaving, it would be saner to use an external pointing device, such as a USB mouse (or PS/2, or what have you). That doesn't fix the problem, but prevents usage of the touchpad.
  6. The issues crop up less, but even using an external USB mouse is not perfect enough for uninterrupted work. Disconnecting the external mouse from the USB port, using the touchpad for a short while to resolve the pointer hang, and re-connecting the USB mouse may help.
  7. Then I got the idea, that perhaps I should disable the touchpad entirely, because I'd occasionally touch it by accident, and it interefered with the pointer driven by the external mouse, forcing the pointer to get stuck again.

    Here I got very nice instructions as to how to disable a misbehaving pointing device: The output of xinput --list with the pointing devices that X has identified:
    Virtual core pointer                          id=2    [master pointer  (3)]
      ↳ Virtual core XTEST pointer                id=4    [slave  pointer  (2)]
      ↳ Logitech USB RECEIVER                     id=9    [slave  pointer  (2)]
      ↳ PS/2 Generic Mouse                        id=11   [slave  pointer  (2)]
      ↳ SynPS/2 Synaptics TouchPad                id=12   [slave  pointer  (2)]
    
    • "Virtual core XTEST pointer" is the first, and should never be shut down, as it will cause X to restart, and lose any unsaved work.
    • Logitech USB RECEIVER is the wireless USB mouse. It's the first wireless laser mouse, and as such, the receiver is a separately mains-powered cradle that connects to the USB port.
    • PS/2 Generic Mouse. I can't tell, if it belongs to an external mouse, or is identified separately by X. Because it's not the external USB RECEIVER mouse, and not then touchpad.

    Follow the id= number of the device, and use that to enable/disable it with the respective console commands below:

    xinput --disble 12
    xinpute --enable 12

    — to shut off what one could think is the offending device. Instructions from here.

    Then again, disabling the TouchPad didn't work, and I was still stuck with a stuck pointer. Ugh.
  8. 19.11.2018 update: Use a different window manager, such as twm.

    At first, I thought the erraticity of the Synaptics Touchpad to be because of LXDE and its use of Metacity. No.

    I'd somehow installed twm (Klaus Knopper gutted the CD-version of Knoppix 7.2 so much, that he omitted twm from it).

    Switching between twm and LXDE requires creating and then editing the local .xinitrc file, and then launching restartx to choose the correct window manager / desktop environment.

    In .xinitrc, the execution commands for twm and lxde are different: For twm, it's just

    twm

    ; For LXDE, it's

    exec startlxde

    For one window manager to be chosen via $ restartx, comment the other out with a hash # sign.

    And so I thought at first to be safe from the Erratic Synaptics Touchpad. Well, no. That still happened, but somehow less, and it was easier to escape the erraticity and non-responsiveness of the pointer. On the other hand, if the pointer did become sticky, I'd be stuck until I'd restartx, sometimes even via Ctrl+Alt+Backspace, if hovering over a terminal window in twm would no longer switch focus to it to allow retartx to happen. In console (as in, Ctrl+Alt+F1...F4), restartx would start, but wouldn't display. Ugh.

    But at least now I know, that it's the fault somewhere in the driver and how X handles it, and not directly with LXDE.

Wednesday, February 11, 2015

Proov vanast mobiilist

Postituse algne tekst on võetud ingliskeelse Wikipedia Linuxi-artiklist:
  Linux is a Unix-like and mostly POSIX-compliant operating system assembled under the model of free and open-source software ...  
Niisiis oli seesinane algselt postitatud Samsung SGH-C170 mobiiltelefoniga, mida kasutan paari enda tehtud wap-lehekülje (jah, WAP-lehekülje) testimiseks, sest see telefon on niivõrd piiratud funktsionaalsusega.
Blogisissekande mobiiliga postitatud sisu eraldasin postitust tavalise arvutiga laiendades teksti lõppu.

Samsung SGH-C170

Samsung SGH-C170 on väga algne 2007. aastast pärinev mobiiltelefon, mis toetab ainult GPRS mobiil-andmeside standardit, ning milles on väga algne WAP-lehitseja, mis toetab vaid WML 1.2.1 standardit, kerget XML-i, ning GIF ja JPEG pilte (max suurus vist kuni 30 Kb, kui mälu ei peta). GPRS peaks nagu tähendama 2.5G toetust...

Muud piirangud

2015. aasta probleem kuupäevaga
Esile tuleb tuua seda, et mis tahes 2015. või hilisema aasta kuupäeva ei otseselt võimalik lisada. Kiiruga toimis see lahendus: selleks, et vähemalt esiekraanil näidatud kuupäev peaks nädalapäeva paika, valisin 11 aastat varasema aasta, mis ei langeks kokku peale 2007. aastat olevate aastatega. Sarnase probleemiga mudeleid on veelgi.

Huvitavama lahenduse leidsin antud telefonimudelit arutava gsmarena foorumi postitusest:

• Keera kuupäev 31.12.2014 23:59 peale, siis muuda kellaaega iga kord 23:59 peale ja oota minut seni kuni kukub õige kuupäevaga uus kuupäev.
Ääremärkus: Aasta lõpupoole novembris-detsembris on muidugi aeganõudev kogu see tsirkus läbi teha...

Kuid kui telefoni kasutada vaid ajutiselt (testimiseks vms), siis on muidugi lihtsam sisestada 3-4 või 11 aastat varasem aasta, kus nädalapäevad sobivad olemasoleva kuupäevaga ilusti kokku.

WAP lehitseja piirangud
C170 mobiili WAP-lehitsejas on WML-lehekülje ühe deki (WML-formaadis lehekülje-osa) piirsuuruseks seatud 4000 baiti. Testimisel selgus serveris oleva üheainsa dekiga faili maksimumsuuruseks 4501 baiti, mispuhul on ühe niisuguse WML-lehekülje kerimine väga-väga aeglane. Niisugust (deki)suurust ületavaid lehekülgi konkreetne telefon ei tõmba, sest "lehekülg on liiga suur." Antud mobiili WAP-lehitsejal puudub ka funktsioon, mispuhul leheküljest esitatakse vaid vastuvõetavas mahus tekst ja ülejäänud jääb tõmbamata.

Antud mobiilimudeli WAP-lehitsejal ei ole https-turvaprotokolli toetust, mis tähendab, et andmeedastus ei ole krüpteeritud. Sellest johtuvalt ei ole lõviosa populaarseid e-posti- jms teenuseid üldse kättesaadavad.

Kirjade saatmine

Algne blogipostitus oli saadetud läbi Elioni (hot.ee) e-kohviku WML(XML?)-formaati toetava e-posti keskkonna.

Kirjutatavale tekstile on suuremgi kitsendus, mis lubab koos e-posti aadressi ja teemaväljaga kasutada kõige rohkem 159 märki. Kirja enda teksti suurus sõltub e-posti aadressi ja teemavälja jaoks algselt läinud tekstimahust, kuid üldjoontes tuleb arvestada kirja 128-märgise limiidiga.

Limiidini jõuab siis, kui kirja tekstiväli (sõltuvalt muude tekstiväljade täituvusest) rohkem märke lisada ei võimalda. Siis tuleb igaks juhuks kustutada umbes viimased viis märki või jätta umbes viis märki varu mõttes kirjutamata. Sest saadetud kujul tuli postituse ette kaks tühikut ja taha samapalju tühikuid. Endal oli selline tunne, et kui _kõik_ märgid olid teksti lõpuni alles jäetud, tekkis kirja saatmisel WAP-lehitsejas tõrge.

Nii et lühemaid e-sõnumeid saab saata küll.

Et Wikipedia tekstile kohandatud litsents on Creative Commons Attribution-ShareAlike tingimustega, tähendab see, et litsentsitingimused peaksid laienema vähemalt antud blogipostitusele ka. (Samas võib muidugi nentida, et teksti lühiduse tõttu on tegemist tsitaadiga, ning tsitaate võib mõistlikus ulatuses vabalt kasutada.)

Lahtiütlus: See blogipostitus ei ole mingil moel Samsungi toetus; blogipostitus kannab informatiivset funktsiooni.

Tuesday, October 7, 2014

Installing the GIMP FFT plugin (in Windows)

The short of it: to install the Fourier FFT transform plugin into GIMP, download the latest version from here (registry.gimp.org). (I chose the Windows distribution, 32 bits).

From this gimpchat.com forum post I learned that both fourier.exe and libfftw3-3.dll must be placed into the GIMP plugins folder (specifically
C:\Program Files\GIMP-2.0\lib\gimp\2.0\plug-ins).

Unfortunately, when starting GIMP again, I got the error that the file libgcc_s_sjlj-1.dll was not found, so this meant that the filter wouldn't work.

To get the libgcc_s_sjlj-1.dll file, this instruction on another GIMP plugin suggested how to get that file: download the x32-4.8.0-release-win32-sjlj-rev2.7z package from Sourceforge (36.1 Mb); then you need to open the compressed file with 7-Zip (if you don't have it, download and install it separately beforehand), move to directory x32-4.8.0-release-win32-sjlj-rev2.7z\mingw32\bin\, and there's the file.

Extract only libgcc_s_sjlj-1.dll to C:\Program Files\GIMP-2.0\lib\gimp\2.0\plug-ins .

I became interested in the FFT plugin from a Wikimedia Commons Help section offering instructions about image manipulation, introducing the plugin here and in the next section.

Wednesday, July 16, 2014

Simple maths on image height

It has taken me a while to post new stuff, but since I finally got around to it, I'll post it anyway.

This time, the description of the problem is not in the lede, but hidden somewhere in this post.
I know there may be a much simpler way and I might have even thought about it after creating this post, but the following is just a way to express how I got to it. My best excuse is that I wanted quite a lot of precision and I found the following to be the best way.


Recently I got my hands on a very simple GPRS feature with only a WAP browser as its most advanced feature. It has 600 kilobytes of storage for small sounds and images, and I'd learned to use the WAP browser to download previously down-scaled photos as background pictures to customize the phone.

One problem that I ran into, is that the phone's default main screen UI text showing operator, date and time is in white colour, and this interferes with images that have white elements of it.
At that time I hadn't found out yet that I could customize UI text colour as well as add text shadows. The limited selection of colours, and text shadows made things legible, but not nice-looking, so I decided on keeping the white text.
Usually, this means that I'd only have to choose pictures with coloration that avoid the white colour. But recently I photographed a very beautiful event, and I wanted the phone to contain a picture of it, but in a way that much of the event would stay under UI text, with the sky above the event serving the function of a beautiful background to white text.

The final photo had to have the dimensions of 128x97 pixels (width x height) without the loss of aspect ratio.

I had previously created myself an XCF template image of that size in GIMP to be able to test the background image against the precise UI simulation before using mobile data charges to download the final and best version.

The precision was based on a "screen measure" image I'd saved in the phone to measure how many pixels the main screen text used up height-wise and how much of the background was free.

Out of a height of 97 pixels I measured 46 pixels that are used up by main screen UI text.

This is what I did in GIMP:
  • In the original large photo, I chose a baseline from the bottom of the selection from which I wanted to expand the selection upwards. The baseline was the lowest point from which I wanted to include information in the selection that would make it to the final image, small as it would be;
  • Then I cropped away the parts below the baseline and kept the rest of the photo. That way it was easier to select from the bottom.
  • After that, I raised the selection, but discovered a roadblock, because I didn't know how high I should raise it: I wanted the event to stay more or less just below main screen text, but in such a way that the text and the top of the stage wouldn't touch.

    The trouble, of course, was getting the height right. I kinda knew that trying to get it right 'by hand' just by making a selection and then testing to see how it looks would take too much time.
I knew I had the base information: 97 pixels height, 46 pixels reserved height at the top which I couldn't use, and 51 pixels that I had free.
Yes, I could have just downsized the big image with Shift+T and a 128x97-pixel layer above it to try and get the approximate right size, but that's not enough for a small image that has to be pixel-perfect.
I realized that it should be possible to get to the right height from the selection that encompassed the area that I wanted to stay below main screen text. This became the essential question.

(I didn't really need the width, because I'd use the template image to calculate the width of the selection using the Scale image widget by just inputting the desired height, given that 128x97 were already set as base dimensions.)

I do admit not being very proficient in mathematics. So I found a simple-to-understand online percent calculator and the default operating system calculator. After much trial and error (but hey :-) I got the right calculations and put them in the right order. Then to automate the whole thing so as to spend less time in the future, I proceeded to put these calculations into LibreOffice (I had to separately find out how to do percent calculations there), and eventually got to connect individual calculations into several formulae.

Yes, I am sure there are probably much simpler math formulae for these calculations, but the main one along with adjacent ones works as expected.

Then I turned to Google Docs, which is this awesome thing if you want to share interesting documents with the world,* and made the spreadsheet look nicer for embedding in a blog.

* Note that information that people want to keep private, secure, and in a cloud, should be kept with the companies that meet three criteria: that said companies are headquartered in countries that have strong respect for people's privacy, that the clouds they use are also located in those countries, and that said companies do not have operations in countries that do not respect people's privacy.

So here's the embedded document, and a link to it:
Calculating reserved image height from a selection

So, in the blue column 47 pixels from top of the image is reserved height; if I change it to 46, the other figures will change accordingly. The 'Input free height' cell is where I set the height of the selection that must include everything I want below main screen text; 'Total' is the total height of the selection.

After I get the total height, I use the 128x97-px template image in another window and the Scale image tool where I replace 97 px with the total height, move input focus with the tab button, and the Scale image tool will calculate the right width for me (if height and width values are connected, as in keeping the aspect ratio).

Then I changed the selection in the big image to that size, moved the selection around a bit, copied it, pasted as a new image, and then scaled the image down to 128x97 px. In the scale image tool, I only needed to change the height from 698 pixels to 97 pixels; the width — as the aspect ratio was correct — was then calculated to 128 pixels.

All in all, I had only four tries and not more. That last two consisted of moving the selection around in the big image to more or less center the stage that I had photographed. The right image turned out to be the one at the third try, when I compared the third and fourth tests.

Maybe in the future I'll provide example images to make a visual point of what I wanted to achieve.

Wednesday, April 3, 2013

Mozillale NoScripti installimine Windows Vistas

Seesinane on siis eestikeelne kokkuvõte oma varasemast ingliskeelsest blogipostitusest. Alguses kirjutasin selle kohta ühele sõbrale, ning kuna tekst osutus siiski pikemaks, leidsin ma seejärel, et jutt vajab avaldamist.

Hiljuti ühes Windows Vistaga masinas avastasin Mozilla 1.7.13. Tegemist on siis tarkvarapaketiga, mille lehitsejamoodul on sama vana kui Firefox 1.0.8 (Aprill 2006; esitlusmootor pärineb 2004. aastast ja Mozilla enda arhitektuur 2001.-st aastast).

Et Mozilla mõnede lehekülgede JavaScripti pärast kokku ei jookseks, läks alguses palju aega, et kuidas sellele NoScript nii peale panna, et töötaks, sest umbes sama vanale Firefoxile Knoppix 4.0.2-s (2005) sai küll. Lõpuks jätsin asja katki...

Mõni kuu hiljem leidsin lahenduse (Mozilla tuli käima panna administraatori õigustega) ja siis panin peale NoScripti, aga nii, et see tuli kindlasti installida Mozilla kasutajaprofiili kataloogi.

SeaMonkey 1.1-ga sellist probleemi ei tohiks olla, sest SeaMonkey 1.1 ja Windows Vista arendus/väljalase langes umbes samale ajale, et põhimõtteliselt sai seda Vista jaoks siis veel kohendada nii, et oleks parem ühilduvus.

SeaMonkey 1.1.19 on üks viimastest vabatarkvaralistest graafilistest lehitsejatest, mis töötab Windows 98/Me peal.

Friday, June 22, 2012

Cannot play videos on Yahoo! News?

Symptom: This often happens with users of Firefox and other Gecko-based browsers, when:
• they can't show most news videos on the Yahoo! News website and some other Yahoo! properties;
• the commenting system is not functional (can't properly view and post comments).

Privacy-conscious users, and/or those who wish for their browsers to consume less resources, use a script blocking add-on, such as NoScript. I often have NoScript configured to allow/disallow full domains (like d.yimg.com) and not just second-level domains (just yimg.com).

As it often happens, allowing only full subdomains instead of just second-level domains brings with itself more issues.

By default, NoScript includes a whitelist of second-level domains without which major services' functionality would be wholly disabled. The whitelist also contains yahoo.com, yimg.com, and yahoopis.com). The instructions herein are for users who have chosen to impose a more fine-grained control over the websites they visit.


Right, well, I finally played around with NoScript and found a solution:

NoScript:
    In addition to news.yahoo.com and screen.yahoo.com and maybe others, allow the following domains essential for video playback:
  • l.yimg.com
  • d.yimg.com
  • connect.facebook.net (If you're privacy-conscious, then allow temporarily).

  • 11.07.2012. Update: I later discovered that non-video news items also featured videos, so here's an addition of domains that must be allowed:
  • video.query.yahoo.com
  • yep.video.yahoo.com
  • yui.yahooapis.com (important on other Yahoo properties, even if not using video)
  • webplayer.yahooapis.com
Flashblock:
• Allow d.yimg.com
^ Including only that domain in the Flashblock whitelist will have the video area rendered with the Flashblock placeholder. Clicking on it will start playback (note that ads are also played).
• Allow l.yimg.com
^ In regular news items that included video, disallowing l.yimg.com wouldn't even load the Flashblock video placeholder.

If you want video to load automatically, allow the above domains, and news.yahoo.com and screen.yahoo.com (and/or other Yahoo! properties as necessary from the Flashblock toolbar button).

Conclusion

Even if l.yimg.com and d.yimg.com are enabled in NoScript, the crucial part for some erroneous coding reason is connect.facebook.net; If that is not allowed, most video code and commenting functionality won't load. Note that connect.facebook.net is the primary culprit. This has been discussed before at forums.informaction.com (a NoScript and web security forum).

Sunday, January 8, 2012

Updates information not visible in Windows Vista

So here's a scenario: When using Windows Update in Windows Vista, and the Windows Update front page shows an x number of critical updates and an x number of regular updates, and you click on either of them, the detailed updates listing is all blank; a user doesn't know then which updates should he choose (or not) to download and install.

The specimen in question was Windows Vista Home Basic Service Pack 2 in a Dell Studio 1535 notebook.

I tried and searched for many solutions, and somehow got the thing to work normally again, but I can't exactly put a finger on what it is that I did, partly because I was too lazy to restart after every move or document too diligently. #tired

Assuming everything else is more or less in order, then —

Services started in-between:
1. COM+ System Application, but didn't set it to start automatically.
2. Microsoft .NET Framework NGEN v2.0.50727_X86 (Delayed Start).
I had read somewhere that in Windows Vista, Windows Update for some reason required .NET Framework 2.0 to run.
So, if memory serves me correctly, I did install it one day, but at the time it didn't yield the required effect and I had to let it be...
And yes, there were regsvr32 things started and re-started from the command line, but that didn't quite help.

After a few hours of searching for a solution, with many a discussion thread suggesting starting and stopping services, registering and unregistering system files, I stumbled upon a set of suggestions that matched the conditions that I had. See the forum thread here.

Since there was a match in error conditions registering Windows Update files, I was confident about the solution as much as the tech guys were on the forum.

So the solution was to run

SFC /scannow

in a Command Prompt window run as Administrator. If you decide to do the same, then beforehand, create a system restore point or rely on a very recent one, for example one made just a few days ago.

SFC is the System File Checker command-line tool and its variant in modern Windows versions checks protected Windows system files against tampering and replaces those it that appear to be wrong.

I ran the tool, it took its while, but then it finished.
I also got to check out its logs (requires administrator mode to view in WordPad) and separated the most recent check into a new file for the sake of posterity. I couldn't see any substantial errors when changing files over, but there was a lot of movement going on.

Then did a restart, and lo and behold, details about individual updates in Windows Update were visible again! Yay!

Saturday, July 16, 2011

DOM Inspector XPI for older Firefox/IceWeasel browsers

Knoppix is the kind of distro that by default does not include the DOM Inspector, it's only on a CD, and I think I had even spent a month searching for a way to install it from a .deb file to a version of firefox in Knoppix. All in vain, even if I had the supposedly right package, because it would still prove incompatible and thus unusable (would crasshh).

Then, by chance, I found the right way to install the DOM Inspector XPI separately for Linux in those distros, where a package might be missing (such as a relevant .deb package in Knoppix 4.0.2, because it's a snapshot from Debian's testing branch of the time) or not included at all... — By downloading a specific DOM Inspector XPI from the old mozilla.org FTP site, which is archived at mozilla.org's own ftp site:

ftp://ftp.mozilla.org/pub/mozilla.org/firefox/releases/1.0.6/linux-i686/xpi

Caveat in Knoppix and other Live CD-s: You can only install it as superuser, it won't install into the user directory and thus it won't save, but rest assured, you can install it again every time you need it, although it may be tedious for daily use, if that might be the case for some users.

Here's what you have to follow, if you're stuck using a LiveCD, a version of Firefox without DOM Inspector built-in, no package repository to rely on and no package to be found for your particular distro (Knoppix):
  1. Find out what your version of Firefox is in your Live CD (launch Firefox; Help>About). For some Knoppix Live CD's I sometimes use, mine is 1.0.6 for Knoppix 4.0.2 and something else in newer versions of Knoppix. Keep in mind that newer versions of Knoppix include Debian IceWeasel (Knoppix is based on Debian), which is a source-compatible rebranded copy of Firefox.
  2. Exit Firefox, relaunch it as superuser, best with sudo firefox
  3. Go to
    ftp://ftp.mozilla.org/pub/mozilla.org/firefox/releases/
  4. From there, choose the version of Firefox/IceWeasel/GNU IceCat you are stuck using (if using a browser click the relevant version folder link);
  5. Once there, browse to a folder called linux or linux-i686 and there browse to the xpi folder. Note down the address in a separate editor.
  6. (Make sure that ftp.mozilla.org is the allowed domain to install XPI's)
  7. Click on adt.xpi (the XPI for DOM Inspector), which should be at the very top of the directory listing, go through the extension installation procedure. If after installation you don't see the extension listed, don't worry. Restart Firefox again as superuser, via sudo (you should now know how to use it). Verify that DOM Inspector is installed by checking the Tools menu. Exit the sudo'd Firefox.
  8. Start user-mode Firefox and you should see the DOM Inspector appear there.
  9. To maintain that you still have the XPI for future use, save it to local storage (a memory stick, for example) by downloading it in a normal-user firefox session from the same FTP address.
Now, I haven't been able to find out an XPI of the DOM inspector for older versions of Firefox that would actually work as an extension installed into the user profile, so until then, it's more of a case for frequent users of DOM Inspector in older Firefox browsers on a Live-CD of reinstalling the XPI after every restart.

Settings for DOM Inspector can be changed through about:config, then search using the inspector string.

Monday, May 23, 2011

Putting stuff before a counter with CSS and associated caveats

I thought this too important to be passed up, so here's only a very rough draft of what I discovered. And because I was only revisiting this subject right about now, I have yet to get my own head around all this, with more detailed explanations.
(Blogger had nasty issues with updating their software, so a number of blogs were in read-only mode and so instead of writing this up I was occupied with other things. The good thing is that Blogger have been very responsive in addressing the posting outage.)


When tallying personal data and opinions for what was ostensibly a list of items in a text file, I wanted to find out how in an ordered HTML list (a numbered list with <OL> tags) I'd be able to use Cascading Style Sheets (CSS) to place some special items before counters (usually numbers, but CSS 2 standard has expanded counters to be much more) as markers of some sort.

The main point was to make a more informative and interesting list... Well, yes, but this turned out to be a far more difficult exercise than I first thought.

For an intro, the following describes the differences in rendering between Mozilla Firefox 2 and Mozilla Firefox 3+. Because these browsers use the Gecko rendering engine, which is used by other browsers, then here's also a quick browser side-by-side of the rendering engine's branches:
Gecko 1.7Gecko 1.8.1Gecko 1.9 and newer
Mozilla Firefox 1.0Mozilla Firefox/IceWeasel 2Mozilla Firefox/IceWeasel 3+

Mozilla Application Suite 1.7
SeaMonkey 1.1SeaMonkey 2+
K-Meleon 1.5K-Meleon 1.6+

What follows is example CSS code with some comments. I haven't yet had all the time to describe everything, but bear in mind the lede.
OL.Eurovisioon {counter-reset:item; list-style-position:outside}

OL.Eurovisioon LI {display:block;}


/*display:block ^ loses the browser's automatic numbering;
• The items must be displayed as block, so as to make sure that the later width attribute applies. */

OL.Eurovisioon LI:before {float:left; content:'miskitekst\ ' counter(item) '.'; counter-increment:item; border:solid 1px gray; padding-right:5px; width:82px; text-align:right; line-height:1.1em; color:navy; white-space:nowrap} /* these work... */

/* ^ • Floating them left makes sure that the items are displayed like in a standard ordered list;
item must be inside counter(), item is also specified for counter-increment;
text-align:right aligns numbered counters right and so makes it more list-like again;
white-space:nowrap makes sure that when increasing text size, text inside blocks wouldn't wrap and add in height and take away from the structure.

Caveats:
Once the items are all displayed as text-block or inline, the width attribute does not apply anymore. Displaying as block and floating to right works in Firefox 4 (I'm also assuming 3.0+), but not in SeaMonkey 1.1 and anything with the Gecko 1.8.1 engine (see the above table) and the caveat applies to all older browsers.). Setting the display to text-block or inline fixes the issues in SeaMonkey 1.1, only that setting width attributes does not work then. */

OL.Eurovisioon > LI.plus:before {width:82px; content:'\ sisu\ ' counter(item) '.\ '; text-align:right; color:blue} /* somehow works */

OL.Eurovisioon > LI.plus {list-style-position:outside}
^ Is this really necessary?
Moreover, the list already contains tabular data; including informative content with :before or :after pseudo-classes means that this data won't be indexed and may be lost to search engines. Non-graphical and older browsers won't be able to see such content.

I, of course, thought that I'd never see the day when my own fancy CSS implementation would not be visible with something like SeaMonkey 1.1.19.

The correct rendering is supported by Mozilla Firefox and IceWeasel 3 (probably since 3.0), SeaMonkey 2, Google Chrome (Version 11 does, so I'm assuming a host of earlier versions do, too), and the latest Konqueror, Apple, and Opera fare. Internet Explorer 7 does not support this. Bleh.

So here's the example list:
  1. tekst
  2. teine tekst
  3. kolmas tekst
  4. neljas tekst
with corresponding code in HTML:
<OL CLASS=Eurovisioon>
<LI>tekst</LI>
<LI CLASS=plus>teine tekst</LI>
<LI>kolmas tekst</LI>
<LI>neljas tekst</LI>
</OL>
So long I still have to use Mozilla Firefox 1.0, I must still use a simple HTML table. At least the advantage is that most browsers will be able to see the content. The table in question is here.

As the information was laid out in a text file, it nevertheless turned out to be tabular data, which was actually much simpler to organise into a table, rather than implement complex CSS for the same.

Thursday, May 5, 2011

Adding formatting to CSS generated content

This solution (or workaround, if you like) came out of a need to write text visible only for modern browsers.

I have a case, where such text would point out a formatting feature containing further information in <ACRONYM> tags, only that severely out-of-date and text-only browsers do not support the dotted underline and border properties, so help text for these browsers was not necessary. I wouldn't use JavaScript (which uses document.write) and there are websites like WordPress (IINM) that only allow editing CSS files and may forbid JavaScript.

The CSS 2.1 specification has it that it's possible to create generated content before or after an element, using :before and :after pseudo-elements, respectively.

The best explanation about how it works is in the CSS2 technical recommendation at W3.

The difficult part is in how to format text within the content: property.

Well, there are two ways that work and a third way that is a workaround. The two ways are well-documented in the W3 technical recommendation (see above link), where it's possible to specify attributes with first-letter and first-line (for longer texts within content) pseudo-elements.

The Third Way

Specifying formatting for bits of text within the content: property is impossible, so the solution is to create one or more rulesets of :before or :after pseudo-elements with similar declaration blocks, wherein some rulesets' declarations are different.

In HTML, write the following snippets of code:
<SPAN CLASS=text></SPAN><SPAN CLASS=dotted></SPAN><SPAN CLASS=bits></SPAN> and so on...
In CSS, example code shows the following:
.text:after {content:'^ Mouse over text with\ ';}
.dotted:after {content:'dotted underlines'; border-bottom:dotted 1px; border-bottom-color:inherit;}
.bits:after {content:'\ for more infobits'}

/* ^ Use the backslash \ to escape special characters, including a space (or it won't be shown). */
The result:
Browsers, which don't support CSS :before and :after pseudo-elements, won't see this. ^

The result is used here in a previous blog post. The example text snipped was put in place of a paragraph break, but since the Lynx browser wouldn't create a paragraph break inside a list with <P></P> or <BR><BR>, or instead there was more space added in modern browsers with variants that included a non-breaking space &nbsp;, then the best solution was to wrap above HTML code within <DIV> tags and add a non-breaking space —
<DIV>&nbsp;<SPAN CLASS=text></SPAN></DIV>
Characteristics
The most interesting and equally obscure characteristic with CSS generated content is, that generated text cannot be directly copied — even when selecting a normal area that wraps around generated content, then only the wraparound selection is pasted.

While this may be useful to wonks interested about protecting original content, then it's still a chore to implement, and advanced users would still be adept at copying text from near the source (unless obfuscated). The technique is similar to mechanisms that disable direct text copying in advanced document files, like PDF, but with the difference in sophistication: PDF files have encryption and other features.

The (dubious) advantage is, that direct copying is disabled; and the disadvantage is, that a number of browsers don't support these pseudo-classes. And not just older (Netscape 4) and niche browsers (Lynx, Links, Elinks), but even Internet Explorer 7 doesn't.

16.12.2015. Update:

I recently wanted to add newlines to generated content, but after several turns of trial-and-error with \A in content:, I turned to a search engine and found about the best blog post by Chee Aun that describes the issue in detail.

The solution with Firefox is to specify white-space:pre-wrap — This preserves both wrapping and newlines.

Thursday, April 7, 2011

Free Software alternatives to Trajan Pro

With the image and font table well below I have tried to find out free small caps and fallback font alternatives to Trajan Pro, a very popular Roman-style font known for its style and legibility. With free, I have in mind the context of free software, so free as in freedom.

The reason for this was that I was fixing the design of a simple website and its original designer had specified Trajan Pro as the font for the site's menu text, only that Trajan Pro is proprietary and non-free, which means that not everyone has it and I had to find out the necessary fallback fonts.
A fallback font means that I specify multiple fonts in the font-family CSS property: If a web browser can't find the first font, it shows text in the next specified font or uses the browser default.

I recently discovered that a similar trick can be used in OpenOffice.org documents, where I'd specify two or more fonts and separate them with a comma. OO.o also has the means to set fallback and replacement fonts in its options.

Requirements for matching fonts:

• Roman typeface.
• Must have small caps, just as Trajan Pro does /capital letters should then be bigger;
• Must look good and legible in bold weight (this was the site requirement) at default size (12pt/16px) and I only chose ones that looked good enough;
• Must contain the ü character /implies that other Latin-extended characters are also contained.
N., 06.09.2012 update:

A large number of primary fonts are already 'Roman' or like by their looks, and nowadays' CSS conventions should allow transforming text into uppercase with a favoured font. Alas, there are sites that are likely to use Trajan Pro, and so there need to be fallback fonts that are similar.

Process:

I found most of the interesting fonts from fonts.debian.net (one large page contains several hundred images of font examples, so beware), an otherwise fabulous resource for all who want to seek free software fonts.

As I was seeking only small caps fonts, I only downloaded these.
In the process it occurred that that some of those fonts wouldn't show properly, because space marks were visible. Since fonts.debian.net shows fonts with all their subsets, I made a half-educated guess that some of the small caps fonts I downloaded were also subsets, which therefore didn't require to have spacemarks in them, because any rendering software would fall back to the main/primary font for symbols that were not used in the subset. Another reason for visible spacemarks might be that the fonts that I got from the above site were not compiled for Windows, but Linux and Unix in a wider sense, so this could also be the reason.

As it turned out some of those fonts displayed on fonts.debian.net were indeed subsets of TeX fonts, which are listed here (if not with the same extensions, like ttf, then still with the same filenames), so skimming over that list should help in distinguishing the fonts that should not be downloaded in the first place, unless you know exactly what you want. The fallback system in TeX is called Metafont, so spaces are probably there, too.
Furthermore, when creating the table, it turned out that the text had to look good both in high contrast (black on white) and in lighter incarnations. I haven't put that yet as a requirement.

Result:

The following is a quick-and-dirty preliminary report, as I have yet to do more research on small caps fonts on the subject.

The fonts I included in the table are only those that passed the requirements, well, somehow:
• Whether any example resembles the cut-into-stone effect of Trajan, is debatable, at least they're Roman;
• They must be reasonably light even when in boldface;
• The winners' most common denominator is that their small caps really are what they say they are, unlike with Trajan, where actual capitals are only slightly larger, which makes the alternatives metric-wise imperfect.

Fonts in the results image and table are in medium size, which defers to the browser and operating system default (typically 12pt). Since even small caps are small, then any smaller-sized text with some of these fonts is very likely to be less legible.

In the image, I've avoided using the actual Trajan Pro font, which is non-free, and resorted to using contours of the text that use it. In a table below the image, the Trajan Pro row text is formatted in that font, but the font is displayed only when a client computer actually has it (otherwise the browser will defer to the blog's default body text font). To fully comply, I've formatted the heading row with the Liberation Sans font (with fallbacks to Helvetica, Helv, sans-serif).
Trajan Pro FOSS alternatives
Results table
Font name
Test wordNotesOverall mark
Trajan ProKülalisteraamatReference
Romande ADF Style StdKülalisteraamat++++
LMRoman10-CapsKülalisteraamatSlightly fatter+++
Berenis ADF No2 StyleKülalisteraamatLegible, but small caps are small...++
The below fonts are fallback fonts with small caps. Conga might be a non-free font, although it's been included in a version of Knoppix.
CongaKülalisteraamatKnoppix 4.0.2, fallback
Copperplate Gothic LightKülalisteraamatWindows, fallback
CastellarKülaliste­raamatWindows, 2nd choice fallback /note that "lower-case" capitals are level with "upper-case" capitals
Felix TitlingKülalisteraamat
Perpetua Titling MTKülalisteraamat
The below fonts, while having "small" caps, were found in Windows, but they don't qualify because of various visual aberrations.
Copperplate Gothic BoldKülalisteraamatWindows, fallback /Ugly when bold, but small caps are smaller
Engravers MTKülaliste­raamatWindows /Too large
AlgerianKülalisteraamatWindows /Too ugly
I intend this post to be a work in progress of sorts, so I hope to make further updates.

N., 06.09.2012. update:

Fonts with small caps that didn't make the cut:

Aegean /incomplete
Akkadian /incomplete
Analecta

Computer Modern Roman Regular Small Caps / CM Roman /ugly
TeX Palladio L Small Caps & Old Style Figures / TeX Palladio L

Irianis ADF Style Standard Regular / Irianis ADF Style Std
Linux Libertine O Capitals / Linux Libertine O C

Text about Free software alternatives to Segoe UI was moved to a separate post.

Wednesday, January 5, 2011

GIMP 2.6 UI text too small?

I had the happy occasion to download, install and use GIMP 2.6.11. Overall it's a very nice image manipulation program, so kudos to developers. One trouble was that its user interface's default text size was too small for my liking. While it may be good on small monitors, it's not good in large monitors and neither is it good for the eyes like that.

So I surfed the web and first found out one solution (forgot the source, of course), and then another one, which is easier (with attribution to the initial suggestion).

R., 05.10.2012. update:

Right, well, this has been brewing for a longer time, but I've now gotten up to describing a more elegant solution that has been available for well more than a year or so. If not more even...

So, anyways, I got the solution for Windows from the help page of the Pidgin instant messenger, and the page is on its own quite straight-forward:
  • Download the GTK2 preferences program, also known as the GTK+ Theme Switcher package (version 0.4.1 and Win32) from Sourceforge;
  • out of which compressed package you should extract gtk2_prefs.exe into the GIMP program folder, such as this —

    C:\Program Files\GIMP-2.0\bin\

  • Then create a shortcut to the program, and then move the shortcut to the desktop or copy it into the GIMP folder in the Start Menu;
  • Then make sure GIMP is not running when you change settings with the below program, because upon quitting it might overwrite the settings you've changed.
  • Launch the program, which is officially named The Gtk2 Theme Selector. There you should be able to change the look of GIMP, including themes. Of the two default themes I chose Raleigh, because it's nicer-looking, but you can download your own via instructions at the Pidgin help page.
Caveat: If you uninstall or upgrade GIMP, the Gtk2 Theme Switcher program (and any additional installed themes) will be deleted. Not sure about whether settings will also be retained, but after upgrading, you'll need to re-extract the Gtk2 Theme Switcher in order to set the settings right (if need be, again). The program's user interface is quite straight-forward. Save settings/quit the theme switcher, start GIMP.

But the above is a much simpler solution than advice below, which has worked for me, too.

And if that doesn't work, then the following should definitely help.

First of all, GIMP uses themes and keeps its configuration data in configuration files of those themes; the files are easily editable. Before you do any changes, make a copy of the original first, just in case.
  • Locations for themes can be found at Edit > Preferences > in the left-side section, click on Themes [since I use the Estonian-language UI, the word is Kujundus; located between User Interface (Liides) and Help System (Abisüsteem)].
  • In the right-side main section, you will then see the list of themes and their locations. Theme names correspond to their relevant folder names. By default, there are two: Default and Small.
  • Go to the themes folder, and make a copy of the Default folder, rename it. I've renamed it to Default-bigger. Making a copy of the theme folder will keep the original theme.
  • Go into the copied theme folder, Default-bigger in my case, and open the gtkrc file. This is the gtk configuration file for GIMP and contains settings directly affecting font size in the user interface. Make a copy of the file first, then open it with a text editor (if you use Windows, I suggest WordPad, because it supports UNIX-style carriage returns, or Notepad2; if resources permit, a local office productivity word processor is good, so long you save the file in the original format).
  • The file's settings are similar to formatting rules in a CSS file. Scroll down in the file and look for font-scale and label-scale items. The default size for these are given as 0.8333. Change them to 1.0, as in
    GimpRuler::font-scale          = 1.0
    Save the file, (re)start GIMP. If something goes wrong, you can overwrite the modified file either from its own original copy or the original in the original Defaults theme.