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.