tag:blogger.com,1999:blog-60318430669551779842024-03-14T13:12:15.122+02:00alga 42Albertas Agejevashttp://www.blogger.com/profile/09242021042711503211noreply@blogger.comBlogger32125tag:blogger.com,1999:blog-6031843066955177984.post-42837966181494111232016-05-16T18:15:00.002+03:002020-05-25T02:03:20.776+03:00Jaro-Winkler in PL/pgSQLWe needed to do a fuzzy text match in PostgreSQL, but the fuzzy search algorithms that are available in the extensions that come in the Debian Postgres packages are pretty crude. Jaro-Winkler distance is available in the extension <a href="https://github.com/eulerto/pg_similarity">pg_similarity</a>, but that requires doing <code>make; make install</code>, which makes installation cumbersome our development and production environments.
An alternative is installing <code>postgresql-plpython</code> and using the Jaro-Winkler distance from the <code>jellyfish</code> library, but that reqires installing the package and enabling the <code>pg_plpythonu</code> extension on all databases. So I took some time and ported the algorithm to PL/pgSQL, which does not require any extensions:
<br />
<pre style="color: #657b83; background-color: #fdf6e3;">
<span style="color: #93a1a1; font-style: italic;">-- Ported from jellyfish/_jellyfish.py
</span>
<span style="color: #859900;">CREATE</span> <span style="color: #859900;">OR</span> <span style="color: #859900;">REPLACE</span> <span style="color: #859900;">FUNCTION</span> <span style="color: #268bd2;">jaro_winkler</span>(ying <span style="color: #b58900;">TEXT</span>, yang <span style="color: #b58900;">TEXT</span>)
<span style="color: #859900;">RETURNS</span> <span style="color: #b58900;">float8</span> <span style="color: #859900;">AS</span> $$
<span style="color: #859900;">DECLARE</span>
ying_len <span style="color: #b58900;">integer</span> := <span style="color: #859900;">LENGTH</span>(ying);
yang_len <span style="color: #b58900;">integer</span> := <span style="color: #859900;">LENGTH</span>(yang);
min_len <span style="color: #b58900;">integer</span> := <span style="color: #859900;">GREATEST</span>(ying_len, yang_len);
search_range <span style="color: #b58900;">integer</span>;
ying_flags <span style="color: #b58900;">bool</span>[];
yang_flags <span style="color: #b58900;">bool</span>[];
common_chars <span style="color: #b58900;">float8</span> := 0;
ying_ch <span style="color: #b58900;">TEXT</span>;
hi <span style="color: #b58900;">integer</span>;
low <span style="color: #b58900;">integer</span>;
trans_count <span style="color: #b58900;">integer</span> := 0;
weight <span style="color: #b58900;">float8</span>;
i <span style="color: #b58900;">integer</span>;
j <span style="color: #b58900;">integer</span>;
jj <span style="color: #b58900;">integer</span>;
<span style="color: #859900;">k</span> <span style="color: #b58900;">integer</span>;
<span style="color: #859900;">BEGIN</span>
<span style="color: #859900;">IF</span> ying_len = 0 <span style="color: #859900;">OR</span> yang_len = 0 <span style="color: #859900;">THEN</span>
<span style="color: #859900;">RETURN</span> 0;
<span style="color: #859900;">END</span> <span style="color: #859900;">IF</span>;
search_range := (<span style="color: #859900;">GREATEST</span>(ying_len, yang_len) / 2) - 1;
<span style="color: #859900;">IF</span> search_range < 0 <span style="color: #859900;">THEN</span>
search_range := 0;
<span style="color: #859900;">END</span> <span style="color: #859900;">IF</span>;
<span style="color: #859900;">FOR</span> i <span style="color: #859900;">IN</span> 1 .. ying_len <span style="color: #859900;">LOOP</span>
ying_flags[i] := <span style="color: #859900;">false</span>;
<span style="color: #859900;">END</span> <span style="color: #859900;">LOOP</span>;
<span style="color: #859900;">FOR</span> i <span style="color: #859900;">IN</span> 1 .. yang_len <span style="color: #859900;">LOOP</span>
yang_flags[i] := <span style="color: #859900;">false</span>;
<span style="color: #859900;">END</span> <span style="color: #859900;">LOOP</span>;
<span style="color: #93a1a1; font-style: italic;">-- looking only within search range, count & flag matched pairs
</span> <span style="color: #859900;">FOR</span> i <span style="color: #859900;">in</span> 1 .. ying_len <span style="color: #859900;">LOOP</span>
ying_ch := <span style="color: #859900;">SUBSTRING</span>(ying <span style="color: #859900;">FROM</span> i <span style="color: #859900;">for</span> 1);
<span style="color: #859900;">IF</span> i > search_range <span style="color: #859900;">THEN</span>
low := i - search_range;
<span style="color: #859900;">ELSE</span>
low := 1;
<span style="color: #859900;">END</span> <span style="color: #859900;">IF</span>;
<span style="color: #859900;">IF</span> i + search_range <= yang_len <span style="color: #859900;">THEN</span>
hi := i + search_range;
<span style="color: #859900;">ELSE</span>
hi := yang_len;
<span style="color: #859900;">END</span> <span style="color: #859900;">IF</span>;
<<<span style="color: #859900;">inner</span>>>
<span style="color: #859900;">FOR</span> j <span style="color: #859900;">IN</span> low .. hi <span style="color: #859900;">LOOP</span>
<span style="color: #859900;">IF</span> <span style="color: #859900;">NOT</span> yang_flags[j] <span style="color: #859900;">AND</span>
<span style="color: #859900;">SUBSTRING</span>(yang <span style="color: #859900;">FROM</span> j <span style="color: #859900;">FOR</span> 1) = ying_ch <span style="color: #859900;">THEN</span>
ying_flags[i] := <span style="color: #859900;">true</span>;
yang_flags[j] := <span style="color: #859900;">true</span>;
common_chars := common_chars + 1;
<span style="color: #859900;">EXIT</span> <span style="color: #859900;">inner</span>;
<span style="color: #859900;">END</span> <span style="color: #859900;">IF</span>;
<span style="color: #859900;">END</span> <span style="color: #859900;">LOOP</span> <span style="color: #859900;">inner</span>;
<span style="color: #859900;">END</span> <span style="color: #859900;">LOOP</span>;
<span style="color: #93a1a1; font-style: italic;">-- short circuit if no characters match
</span> <span style="color: #859900;">IF</span> common_chars = 0 <span style="color: #859900;">THEN</span>
<span style="color: #859900;">RETURN</span> 0;
<span style="color: #859900;">END</span> <span style="color: #859900;">IF</span>;
<span style="color: #93a1a1; font-style: italic;">-- count transpositions
</span> <span style="color: #859900;">k</span> := 1;
<span style="color: #859900;">FOR</span> i <span style="color: #859900;">IN</span> 1 .. ying_len <span style="color: #859900;">LOOP</span>
<span style="color: #859900;">IF</span> ying_flags[i] <span style="color: #859900;">THEN</span>
<<inner2>>
<span style="color: #859900;">FOR</span> j <span style="color: #859900;">IN</span> <span style="color: #859900;">k</span> .. yang_len <span style="color: #859900;">LOOP</span>
jj := j;
<span style="color: #859900;">IF</span> yang_flags[j] <span style="color: #859900;">THEN</span>
<span style="color: #859900;">k</span> := j + 1;
<span style="color: #859900;">EXIT</span> inner2;
<span style="color: #859900;">END</span> <span style="color: #859900;">IF</span>;
<span style="color: #859900;">END</span> <span style="color: #859900;">LOOP</span>;
<span style="color: #859900;">IF</span> <span style="color: #859900;">SUBSTRING</span>(ying <span style="color: #859900;">FROM</span> i <span style="color: #859900;">FOR</span> 1) <>
<span style="color: #859900;">SUBSTRING</span>(yang <span style="color: #859900;">FROM</span> jj <span style="color: #859900;">FOR</span> 1) <span style="color: #859900;">THEN</span>
trans_count := trans_count + 1;
<span style="color: #859900;">END</span> <span style="color: #859900;">IF</span>;
<span style="color: #859900;">END</span> <span style="color: #859900;">IF</span>;
<span style="color: #859900;">END</span> <span style="color: #859900;">LOOP</span>;
trans_count := trans_count / 2;
<span style="color: #93a1a1; font-style: italic;">-- adjust for similarities in nonmatched characters
</span> weight := ((common_chars/ying_len + common_chars/yang_len +
(common_chars-trans_count) / common_chars)) / 3;
<span style="color: #93a1a1; font-style: italic;">-- winkler modification: continue to boost if strings are similar
</span> <span style="color: #859900;">IF</span> weight > 0.7 <span style="color: #859900;">AND</span> ying_len > 3 <span style="color: #859900;">AND</span> yang_len > 3 <span style="color: #859900;">THEN</span>
<span style="color: #93a1a1; font-style: italic;">-- adjust for up to first 4 chars in common
</span> j := <span style="color: #859900;">LEAST</span>(min_len, 4);
i := 1;
<span style="color: #859900;">WHILE</span> i - 1 < j <span style="color: #859900;">AND</span>
<span style="color: #859900;">SUBSTRING</span>(ying <span style="color: #859900;">FROM</span> i <span style="color: #859900;">FOR</span> 1) = <span style="color: #859900;">SUBSTRING</span>(yang <span style="color: #859900;">FROM</span> i <span style="color: #859900;">FOR</span> 1) <span style="color: #859900;">LOOP</span>
i := i + 1;
<span style="color: #859900;">END</span> <span style="color: #859900;">LOOP</span>;
weight := weight + (i - 1) * 0.1 * (1.0 - weight);
<span style="color: #859900;">END</span> <span style="color: #859900;">IF</span>;
<span style="color: #859900;">RETURN</span> weight;
<span style="color: #859900;">END</span>;
$$
<span style="color: #859900;">LANGUAGE</span> plpgsql;
</pre>
Albertas Agejevashttp://www.blogger.com/profile/09242021042711503211noreply@blogger.com3tag:blogger.com,1999:blog-6031843066955177984.post-72189819006479570952013-04-02T13:12:00.000+03:002013-04-02T13:18:38.117+03:00Failed escape<p>I've been using Ubuntu since the spring of 2005, that is for over 8 years. I appreciate the Debian underpinnings, predictable releases, general fit and finish. However, now I'm using Gnome Shell instead of Unity and I feel that there's not much value provided to me in over plain Debian Testing. Moreover, I'm unconvinced in the general direction of Ubuntu is taking for the past couple of years, the "Not Invented Here" mentality of developing competitors to other Open Source projects (Unity, indicatorors, Mir). So I decided to switch.</p>
<p>I downloaded a Debian Testing (wheezy) netboot 23 MB mini.iso image, set it up to boot with GRUB from a USB flash drive, made a copy of my system partition, and rebooted. Long story short, the installer failed on the base system install stage, something about unable to authenticate the busybox package. I've spent a couple of hours fumbling around trying to get past the error, downloaded a different version of the wheezy netboot image, to no avail. I also tried the 200 MB mini-CD image, but that failed with "Could not mount the CD-ROM" being booted off a flash drive.</p>
<p>After a while I just restored the backup, updated the new root FS UUID in /etc/fstab and /boot/grub/grub.cfg and went on with life. On Ubuntu. I'm still on Precise, probably worth trying an upgrade to Raring. I'll keep the backup of the Precise system partition, though.</p>Albertas Agejevashttp://www.blogger.com/profile/09242021042711503211noreply@blogger.com1tag:blogger.com,1999:blog-6031843066955177984.post-21622070813389843382011-11-13T00:24:00.007+02:002011-11-21T23:47:25.889+02:00App Camp 2011, first day<a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://www.appcamp.lt/images/main_logo.png"><img style="float:right; margin:0 0 10px 10px;cursor:pointer; cursor:hand;width: 124px; height: 116px;" src="http://www.appcamp.lt/images/main_logo.png" border="0" alt="" /></a>So, <a href="http://www.appcamp.lt/lt">App Camp</a> kicked off at about 6pm on Friday with a greeting from Andrius Kubilius, the prime minister of Lithuania, followed by Rimantas Žylius, the minister of economy. The politicians were wearing jeans and jackets, no ties already. Kubilius reminded us on numerous occasions that it's the XXIst century, confessed that he wouldn't be able to make a mobile app, and asked for an app that would solve the budget deficit issue. The MC commented that the PM is not as tech-naive as he presents himself, as he's using both and iPad and a Samsung Galaxy Tab, because, as he tells, the apps are different on these. Žylius reminded us that everything is possible, if even he could become a cabinet minister.<br /><br />Several short keynotes by foreign guests and local mobile community tycoons were followed by the app pitches. Each team had 60 seconds to present their idea to attract collaborators. Most of them have been pretty good, the presenters were successful in conveying their idea and getting people interested.<br /><br />There were several recurring themes: 3 pitches for apps for fishermen, 3 pitches for loyalty system apps (with the promise of ridding your wallet of all these loyalty cards), a coulple of GPS adventure games geared to get geeks of their monitors, a couple of variations on the where to go for lunch theme.<br /><br />Other app ideas that I found noteworthy: an egg cooking simulator for small kids, rules of the road reader & quiz, onboard Java IDE, location-based hitchhiking hookup, mobile app based on the <a href="http://sviesoforai.lt/">sviesoforai.lt</a> traffic congestion IS, a mobile app to report places of environmental concern for green NGOs to take care of, GPS taxi meter to tell if you're getting ripped off, a mobile confession app that uploads the audio to a CMS for a priest to listen to and grant penance over the air. A game to learn the map by navigating Lithuania and Europe by choosing the direction by the names of the adjacent towns. The prize for the best pitch (Samsung Galaxy S II) was awarded to the guy operating a <a href="http://www.manodrabuziai.lt/">clothing swap web site</a>, who promissed his collaborators access to a database of 100k girls in Lithuania with names, profile photos, clothes sizes, and contact details :) That's the team I joined!<br /><br />Then there was time for networking over soft drinks and light snacks. Later, beer appeared, too. It appeared that a lot of the app ideas were proposed by marketers willing to promote the idea and looking for devs to implement it for free. Undecided developers were floating from one circle to the next, looking for a good app idea to invest their weekend in.<br /><br />My clothes swap team consists of 4 developers and a designer. At 9am on Sunday the development began with brainstorming over coffee and cinnamon buns. We were driven off the premises at 10pm. We have a working app with the main functionality fleshed out, but perhaps it's too early for screenshots yet. If interested, the code is on GitHub: <a href="https://github.com/alga/AppCamp16">https://github.com/alga/AppCamp16</a>. My team mates who have some iOS experience, but have not dealt with Android before, commented how easy developing for Android is.<br /><br /><a href="http://www.flickr.com/photos/akaidanovskij/6271387873/" title="Vilnius - Šnipiškės by A.Kaidanovskij, on Flickr"><img src="http://farm7.static.flickr.com/6223/6271387873_d71295d00d_m.jpg" width="240" height="159" alt="Vilnius - Šnipiškės" style="float:right; margin:0 0 10px 10px;cursor:pointer; cursor:hand;"></a>The whole event is held in the airy, light, inspiring spaces of the <a href="https://www.google.com/images?q=nacionalinė+dailės+galerija">National Gallery of Art</a>, one of my favourite buildings of all. The venue was a substantial factor in my decision to come and participate. I'm very glad I came, and not only because of the building. I'm looking forward to the next day (which is quite soon already, time to catch some sleep!)Albertas Agejevashttp://www.blogger.com/profile/09242021042711503211noreply@blogger.com0tag:blogger.com,1999:blog-6031843066955177984.post-13932031988290700772011-11-09T15:41:00.003+02:002011-11-21T23:51:39.131+02:00Ubuntu Oneiric FTW :(I was used to having uptimes in the order of weeks on the laptop. A couple of suspends, resumes every day, hooking up and disconnecting from the external monitor. Everything worked without a hitch on Ubuntu during the last couple of years. I was being conservative and used Gnome 2 without compositing most of that time. But Ubuntu 11.10 Oneiric is different. Gnome 3 used to crash 5 times a day, Unity has a ~50% chance of surviving a day or two. Most often things seem to crash after the screensaver has kicked in. Yay Ubuntu. Might be time to look elsewhere. Linux Mint or good ole Debian.Albertas Agejevashttp://www.blogger.com/profile/09242021042711503211noreply@blogger.com2tag:blogger.com,1999:blog-6031843066955177984.post-77015038583177787422011-10-15T19:25:00.005+03:002011-10-15T19:46:59.418+03:00Make use of the Caps Lock keySo, there is this Caps Lock key on all keyboards, sitting untouched in polite society. Why not put it to good use? Here are the commands that map the Find symbol to the Caps key on Linux. Stick them somewhere in the X session startup:<br /><pre><br />xmodmap -e 'remove Lock = Caps_Lock'<br />xmodmap -e 'keycode 0x42 = Find'<br /></pre><br />Then I map the key to the keyword completion command in Emacs like this. The second command is needed for Emacs in a terminal window:<br /><pre><br />(global-set-key [find] 'dabbrev-expand)<br />(global-set-key "\M-[1~" 'dabbrev-expand)<br /></pre>Albertas Agejevashttp://www.blogger.com/profile/09242021042711503211noreply@blogger.com0tag:blogger.com,1999:blog-6031843066955177984.post-23307392532116504942011-10-04T14:50:00.006+03:002011-10-04T15:50:05.429+03:00"Version Control by Example" -- first impressions<a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiE8pPko5ddsHaEbk_Q8r-IhnUTDxAyiDbin_2U4ACvrwTbNHiYLwA_u9onG8u1_KBdV0jLKI96JN26p-yw3sQYkhK7Nsyzrg7_MCnet-rN0WTFZu9XVapfrpnbFIsD6B2_CHuLKEmiZts/s1600/vcbe.jpg"><img style="float:right; margin:0 0 10px 10px;cursor:pointer; cursor:hand;width: 240px; height: 315px;" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiE8pPko5ddsHaEbk_Q8r-IhnUTDxAyiDbin_2U4ACvrwTbNHiYLwA_u9onG8u1_KBdV0jLKI96JN26p-yw3sQYkhK7Nsyzrg7_MCnet-rN0WTFZu9XVapfrpnbFIsD6B2_CHuLKEmiZts/s320/vcbe.jpg" border="0" alt=""id="BLOGGER_PHOTO_ID_5659603838955405938" /></a><br />One summer night when browsing Reddit or HackerNews, I came across an offer of <a href="http://www.ericsink.com/vcbe/">a free book about VCS'es</a> in return for <a href="http://book.sourcegear.com/vcbe/request_book">filling in a simple survey</a>. I thought, what the heck, and did it. They promised to dispatch it within 2 or 3 months. This morning an envelope arrived.<br /><br />The book is printed on a heavy, coated paper, which imparts a sense of quality. Certain design and editing aspects, though, give away it being a self-published work. In particular, I find the coloured borders of pages are a bit too noisy for my taste, and punctuation like "?!?!?" would have never gotten through a professional editor.<br /><br />The author, <a href="http://www.ericsink.com/">Eric Sink</a>, curiously, is the founder of AbiWord open source project. He's been is in VCS business for 15 years. His company started by offering tools for SourceSafe, and is now promoting their own open source (Apache licensed) source control management system <a href="http://veracity-scm.com/">Veracity</a>.<br /><br />Obviously, promoting Veracity is the motive of giving away books for free. However, along with Veracity, the author gives an equal standing and an honest review of Subversion, Mercurial and Git, along with a general introduction into version control concepts and some sage advice about best practices in version control. The book presents each VCS by going through an example of two developers collaborating on a small and silly C program, which is easy to follow and presents the peculiarities of each VCS in a natural setting.<br /><br />I'm sure this will become my handbook tome when dealing with Mercurial and Git. I have long fantasized about having a nice dictionary of command equivalents in different VCS'es (clone/branch, fetch/pull/update), and the book has such a table in an appendix. However, sadly, Bazaar is missing from this comparison and the rest of the book, although it is mentioned as one of the three most popular DVCSes in the introduction.<br /><br />Altogether, I'm thankful for the gift of a book that has, doubtless, taken a lot of time and effort to make.Albertas Agejevashttp://www.blogger.com/profile/09242021042711503211noreply@blogger.com1tag:blogger.com,1999:blog-6031843066955177984.post-42645624280492829652011-09-19T09:42:00.006+03:002011-11-21T23:48:41.015+02:00Updating Samsung Galaxy S SCL GT-I9003 to Gingerbread in Ubuntu<a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEipoxuhlr4qX7u6sXYRQtMWVbbUzKVEBu7y4yezIoyxRW9GB9TaxMPctGl-j08qsCJqAaWyFLyj9cD1R9ut0izmFqNRYtgr-anv_ggzUEDhOCKtKgKVC8ToCrJGNXUV2Hbu62snZjhZ8Dw/s1600/SC20110919-102540.png"><img style="float:right; margin:0 0 10px 10px;cursor:pointer; cursor:hand;width: 192px; height: 320px;" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEipoxuhlr4qX7u6sXYRQtMWVbbUzKVEBu7y4yezIoyxRW9GB9TaxMPctGl-j08qsCJqAaWyFLyj9cD1R9ut0izmFqNRYtgr-anv_ggzUEDhOCKtKgKVC8ToCrJGNXUV2Hbu62snZjhZ8Dw/s320/SC20110919-102540.png" border="0" alt=""id="BLOGGER_PHOTO_ID_5653974835136999186" /></a><br />So, I came across the news on the net that Android Gingerbread 2.3.4 update has been made available by Samsung to GT-I9003 phones. Apparently, it was being rolled out on a country or region basis via Samsung's Kies application. First I tried updating the phone with Kies in Virtualbox, but that didn't quite work, I could not get Kies to connect to the device. (Might be the reason was that the phone was not in Kies USB mode). Then I tried booting the OEM Windows Vista on the laptop. Vista <em>had</em> worked after I copied the partition from another hard drive, but now it refused to boot. Apparently, system could come up from hibernation, but depended on the hard drive unique ID in order to boot. Some web browsing, several reboots and trials later, I repaired the Vista boot configuration with the help of a warez Vista DVD. The laptop's recovery partition is useless -- basically it offers restoring from an external backup made earlier or a "factory reset". No Windows recovery, no command prompt.<br /><br />So, turns out Samsung Kies sucks on real Windows as much as it does on Virtualbox. Granted, it did connect to my phone, but I could get more out of it than a backup of the 7 contacts in my phone's memory (the rest are synch'ed with Google). But backing up the 300 photos I have made Kies show a progress bar for 15 mins and then choke. And worst of all, there was no update of any kind offered! I wasted about 10 minutes staring at progress bars waiting for it to install, and then some 30 more minutes staring at progress bars waiting for the backups to fail.<br /><br />So then I looked again at flashing the phone myself. I got the firmware from <a href="http://www.samfirmware.com/">samfirmware.com</a>, found the instructions for flashing with the leaked proprietary Samsung Windows flasher called Odin, got the Open Source flasher <a href="http://www.glassechidna.com.au/products/heimdall/">Heimdall</a> (Debian packages worked fine), found <a href="http://wmarkito.wordpress.com/2011/02/11/flashing-android-froyo-in-a-galaxy-s-with-ubuntu-and-heimdall/">an encouraging blog post on how to use it</a>.<br /><br />The firmware from Samfirmware is a RAR archive (password: samfirmware.com) containing a tar:<br /><code><br />-rwxrwx--- 1 alga alga 191658005 2011-09-19 01:23 I9003XXKPH_I9003XXKPH_I9003SERKPH.rar<br />-rw-rw-r-- 1 alga alga 353699840 2011-08-10 09:53 I9003XXKPH_I9003XXKPH_I9003SERKPH_HOME.tar<br /></code><br />Inside the tar, there are the firmware images:<br /><code><br />$ <b>tar xvvf I9003XXKPH_I9003XXKPH_I9003SERKPH_HOME.tar</b><br />-rwxr--r-- jonghoon/na-cdma-sw 262144 2011-08-09 15:19 boot.bin<br />-rwxr--r-- jonghoon/na-cdma-sw 1310720 2011-08-09 15:19 Sbl.bin<br />-rwxr--r-- jonghoon/na-cdma-sw 618496 2011-08-09 15:19 param.lfs<br />-rwxr--r-- jonghoon/na-cdma-sw 5787648 2011-08-09 15:19 normalboot.img<br />-rwxr--r-- jonghoon/na-cdma-sw 324751360 2011-08-09 15:19 system.rfs<br />-rwxr--r-- jonghoon/na-cdma-sw 12582912 2011-08-08 06:23 modem.bin<br />-rwxr--r-- jonghoon/na-cdma-sw 8378368 2011-08-09 15:20 cache.rfs<br /></code><br />Apart from these, you need a partition table image (<code>*.pit</code>, <code>latona_20110114.pit</code> in my case), that can be downloaded from the Samfirmware site, too.<br /><br />The phone needs to be placed in download mode. Everyone on the internet says this can be done by holding down Volume Down, Home, and Power buttons at the same time, but this did not work for me. An alternative is to use adb:<br /><code><br />$ <b>adb reset download</b><br /></code><br />Then the flash command is as follows:<br /><code><br />$ <b>heimdall detect</b><br />Device detected<br />$ <b>heimdall flash --pit latona_20110114.pit --primary-boot boot.bin --secondary-boot Sbl.bin --normal-boot normalboot.img --cache cache.rfs --modem modem.bin --param param.lfs --system system.rfs</b><br /></code><br />About 2 tense minutes of progress counters uploading these files, a long reboot, and presto! The phone boots up into Android 2.3.4 Gingerbread!<br /><br />The <code>heimdall flash</code> command can be run with the <code>--repartition</code> flag or without it. Repartitioning is needed if the partition layout is different, or, as one forum post suggests, a filesystem type changed. However, it seems that the partition layout is the same for all GT-I9003 versions (Samfirmware suggests the same pit file), so just flashing the partition images is OK.<br /><br />Looking at other firmware archives, it looks like the number of images and their names vary. You just need to match up the files you have with the <code>heimdall</code> option flags (in other words, partition names of your phone). The <code>heimdall print-pit</code> can be useful here, it prints out the actual partition layout of the device.<br /><br />The nice thing about flashing Android updates is that none of the user data was overwritten -- the system lives on separate partitions from installed programs and their data. Although, of course, there is a risk that something goes wrong, so it's wise to back up data before flashing.<br /><br />Now, speaking of Gingerbread, it seems that most of the goodies added in it Samsung had already forward-ported in their Froyo firmware. I hope that they fixed the stability issues. My phone used to crash often with a black screen on Froyo when sitting idle.Albertas Agejevashttp://www.blogger.com/profile/09242021042711503211noreply@blogger.com2tag:blogger.com,1999:blog-6031843066955177984.post-58558599417807322612011-03-29T00:41:00.006+03:002011-11-21T23:52:06.150+02:00Android FTWFinally, I got an Android phone. It's a Samsung Galaxy S SCL. Got it at the end of Friday, had the whole weekend to play.<br /><br /><br /><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhF8zy_SIgLNuCtp8_JHiwCXWadl1Qjahic-hOZ728Q5-CeTfgumNdsDAmOuxhN7pzeqw7kdDRCEUuxhVngXNxXMpEbmZ63vmDfFmRw92ZC5UZsm237H0EiBc9Z0SbwmNKhAkgIhakgfRU/s1600/samsung-galaxy-sl-gt-i9003.jpg"><img style="float:right; margin:0 0 10px 10px;cursor:pointer; cursor:hand;width: 320px; height: 252px;" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhF8zy_SIgLNuCtp8_JHiwCXWadl1Qjahic-hOZ728Q5-CeTfgumNdsDAmOuxhN7pzeqw7kdDRCEUuxhVngXNxXMpEbmZ63vmDfFmRw92ZC5UZsm237H0EiBc9Z0SbwmNKhAkgIhakgfRU/s320/samsung-galaxy-sl-gt-i9003.jpg" border="0" alt=""id="BLOGGER_PHOTO_ID_5653957114420454226" /></a><br /><br />Small, posh box. Quality accessories. A charger the size of a matchbox, practically just the plug. Earbuds with rubbery thick wires that do not tangle up. The device is slick, the UI is fast and smooth.<br /><br />The UI is all translated, with a couple of amusing bugs. One of them is that the Bluetooth menu is, in fact, Italian, not Lithuanian (it, lt, big deal!) "Impostazioni Bluetooth. Ricerca dispositivi." Then there are some usual cases where the translator did not quite get what they're translating. "Build number" in the system information is translated as "Sukurti numerį" (literally "create a number").<br /><br />The Android Market is amazing. I found everything I needed: an ssh client, a PasswordSafe program, a fb2/html/txt book reader, an OpenStreetMap based vector map program with address search and routing, an app for WindGuru and Windfinder, a virtual drum kit like my bro had on iPhone4, etc. Usually there are more that one choice for each particular type of app. But I'm going to write my own fuel log app anyway, as the one that does everything I want and a bit more is castrated in the free version.<br /><br />Turns out, with Android it's even harder to hide your data from Google. Just enter your Google account creds once, say in the Google Talk app, and look, your address book is sync'ed with your Google account too! It can all be turned off, of course, but still. That's my current tinfoil hat conspiracy theory as to why Google invested in Android -- to gob up everyone's address books!<br /><br />I tried avoiding feeding all my data to Google. I played with SyncEvolution for two hours trying to fish out the data from my Symbian phone. In the end it worked, I had the phonebook on the laptop as a directory with 350 vcards. Now it's just a matter of adding the new device, and pyushing it up there, right? Bzzzt, what do you mean Android not supported!? Turns out it's true. Android has no SyncML support built in. There are apps that might or might not work over the network, but Bluetooth, here and now, is out of the question.<br /><br />I went to the Android Market and looked for a phonebook import app. Found <a href="http://www.waxworlds.org/edam/software/android/import-contacts">one that did exactly what I needed</a> -- filled the address book from a directory with vCards. A couple of minutes, and here we have it! But wait, all non-ascii characters got mangled, double-UTF-8-encoded. Good job the app is GPL, bzr repo available at the author's web site. Another half-hour, and I have the SDK all set up with Eclipse integration. A quick look at the source, a couple of recompiles and reruns, one offending line commented out, and the phonebook is all imported. Only later I found that the standard phone book app has the vCard import/export too, perhaps even without bugs! The patch for the import app is still to be sent.<br /><br />Anyway, now I'm diving into Android dev tutorials and reading Bloch's <em>Effective Java</em>.Albertas Agejevashttp://www.blogger.com/profile/09242021042711503211noreply@blogger.com3tag:blogger.com,1999:blog-6031843066955177984.post-25779059709803551532010-11-15T21:16:00.006+02:002011-11-21T23:52:33.843+02:00Mobile Monday Vilnius (Nov 2010)A couple of hours ago I participated in the Mobile Monday event. It was quite cramped, also it was quite fun. There were four 15 minute presentations. Here's a summary:<br /><span style="font-weight:bold;"><br />Omnitel</span>: smarphones are, like, selling, and, like, their market share is, like, increasing. Over 50% of the phones we sell nowadays "have an operating system".<br /><br /><span style="font-weight:bold;">Microsoft</span>: Windows Phone 7. We realised that our mobile OS offering is crap, so we took a fresh start. We're going to give a shot at the exercise we failed at back in 1985: try to imitate what Apple is doing! See, it's all touchy and slidy and aesthetically appealing! Apps are the key, so please go and download our SDK for free! Castrated Visual Studio, emulators, templates, everything is free! Then you can submit apps to our app store, we'll review them, and then you will be able to make moneys! The platform you use to develop apps is a mix of our browser bling platform and our gaming console toolkit!<br /><br />Then there was a 15 minute breather break, as the air got quite stuffy.<br /><br /><span style="font-weight:bold;">Nokia</span>: Yeah, well, we realised that we had a lot of stuff (a slide with logos for Java, Python, Qt, Maemo, Meego, Symbian, and some more) so we decided to get our story straight: Qt (pronounced "cute")!!! It's the new Java, write once, run anywhere!!! Symbian, Meego, it's all irrelevant, Qt is what you'll develop your apps in! Also, we have an app store we call OVI. We will sell your Qt apps there. It's really cool, the customer is billed on their mobile bill, we have agreements with most of the providers in the world. It will cost you more, but with no credit cards involved, customers have a lower barrier to buy. Also, we encourage and invite local apps and local services, create a great local app, we will put in on the featured page for your locale, and you'll be RRRRRich!<br /><br /><span style="font-weight:bold;">Some guy</span>: Mobile web. A lot of people use web on their mobile. Uhhh. So we should develop mobile versions of our sites. But having http://m.* in front of URLs kinda sucks, and people disregard these, just go to the main site and pan and zoom. CSS3 and HTML5 is the answer. Apple has a lot of nice demos of that! But wait, they're only drafts now. And Javascript is the answer! Thanks, bye.<br /><br />Then there was a panel with the presenters FINALLY taking questions.<br /><span style="font-weight:bold;">Audience</span>: MS guy, what are the hidden costs in your platform? <br /><span style="font-weight:bold;">MS guy</span>: it's free! Download with one click, install, develop your content, submit!<br /><span style="font-weight:bold;">Audience</span>: but come on now, how much does it cost in reality?<br /><span style="font-weight:bold;">MS guy</span>: I'm telling you, it's really free.<br /><span style="font-weight:bold;">Audience</span>: What about VisualStudio?<br /><span style="font-weight:bold;">MS guy</span>: We give you a special version we call "Visual Studio Express" for free! Well, if you want to experiment with the look&feel, you need to cash out for the full blown one, but to summarize it's free.<br /><span style="font-weight:bold;">Audience</span>: Nokia, the Symbian Foundation has fallen apart, what do you make of it?<br /><span style="font-weight:bold;">Nokia guy</span>: Symbian, Shmimbian, it's all irrelevant, Cute is the answer!<br /><span style="font-weight:bold;">Audience</span>: What about the horrible signing process?<br /><span style="font-weight:bold;">Nokia guy</span>: we fixed it! If you submit an app for review to our OVI store, we'll sign it for you! And Qt is the new thing!<br /><span style="font-weight:bold;">Audience</span>: what about the market share? How much market do you gather your plaform has?<br /><span style="font-weight:bold;">Nokia guy</span>: Frankly, I don't know and don't care. And as I said, platforms are a thing of the past, Qt is the king.<br /><span style="font-weight:bold;">MS</span>: We hope we will get some market share! PLZ help, but sorry, you need to get someone abroad to buy you a phone and then submit an app for you. Anyways.<br /><span style="font-weight:bold;">Omnitel</span>: Weeeel, obviously, S60 is by far the moooost popular smartphone platform in Lithuania, then there is Apple, and Android is rising, and RIM is also showing promise...<br /><br />Then the questions were over and there was some shmoozing over wine and finger food. By then it was pas 8pm, so the crowd dissipated quickly.Albertas Agejevashttp://www.blogger.com/profile/09242021042711503211noreply@blogger.com6tag:blogger.com,1999:blog-6031843066955177984.post-37655094889636663292010-10-11T11:49:00.004+03:002011-11-21T23:49:24.799+02:00Freeing up some space on UbuntuI tried upgrading to Ubuntu Maverick Meerkat, but, as it often happens, the upgrade manager brushed me off saying I need to clear up about 970 MB of disk space on the root filesystem.<br />Time to buy a new hard drive, but in the meantime I still want to upgrade with what I have.<br /><br /><code>apt-get autoremove</code> freed up some space, but more than an order of magnitude less than the gig I needed to find.<br /><br />deborphan has always been a great tool to seek out the unneeded packages that use up disk space. If you run it without any arguments, it reports the libraries that are not required by any application. So you can safely remove every package deborphan reports unless you know you need it (for your own development, proprietary software you installed manually, etc.). When deborphan reports nothing, it's time to lax up the requirements:<br /><pre><br /> deborphan -anz | sort -n<br /></pre><br />This lists all packages that are not required by other packages, even if they aren't libraries, and sorts them in a descending order by size. Old kernel images show up in this list near the bottom. There's usually more low-hanging fruit at the end of the list that can help you free up several hundred megs of space. Here you need to be careful not to delete something that you need from the system, as with these flags deborphan lists even packages that are apps rather than libraries, and even includes those that are suggested or recommended by other packages.<br /><br />We're still several hundred megs short, but there are no obvious large packages to remove. The space is taken up by hundreds of relatively small ones. An effective technique I have found for this situation is start up Synaptic, order packages by origin, then go through restricted, multiverse and universe, sort packages by install status and size, and remove all the small packages you know nothing about, and various utilities you installed and used once. Sometimes it will threaten to remove a program that you need, then you need to back out. After you apply the changes, it's a good idea to close Synaptic and let <code>apt-get autoremove</code> and deborphan have a go again. If you're still not there, start up Synaptic again and prune Universe some more.<br /><br />Presto! I got my gig (and more!) of free space by removing old kernels (480 MB), sacrificing Flightgear, QCad parts library, and lots of small utilities from Universe (900 MB).Albertas Agejevashttp://www.blogger.com/profile/09242021042711503211noreply@blogger.com1tag:blogger.com,1999:blog-6031843066955177984.post-62928762340805985882010-05-21T10:54:00.005+03:002011-11-21T23:47:52.201+02:00EuroPython 2010!<a href="http://www.europython.eu/" title="europython"><img alt="europython 2010" class="attachment" src="http://wiki.europython.eu/Publicity?action=AttachFile&do=get&target=europython_speaking_126x70.png" title="europython 2010" style="float:left; margin-right: 1em"/></a><br /><br />Yay, my talk <a href="http://www.europython.eu/talks/talk_abstracts/#talk82">Zope Components for the Win</a> got accepted to EuroPython! I'm going, and probably taking my wife and a baby too!Albertas Agejevashttp://www.blogger.com/profile/09242021042711503211noreply@blogger.com0tag:blogger.com,1999:blog-6031843066955177984.post-16107898368982664142010-03-14T17:26:00.005+02:002011-11-21T23:50:08.892+02:00upicasa -- an upload script for PicasaWebSo, as <a href="http://alga42.blogspot.com/2010/03/sometimes-google-is-great.html">planned last time</a>, I developed my PicasaWeb script a bit further. After I got home from a niece's first birthday party, I had some photos I wanted to upload, so I added the support for listing and creating albums. Then today I moved the authentication credentials out of module globals into a combination of a config file and interactive email/password query. With my password out of the source code it became ready for the initial import into a version control repository.<br /><br />I chose <a href="http://mercurial.selenic.com/quickstart/">Mercurial</a> as a VCS just to try it out. Thus, <a href="http://bitbucket.org/">Bitbucket</a> was a natural place to host the repository. Unfortunately, yesterday evening it was inaccessible. Mercurial feels really fast and convenient.<br /><br />Bitbucket was <em>a total blast</em> to get going. I registered in with my Launchpad OpenId, created a new repository for my project, uploaded my SSH pubkey, and was able to push my initial version within two or three minutes. Way to go, dudes! Very clear, simple, and good looking. A stark contrast with Launchpad, which leaves me confused whenever I try to do something that should be really simple. Here's the <a href="http://bitbucket.org/alga/upicasa/">link to the upicasa hg repo on Bitbucket.</a><br /><br />So, anyway, I wrote a setup.py script, a README file, polished the script a bit and released it to PyPI: <a href="http://pypi.python.org/pypi/upicasa/0.1">upicasa 0.1</a>. Writing the setup.py and the README in order to package the script took about the same time, if not more, than writing the script in the first place, but that's how it goes with Open Source, doesn't it?<br /><br />The more I use PicasaWeb the more I like it. It has a nifty semi-automatic face recognition feature. It makes tagging people on photos pass the threshold of convenience where it becomes practial. Finally I'll be able to find a photo of someone I know I have. Full screen album display feature is also very nice.<br /><br />So, now I have a warm fuzzy feeling of having done a useful weekend programming project. Tried something new. Learned a bit. Now it will be great to see whether other people will find it useful.Albertas Agejevashttp://www.blogger.com/profile/09242021042711503211noreply@blogger.com1tag:blogger.com,1999:blog-6031843066955177984.post-49364737178291276142010-03-12T13:52:00.007+02:002010-03-12T15:53:24.053+02:00Sometimes Google is greatLast weekend we have been invited to a neighbour's 5th birthday party. It has taken place at a <a href="http://www.xplanet.lt/">kids' entertainment park</a> in a shopping centre. I took my camera, and the neighbours asked me to share the pictures.<br /><br />So, I decided I want to post the pictures at <a href="http://picasaweb.google.com">PicasaWeb</a>. It's web galleries are quite convenient and featureful, look like a good place to dump large amounts of photos someone wants you to share. Facebook, in contrast, scales them down to obscenely small sizes. Since I already have a Google account, I just had to click the Register button, and I got into my gallery with my Blogger avatar already in it. I created a new album, but the upload form for adding pictures was <em>so 1990's</em>. It had 5 file upload input fields. Even if new ones would appear as needed, it meant that I would have to select each and every photo individually.<br /><br />I started looking for a tool for automatic upload into Picasa, but a stand-alone tool for that doesn't seem to exist in Ubuntu. There is, however, a <code>python-gdata</code> package with a Python API to Google online services. I googled "python gdata" and got the documentation in Google Code as the first hit. It has <a href="http://code.google.com/intl/lt/apis/picasaweb/docs/1.0/developers_guide_python.html">a section on PicasaWeb</a>. 15 minutes later the photos were already on the way. Here is the script:<br /><pre><br /><font color="#ffa500">#!/usr/bin/env python<br /></font><font color="#008b00">"""upicasa.py -- an upload script for PicasaWeb"""</font><br /><font color="#4682b4"><b>import</b></font> sys<br /><font color="#4682b4"><b>import</b></font> gdata.photos.service<br /><font color="#4682b4"><b>import</b></font> gdata.media<br /><font color="#4682b4"><b>import</b></font> gdata.geo<br /><br /><font color="#000000">EMAIL</font> = <font color="#008b00">'xxxx.xxxx@gmail.com'</font><br /><font color="#000000">PASSWORD</font> = <font color="#008b00">'XXXXX'</font><br /><br /><font color="#4682b4"><b>def</b></font> <font color="#ff0000"><b>main</b></font>():<br /> gd_client = gdata.photos.service.PhotosService()<br /> gd_client.email = EMAIL<br /> gd_client.password = PASSWORD<br /> gd_client.source = <font color="#008b00">'alga-upicasa-1'</font><br /> <font color="#4682b4"><b>print</b></font> <font color="#008b00">"Authenticating..."</font><br /> gd_client.ProgrammaticLogin()<br /><br /> <font color="#ffa500">## I used this to fish out the album id pasted below<br /></font> <font color="#ffa500">#albums = gd_client.GetUserFeed(user=EMAIL)<br /></font> <font color="#ffa500">#for album in albums.entry:<br /></font> <font color="#ffa500"># print 'title: %s, number of photos: %s, id: %s' % (album.title.text,<br /></font> <font color="#ffa500"># album.numphotos.text,<br /></font> <font color="#ffa500"># album.gphoto_id.text)<br /></font> <font color="#ffa500">#return<br /></font><br /> album_id = <font color="#008b00">'123123123123132123'</font><br /> album_url = <font color="#008b00">'/data/feed/api/user/%s/albumid/%s'</font> % (EMAIL, album_id)<br /> <font color="#4682b4"><b>for</b></font> photo <font color="#4682b4"><b>in</b></font> sys.argv[1:]:<br /> <font color="#4682b4"><b>print</b></font> <font color="#008b00">"uploading"</font>, photo<br /> photo = gd_client.InsertPhotoSimple(album_url, <font color="#008b00">'New Photo'</font>,<br /> <font color="#008b00">''</font>, <font color="#ffa500"># title<br /></font> photo, content_type=<font color="#008b00">'image/jpeg'</font>)<br /><br /><br /><font color="#4682b4"><b>if</b></font> <font color="#cd0000">__name__</font> == <font color="#008b00">'__main__'</font>:<br /> main()<br /></pre><br />It was really fun and empowering to get the photos programmatically uploading into online albums in such a short time. Top marks to Google for providing this simple, sensible way to manage data on Google. No app registration, no developer keys, no nonsense, just the Google login and password are needed to get started. I think I'll develop this script a bit to allow for managing the albums from command line and uploading photos into them, then add it to <a href="http://pypi.python.org/">Python Package Index</a>. Perhaps a simple GUI could also be useful.Albertas Agejevashttp://www.blogger.com/profile/09242021042711503211noreply@blogger.com3tag:blogger.com,1999:blog-6031843066955177984.post-8385087931824517062009-10-12T20:48:00.006+03:002011-11-21T23:50:29.546+02:00The Future<img src="http://nds3.nokia.com/pressphotos/public/global/devices/n900/Nokia_N900_20_lowres.jpg" alt="Nokia N900" /><br /><br />I've touched it. <a href="http://maemo.nokia.com/n900/">Nokia N900</a> is awsome. The shape and size is that of a large phone, like the early Symbian smartphones. But it is very slick and is <em>packed</em> with features. It has a slide-out keyboard, a camera with a sliding cover, a leg to stand on the table, a Micro USB connector for power and data, a hardware key lock, several hardware buttons, etc.<br /><br />The software side, Maemo 5, is also awesome. Looks very slick, feels responsive and ergonomic. And polished. But it's an open platform, based on Linux, X11, QT, GTK+, D-Bus. It looks like head-on competition to iPhone. Reminds me that companies the size of Nokia have the resources pull off almost anything. But it's really great that Nokia is doing it right -- in a way that is Open Source, community based, and iterative.Albertas Agejevashttp://www.blogger.com/profile/09242021042711503211noreply@blogger.com3tag:blogger.com,1999:blog-6031843066955177984.post-29707096741903322902009-08-20T01:11:00.001+03:002009-08-20T01:14:09.949+03:00Linux counterLook what I have:<br /><br /><a href="http://counter.li.org/cgi-bin/runscript/display-person.cgi?user=77161"><img src="http://counter.li.org/cgi-bin/certificate.cgi/77161"></a><br /><br />A five-digit, 11-years-old Linux counter number!Albertas Agejevashttp://www.blogger.com/profile/09242021042711503211noreply@blogger.com1tag:blogger.com,1999:blog-6031843066955177984.post-86093155321036830302009-03-12T22:39:00.003+02:002009-03-13T00:14:30.848+02:00Goodbye, Palm V<a href="http://www.flickr.com/photos/alga/3349255447/" title="Palm Vx by Albertas Agejevas, on Flickr"><img src="http://farm4.static.flickr.com/3473/3349255447_9561ca26f0_m.jpg" width="240" height="240" alt="Palm Vx" /></a><br /><br />Recently, my Palm died on me due to me neglecting to charge it and brought with it more than a year's worth of statistics of my car's fuel useage, petrol prices, and mileage. Surprisingly from today's standpoint, Palm's memory is not flash and has to be powered in order to keep its contents. If the battery discharges, the device returns to the factory state.<br /><br />I have owned and used a Palm Vx since 2001. For the last couple of years I have been using it for only two applications: storing passwords in <a href="http://gnukeyring.sourceforge.net/">Keyring</a> and keeping tabs on my cars' fuel usage with <a href="http://palmfuellog.sourceforge.net/">Fuel Log</a>. Both of these programs are GPL licensed. I've migrated passwords to <a href="http://nsd.dyndns.org/pwsafe/">pwsafe</a> on the laptop a couple of months ago. Now that the fuel log is gone, there's nothing binding me to it.<br />Sounds like a good opportunity to retire the Palm at last.<br /><br />I will always have fond memories of this little device. A truly portable PDA, less than 1 cm thick, the weight that does not strain a shirt pocket, battery charge good for several weeks of standby time or 20 hours straight of reading of e-books (tried that). The screen is laughably low-res by today's standards (160x160 pixels). Nowadays most mobile phones have a higher resolution screen. However it was very comfortable on the eyes, and the green inverse backlight was very pretty, was very comfortable in darkness, but made the screen pretty much useless in twilight.<br /><br />Oh, the thousands of pages of books I have read on this thing! It was so convenient. I had Palm with me at all times and could delve into the book I was reading at the time at each opportunity: a long line in the supermarket, in the doctor's lobby, in bed at night, sunbathing at the lake, anywhere! I could look up a rare word by just clicking on it and switching to the dictionary app. I could not agree more with everything John Siracusa has to say about the Palm e-book experience <a href="http://arstechnica.com/gadgets/news/2009/02/the-once-and-future-e-book.ars">in his excellent article on the history of e-books</a>.<br /><br />Palm had a great set of <abbr title="Personal information management">PIM</abbr> applications: Notes, Address book, To Do. These were really excellent and served their purpose very well.<br /><br />Miraculously, my Palm's Lithium battery is still working, about 9 years from production! Other things have obsoleted the device: my current laptop (Thinkpad X61s) does not have neither RS-232 nor IrDA ports, and these two are the only communication channels on the Palm. The 8 MB of memory were enough 7 years ago to keep several books and an assortment of useful programs, but are laughable today. But even in its heyday, getting online not too comfortable: if there was no table around, you had to balance the Palm and the mobile phone on your knee with their infrared ports aligned, and the 9600 bps dialup on GSM was slow by any standards, and there was no web browser, at least a free software one.<br /><br />Later offerings from Palm Inc. were faster, brighter, more capable, more powerful, and more expensive, but lost to Palm V in several important respects: size, weight, and battery life.<br /><br />So, anyway, I need a new fuel log application, and I know the device where I want it. My S60 mobile phone. I also have it with me at all times, it's always on and ready to roll, and it holds its charge for many^H^H^H^Hseveral days. And i'm going to write it in Python.Albertas Agejevashttp://www.blogger.com/profile/09242021042711503211noreply@blogger.com0tag:blogger.com,1999:blog-6031843066955177984.post-40987307380729131022008-09-18T00:10:00.003+03:002008-09-18T00:45:59.210+03:00Hardware problems with OLPC XO-1: my 2 centsProblem: my kid's XO wouldn't turn on. The power light would go on, but the screen would stay dark. And it wasn't just the backlight. There was no startup sound as well. Powering on while holding D-pad left did start the hardware diagnostics, but the machine turned off in the middle of the test and wouldn't come back up.<br /><br />On the OLPC wiki I found excellent information on <a href="http://wiki.laptop.org/go/Startup_Diagnosis">startup diagnosis</a>, but my symptoms weren't there. The next step was to use the excellent <a href="http://wiki.laptop.org/go/Disassembly_top">disassembly instructions</a> and look for a connection shaken loose or some mechanical damage.<br /><br />XO is really beautiful inside. Looks very sturdy, also it looks simple and sophisticated at the same time. Mostly everything is in the top part, behind the screen. There are only ~9 wires coming from the bottom: 2 from the battery, another small 2 wire connector (battery temperature sensor or something like that) and a 5-wire keyboard cable. It took me a minute or two to identify the problem.<br /><br />Solution: remove the 2 cents coin from the SD card slot!<br /><br />P.S. Also, I checked out the firmware easter egg (power up while holding D-pad right). Nice!Albertas Agejevashttp://www.blogger.com/profile/09242021042711503211noreply@blogger.com4tag:blogger.com,1999:blog-6031843066955177984.post-77881267058851458472008-06-22T14:06:00.005+03:002011-11-21T23:47:00.730+02:00The joys of Linksys WRT 54GLOn Friday there was a thunderstorm. Usually during the storms the surge protection in my radio link antenna's power-over-ethernet power supply trips up and needs to be reset by disconnecting the PSU from the mains for around 10 minutes. This time the usual measure didn't suffice. The lights on the adapter came up, but still there was no connectivity. I reported the problem to the ISP's tech support. The next day the engineer rang up and said that he can connect to the dish at my side.<br /><br />I connected a laptop directly to the uplink cable, configured the static IP address. Lo and behold, the pings go through. Apparently the uplink Ethernet port on my OpenWRT router got fried.<br />Luckily, this router does not just have an uplink port and four lan ports, it has a programmable switch and an open firmware (OpenWRT 7.09 "Kamikaze") lets me tap into it.<br /><br />I looked at /etc/config/network, and found the following lines at the top:<br /><code><br />#### VLAN configuration <br />config switch eth0<br /> option vlan0 "0 1 2 3 5*"<br /> option vlan1 "4 5"<br /></code><br /><br />vlan0 is the internal lan, 0-3 are the external lan ports, and 5 is the host port. vlan1 connects the uplink port (4) to the router (5). The asterisk probably means packet tagging. As the router internally has just one physical ethernet port, the internal and external interfaces are virtuals employing the same physical interface. Their packets are distinguished by tags.<br /><br />So, I changed the config thus:<br /><br /><code><br />#### VLAN configuration <br />config switch eth0<br /> option vlan0 "0 1 2 5*"<br /> option vlan1 "3 4 5"<br /></code><br /><br />I rebooted the router and plugged the blue uplink cable into the first LAN port (the numbering of the holes on the router is backwards). Tada! Here's my Internet connection again!Albertas Agejevashttp://www.blogger.com/profile/09242021042711503211noreply@blogger.com3tag:blogger.com,1999:blog-6031843066955177984.post-92196858298876415882008-06-19T16:19:00.003+03:002011-11-21T23:53:48.966+02:00Huawei E220 USB HSDPA modem on LinuxTested on Ubuntu Hardy. When you plug the modem in, things happen:<br /><br /><code><br />[ 1872.829603] usb 5-2: new full speed USB device using uhci_hcd and address 11<br />[ 1872.988741] usb 5-2: configuration #1 chosen from 1 choice<br />[ 1872.998189] usb-storage: probe of 5-2:1.0 failed with error -5<br />[ 1872.998226] airprime 5-2:1.0: GSM modem (1-port) converter detected<br />[ 1872.998441] usb 5-2: GSM modem (1-port) converter now attached to ttyUSB0<br />[ 1873.006403] usb-storage: probe of 5-2:1.1 failed with error -5<br />[ 1873.006437] airprime 5-2:1.1: GSM modem (1-port) converter detected<br />[ 1873.006615] usb 5-2: GSM modem (1-port) converter now attached to ttyUSB1<br />[ 1873.057365] scsi30 : SCSI emulation for USB Mass Storage devices<br />[ 1873.058803] usb-storage: device found at 11<br />[ 1873.058810] usb-storage: waiting for device to settle before scanning<br />[ 1876.078727] usb-storage: device scan complete<br />[ 1876.082294] scsi 30:0:0:0: CD-ROM HUAWEI Mass Storage 2.31 PQ: 0 ANSI: 2<br />[ 1876.117573] sr0: scsi-1 drive<br />[ 1876.117674] sr 30:0:0:0: Attached scsi CD-ROM sr0<br />[ 1876.117754] sr 30:0:0:0: Attached scsi generic sg1 type 5<br /></code><br /><br />As you can see, we get two serial ports and a CD-ROM drive. The second serial port and the CD-ROM drive can be ignored. PPP works straight away with the following config:<br /><br /><code><br />noauth<br />connect "/usr/sbin/chat -v -f /etc/chatscripts/e220"<br />debug<br />/dev/ttyUSB0<br />230400<br />crtscts<br />defaultroute<br />noipdefault<br />user ignored<br />remotename whatever<br />ipparam whatever<br />usepeerdns<br /></code><br /><br />Here's the e220 chatscript (put in into /etc/chatscripts, replace the "****" with your pin code, replace "omnitel" with your provider's APN):<br /><br /><code><br /># Chat file for Huawei E220 HSDPA USB modem<br />ABORT BUSY ABORT 'NO CARRIER' ABORT 'NO ANSWER' ABORT DELAYED<br />'' AT<br />OK AT+CPIN="****"<br />OK ATX3<br />OK 'AT+CGDCONT=1,"IP","omnitel"'<br />OK ATDT*99***1#<br />CONNECT ""<br /></code>Albertas Agejevashttp://www.blogger.com/profile/09242021042711503211noreply@blogger.com1tag:blogger.com,1999:blog-6031843066955177984.post-48109632554940538772008-06-08T22:24:00.007+03:002011-11-21T23:54:11.405+02:00New phone<a href="http://www.flickr.com/photos/alga/2562160774/" title="Got a new phone by Albertas Agejevas, on Flickr"><img src="http://farm4.static.flickr.com/3137/2562160774_de0ef6006b_m.jpg" width="240" height="194" alt="Got a new phone" /></a><br /><br />I got a new phone on Thursday, Nokia 6120 classic. It is my first Series 60 phone. I have been a loyal Nokia user for around four years now, mostly because of the ubiquity and universality of Nokia chargers. During the whole time they were producing GSM handsets, Nokia has changed the charger connector only two times. Each time the change was motivated by miniaturization.<br /><br />Series 60 3rd edition is very nice. The UI metaphor is different from Series 40, but it's quite intuitive and comfortable. Surprisingly, there's no stopwatch app, but of course there already are too many Stopwatch apps for S60 on the web. Should I write another one? :-) There's a snag that this phone is not yet supported by Gnokii/Gammu/Wammu, so I had to install the Nokia PC suite on Windows in order to transfer my contacts from my old Nokia 6230i. Know what? It was not flawless. Getting the contacts from the 6230i was easy (if we ignore the constant Vista disk grinding), not so with restoring the backup on the 6120c. It took Nokia PC suite 3 attempts to create the Bluetooth pair, install the drivers on the PC and on the phone, and connect to the phone.<br /><br />The phone has all the 3G technologies: UMTS, HSDPA. During my first Internet connection test on a late Thursday evening <a href="http://speedtest.net/">speedtest.net</a> indicated 1.2 Mbps down and about 100 kbps up with a 3.5G (HSDPA) connection. On a Saturday night though the speed fluctuated between 300-600 kbps on average, and it took a couple of attempts to establish an HSDPA connection, I would get EDGE instead. I'm using the Bitė GMS network. We'll see how things will go with Omnitel.<br /><br />Yesterday I installed Python on the phone. I set up and played with a Bluetooth console. The Hardy bluez-utils are broken (see <a href=" https://bugs.launchpad.net/ubuntu/+source/bluez-utils/+bug/211252">Ubuntu bug 211525</a>), so I had to install bluez-utils from Sid. The Bluetooth console is much more convenient than banging in Python code on the phone keyboard, but it does not have readline.<br /><br />I got an impression that Nokia wants people to use Python on Series 60 very much. They try very hard to make it easy, provide all sorts of docs, even multimedia tutorials. Probably they see the ease and accessibility of Python as a path to widespread platform adoption. The Python API has easy access to most of the phone's functionality, including the GUI toolkit, camera, bluetooth, networking, messaging, contacts and so on. I have an impression that cooking a homebrew contacts backup/restore application in Python will be pretty trivial. I cannot start hacking away as Python looks for modules on the flash card, and I haven't bought a microSD card yet. On a positive note, it's nice that this time Nokia didn't include a cheap claustrophobic-sized card. They're useless after you buy a real card, but hard to throw away, so they contribute to cruft accumulation in life.<br /><br />Unfortunately, Nokia only provides the platform SDK for Windows, but <a href="http://www.martin.st/symbian/">there are ways</a> to use the GNU toolchain in combination with the SDK and some Wine.<br />The SDK is needed in order to package Python scripts as SIS installable files. Even then, I'm not sure it will work, as Series 60 3rd ed. only accepts packages signed by a registered developer. There should to be a way to play with your own software, no idea yet what's involved.Albertas Agejevashttp://www.blogger.com/profile/09242021042711503211noreply@blogger.com4tag:blogger.com,1999:blog-6031843066955177984.post-25360661932544876412008-04-30T16:24:00.008+03:002011-11-21T23:54:23.122+02:00Seasonal headache: ABBYY eFormFiller 2.5 on LinuxThe beginning of May (May 6 this year) is the deadline for income tax declarations in Lithuania. Our tax inspection accepts paper forms, has a lame web interface, and offers a Windows program that looks nice, calculates all the derived values for you, and has validation. There are <a href="http://appdb.winehq.org/objectManager.php?sClass=version&iId=4816">some problems</a> with running it on <a href="http://www.winehq.org/">Wine</a>. Last year I tried getting it to run for a couple of hours, then gave up and booted Windows on one of the laptops.<br /><br />This year around, I made an effort and finally got it to run. Here are the commands that made the cut for me (Ubuntu Hardy, Wine 0.9.59):<br /><br /><code><br />mkdir /tmp/formfiller<br />cd /tmp/formfiller<br />wget -nv http://deklaravimas1.vmi.lt/eFormFiller25v6_2008_03_06.zip<br />unzip eFormFiller25v6_2008_03_06.zip<br />wget -nv http://kegel.com/wine/winetricks<br /><br />export WINEPREFIX=~/.wine-eFF/<br />wineprefixcreate<br /><br />sh winetricks dcom98<br />sh winetricks win98<br />sh winetricks riched20<br />sh winetricks vcrun6<br />sh winetricks wsh56<br /><br />wine setup.exe /q<br /><br />wine $WINEPREFIX/drive_c/Program\ Files/ABBYY\ eFormFiller\ 2.5/FormFillerLight.exe<br /></code><br /><br />I hope it will be useful to somebody.<br /><br /><strong>Update:</strong> naaaah, it works with the last year's income tax form, but doesn't with this year's. Time to boot Windows again :(Albertas Agejevashttp://www.blogger.com/profile/09242021042711503211noreply@blogger.com8tag:blogger.com,1999:blog-6031843066955177984.post-8336367387103541702008-04-02T19:49:00.002+03:002008-04-02T20:07:09.539+03:00Oh, the convenience!I was browsing around for <a href="http://www.europython.org/community/Accommodation_Suggestions">hotels</a> close to the <a href="http://www.europython.org/">Europython 2008</a> conference venue (Reval Hotel Lietuva). I remembered that the classic Soviet-decorated Neringa hotel is 10 minutes away, just across the pedestrian bridge between the banks of Neris. Unfortunately, Scandic Neringa does not have any rooms available for the duration of the conference, but they suggested another hotel nearby.<br /><br /><a href="http://nariai.akl.lt/alga/photos/misc/wtf/show/scandic1.png?display="><img src="http://nariai.akl.lt/alga/photos/misc/wtf/small/scandic1.png"></a><br /><br />Your daily commute: 1250 km in each direction.<br /><br /><a href="http://maps.google.com/maps?f=d&hl=en&geocode=11258561823583699868,54.683300,25.316600&saddr=3+Koskikatu,+87200+K%C3%A4tt%C3%B6,+Kajaani,+Finland&daddr=Gedimino+Avenue,+23,+Vilnius,+01103,+Lithuania+(Neringa)&mra=pe&mrcr=0&sll=59.455203,26.50449&sspn=11.112721,26.147461&ie=UTF8&ll=59.445075,26.015625&spn=11.112721,26.147461&z=5"><img src="http://nariai.akl.lt/alga/photos/misc/wtf/small/scandic2.png"></a>Albertas Agejevashttp://www.blogger.com/profile/09242021042711503211noreply@blogger.com0tag:blogger.com,1999:blog-6031843066955177984.post-49633963367073596872008-01-11T16:54:00.000+02:002008-01-20T02:49:57.423+02:00Schneier on open WiFiI've been running an open WiFi network at home (and at the office as well). Turns out, the security guru Bruche Schneier does the same, as he writes in <a href="http://www.wired.com/politics/security/commentary/securitymatters/2008/01/securitymatters_0110">his article "Steal This Wi-Fi"</a>. Not only Schneier puts down in words my own vague moral arguments for doing so, but also assesses the risks associated with the practice of running an unsecured wireless network.<br /><br />So, whenever you come by my house, be my guest and use the WiFi. By the way, my ESSID conveys this in Lithuanian: "Skanaus".Albertas Agejevashttp://www.blogger.com/profile/09242021042711503211noreply@blogger.com2tag:blogger.com,1999:blog-6031843066955177984.post-47158930384620047882007-12-19T22:53:00.000+02:002007-12-19T22:54:32.957+02:00So trueJava is like a variant of the game of Tetris in which none of the pieces can fill gaps created by the other pieces, so all you can do is pile them up endlessly. -- <a href="http://steve-yegge.blogspot.com/2007/12/codes-worst-enemy.html">Steve Yegge</a>Albertas Agejevashttp://www.blogger.com/profile/09242021042711503211noreply@blogger.com1tag:blogger.com,1999:blog-6031843066955177984.post-20455678187844177702007-10-05T16:47:00.000+03:002007-10-05T16:48:24.050+03:00Personal DNAI took the Personal DNA test today.<br /><br /><div style="position: relative;overflow: hidden;width: 200px;height: 200px;"><div title=" Very High Spontenaiety" style="position: absolute;overflow: hidden;left: 0px;top:0px;height:84px;width:70px;background-color:#19fcfc"></div><div title=" Very Earthy" style="position: absolute;overflow: hidden;left: 70px;top:0px;height:84px;width:66px;background-color:#8a4c0e"></div><div title=" Very High Trust" style="position: absolute;overflow: hidden;left: 136px;top:0px;height:84px;width:64px;background-color:#1818f2"></div><div title=" Very High Masculinity" style="position: absolute;overflow: hidden;left: 0px;top:84px;height:43px;width:112px;background-color:#177ee6"></div><div title=" Slightly High Confidence" style="position: absolute;overflow: hidden;left: 0px;top:127px;height:42px;width:112px;background-color:#e31717"></div><div title=" Slightly High Openness" style="position: absolute;overflow: hidden;left: 0px;top:169px;height:31px;width:112px;background-color:#14cc70"></div><div title=" Average Empathy" style="position: absolute;overflow: hidden;left: 112px;top:84px;height:63px;width:53px;background-color:#c7146d"></div><div title=" Slightly Low Agency" style="position: absolute;overflow: hidden;left: 165px;top:84px;height:63px;width:35px;background-color:#11ad11"></div><div title=" Functional" style="position: absolute;overflow: hidden;left: 112px;top:147px;height:33px;width:58px;background-color:#5da811"></div><div title=" Slightly Low Extroversion" style="position: absolute;overflow: hidden;left: 112px;top:180px;height:20px;width:58px;background-color:#990f99"></div><div title=" Low Femininity" style="position: absolute;overflow: hidden;left: 171px;top:147px;height:41px;width:18px;background-color:#8f8f0e"></div><div title=" Low Attention to Style" style="position: absolute;overflow: hidden;left: 189px;top:147px;height:41px;width:11px;background-color:#8a8a8a"></div><div title=" Low Authoritarianism" style="position: absolute;overflow: hidden;left: 171px;top:188px;height:12px;width:29px;background-color:#4a0e87"></div></div><div style="position:relative; text-align:center; width:200px;"><a href="http://www.personaldna.com">Considerate Leader</a></div>Albertas Agejevashttp://www.blogger.com/profile/09242021042711503211noreply@blogger.com0