The One with the Thoughts of Frans

Archive for Android

Web Apps Opera Bork Edition

It’s been 18 years since Opera published their classic bork edition, to protest that MSN would have loaded properly in the browser if only it were served the same code as Internet Explorer.

“Hergee berger snooger bork,” says Mary Lambert, product line manager desktop, Opera Software. “This is a joke. However, we are trying to make an important point. The MSN site is sending Opera users what appear to be intentionally distorted pages. The Bork edition illustrates how browsers could also distort content, as the Bork edition does. The real point here is that the success of the Web depends on software and Web site developers behaving well and rising above corporate rivalry.”

Since I’m a Vivaldi user, today’s the first time I noticed that Chrome on Android artificially restricts installing webpages as apps on the homescreen. Only webpages that specify a manifest.json can receive such a hallowed treatment, instead of every single webpage ever made. For the rest of the internet, there’s only a shortcut. While the situation is not quite comparable, I found the design principle sufficiently distasteful to revive Opera’s classic bork script, in this case specifically targeting the Chrome browser.

You can put it on your website or in your TamperMonkey to remind you when you accidentally open Chrome. The classic result looks like this:

A borked Vivaldi announcement as seen in Chrome.
// http://web.archive.org/web/20050301075735/http://www.opera.com/js/bork/enchefizer.js

/* -*- mode: C++; mode: font-lock; tab-width: 4 -*-
 * 2003-02-10
 *
 * The Enchefizer code is based on a script fetched from 
 *   http://tbrowne.best.vwh.net/chef/
 * written by Andriy Rozeluk , which is
 * based on a Java version written by Josh Vura-Weis
 * , which is based on a UNIX version
 * from 1993 written by John Hagerman  and
 * Jeff Allen 
 *
 * Subsequently hacked by Opera Software to work inside a page by 
 * traversing the DOM tree, and to improve performance. 
 *
 * Typical usage is to add the following text to the bottom of a page:
 *       
 */

const classicOperaBork = () => {
    /* USER CONFIGURATION BEGINS */
    var victim=false;   // false (apply to any page) or regex to match page URL
    //var victim=/^http:\/\/(?:(?:www|msdn).microsoft.com|www.msn.com)/;
    var delay=50;       // ms between replacements, set to 0 to disable waiting
    var units=30;       // number of text nodes to translate each time
    var highlight=true; // highlight the text we're working on
    /* USER CONFIGURATION ENDS */

    var textnodes=[];   // text nodes in the doc
    var nextnode=0;     // next node to process

    function nextWordPos(line)
    {
		var p = line.search(/[ \n\t\\,<.>/?;:\'\"\[{\]}|=+\-_!@#$%^&*()~`]/);
        return p == -1 ? line.length+1 : p;
    }

    function encheferizeLine(line)
    {
		var buff="", word="", t="", out="", wp;

		while(line.length > 0)
		{
			wp = nextWordPos(line);
			word = line.substring(0,wp);
			t = line.charAt(wp);
			line = line.substring(wp+1,line.length);
			out = out + encheferizeWord(word) + t;
		}
		if(t == ".")
		{
	        out = out + "\nBork Bork Bork!";
		}

		return out;
    }

    function encheferizeWord(word)
    {
		if(word.toLowerCase() == "bork") return word;
      
		var letter, count, len, buff, i_seen, isLast;
      
		count=0;
		len=word.length;
		buff=""
		i_seen=false;
      
		while(count0){
               
				} 
			} else if(letter=='t'){
				if(count==len-2 && word.charAt(count+1)=='h'){
					buff = buff + "t";
					count+=2;
					continue;
				} else if(count<=len-3 && word.charAt(count+1)=='h'
						  && word.charAt(count+2)=='e'){
					buff = buff + "zee";
					count+=3;
					continue;
				} 
			} else if(letter=='T' && count<=len-3 && word.charAt(count+1)=='h'
					  && word.charAt(count+2)=='e'){                                                
				buff = buff + "Zee";
				count+=3;
				continue;
			} else if(letter=='v'){
				buff = buff + "f";
				count++;
				continue;
			} else if(letter=='V'){
				buff = buff + "F";
				count++;
				continue;
			} else if(letter=='w'){
				buff = buff + "v";
				count++;
				continue;
			} else if(letter=='W'){
				buff = buff + "V";
				count++;
				continue;
			}
			//End of rules.  Whatever is left stays itself
			buff = buff + letter;
			count++;
		}
		
		return(buff);
    }

    function bork()
    {
		var limit = delay == 0 ? Number.MAX_VALUE : units;
		var start=nextnode;
		var oldc = new Array();
		var n, i, candidate;

		if (highlight)
		{
			for ( n=start, i=0 ; i < limit && n < textnodes.length ; n++, i++ )
			{
				candidate = textnodes[n];
				oldc[i] = candidate.parentNode.style.backgroundColor;
			}

			for ( n=start, i=0 ; i < limit && n < textnodes.length ; n++, i++ )
			{
				candidate = textnodes[n];
				candidate.parentNode.style.backgroundColor = 'red';
			}
		}

		for ( i=0 ; i < limit && nextnode < textnodes.length ; nextnode++, i++ )
		{
			candidate = textnodes[nextnode];
            candidate.replaceData(0,candidate.length,encheferizeLine(candidate.data));
		}

		if (highlight)
		{
			for ( n=start, i=0 ; i < limit && n < textnodes.length ; n++, i++ )
			{
				candidate = textnodes[n];
				candidate.parentNode.style.backgroundColor = oldc[i];
			}
		}

		bork_more();
    }

    function bork_more()
    {
		if (nextnode < textnodes.length)
		{
			setTimeout( bork, delay );
		}
    }

    /* In large docs traversal is a bottleneck at startup; we could
       CPS it or otherwise reify the traversal state to interleave
       traversal with the translation.
	*/
    function find_textnodes(elm, acc)
    {
		if (elm.nodeType == 3)
		{
			if (!elm.data.match(/^[\s\n\r]*$/))
			{
				acc.push(elm);
			}
		}
		else
		{
			var c = elm.childNodes;
			for ( var i=0 ; i < c.length ; i++ )
			{
				find_textnodes(c.item(i),acc);
			}
		}
		return acc;
    }

    /* run page's onload handler, then do our thing */
    var res = false;

    if (typeof old_onload == "function")
	{
		res = old_onload();
	}

    if (/*window == top &&*/ (!victim || window.location.href.match(victim)) )
    {
		textnodes = find_textnodes(document.body, new Array());
		nextnode=0;
		bork_more();
    }
    return res;
}
if (window.navigator.userAgentData.brands.filter(e => e.brand === 'Google Chrome').length > 0) {
    document.addEventListener('DOMContentLoaded', classicOperaBork);
}

CommentsTags:

Android Version API Level

It’s in the docs, but I’m always losing it. So here’s a quick overview of some of the ones that are more important to me.

Android version API level
Android 8.1 27
Android 8.0 26
Android 6.0 23
Android 5.0 21
Android 4.1 16
Android 4.0.3, 4.0.4 15
Android 4.0, 4.0.1, 4.0.2 14
Android 2.3 9

https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels

CommentsTags:

Skype on Android x86

A new Skype update was installed! Now “rebuilt from the ground up […] the best Skype we’ve ever built” (release announcement). Okay, cool. Let’s give it a go.

What’s that, a crash? And it won’t be fixed because I have the wrong kind of CPU? You can tell Google Play not to update the app by unchecking auto-update. Tap the three vertical dots in the top-right corner to bring up the option.

Uncheck auto-update.

Then download the old Skype Android app from AndroidDrawer.com (“Because Newer is Not Always Better”) or any similar site. Version 7.46.0.596 seems to be the most recent version which still works on x86.

Enjoy your Skyping. Or maybe just switch to Discord. It offers video chat now. Skype and I have had a decent run since ’04, but let’s face it, these past few years nothing good has happened. Take, for instance, the announcement last year that Skype for Linux was being updated again.

For example, you’ll be using the latest, fast and responsive Skype UI, you can share files, photos and videos and send a whole new range of new emoticons.

I have no idea what they intended by talking about “responsive UI”. The supposedly retired version 4.3[1] scales along just fine with DPI thanks to it being Qt-based. I guess they hope that by just tossing out random terms I won’t notice the old version already does all the things they’re boasting about. Well, except for those emoticons. Big whoop.

What’s my ICQ number again?

[1] “Important notice: All Skype for Linux clients version 4.3 and older will be retired on July 1, 2017. To keep chatting, please install the latest version of Skype for Linux.”

Comments (1)Tags:

Changing the Android Default Alarm on Zenfone 2

I don’t like the default alarm sound on my phone much and apparently changing it to something a little bit gentler can only be done on a per-alarm basis. Luckily I found this:

Today I was looking for a way to change the sound that is applied by default to new alarms you create in the Alarms app. After quite a bit of effort I came upon the following procedure:

  1. Install ES File Explorer
  2. Open it and select / from the Favorites
  3. Browse to /system/media/audio/alarms
  4. Click on the file you want and in the "Open with" prompt select "ES Media Player"
  5. Click on the bell beside the file name, pick "Set alarm" and click OK

Should you choose to change again the default, you may notice that the defaults you pick will appear in the music library. Also, they will be listed twice in the tone selection list which appears when you manually change the tone of an individual alarm.

You can fix that with the following steps:

  1. Open Settings
  2. Go to Applications > Manage Applications > All
  3. Click on Media Storage and then Clear data
  4. Reboot your phone
  5. You will now have to set your new default sound

(I've noticed that sometimes, when you view a music album which doesn't have a cover art image and add an album.jpg file to it later, Music Player will not use that file for the cover art. The above steps, as a side effect, will make Music Player look for images for all albums, thus having the cover art of all your albums updated.)

Hope this helps 🙂

The ASUS Alarms app.

Comments

Using Syncthing to Replace Dropbox on Android

According to the timestamp on Getting Started.pdf, I’ve been a happy Dropbox user since 2010. For probably equally many years, they’ve had the most obnoxious Android app. Perhaps I don’t want to put my whole Dropbox on my Android phone (although I’m not so sure I don’t), but obviously you should be able to select a whole directory to sync. Solutions like Dropsync are unfortunately super slow, probably because it seems to be mostly a clever hack that syncs files one by one.

Instead of a similar alternative, I’ve really always been irked by the lack of an easy to use Unison-like sync for my phone. Running Unison in a chroot just doesn’t quite cut it… The obvious solution is something like Syncthing or Bittorrent Sync, which works regardless whether or not there’s a remote server involved. And if there is, it’d be a remote server under my own control.

Syncthing isn’t ideal because of its lack of subdirectory selection. But since in reality it’s almost exclusively a one-way street anyway, it doesn’t matter so much. The main point is that this is all easier than running an FTP server on the device, plugging it in over USB, running a webserver on it to drop files into a browser window or whatever other overly complicated solutions might exist. To install Syncthing, get it on F-Droid. Or Google Play, if you don’t think it’s obnoxious.

You can get by almost entirely on F-Droid alone. In fact it’s where most of the best software is found.

Unfortunately Syncthing can’t sync wherever. Oh well, we’ll just sync within its own directory instead.

On my phone, Syncthing can’t handle the MicroSD card, but we can trick it.

It’ll make some things a touch more complicated. Maybe a symlink? Oh drat, FAT32 strikes again. Meh.

Aard Dictionary doesn’t care where it’s located.
Add a favorite, a shortcut, or both. It’ll be difficult to interact with the directory otherwise.

The sync problem isn’t really solved yet, but it’s sure a lot better. All in all, Android is still awful and you should probably consider getting an Ubuntu Phone instead. The end.

As for Syncthing, perhaps its most interesting property is that it can largely replace both Dropbox and Unison. In fact it can probably completely replace Unison for me, because I haven’t actually bothered replicating my stuff onto a separate physical HDD in years. And Syncthing definitely makes it easier to add more of my laptops and whatnot into the mix. On the flipside, the fact that I run Unison once a week or so forces a kind of built-in review of the changes I made, so I can undo them if desired. In this way it’s more like a backup. But of course, Syncthing can sync between more than two computers at once, while the changes are happening. It’s worth a look, if nothing else.

Comments (1)Tags: , ,

Connecting to Belgacom FON: It’s Still Possible

I was happily using Belgacom FON Autologin instead of the behemoth of an official Belgacom app, but ever since Belgacom updated their portal code I’ve barely been able to connect at all. That’s Belgacom’s fault, not the app’s. I haven’t been able to connect through the web interface or the official app either, because it just times out or gives mysterious errors. Unfortunately Belgacom FON Autologin pretends to be a browser by sending information over the HTTP protocol, so it equally fails to connect.

Luckily I just came across FON AccessFon, an app that utilizes the WISPr protocol. In a magnificent 33 kB it manages to connect to Belgacom FON quickly and efficiently, and for every FON router rather than just Belgacom’s to boot.

Comments

I Joined the Dark Side

Back in 2010 I was really looking forward to the upcoming MeeGo phones by Nokia, but alas, it was not to be. My five-year-old phone started dropping its connection now and then for no apparent reason, so it was time to upgrade. Unfortunately all the phones out there seemed to be either mini-tablets or otherwise not living up to my requirements, but a few weeks after I’d stopped looking I almost accidentally came across the Sony Ericsson xPeria ray. It combined two features very important to me: it is not a small tablet and it has a nice resolution, resulting in nigh 300 PPI. Can I get the latter on desktop monitors please, instead of that paltry 1080p HD that seems to be popular right now?

I intend to document some of the apps I’ve installed and why, and perhaps also why I quickly uninstalled some others. To that extent it’s more of a public note to self, but who knows — it might just help to someone else.

Sense Analog Clock Widget
Because none of the other clock widgets were big enough. Call me old-fashioned, but I like a big clock to be the first thing I see. The weather, system info and configurable click actions are a nice touch.
K-9 Mail
The default e-mail client was alright, but not really any better than what my old SE s500i gave me over half a decade ago. Besides, it’s mostly just the default client with some bells and whistles.
K9 Mail Unread Count Icon
Unlike the default e-mail client, K-9 Mail doesn’t display the number of unread messages in its icon. This widget takes care of that.
Keyboard from Android 2.3
I like the default Android 2.3 keyboard better than the one Sony Ericsson included. You can choose your preferred keyboard by long-pressing on a text-input field. Among the advantages are that it’s easier to type symbols and you can change languages by a simple swipe on the space bar. Besides, it has a speech recognition button built-in so you don’t necessarily have to type on the screen.
AndFTP
I tried a few FTP programs. Most were lacking in the SFTP department. However, I think it may not ask before it overwrites files.
Dropbox
Heck, it’s useful. Besides, they give you 500MB of extra free storage.
ArchiDroid
I need to extract files sometimes. Duh.
OI File Manager and Open Manager
I haven’t decided which one I like better, but it’s preposterous that something like this wasn’t included by default. Did I mention my feature phone came with a basic file manager?
Barcode Scanner
Very straightforward. It scans those funky QR code blocks without any fluff.
QR Bookmarklet
This one actually isn’t for my phone, but for my regular browser. I saved it among my bookmarklets and gave it the nickname “qr”. Now if I want to open any page on my phone, I can just type “qr” and use Barcode Scanner.
Opera Mobile and Opera Mini
Are any other browsers even in the same league? Mobile for Wi-Fi, Turbo for when a real browser might be required on the go, and Mini for true data saving. Also consider Firefox. The default Webkit browser is bearable, but basically awful. Note that while Opera Mobile supports options like site preferences, adding them is a bit of a pain due to the lack of a simple interface.
Battery Widget
I like a big battery indicator — and the little one it adds to the notification bar has an actual number so you know what’s going on.
Screebl Beta
The best argument for those motion sensors yet. It disables or holds back the screen timeout while the phone is in your hand and can speed it up when you lay it down.
Timeriffic
Again, it seems like this should be included by default. Set your phone up to stfu at night and whenever else you don’t want it to ring. You can also change some other settings if you want, but for me it makes more sense to turn e.g. Wi-Fi on manually.
OpenOffice Document Reader
LibreOffice is my preferred office application after HTML + CSS rendered to PDF with Prince. I may want to look up something in one of my documents on the go.
wifi AutoSyncAutoToggle widget
I don’t really want my phone wasting CPU or data on syncing unless I’m on WLAN. This takes care of that. Don’t forget to tell your applications to obey this setting. Other applications, most notably Google Play Store, don’t necessarily live by this setting, but sport options like “update or sync over Wi-Fi only.”
SD Tools
I don’t know if I’d recommend installing it per se, but benchmarking the speed might interesting for comparison.
Maps With Me
It’s a lot like Google Maps, except it’s based on OpenStreetMaps and offline. There are more OSM apps out there, but most I’ve tried seem to be less fluid, uglier, or default to turning the GPS on. I’m just looking at having a decent 2D map just in case — I’ve got an actual GPS with a bigger screen (albeit sadly with a much lower PPI value) for driving. Surprisingly, although I also gave a few commercial applications a try, their 2D maps didn’t seem nearly as usable as the Google Maps or Maps With Me varieties. The commercial apps have loads of POIs though, which might sometimes be useful.
Aard Dictionary
In a similar vein, I’ve now got The Collaborative International Dictionary of English and the entirety of Wikipedia on my phone. It’s not only useful for when you don’t want to use data: it’s actually really, really fast. There are more dictionaries available, or you can make your own. The only downside I can think of is that SVGs (which presumably shouldn’t take too much extra space) are missing from the files.

Android is certainly usable, but ultimately it’s too Apple-ish for my tastes. It’s also a bit annoying that by default everything’s set up to use data all the time. I understand that connectivity is a big factor of the device, but it’s no wonder people complain about low battery life if their phones are synchronizing all kinds of things every few minutes. If I’m on the go I can live with checking for new e-mail manually to conserve both data usage and battery life. Ultimately, while I’m happy with my new phone, I hope real GNU/Linux will be available before I have to buy a new one again.

Comments (1)