perjantai 27. marraskuuta 2015

Security question that wasn't to be


Sometimes user registrations do mysterious things...

So I got the new tablet I mentioned earlier. Another Asus, cheap-ish ZenPad that was essentially unusable out of the box. It kept freezing and refusing to start up after sleep. Not good, Asus, absolutely not good.

After playing with it for some time I chose to do factory reset and start over, this time installing all the system updates first (for some reason it didn't bother to even offer that first time around, I only found out about these when doing some internet searches about freezing). And it helped, although I think I had to do full three system updates (granted, each smaller than one before it) before it was up to date. At least now it is working better, with no new major issues found so far.

Anyway...

Before factory reset I had noticed that this tablet included also a kids mode program built in. In previous one I had to use some third-party software which was less than perfect, but the new one seemed to be better so why not use it.

Of course, to use it I had to enter four-number PIN (as expected), then security question (which I didn't really expect), then set up the software allowed in that mode (quite expected). I consider it somewhat stupid that in kids mode the application grid is limited to about a third to a quarter of screen when in landscape mode, while most of the space is taken up some graphics and large "exit" and "configure" buttons. But that aside it seemed better than previous program I had used.

Then I did the factory reset. So all the settings were lost, except...

Now, when I tried to set up the kids mode again the PIN went fine, but apparently my answer to the security question during setup, when it is first entered to the system is wrong. Really, how can that be, as I haven't actually given answer yet. And yes, I did check the spelling many times over, used same answer as previous installation and everything. To no avail. It just won't accept my answer. And this was the setup part of the use, not shit I forgot the PIN part.

Just great... Finally I managed to find "skip" button (way down on the screen, previously covered by keyboard overlay) and managed to get things working, but this was very, very puzzling. Some leftovers from previous installation? If so, there's something seriously wrong with factory reset procedure. Who knows...

Well, fortunately I happen to consider those questions more a security risk than safety anyway, so nothing lost by not enabling it anyway. But I'm still puzzled why exactly I couldn't enter it anyway...


maanantai 23. marraskuuta 2015

What, I can't buy beer?


Just today I heard on some news that there was some research done which indicated that booze has been part of Finnish culture since times unknown, curiously including sermons at churches, and also current government has been fighting this equally long time. Kinda explains some things. Text below has been in my queue for some time now, so guess I'll just publish this now.

Sometimes the laws regarding alcohol here (Finland) feel somewhat puritan.

It used to be that you couldn't buy any alcohol (including beer) from shops (bars and such naturally were exempt) past 9 PM, until the next morning. This I didn't mind too much, really. But then this law was made stricter - you couldn't buy alcohol until 9 AM. Apparently idea was that the (small number of) heavy users couldn't get their refill first time at a morning.

Several years ago I was staying at a hotel at Turku due to a trade fair, exact details escape me. When having breakfast (around maybe 7:30 to 8 AM) I noticed that there were two German men at the next table. They apparently wanted to have beers for breakfast. Waiter told them that no can do, they can't serve alcohol until 9 AM (I haven't read the actual text of this law so I don't know if it actually applies to hotel restaurants serving breakfast, but they at least interpreted it so). As you could guess, there two German gentlemen were very confused about such laws.

I don't remember if this was before or after above, but my wife worked night shifts at one point. At one day I picked her up from work (around 7 AM -- you might already guess where this is going...) and before I dropped her off to home and went to work myself we went to a shop to get some groceries. What we bought doesn't really matter, usual foodstuffs, but I do remember being somewhat annoyed that I couldn't grab few cans of beer with me to be enjoyed on evening (since this was before 9 AM). Yeah, like the gentlemen above, I am not a fan of this completely retarded law either.

In Finland these laws aren't officially based on morality (read: hypocrisy) like in some other places, but on citizens' health (repeat: officially so). For same reason taxes on alcohol are very high, and some people in high places (including some batshit crazy religions ones) want to still raise alcohol taxes even higher.
 
Now, this taxation idea is forgetting one very very important detail. Finland is member of European Union these days. As is Estonia, our southern neighboring country across a small sea. And Estonia is much cheaper country than Finland. And there is this thing called free movement of goods in EU region.

There are ferries that travel between Helsinki (capital of Finland) and Tallinn (capital of Estonia) several times a day and roundtrip tickets are fairly cheap. So what happens is that people hop in a ferry, buy loads of alcohol in Estonia, then come back with loads of beer and other beverages, with total cost way lower than if they had bought same amount in Finland.

So what actually happened is that government here, in its infinite wisdom (yes, you can assume text here to be extremely sarcasm-heavy) has managed, by stubbornly refusing to acknowledge facts, to retain all high medical costs of heavy alcohol use while at same time losing tax income by making it cheaper for people to travel to neighboring country to buy their booze. Booze that quite often happens to be brewed by a Finnish brewery, in Finland and exported there.

Good job there, government. Absolutely brilliant.

But wait, it isn't over yet - some geniuses have proposed that all (retail) alcohol sales should be forbidden on sundays. Fortunately that hasn't come to pass, at least not yet, as I predict that such law would only increase alcohol usage. Want to guess why?


perjantai 20. marraskuuta 2015

Tablet glass replacement


I've been either careful or lucky with my mobile devices, as although I've never used any kind of holder, bag, pouch or whatever protector I've never managed to break the devices. I've dropped them plenty, even on asphalt, but devices have survived, although most at the end of their useful life have carried their share of dents and scratches.

Kids, however... Well, our kid managed to somehow wedge tablet between balcony door and even as it seemed there was only slightest hint of force involved the glass cracked. Just great. Last five months or so the tablet has had clear plastic over the cracks so that we wouldn't get glass shards on fingers, but it has been usable.

But let's go back a bit. When I first wanted a tablet, I went for Asus Transformer, the original one (TF101 or whatever the model was). The keyboard seemed useful, but the extra battery within the keyboard even more so.

Well, it turned out that keyboard in tablet isn't actually too useful. Occasional quick email aside I'll take a real computer for work any and every day. Tablets just aren't really suitable for anything else than browsing relatively static data (maps, videos, internet as long as you don't need to post anything lengthy and so on) or maybe some light instrumentation (review values, adjust something and done). And some relatively simple games. That's it.

The extra battery the keyboard had in it was great however. So when that tablet started dying - it wouldn't charge anymore and I couldn't figure out why - I went and got newer model transformer. Which, compared to previous one, was pretty damn disappointing (yes, should've read more about it first...). New model no longer had extra battery in keyboard, the keyboard never worked reliably (it sometimes needed full reboot to detect keyboard again) and in general it felt sluggish (maybe the change from ARM to intel atom wasn't helpful?). So when the screen now broke (keyboard wasn't attached at that time so it couldn't protect it) I wasn't too happy, of course, but not devastated either. And that clear plastic did its job just nicely enough for some time, keeping our fingers shard-free.

As I have never repaired any this kind of screens I was hesitant about doing it myself. I asked around, but none of local shops that specialize on repairs wanted to work on Asus. One place straight up said they wouldn't do it, one took my contact and told me they'd get back to me. They never did. And I didn't feel like sending old(ish) tablet anywhere far away for repairs (like Asus' official repair, which IIRC isn't even located in this same country - hell no, I don't want to deal with that!)

Crap. Guess I had to do it myself.

So I watched some videos (unfortunately my model seems to be slightly different than ones everyone else in those videos seemed to have). Ordered glass/panel replacement. And when it got here went to work.

So... This is with the contact plastic still on. I had to change the plastic a few times and last one was kinda grainy matte instead of completely clear. By the time I noticed it it was already on and I didn't feel like starting over, as it didn't distort the picture too much.



I used my cheap chinese hot air station, set to 120 degrees C to loosen the glue a bit, and after a while took small knife to start prying the old glass off.


After a while I set the hot air nozzle "hanging" onto my microscope stand. It may look like it's touching the base but it wasn't - it was some 5cm away. This freed my other hand to work on the device itself. I used larger (and stronger) knife to hold already loosened part of the glass up so glue wouldn't set again.

If you want to take glass off from your device, do consider wearing some king of light rubber gloves. It's very easy to get glass splinters into your fingers (I didn't, as far as I can tell, but at some points I think it was very very close).


It took a while but old glass came off! In pieces, but still...


Before putting new panel there, just a quick try... Well, fsck me. At some point I apparently went a bit too deep and managed to cut into the edge of the display module, cutting the flex cables within.


So pretty much an almost complete failure. "Almost" comes from learning from your mistakes, next time I'll be even more careful. Hopefully I don't have to do this very soon again, though.

After some more research I found out that new displays aren't easily available. I could try to order one from China, of course, via Aliexpress or other even sketchier sites, for relatively high price (compared to value of tablet itself). So instead I chose option B - destroy electronics of this one sufficiently enough that one retrieving my leftover data won't be easy, then get a completely new tablet. One without keyboard. (now, Surface Pros seem like very tempting devices, but I haven't had any hands-on experience with them and anyway they're way too expensive for a family plaything - it'll be almost exclusively videos, games and light browsing with it anyway)





maanantai 16. marraskuuta 2015

How to prevent screen blanking in Sailfish


I was playing with simple visual timer to help kids focus onto given task and needed a way to prevent a screen from turning off (aka blanking) during the countdown.

As it happens, this isn't very difficult, but information on how to do it is a bit scattered. As far as I know the method described below is allowed withing Jolla store, but I haven't published this timer yet (I'll need to add user-selectable countdowns first, in addition of fixed ones) so I can't be completely sure.

This can't be done (yet?) with QML only, so some C++ is required, but fortunately no deeper magic is required.

First, you'll need to create simple helper object that can be called fromQML.

Header (note: when working with Qt classes the class definition, even simple one like this, absolutely must be in external header (.h) file; you can't include it in .cpp file as it will fail mysteriously to compile. Want to guess how I found this out? *eye roll*)

class BlankPrevent : public QObject
{
    Q_OBJECT
public:
    Q_INVOKABLE void prevent(int prevent);
};

Source:

void BlankPrevent::prevent(int prevent) {

    QDBusConnection system = QDBusConnection::connectToBus(QDBusConnection::SystemBus, "system");
    QDBusInterface interface("com.nokia.mce", "/com/nokia/mce/request", "com.nokia.mce.request", system);

    if (prevent) {
        interface.call(QLatin1String("req_display_blanking_pause"));
    } else {
        interface.call(QLatin1String("req_display_cancel_blanking_pause"));
    }
}

Above is shamelessly borrowed from this source, so credit where credit is due. Also you'll need add proper includes, as well as "QT += dbus" to your .pro file.

If your app is C++ only, you can simply call this function every now and then and it's done. From QML you'll need a bit more. First, add component registration to your C++ main();

qmlRegisterType("harbour.myapp.CustomComponents", 1, 0, "BlankPrevent");

And now it can be added as an item in your QML;

import harbour.myapp.CustomComponents 1.0

...

BlankPrevent { // as part of SilicaFlickable from example
            id: blanker
        }

...

property int refresh: 0;

Timer {
        interval: 15000; // adjust as needed
        running: true;
        repeat: true;
        onTriggered: {                
             blanker.prevent(1);
        }
}    

And done, your app will stay on as long as your app is on foreground. And do remember to call prevent(0) when you are done.



maanantai 9. marraskuuta 2015

Malware of the worst kind


My opinion for longest time has been that all the so called antivirus and spam filters tend to be the worst kind of malware. Always preventing me to doing my work, always nagging for updates (often paid updates) and always being more trouble than they are worth. Local ones are generally manageable, but when they are offered as an service they get unbearable.

Case one I've had to tolerate lately: I have business relation with a certain person in a larger organization that has been ongoing for several years now. I've been ordering stuff from them almost every month by email. Nothing fancy or anything that could be considered malicious; no links, no attachments, just few lines of text to indicate what I need. And yet every now and then my order mails ends up in their spam folder.

Their email is managed by Sonera (or Telia-Sonera), local large internet operator, and apparently there is nothing they can do to fix the overly zealous email filter. Annoying but yet somewhat tolerable.

Case two: Once again Sonera tries to sabotage our business. We were negotiating about certain order with another company and sent simple scanned PDF (some 500k in size) an an attachment, by their request. And suddenly every single email we try to send them (apparently from our entire domain) gets bounced:

This message was created automatically by mail delivery software.

A message that you sent could not be delivered to one or more of its
recipients. This is a permanent error. The following address(es) failed:

  xxxx@xxxx.xxx
    host mail.cm.sonera.com [193.208.151.61]
    SMTP error from remote mail server after RCPT TO:<xxxx@xxxx.xxx>:
    550 #5.7.1 Your access to submit messages to this e-mail system has been rejected.

I tried to find an email address I could sent a failure report (as this very clearly is a failure at their end) but there just isn't any. Why yes, they seem to have twitter and facebook as contacts, but I absolutely refuse to use either of them. Fuck you very much, Sonera.

This is one of the many reasons I terminated all my contracts with them years ago (except one mobile subscription, least expensive one I could get I have for testing purposes.)


torstai 5. marraskuuta 2015

Wireless mice


I have to admit, I was wrong. Somewhat.

Since the first wireless [computer] mice were introduces I've considered them mostly curiosities that at best are always out of batteries or lost somewhere on the desk a - valid concern as my desk usually is full of papers, electronic boards and whatnot. 

Some time ago I finally went and bought one for my laptop, mostly to be used when out of office. Specific model isn't important, suffice to say that it was Logitech and one of the cheaper ones. Somewhat smaller than my typical desktop mouse too.

Small size was weird at first but I've grown used to it. I wouldn't want to play any action games with it but for basic tasks it's fine. Now I've been using it on and off for six months (almost daily, as it's being used with the laptop I often work with at home) or so and I've also been pleasantly surprised of its battery life. It is powered by single AA battery, and I'm still using the battery it came with - some cheap-as-possible chinese brand so I wouldn't expect great life either. Considering that I often forget to turn it off, its current consumption is amazingly small. I'm almost tempted to open it to see what's inside it and do some measurements.

So far I haven't managed to lose it either, at least too many times, or for too long. Although I have had to spend some time finding it when it has fallen off the desk and disappeared by bouncing unexpectedly far away a few times. There must be some really weird physics going on when dropping something small and important, like screws, springs and mice ...

But I think I still prefer to have proper, larger wired mouse for my desktop anyway. With no "ergonomic" shapes only two buttons and scroll wheel, thank you. Those weirdly shaped gaming mice with heaps of buttons just feel wrong to me.

sunnuntai 1. marraskuuta 2015

How to play DVD on PC


Continued from previous post.

So the new and shiny disks I bought were useless in every single windows computer (well, all two of them) I had available. No player I had would work. And I really didn't feel like wasting money on some external players that might or might not work any better.

Anyway, the first step seems to be "Don't bother using (newer) windows, it won't work". 

I also mentioned that I had another old computer handy. It's old, slow, power-hungry -- but it's free (as in unused and readily available) and had everything in place except its HD was relatively small. Fortunately I had one larger leftover disk so I was able to start playing with it without having to visit shops.

So considering the problem I had on hand I tried some media center-specific distributions first, like LinuxMCE and geexbox. There may have been others but I have deleted some of the downloaded ISOs already so I might already have forgotten. Some didn't work at all (failed to either install or start up after installing), and some I wasn't very pleased with.

Eventually I figured out that too many of these media center-type distros weren't to my liking, as for anything else than media stuff I pretty much had to fight the setup to get anything done. Not really fun. So moving on, to more generic desktop, with idea to install media center software (mainly ripping & DLNA sharing), so I went to Kubuntu first. Which didn't work at all on this computer. So Xubuntu then. Which worked nicely enough, though I think I might still wipe it and start over at some point with some other distro (I like bare-bones debian; it might not be nicest desktop around but at least it doesn't try to hide stuff from user like ubuntu-based setups like to do)

So to DVD ripping. After some quick searches it seemed that handbrake would be best option (and I was already familiar with it, although on Windows side), so after few magical apt-gets  that was ready to try. And what do you know, it would open and rip these troublesome disks with no problems (no, windows version couldn't). Very slowly, yes, this being ancient computer, but since this computer is built for single purpose only - to host copies of my DVDs (especially ones like certain rodent's clubhouse and other similar shows whose disks may encounter some very careless handling in our household) - lack of ripping speed is perfectly okay.

So next step was to set up media server. Kodi (formerly XBMC) was first, and it did work nicely, but it seemed to be using fair amount of CPU power when idle, so that was less nice. Then some other, server-only programs, but there was some weird connection issue that I couldn't figure out so I got rid of some and eventually ended up with mediatomb. Which didn't work either at start, so I tried also venerable samba share as quick and dirty solution. Which didn't work too well either.. Hmm.

After some (fruitless) searches I started to suspect physical ethernet connection. This computer was in a room that had old cable that previous owned had built by hand, and considering his handiwork around the house this was from substandard parts and made with even more substandard skills, so that cable was definitely a suspect. And computer informed me that it was using gigabit link. No wonder link's a bit unstable.

Unfortunately this cable is somewhat built in walls and I wasn't feeling like ripping them up so that had to do for now. Some more experimentation and now that computer is happily using 100Mbps link and now it actually can be connected remotely. Link speed still isn't as good as it should be so I may have to do more troubleshooting but it'll do for now. Curiously even with failing link downloads to that computer worked so cable wasn't my first guess.

So a weekend wasted there for such a tiny thing. Or maybe not, I had planned something like this for that computer for long time -- only now I actually had good enough reason to start working on it. And now I also have a dedicated linux computer I can play with at home. What (else) to do with it, that is the question...