torstai 31. joulukuuta 2015

End of the year


Once again another year has come to an end.

I am very disappointed to see what is happening around the world. The world at the moment is (arguably, and with some major exceptions) about safest it has ever been. And still we are hearing all the time about terrorists, criminals and other less pleasant folks and how you - everyone - should fear them. And how you should support your governments' efforts in catching those scary people.

Maybe the government agencies who are supposed to keep us safe have been completely incompetent before, but to me it seems that they have grown even more hopeless lately, based on their requests to blatantly take away freedoms from everyone. Apparently now the go-to method of catching bad guys is to expose everyone to spying - that is, everyone, including the citizen, must be placed on ever-vigilant, ever-recording surveillance. And trying to avoid this surveillance will place you on watchlist - or worse.

There is one very important question one should remember when witnessing political acts; be it terrorist acts, trade deals (like TPP) or internal political maneuvering. Who will benefit from this?

Before blindly agreeing or disagreeing on anything, first ask yourself that. Who will gain power or money? In case of ISIS this gets very interesting indeed - the grunts who do the fighting clearly aren't ones that benefit from it. Neither are those visible leaders like Bin Laden and others, at least in my opinion. So who is standing behind the curtain and pulling the strings? I unfortunately have no answers, and I'd rather not voice out my wild guesses.

Trade deals? Well, no question there, citizens on both sides of the deal will get shafted while major corporations laugh all the way to the bank. This is what corrup... oh, sorry, that's a bad word - lobbying will get you. No, just because it is supposedly (semi-)public, (semi-)anonymous and happens at higher level than some random police asking for donation to make the problem go away doesn't make it any different. But I digress again...

Surveillance? This one is a bit sketchy, especially since most of the western world is supposed to live in democracies (or representative republics) where people in power change relatively often, so this wouldn't gain current government much. But again, who is behind the curtain there?

The other side of surveillance is censorship. Governments doesn't officially censor things here, at least not officially, but major news agencies do, with absolutely no exceptions (some just are less blatant about it), by reporting only one side of the story, withholding important details or not reporting certain stories at all. So unless you have some other sources (reliable ones - which might be tricky), you will only get the story they want to tell. This, in my book, is even worse than the direct censorship China practices - at least China is (mostly) honest about it.

When discussion turns to surveillance the phrase "I don't have anything to hide" is spoken often, and it is always wrong. Would you like to have your sexual preferences, bathroom habits or browsing history to be public or browseable by some bored government  agent (or worse, low paygrade grunt working for corporation hired by government)? While there might be nothing blatantly criminal there, those are still your private business and no one, no government should be making notes of those. Or of anything else you do.

How about this then: Let's say that in 20 years or so you (or your relative) has somehow ended up in position of some political power. The thing is that you are now threatening the established system, so now some people are busy digging through all the collected data about this politically inconvinient person and his (or her) relatives. What will your chat logs from now say? Browsing history? Porn habits? Vacation photos? Dig enough and there will be something (even taken out of context, or combined with some fact) that will badly damage the reputation of everyone concerned, and status quo is held once again.

Or if that seems unlikely, let's say you make some random remark on facebook or another forum which makes some person angry. Even now, without this all-encompassing database he can find out a lot about you, including things you wouldn't want to be known by say your employer, parents or neighbors. Can you imagine what he could find out with access to everything you have ever done, even those that you never directly made public (like those photos your phone stored in cloud, or your text messages, or anything). All it takes is a disgruntled low-paid grunt whose job is to browse through all that data anyway...

At the moment some governments are planning on requiring all encryption to be backdoored, because criminals of course. But the thing is that there is no backdoor that is only accessible to the "good guys". Backdoor, by definition, is usable by anyone that happens to stumble on the keys. So now not only is your supposedly safe communication stored by government, but also criminals who can now listen in as well once they get the keys. And they will get them, sooner or later, by accident, by mistake or by straight out bribing or blackmailing someone.

This must not be allowed to happen. This is what general surveillance and loss of privacy means.

Do not give in to the fear for it will doom us all. Resist these plans of cencorship and loss of privacy so the next year will be better - for everyone, everywhere.

While the following quote is not from a real person but from a fictional character from a game, it is no less insightful for that. I'll end this year with this:

"As the Americans learned so painfully in Earth's final century, free flow of information is the only safeguard against tyranny. The once-chained people whose leaders at last lose their grip on information flow will soon burst with freedom and vitality, but the free nation gradually constricting its grip on public discourse has begun its rapid slide into despotism. Beware of he who would deny you access to information, for in his heart he dreams himself your master."
  • Commissioner Pravin Lal, "U.N. Declaration of Rights"
  • (Alpha Centauri)



Despite all this, Happy New Year everyone!



sunnuntai 27. joulukuuta 2015

How goverment software contracts work


If you have followed the news you already may have a good idea how goverment procurement of software works - from outside. Some company is contracted to do the work for X amount in Y months. Invariably after X and Y have been spent they have nothing useful, so in the end it will take at least 4X and 4Y to get somewhat working solution.

Why is this? Well, I have no inside knowledge from either side of that process but still I can offer an educated guess of the process, rougly based on what I wrote about difficulty of writing a specification on previous post.

To recap previous post, writing a good software specification is extremely hard task.

I speak primarily of government contracts here because they happen to be most visible, but the same applies to any large software procurement. Only when the deal is between two large corporations the ugly figures are easier to hide.

Software requested by governments aren't typically exactly simple, as typically they need to handle huge amount of information with many users at peak (office) hours, and then there are privacy aspects (like health care), massive amount of distributed data and so on.

So, when government requests some software, the specification supplied with RFQ is very likely written by someone who isn't experienced enough to write specification at first place, possibly then edited by some committee of complete ignorants who focus on polishing political details and very likely will take out every single technical detail there happened to be. So by the time this ... specification arrives in hands of companies that should offer quotes the project is already ruined - the specification describing the software is nothing more than empty words that in very crudely describe approximately what is needed.

An engineer worth his pay will look at such specification, try to work around issues and general lack of details, taking guesses and so on, estimating certain workload and providing quote of Z.

The houses that almost always get these contracts do not do that, ever. They take the specification, see the problems - and completely ignore them, perfectly knowing and even relying on the fact that by doing that the end result will be completely useless. Then they provide a quote of about Z/3. And they get the contract. Government contracts often have to (by law) to always go for the cheapest offering (there is actually a very good reason for this, but that is off topic so no more of that here.)

The code monkeys employed by this company (I am very tempted of naming a certain Finnish company here as an example but will not do so) are at this point absolutely forbidden to work around any of issues in the specification unless it completely prevents something required by the specification from working. They are to provide what the spec called for - absolutely nothing more, absolutely nothing less.

So the end result of course is something completely useless. Yet they fulfilled the contract by supplying what was asked for, to the letter, so they get their Z/3 money, despite the fact that the end result is so very clearly useless.

Company then immediately provide quote of, say, another Z/3 to fix immediately apparent issues (which are of course very explicitly listed) over certain time period. So unless customer is willing to see spent amount as sunk cost and moving on (hint: most people never will, not at this point, and government people are about the least willing to abandon wrecked project), they have no choice but to agree on this.

After fixes the software is still almost completely useless, so this step is repeated a few times over, each time with very explicit list of fixes. When the software finally is mostly usable, the total cost has easily been something in range of 3Z or 4Z, and time spent likewise. But this is all right, since they won the contract, fair and square. Yet government ended up paying way more and spending way more time than with the other company that, in retrospect, did made better offer. But no, lowest price up front always wins, although everyone knows that this will happen.

Again, like I already said, this is mostly an educated guess on what's going on, but I'd be surprised if I'm wildly off at any point. And if I'm right, there is pretty strong smell of incompetence and borderline fraud at this kind of process.

Me? I take pride of trying my best to deliver what customer wants instead of what he asked for (no government jobs so far though). Up front my cost might be somewhat higher, but my costs (as quote explicitly says) always include some tweaking and at minimum initial support. I do lose some deals because of this but that's okay, I still value happy customer who got exactly what he (or she) wanted over customer who got something almost useful for half or quarter the price - and ended paying way more later on.


maanantai 21. joulukuuta 2015

So you need a software specification


I don't remember if I have written about this already, but if so, let's say this this a recap and introduction to my next post. While I talk of software specification here, the term used might as well be requirement specification or somesuch; in this case they could be used interchangeably.

Software specification is often overlooked as something trivial which can be handed to be written by some random trainee. In my experience this is completely and absolutely wrong way. While anyone theoretically can write a software specification, such specification rarely is worth the paper it's printed on (doubly so if it's never actually printed). Writing a good specification however is extremely difficult and should never ever allowed to be written by anyone who isn't both excellent software designer and at least proficient (tech) writer. And of course motivated to get it right, but first part there pretty strongly implies this already.

If you are dealing with internal projects you can most likely get away with a relatively poor specification. "Internal" here means "within the same small group I'm working in." If your company's work culture is good, group members communicate freely and easily and can always work around shortcomings and mistakes in the original specification, as long as issues are relatively small. (I'm completely ignoring the scheduling and budgeting here although they naturally are related topics, this is all about the specification quality).

Years ago I was given something that could be called a project plan. It described a software that needed to be written in very general terms, in just a few pages. I was sufficiently familiar with system this was to work with that I could tell them that yeah, I could do this in just a few weeks (so really nothing too major). I was told that no, they wanted to outsource this and I had to write the specification for it, primarily as an experiment on how outsourcing would work in this company's case. So I shrugged and got on it.
I found out that it took me about the same time to write the very detailed specification (covering every single detail I could think of) as if we had done the entire project internally. And then it took remote group even more time to write the actual code. The end result wasn't really bad, of which I blame my pretty good specification, but it still took quite a long time.
I don't really know if this company learned anything of this, but I certainly did.

The further away you get from your own group, the more detailed the spec must be be. Reason is both cultural and communicative; it's far more difficult and slower to ask for clarification for some part when you are not familiar with person who wrote the spec, even if person works just for different part of same company - and this gets worse the further away person writing the spec and code get.

Having direct line of communication helps - if you can communicate with your counterpart at the other side of the world, even with email, things are easier. If however communication must go through few layers of middle management at both ends it's pretty much automatically game over. More communication layers means that much of the message gets lost in translation (both literally and figuratively.)  In such case any shortcomings in initial specification means that the results will be pure rubbish. If resulting code/software can be reviewed often enough it may save something (specification can be improved and made more detailed where it is found lacking), but if you only get to see the end result - forget all hope. It most likely will be useless.

Of course in some cases a good developer may read between lines and implement details implied in specification, but you may never, ever rely on this - good developers aren't that abundant, especially on that level. Very likely the person writing the code has no idea on background and related environment where this software should work so he has no way of figuring out issues you might consider self evident.

So, whenever you find that a software specification (or requirement specification) needs to be written, always make sure that it is written by most experienced software developer you can find, and absolutely no detail (no matter how trivial or self-evident it seems) is left out. Those will come back to bite you in the end.

Yes, it will take a long time and cost a lot up front. But this is the part you absolutely do not want to skimp on, as those relatively minor savings will come back to bite you in end.

perjantai 18. joulukuuta 2015

Working to live or other way around


On tech field - at least overseas - there seems to be obsession to do insane hours with essentially no compensation (aside possibly some vagues promises of stock options), and even skipping your vacations. In Europe the situation is not that dire, but even then there seems to be some push to do essentially unpaid extra, at least in some places.
 
When I was still working on salary I felt kinda bad for browsing the net occasionally when I couldn't get anything useful done. Only lately I've actually figured out why that happened (and I mean the part of not getting anything done, not the browsing part). And it only took me ten years or so.

The thing is that I (and based on every discussion on topic I've seen, everyone else too) can work in efficient creative mode for only so long before that precious creative energy runs out. For me the daily upper limit for that seems to be around six hours, after which I am completely exhausted and will not get anything creative done for that day. This covers essentially everything, be it planning, designing, writing code or even testing it. Note the last one there; often people mistakenly think that this exhaustion doesn't apply to that. Not so - you might be able to do very simple testing (like mechanically testing out some already known sequence - which you should have scripted out anyway as part of automated tests) but actually useful testing ("hmm, what happens if I press that button now when that other thing is doing its stuff...") is out of the question.

Above I said daily upper limit. This exhaustion effect appears to be cumulative - working to the limit every day will gradually shorten the daily productive time over time. Sometimes switching to some other, completely different task helps (like dropping software part for a while and doing PCB schematic or layout work) but even then there is an absolute limit. And when that limit is reached, it will take several days before I start to get that energy back.

Considering above the idea of living to work - that is, doing insane hours - is even more insane. Not only are you wasting time at office without being compensated for time lost, you aren't even getting anything (worthwhile) done!

Of course, these days I can do other than creative things, like doing menial assembly or testing work that doesn't really need any creativity, so that time isn't completely wasted either. But there is only that much of that to be done. And of course not everyone can just switch to something different when energy runs out.

Or, you know, since my phone isn't tied to the desk, I can also go out biking or hunting or whatever. I always get my best ideas when I'm out there anyway, far away from the office.


Far away.

Might I recommend that for you, too?





sunnuntai 13. joulukuuta 2015

Tablet keyboard


Since my old tablet itself was already dead, I decided to take a look inside its keyboard too. Which was broken also, about half of the keys didn't work anyway so loss of the tablet itself wasn't that big problem anyway.


Bottom panel was held on by not less than three (3!) different kinds of screws; ones on sides with tiny torx head; two screws more under lower rubber feet with phillips head and two more under upper feet with slightly larger phillips head. Why? Oh, and after screws it was still held in by clips at edges.

As a side not, I've had this screwdriver with its small heads (including really tiny allen heads, torxes, phillips and others) for long time now. I bought it from a local general parts store for maybe 5eur or so and it has been invaluable ever since. Unfortunately I've never seen any kit like this for sale anywhere since then, at least not locally, so I'd really hate to lose or ruin this set.


Bottom (rear?) panel off. Almost everything is covered by this large, relatively thick metal panel, most likely to add rigidity and weight to balance tablet's weight when open. The mechanical build quality of this thing is actually pretty nice overall.

With metal panel off rest of stuff is exposed, the little there is. At lower part there is trackpad (chip below sticker is Elan 3320KD-3100; brief search didn't turn up anything useful) and at upper part USB device port and under sticker Nuvoton NPCE69ALA0DX. I didn't find any information about that chip but it appears that all data goes through it. Best guess would be some kind of USB hub/keyboard chip. Thin covered cable snakes in the hinge and there isn't really any protection aside grey cloth-like cover material so I really can't say how long it would last before metal parts wear it out. So far there wasn't any noticeable wear so I'd guess answer to that would be 'long enough'.

I didn't feel like opening keyboard itself further as it very likely is like any laptop keyboard these days.

And yeah, no extra battery. Such a shame Asus decided not to include that with new Transformers, doubled use time on original Transformer was absolutely worth the extra bulk on keyboard, especially when traveling.


perjantai 11. joulukuuta 2015

What is road friction


We've been producing friction meters to be installed in cars for fairly long now, close to 20 years or so. Idea itself is fairly simple; you measure the deceleration during braking and from that you can calculate relative friction of the road. First models interfaced with car systems directly, and some newer models use accelerometer to measure deceleration.

Lately I've been playing with slope compensation as well. In addition of direct friction (which is affected by extra acceleration or deceleration caused by gravity) the slope is determined too and that is used to compensate the gravity-modified friction reading. Relatively simple math, really.



But what is this used for, then?

The winter season in Finland is in average maybe 5 to 6 months. I say 'season', because weather varies a lot, and actual slipperiness of road may change a lot in just a few hours, especially at autumn and spring. Proper winter tires are absolutely essential, and in fact mandatory.

And since it is winter, there will be snow. Amount varies by latitude, but generally amount varies from "enough" to "way too much". And despite this Helsinki-Vantaa international airport practically never closes due to snow - and if it does, it is for maximum of hour or so during the worst storms. This should already tell you something about how seriously wintertime maintenance is taken here. Same applies to our roads - snow plows take off (to work) after just few centimetres of snow and they keep the roads open, every day, all day. And yes, of course there are some periods after heavy snowfall when roads may be in bad shape before they get cleaned, but that is only for few hours typically.

Road here may seem slippery, but if I remember correctly, this specific section actually has 100km/h speed limit even in winter and you can actually drive at that speed relatively safely most of the time. I don't recommend that however if you have bad tires or have never driven in winter.

Like you see above it's impossible to can't get all snow and ice off the road (that shine on asphalt is ice), there always is some remaining. Fine gravel and salt are used to slipperiest places, but how you determine where it is slippery? Keeping the roads in pristine condition isn't exactly cheap.

That's where friction meters come into play. They are used widely to track road condition by measuring road condition so persons responsible for the maintenance know almost immediately when something needs to be done. Determination is done by having all friction meters calibrated to measure same reading at same conditions and comparing these readings about nationwide standards. While experienced people know the road condition instinctively, measurement makes the maintenance easier by giving quantifiable and documentable readings on which the decisions can be based on.

While this might seem a lot of effort, it actually makes the traffic work very well. Finland is large, sparsely populated country, and lot of goods and people travel by roads. When roads are known to be in good, safe condition traffic can move quickly, easily and safely around, year round. There just are no "snow days" in Finland.

Want to learn even more? Winter road congress is coming up again, on February at Tampere. We'll be there too.



maanantai 7. joulukuuta 2015

Holiday in Cambodia


I just browsed some old(er) photos and felt the need to make this post, for no other reason than to post some pictures and hopefully to encourage some people to travel more.

Oh, Cambodia. Khmer Rouge is pretty much gone but the country is still in ruins. I'll never forget the sinking feeling I had on the border from Thailand to Cambodia. Thailand side seemed mostly healthy green, even somewhat prosperous, but after crossing over it all turned into wasteland. Houses, land, everything. Not a great first impression to get from a country, nevermind how accurate it is. Until later we got to see Killing Fields and Tuol Sleng. While I already knew the story of those places, seeing all that in person was still simply a soul crushing experience. And I absolutely, positively recommend visiting and learning about them to everyone, with absolutely no exceptions (at least past age of 10 or so, for smaller children it very likely will be too much)


Yes, these human skulls, and every one of them is victim of genocide started by Pol Pot and his Khmer Rouge. I don't post the full story here, anyone interested can look it up as one more lesson on how cruel we humans can be. Just like Stalin and Hitler, and lately ISIS, just to name few commonly known names. At some point I thought that anything like this wouldn't, couldn't happen anymore, but lately I haven't been as optimistic...

To move onto little less dark topics. While at Phnom Penh on one night we chose to have a dinner at one of the places near Mekong river. Dinner itself was nothing exceptional (but not bad either) so no more about that, but afterwards we tried to look for local taxi service (or equivalent) to get back to our hotel was a bit difficult. For some reason we just couldn't fine any nearby.

We started to walk back towards our hotel (I think it maybe 3 or 4 kilometres so not too long walk anyway), hoping to find a ride near major roads. After a short walk we did find drivers, too, although we had some serious communication issues - they didn't seem to understand a word of English (French might have worked, which we didn't speak), but after some attempts I managed to pronounce a name of a marketplace near our hotel. I see one driver's eyes brighten (there were three very Cossack-looking men, each with their own tuk-tuks - Cambodian version is essentially cart pulled by motorbike), he knew where to go. So we negotiate price (they knew enough English for that, curiously enough) and while price sounded a bit high for me, it wasn't outrageously high so we still accepted it, hop on and there we go.

We drove a while. At some point I start to pick up familiar looking locations. Now I know where we are - on a major road that goes past our hotel. But then the driver goes straight past the point where we should have turned to a side street. I'll contact him and use pretty much gestures to indicate where we should go. "Turn back", "turn left here", "right here", "thanks, here's the fare". He looked very confused but at least we got back safely.

What I guess happened is that he though we wanted to go to "night market" (like I said, I mentioned name of some other market near our hotel). "Night market" is apparently somewhat shady place with a lot of bootlegged goods (by reputation, we never visited that place), and I just very lucky that we knew the surroundings of our hotel (and that driver chose to use major roads) so I could instruct him. This most likely explains bit high price (he thought we were going further away) and his confusion at our drop-off point, but I didn't try to haggle and just paid original agreed price.

I learned something here: always, with no exception, have you hotel's business card with you when you go out. Even if your driver don't speak your language, they'll generally at least have idea where the address on card is. And of course, have some knowledge of your local surroundings.

We also visited a smell village of Kep, at southern shore. We weren't originally planning to stop there but some local travel marketers boarded our bus (peacefully, and during scheduled stop) and managed to convince us to stay there for a while. I don't regret that a bit - it was a small, sleepy village, nothing more (although it apparently was a pretty hot tourist spot before Khmer Rouge). Absolutely perfect for brief relaxing stop.


All this was close to ten years ago now. I just looked how it looks on google street view now and I really don't recognize the place anymore. Beach resorts, bars, restaurants. Tourism is picking up, which is of course great for them, but like so often I feel that something is lost at the same time.


Above is from a boat trip on Mekong, near Phnom Penh.

All in all, I don't regret a second of just taking long time off and visiting that region. I just wish I could take another long time off again, but it doesn't seem very likely in near future...

Oh, and just to mention, we felt unsafe only two times during our entire trip; one time when we cut through a dark back alley at Bangkok and some dogs felt like they didn't like us, and another when monkeys at one nature preserve started to get too aggressive for our tastes. Dangers of these regions are often wildly exaggerated, and even little common sense allows you to navigate clear of most dangers. On hindsight, taking a shortcut through back alley mentioned above wasn't a good idea, and it only saved us few hundred metres of walking. Don't do that, stay on well-lit roads.

And to finish this, I give you sunset at Preak Tuek Chhu river (spelling from Google Maps), Kampot.



torstai 3. joulukuuta 2015

Old programmer's bible


I don't have many books on my work shelf. One of them stands out though:

"Programmer's PC Sourcebook", second edition, which I got maybe in early 90s (I don't remember exactly when). I used to call it 'bible', even. It covers mostly MS-DOS and BIOS level stuff, so literally all the information within it is completely useless these days - unless of course you happen to work with ancient computers or emulators (say, dosbox). Which I don't.

I don't think I have even opened it since late 90s when it started to become completely obsolete, but I just don't have heart to throw it away. That single book just has been so very useful to me in the past. Information from time when computers were so much simpler to work with. I'm using the work in 'you can see and know everything happening under the hood' sense, unlike these days where operating systems hide all the cool details from the user - or in worst case, actively prevent users from seeing anything past provided API.

Let's just call is nostalgia. Or maybe part of the reason why I like to work with embedded stuff; I get both to make the hardware and program it. Working with low level stuff is what I like to do most, maybe because that is what I started with so long ago.


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...


perjantai 30. lokakuuta 2015

Shut up and stop refusing my money!


...well, any more of my money, at least. Another rant coming right up.

I've been less than pleased with DVDs lately. There's nothing but endless trouble trying to play them, as they either keep freezing or just refuse to work at all.

Just now I tried to watch Star Trek DS9 DVD I just bought, but I just can't. Windows 10 doesn't have DVD player so that's off the table. VLC played a few minutes of it, then froze. So failure there. And MPC just reports copy protect failure. At least I have DVDFab as last resort... But the point is that I should not need to resort to these tools just to watch the goddamn DVD I own!

Well fuck you [checking back of DVD quicly] CBS & Paramount. While I'd love to get (as in buy) rest of the series on shiny disks, at the moment it seems that places like piratebay offer far better value. Their offerings at least fucking work as advertised!

(and no, netflicks doesn't offer any Star Trek series here. Apparently they don't want my money either... Well, screw them, too.)

Update, the next day: I had old unused (or no longer used, maybe ten years old) computer still laying around and this experience was just what I needed to push me past the initial trouble of installing (once again) a Linux distribution (Xubuntu proved most useful for me) on it. And what do you know, this DVD that proved unwatchable in Windows played without any trouble whatsoever.


maanantai 26. lokakuuta 2015

Why, not what


This has been said over and over again, but yet I feel like saying it one more time again.

At the typical beginner class people are taught that comments are good and every line should be commented. So we end up something like this;
for (i = 0; i < np; ++i) // Iterate np times
  tot = tot + s[i];  // Add value to total

Totally useless comments that tell nothing. Contrary to popular opinion this kinds of comments are actually worse than no comments at all, as they tell nothing or even worse, they tell lies.

for (i = 0; i < p; ++i) // Iterate np times
  tot = tot + s[i];  // Add value to total 

p times? np times? What is going on? Someone did some changes, possibly, but never bothered (or remembered) to update comments. If you trust the comments (I generally don't, in cases like this) it is possible that there is a bug in there and now you have to spend time figuring out whether code or comments is right. And then some more time to fix the mess.

So please, don't write comments like that. They're useless.

So what then?

Just few days ago I was going through some code I wrote maybe a year ago and came up with this nugget:

i = 0;
while (inBuffer[i])
  { if (inBuffer[i] != '0')
      { addString(inBuffer);      
        break;
      }
    ++i;
  }
if (!inBuffer[i]) 
  { ...
  }

What is going on here? But right after first confused glance I noticed the comments;

i = 0;
 // if given string has other chars than zeros, use it. 
 // Only zeros (no matter how many) -> ignore
while (inBuffer[i])
  { if (inBuffer[i] != '0')
      { addIdString(inBuffer);      
        break;
      }
    ++i;
  }
if (!inBuffer[i])  // just zeros; discard data
  { ...
  }

Just a few short sentences, but enough - now it immediately made sense. Data passed here is only numbers as ASCIIZ string (no other characters except ending zero, reading the value takes care of that already so validation not needed at this point) and value with just zeroes is to be ignored. So this checks the string, stores it if it isn't just zeros, or throws it away if it is. There absolutely are prettier (as in easier to read without comments) ways to write this but I often prefer efficiency, this is code for relatively tiny MCU anyway.

Granted, it wouldn't have taken me long to figure this out even without comments, but with comments I didn't have to waste time for that. This might not be greatest example there is, but this is a real world example I just stumbled, and of my own making, too.

Neglect is something even this commenting style doesn't fix, however. If I were to change the code and not update the comments to match, next time I visit this code I'd have to spend some time figuring out what is going on - and what should be going on. 

So once again: Code is there to tell reader (be it compiler or human being) what is done. Comments are there to tell reader (human being) why and preferably also how it is done. Together they tell more about the code than either ever could alone. And do keep comments short unless absolutely, positively necessary. Writing novel-length comment is the easiest way to make sure no one will ever read or update it. Keep it short and to the point.


torstai 22. lokakuuta 2015

Bad caps


Well, seems that we aren't immune to bad caps either. No real surprise there, though.


Taking picture of the bulge is often tricky but just trust me here, once you actually see them the bulge is very obvious. Diagnosing first units wasn't exactly easy as unlike ones here the caps aren't always visibly bulged. To make things even more annoying the failure mode varied a lot; device suddenly turns itself off, fails to start on morning, starts counting distance at a wild pace, display behaves erratically... When first such device comes up, finding the real culprit may be difficult, especially since power rails sometimes seem good when measuring them on the desk, even after some gentle persuasion with heater and/or cold spray. ESR of caps very likely is off, but measuring that with caps still on board may be tricky and I don't have ESR meter handy anyway.

On the other hand, these are from devices over ten years old that have been powered essentially 24/7 the entire time. I'd say that few failures after over 80k hours of operation is within acceptable limits.

And yes, I still repair these units if asked to.


maanantai 19. lokakuuta 2015

Replacement bike parts? Print 'em!


I can be cheap bastard at times with things that might seem so very insignificant, which might be reason too - when something small, stupid and, well, insignificant is broken I don't really want to pay for it.

Case in point: my bicycle's side stand (I'm not sure this is the proper term for it, but I'll use it for now) is essentially but a hollow two-part metal tube (two-part due to adjustable length) that originally came with plastic at the end to distribute the load on ground. Over time (fairly quickly, actually) plastic wore out, and not very surprisingly hollow tube doesn't hold even bike's weight very well when on a gravel, grassy or otherwise less firm surface, making the stand pretty useless as bike will just fall over. Plastic part is still there but since it was so difficult to rip off that I just left it there.

On recent bike ride the screw holding two parts together came loose. Fortunately this was at stop so no parts were lost so instead of spending some 20€ (or something around that, haven't checked exact prices) and some ten minutes of my time (to take old out and put new in, ignoring time needed to drop by a shop) I chose to waste some 15 minutes of time to draw and print a new end piece. Printing of course took longer but since it's hands-off I don't really count it.


Drafting the part in openscad took just few minutes (I've grown used to it by now so small things like this are trivial), but maybe I shouldn't have drawn it first thing on the morning. I measure the opening at the end of metal tube, which was about 6.5mm. Then I draw a cylinder (well, cylinder stack actually) with r=6.5mm and commit print (I think print time was one hour or so)

When prints start I usually check that is started well, but typically I don't bother but occasional quick check mid-print (I moved the printer to another room as the noise gets annoying next to my desk when trying to do something else so I don't watch it all the time anymore).

After printing finished I go to check it out and immediately see what went wrong. Radius of 6.5mm. Stupid me.

Modify model and start over.

If you've been reading my posts you might remember that I pretty much consider USB unusable for any  job that requires any reliability. As it turns out, that list would include 3D printing. Mid-print I hear usual USB disconnect noise (for no reason apparently), printing stops and it's ruined. Close Repetier, unplug cable, plug back in, and restart. Another 30 minutes (of print time) wasted.

Try again. And then I get the part printed.


Now to see if it does the job. Angles don't match the original but hope it's good enough but then again, I can modify it and print it again anytime if it doesn't. Possibly with a different material, as PLA most likely isn't the best material for the job (didn't feel like switching material just for that).

As a side to, the more I use the 3D printer the more I start to find it useful for many small, even tiny things like this. Some small part that broke, or some small thing that would be useful (like wedge-shaped spacer for between shelves and wall to distribute load), toy repair like mentioned before... Anything. Draft it quickly and print it. Parts aren't necessarily pretty but who cares, they get the job done well enough.


perjantai 16. lokakuuta 2015

Story time: Airlines


There was a recent headline I saw where an airline sent a woman home for no cost when then found out her son got injured. Although this was a good deed in this case, by airline that apparently cares about its service (I didn't really bother reading the article itself, wasn't that interested), the headline and reputation of some less than stellar airlines made be expect the events to be something like this:

"Looking for Mrs. Bouvier, Looking for Mrs. Bouvier, please come to gate desk."
Middle-aged woman looks briefly confused but then gets up and walks to gate desk. "I'm Mrs. Bouvier, what is this about?"
Aside normal gate desk operator there is also a man in his late 20s, in dark suit, standing behing the desk. He glances at woman quickly then speaks: "Mrs. Lorraine Bouvier, from Atlanta?"
"Yes, that's me."
"It has been bought to our understanding that your son was recently in an accident. You have my deepest symphaties and we have arranged your return flight home immediately."
"What? An accident? No, that's not.. "
"Your returns flight is leaving shortly so I ask you to move to gate 23 immediately for immediate boarding."
"No, no, it's not possible, he was just training when.."
"Now, unfortunately the business class for this flight was full so we had to downgrade you to coach."
"What?!? Now, he just strained his ankle, why should I ret--"
"I understand that you are under considerable stress due the recent events but please restrain yourself. Everything has been arranged for you and I'd like to ask you to follow me to gate 23, please."
"NO! He just strained his ankle, there's no reason to go back now, I'll just continue to my destination."
"Unfortunately that is not possible, we had to cancel your next flight to make new arrangements. You don't need to worry about your luggage though, I am sure that they will be moved to your new plane before it will take off."
"No, no..." Woman is now in clearly distraught. "He just strained his ankle, he's okay..."
Man sighs, then glances sideways. "I was hoping this would be needed. Boris, will you please show Mrs. Bouvier to her next flight."
A very large man, wearing similar, but badly fitted suit, steps in, taking hold of woman's arm, guiding her almost forcefully away from gate desk. She is too confused to even properly resist. The first man then turns his attention to a man that has been so far silently following the conversation, mouth agape.
"Mr. Bouvier?"
"That's me. Why the--"
"I understood that you are not the biological father?"
"Well yes, I'm not, but what--"
"Unfortunately we could not make similar arrangements for you because of this, but I guarantee that your original flight plan is still in effect." He smiles.
"--Now hold on--"
"Have a nice wedding anniversary at Hawaii, Mr. Bouvier." He turns and walks away.
"..."



maanantai 12. lokakuuta 2015

Cyberpunk predictions


On a wake of rise of personal computers in 80s a new kind of fiction was introduced - cyberpunk. It was pretty much created (or at least popularized, there were novels with similar themes and environments before) by the Willian Gibson, specifically with his novel Neuromancer. Although (so I've been told) Gibson himself didn't even use computers at all, he still pretty much lanched it as major literary genre. Not a small feat.

For those not familiar with genre, typical setting is somewhat dystopian/film noir-type future where megacorporations essentially run the world, cities are polluted and dark, and a human life is pretty much worthless. People can jack in the cyberspace (essentially direct brain link to virtual reality internet), and for many this is escape from bleak life - or, for some, a way to fight corrupted world. Or to fight for corrupted world. Our concepts of "white hat" and "black hat" don't exist there - there's just shades of grey, and shades change depending on one's point of view.

As a prediction of future a local computer magazine wrote (to paraphrase from my memory, this also being in mid-to-late 80s if my memory serves); "..Maybe in future someone reading this will be worth keeping alive no matter what; even with [extremely expensive, injected] nanomachines that would keep you alive by repairing cellular damage...". This stuck to me, guess I was hoping to be one of these very best hackers later.

As it turns out, the future didn't turn out as predicted - at least not completely. So far world hasn't become noir-ish polluted, dark hellhole (which is good) but power the global corporations hold seems to be way too large for comfort relative to us mortals (which is bad). But at least they hold puppets - often called politicians (fully bought and paid for, bad again) as a facade so far so it isn't as explicit as in cyberpunk novels (but I wouldn't call it good anyway). So far separation on black and white hats also stands (good again), but sometimes that seems to be starting to slip - there's been news on corporations wanting to start essentially cyberwarfare against hackers that are attacking them - that are possibly employed by some other corporations. So who is "good" and "bad" there, really? (shouldn't need to be said, but I do consider that bad)

For us who actually do the work building the systems, even the best of us are little more than cogs in the machine in the eyes of these corporations. There is no appreciation, or even ability to appreciate or even properly evaluate a programmers in companies these days, as evident from numerous articles about interview and work practices - and results of those practices. This isn't just limited to large ones, this applies to just about every company these days, some smaller ones possibly excepted (where everyone knows everyone and everyone reads everyones code - bad programmers tend to stand out then). While companies are looking for - and hoping to find - a rock star (read: insanely great) programmer, they rarely if ever find one, and even less often allow their newly found stars to work as they do best.

These days the committee sets the coding standards, and every cog in the machine has to meet these standards without deviation or that cog will be forcefully be made to meet them or be thrown out. As it happens, that standard very often happens to be the bare minimum - i.e. not very much. In our current, standards-seeking future there is no place for master hackers of cyberpunk nor the rock stars of reality. Everyone has to be a cog in the machine -- nothing more, nothing less. No deviations allowed.

And those health-providing nanomachines? At this poins I'm absolutely certain that those will be reserved for those that bring the most value to the company -- CEOs, boards and other highest executive staff, the people that get benefits and bonuses no matter how badly they screw up. Not the lowly cogs that do (and suffer) the actual work, they just get laid off for their mistakes. No, not "they" the workers, I mean "they" the highest bosses. Cogs can be discarded and replaced at will, no point wasting money on them. What do they know, anyway?

Now I'm only waiting for the cyberspace. With devices like Oculus that might be getting nearer. Direct brain link (as typically described for cyberspace) doesn't sound too compelling to me, however, even with very, although there are some very, very temping arguments for it.

See, cyberpunk predicted also black ICE, essentially a firewall around company network that could actually attack your brain (direct link, rememer). In literature those reacted only if you got too near, but in the internet of today of a bit too accessible as it is. I'd rather not have some random goon try to take over my wetware just because they just stumbled on my WIP by chance (wetware IP, I just made that term up), or if I tried to search for more information about some obscure yet restricted topic, thank you very much ...


perjantai 9. lokakuuta 2015

Teknologia '15


Just this week there was Teknologia '15 fair at Helsinki. I haven't been regular there as I haven't had any need to keep in contact with different equipment/part dealers there are often, but this year I had enough stuff planned that I chose to spend a few hundred euros to drop by.

My primary interest was Elkom part (Elektroniikan komponentit, Electronics components), but there are several different but thematically close events at same general event, including automation, hydraulics & pneumatics, mechanics, manufacturing, packaging and so on. Essentially almost everything you'd need when designing, building and manufacturing (technology) products, albeit there was also food production/packaging equipment on display so not just technology after all.
 

Since every other stand seems to have these huge structures reaching towards, or hanging from ceiling it's damn difficult to get a good overall photo. But I still had to try.

I've been drooling after new 3000-series scopes by Keysight lately, and damn did they have nice offer there - buy any keysight scope this year and you get all software options included, free of separate charge! I think I just spent several grand there, too, nevermind that I haven't received my quote yet.
No photos of that, I'll just forward you to Dave Jones' video blog, I think he checked one out lately.

Aside that, there was a lot to see. Almost too much for single day, and boy I was tired when I got back home that evening after all the walking and gawking and negotiating. This day wasn't waste of time nor money I think. I can't go in depth to other things I discussed there, some of that is a bit hush hush for now, but I think I made some promising connections for future.

These camera microscopes seemed pretty handy, although I'm not sure how I would get used to working like that instead of the microscope I'm using now. I think this setup (on right, one on left was something else) was around 4000 eur. And there was one with price tag of about 8000 too at another stand. A bit too much for my budget...


But some other random pickings...

How about some Heavy machinery? This motor (?) was rated at 800kW if my memory serves, plaque said 6000v / 90A (I think). I know, numbers don't match, I just took a quick glance so something might be wrong.

Containers of bright, colored fluids bubbling or whirling in them are always fun to watch. For a while. Then someone comes asking be what I'm interested in on their stand - and I don't know squat about (chemical) process technologies. Time to quickly mumble something incomprehensible and move on...


Helsinki Metropolia (University of Applied Sciences) was also present. They had their all-electric race car on show too. Sorry for bad photos, like most of them here I remembered to snap them only when being almost ready to leaving so I didn't have much time or energy to spare for nice ones. And really, there's a lot of press about it floating around already. Well, at least locally there is...


Next to this was another project car, with classic e-conversion labeling. I didn't examine it too much, but damn those power cables are of impressive size. I'm pretty sure that the small battery, as seen directly left from those cables isn't the one feeding the power units there...

And much much more, in so many categories that ones can't but feel exhausted after a day of browsing. Maybe next time some more, then ...


tiistai 6. lokakuuta 2015

Old copy protection dongle


Long time ago, back in 80s when Programmers were Programmers and happy to write assembly to get the shave off the last clock cycle from inner loop, when computers were archaic and ran DOS the printers were connected to computers via parallel port. And that printer port was great thing indeed, offering bidirectional 8-bit bus and "clock" signal for running all kinds of fun external devices aside printers. I for example built a primitive 8-bit D/A converter out of it, mostly for fun. Sound quality was pretty awful but that didn't bother me.

Then modern Windows' appeared (in this context I mean Windows NT, 2000 and XP), blocking common software from accessing the parallel port (at least without using third-party drivers) and spoiled all the fun. Although serial ports (often) remained, they weren't as useful as good old parallel port.

But dwelling in ancient history is not my topic today, although this is related.

Apparently at some point I had actual license to an some kind of CAD program that ran on those old computers, as I have actually its copy protection dongle left over. I don't remember ever really using this software but that doesn't really matter here.

I am not exactly sure how these dongles worked (I never bothered to crack any of the programs using them) but my guess would be similar to one game I did successfully "liberate"; the software itself doesn't actually have all the necessary data needed to run it, instead some must be loaded from a dongle (or in a part normally inaccessible on a floppy disk, in case of the game mentioned). When loading program, this part if fetched from protection device, allowing program to properly run.

This method of course makes program pretty much impossible to crack if you don't have the protection device (be it dongle, floppy disk or whatever) accessible, but with it process often is fairly trivial (details are left as exercise for the reader), despite programmers' best efforts to make it as challenging as possible.

At this point the CAD package is irrelevant, as is the dongle too, but I was kinda interested on what's inside this thing anyway. These were plugged in parallel port and they actually could coexist with other devices and printers. At least usually, sometimes they did conflict. Quite annoying if you had to keep reaching behind the computer to switch these dongles.

Opening this was simple enough and inside is a simple PCB with passives and three chips.
Before proceeding further I just mention that these things weren't built just for single software product; some company designs and manufactures these modules and associated protection software, and the company using these to protect their software needs to "simply" include provided protection library in their product (not unlike modern protection counterparts). So there were many software packages from many developers that used essentially same dongles.

But back to innards of this dongle.

Left side chip has marking 74HC0324AM, indicating common-as-dirt 74-series logic. 324 within that family is a VCO - voltage controlled oscillator - but this chip here has 20 pins whereas VCO only has 14. So that doesn't sound very likely.

A bit of digging around suggests that this marking is actually forgery and that it is likely some kind of GAL (Gate Array Logic) chip, proprietary to this application. Considering that this thing is supposed to protect Very Expensive software I have to agree there - short of decapping chip and comparing it against other silicon there is no way to figure out what chip it is and what kind of logic is in there.

In middle there is 93LCS56, 4kbit serial EEPROM. There are two options here; this chip may contain the logic code for the GAL chip, or it may contain some software package-specific data such as license identification, serial number or such. Or possibly both. Very likely encrypted somehow (this being from mid-90s simple XOR with custom key is most plausible). Or its marking might also be forgd, but on quick glance pinout seems to match. I didn't feel lucky so I didn't bother trying to pull data out from it.

On right side there is chip with marking T9421W. Only thing I find with that code is a digital potentiometer but that isn't very plausible either. That code might, too, be forged to hide what the actual chip does. So pretty dead end deducing how the thing works (well, if I had better equipment and some nice chemicals I could try to dissolve packages to see what is inside, but alas I don't).

Now speculating on the functionality. Since you could put multiple of them together (for multiple different software packages) and still have the printer functional, there must be a way to activate one specific module. This is most likely done by outputting a specific byte pattern from PC, after which the triggered module takes over the parallel bus and starts communicating with PC.

Then there must be some data exchange; possibly some challenge/response type queries (above byte pattern being first of those) - possibly with changing keys to check if module is actually module and not, say, another PC replaying some stored old communication pattern. And then there is exchange of actual product specific data, which very likely is verified at the PC end somehow.

Of course the software on the PC doing all this is very likely encrypted on disk, obfuscated as well as possible, very picky about timings (no breakpoints for you!) and be in every way as annoying to work with as possible.

And I bet I would have had some serious fun cracking it back in my teens!