Archive for May, 2008

Keep the data safe

Thursday, May 29th, 2008

I’m really angry at HTC.

I’m an owner of HTC TyTN II and I like this little device. It’s not perfect but I’ve never seen anything perfect with Windows Mobile inside (well, to be honest, that applies to any kind of Windows but especially to Mobile family). The reason is simple - too much freedom and not that much stuff working out-of-the box. Those two usually goes one with the other, iPhone and iPod don’t give you much freedom but you already have everything you need, Windows Mobile doesn’t care about third party applications but everything that comes with it sucks. It’s completely unusable for anything, you have to install Opera as a browser, mp3 and video players, all kind of readers. Thank god it could call by itself but the way it manages address book is just horrible. But at least you have freedom and can choose better products. It just drawned upon me what that reminds me of - Linux. That’s right :) The first thing you notice when you install Linux is how much alternatives you have to everything. And how authors of distributives sometimes decides not to provide you with even essential tools since they couldn’t choose between deferent implementations of them. It sounds different but feels pretty much the same, you, as a user, have to find yourself a tool you like and could use, spend your precious time to that, while the authors of OS just feel pretty well since they give you alternatives and didn’t spend they precious time choosing themselves. But at least everything under Linux is free.

But enough about WM, it sucks, it will never be as good as iPhone. But it’s not HTC fault.

As already said I love my little device, it helps me everywhere I go. It slow for it’s money but there isn’t anything else usable with sliding QWERTY keyboard on a market. Yet. But even though HTC doesn’t want to make it faster by providing drivers for (already licensed and built inside) graphic accelerator, it’s also not the reason I’m angry at them.

HTC was very kind and provided update to WM to version 6.1. I did upgrade since people said it’s faster than version 6. Upgrade procedure wasn’t really hard to follow, backup your data, run this program and wait for 10 minutes. Yes, you have to backup since upgrade will wipe out every single piece of data it could find. Ok, I thought, I backup already, I’ll restore everything later. So I run the program and now my device has working WM 6.1. “How nice”, I thought, “now I just need to restore my data and good to go”. “Not that fast”, said backup utility, “you see, your version of OS is different from what that file was created for and since stupid Windows store all the system data in the registry as every other application in the system do, I can’t just restore everything because it’ll almost sure will break your system”. “Heh”, I thought, “so I have a backup, I did everything instruction said but I’m still screwed. How nice of HTC was to forget inform me about this little inconvenience”. And that’s why I’m angry at them.

I mean how hard it was for them to check the simplest use case of this update. I didn’t do anything custom, I even used a tool they provided to backup my stuff. That what 90% of people out there did as well I think. The funniest thing is that I could prevent all that if only I knew before. The tool is actually rather smart and if you know you’re going to upgrade your system, you could run a special application that will collect data about system stuff and with the help of that info backups could be restored afterward. But of course I didn’t know about this UNTIL I got to the point when I couldn’t do anything to fix everything and put my data back where it was.

That is partially my fault. I’m software engineer, I should know better. I shouldn’t trust any software and check that I could revert everything back before I run any application. But common, I’ve upgraded a ROM on couple of devices, I have never seen that it deletes all the setting AND all my data as well. I mean, yeah, BIOS isn’t critical part of a modern OS, if it changes, OS doesn’t care. But I did upgrade my Siemens CX65 phone as well numerous times and it never deleted a single setting I made before. So I wasn’t exactly prepared for that kind of situation.

But ok, if only HTC cared about their users a little bit more, they would have tested the whole update scenario and I’m sure they would have noticed that it’s impossible to restore a backup if you didn’t take special precautions before and they would have put the note about it in upgrading steps description and I wouldn’t have lost all my data and settings. If only…

So remember kinds, if you provide your customers with upgrade that will wipe (or could wipe) all her data out, check that she could restore backup she made. And if you are a customer, who going to upgrade to a new version of a product and that version could wipe your data out, wait couple of weeks and then check the blogs about other users experience. That will make your data safe.

Colorediffs bookmarklet

Saturday, May 10th, 2008

As I’m sure almost nobody know yet, I am a developer of pretty Thunderbird extension called Colorediffs. It does a good job for couple of people coloring those boring plain text diffs every good developer receiving constantly. It’s part of our job to review them, we couldn’t do anything with this. Except maybe use some good tool to make life a little bit easier.

Anyway as a developer of this extension I get numerous of request from people to add some additional features in it but the most surprising was to make it work in a browser. I was almost shocked, do people really use browsers for reading code? If they do why the provider of a code couldn’t make it look pretty? It isn’t that hard, I mean the simplest and welcomed by a lot of people solution is just color the changed lines and it could be done with a simple regexp. Really simple.

But it turns out, yes, people look at plain text in their browser. Still. And then I thought, could I help them? Making extension work in a browser isn’t a good idea still, it’s heavy, slow and doesn’t care if there’s other content on the page except code. It just wasn’t made for that. In the world where it lives, whole letter is under it’s power and it uses it to make diffs looking good and actually make sense for a reader.

But web pages is just a whole different story. Even though as it turns out people use browsers for reading plain pages of code they usually looking at other pretty stuff and make an extension understand that is a hard task. Even harder one is to find couple of lines of code on the page with other stuff and make it any good.

On the other hand, I though, do I have to do this with extension and it’s full blown diff files parser? Could I just color some lines in <pre> blocks and call the work done? That’s still better than black-on-white stuff. So I thought a little more and created a Bookmarklet. Just drag-and-drop it to your bookmarks panel and click when you’re viewing some site with a code, and your code will have some colors. Enjoy!

Full code is below, you could do everything you want with it but if you would convert it or improve it somehow I would appreciate if you send me a link to a project.

var s=document.createElement('script');
s.setAttribute('src', 'http://jquery.com/src/jquery-latest.js');
document.body.appendChild(s);
s.onload=function(){
    jQuery.noConflict();
    jQuery("pre").each(function(i, el) {
            jQuery(el).html(
                jQuery(el).html()
                .replace(/^(@@\s-[\d,]+\s\+[\d,]+\s@@)\s/mg,
                         "$1\n")
                .replace(/^(@@\s-[\d,]+\s\+[\d,]+\s@@)$/mg,
                         "<span style='color:blue'>$1</span>")
                .replace(/^(\+)$/mg,
                         "<span style='color:green'>$1</span>")
                .replace(/^(\+{3} [^+].*)$/mg,
                         "<span style='color:green'>$1</span>")
                .replace(/^(\+[^+].*)$/mg,
                         "<span style='color:green'>$1</span>")
                .replace(/^(\-)$/mg,
                         "<span style='color:red'>$1</span>")
                .replace(/^(\-{3} [^-].*)$/mg,
                         "<span style='color:red'>$1</span>")
                .replace(/^(\-[^-].*)$/mg,
                         "<span style='color:red'>$1</span>")
            );
        });
};
void(s);