16. 05. 2012.

lm-sensors automatic deployment, issue with sensors-detect

 
If you wish to deploy lm-sensors on multiple diferent linux machines issue is with sensors-detect what ask you quite a few questions.
 
I asked on IRC and got few suggestions. First one is if you wish to accept defaults which sensors-detect suggest you need just to press [ENTER] all the time. To automate this use this one liner:
 
(while :; do echo ""; done ) | sensors-detect
 
If you wish to override defaults and answer YES to all questions then use this oneliner:
 
yes "" | sensors-detect
 

09. 05. 2012.

Maximum wifi speed with OpenWRT? (802.11a Turbo mode aka Super A)

 
Hi, we have been testing what is the absolute maximum speed over wifi when using openwrt, for out test we used this hardware:
 
- 2 x Ubiquity Router station
- 2 x Wistron CM9 802.11a/b/g mini pci cards
- 2 x 3dBi omni antennas
 
- openwrt version – backfire 10.03.1
- wifi driver – madwifi
- distance – 2 meters (same room)
- encryption – psk2
 
For benchmarking we installed iperf package and used default settings (tcp packets in one direction).
 
First we tested “plain” 802.11a mode (hwmode 11a) on channel 40 and we got 30-35Mbit speeds.
 
Then we switched to 801.11a turbo (hwmode 11ast) and got 55-60 Mbit speeds.
 
Is this the maximum speed possible? Are there any other tweaks we can do to get faster speeds?
 
Did you get faster speeds? How? Which gear did you use? We didn’t make results artificially better by using udp packags, my guess by using udp packages we could get near 100 Mbit speeds.
 
Are there any openwrt tutorials for tweaking and benchmarking maximum speed?
 

08. 05. 2012.

rpcbind is new portmap or how to make nfs secure

I was installing NFS server on otherwise public host recently, and noticed that conventional wisdom about securing NFS server is somewhat dated. My goal was to expose NFS on two internal interfaces without exposing it to whole wide Internet (assumptions about network security changed a lot since NFS was designed, sadly).

For a start, you are probably running rpcbind instead of portmap on recent Debian installations. So you will need to modify flags which are passed to portmap on startup:

root@rsync1:~# cat /etc/default/rpcbind 
OPTIONS="-w -l -h 172.16.10.2 -h 192.168.0.219"
You will also need to add following line:
root@rsync1:~# grep rpcbind /etc/hosts.deny 
rpcbind: ALL
Now you will notice that rpcinfo -p still works OK on localhost. That's because rpcbind will always add loopback address, so we have to test it from another machine:
root@rsync1-dev:~# rpcinfo -p 192.168.0.219
rpcinfo: can't contact portmapper: RPC: Authentication error; why = Client credential too weak
That's more like it! If we take a look in log...
root@rsync1:~# tail -1 /var/log/auth.log
May  8 20:31:51 rsync1 rpcbind: connect from 192.168.0.21 to dump(): request from unauthorized host
...we don't even have to guess local system IP adress. We'll allow this host to connect with...
root@rsync1:~# grep rpcbind /etc/hosts.allow 
rpcbind: 192.168.0.21
We can also check our tcp wrappers configuration with:
root@rsync1:~# tcpdmatch rpcbind 192.168.0.21
client:   address  192.168.0.21
server:   process  rpcbind
access:   granted

02. 05. 2012.

munin migration and upgrade to v2

I always loved graphs. For my monitoring needs I'm using munin so in last few days I was migrating one installation from machine behind DSL line to co-location (virtual) server. Using old munin server, I would occasionally get e-mail alerts about unavailable services, mostly because n2n (which we use to connect to nodes) forgot about node or dropped packets because of busy DSL line. In the process, I decided to jump ahead and install version 2.0-rc5 from Debian unstable. This blog post will try to describe my journey...

I started simply by installing new munin instance in new (virtual) machine. I decided that historic data is important, so I decided to move configuration and graphs over to new instance. Simply coping rrd files over didn't went all that well and resulted in dreaded This RRD was created on another architecture error. This was unfortunate but rrd files where so large, that transfer won't fit into 5 minute munin poll interval anyway, so I had to take different approach.

To keep all historical data and not loose any munin polls while I transfer them I decided to first configure new munin node to poll all clients (so new updates will be preserved) and while this is running copy over rrd files from old server. This involved editing all nodes (9 of them!) and Cluster SSH came as perfect solution to add additional allow ^192\.168\.0\.10$ lines in /etc/munin/munin-node.conf on all nodes.

Coping rrd files had to be done using rrdtool dump/restore and it had to be done over compressed ssh link due to slow DSL line. For that, small shell script came very handy:

#!/bin/sh -x

dir=/var/lib/munin/maxxo


via_ssh="ssh -o ControlPath=/tmp/ssh_sock -o ControlMaster=auto -o Compression=yes root@10.1.3.10"

if [ ! -e /tmp/ssh_sock ] ; then
        $via_ssh read
fi

ls $dir/*.rrd | while read file
do
        echo $file
        rrdtool dump $file | $via_ssh rrdtool restore - $file --force-overwrite
done
You need to start it twice. First invocation will ask for password and open master ssh socket which next invocation will use for transfers of rrd files using compressed ssh link, without connection overhead for each file. We are talking about 4560 rrd files with total of over 250Mb, after all... Even with all this, it took hour and a half to transfer all that over, so setting up update of existing files was really required.

You might think that it's all, but unfortunately, it's not. Looking in /var/log/munin/munin-update.log I could see [FATAL] Socket read timed out to node. Terminating process.. Some of nodes required more time than default value provided by munin (30 sec) to respond with all data. It seems that ipmi plugins are notoriously snow to respond for example. To change server-side timeout, you have to pass --timeout 90 to munin-update utility. Unfortunately, in Debian you can't do that by modifying munin-cron invocation in /etc/cron.d/munin because it passes all parameters to munin-limit which doesn't have timeout option and dies on you (moral of the story: check cron e-mail while configuring cron jobs). In the end, I edited /usr/bin/munin-cron directly, changing one line:

/usr/share/munin/munin-update --timeout 90 $@ || exit 1
This will probably break with next update, but this blog post will remind me to change it again :-)

There where also a few tweaks on munin-node plugins to make them work inside kvm. iostat_ios plugin from munin-plugins-extra didn't like virtio devices which have major number 254, same as LVM2 devices which it ignores. Following patch solved this problem:

diff --git a/cs-munin/etc/munin/plugins/iostat_ios b/cs-munin/etc/munin/plugins/iostat_ios
index 1380eb1..823df63 100755
--- a/cs-munin/etc/munin/plugins/iostat_ios
+++ b/cs-munin/etc/munin/plugins/iostat_ios
@@ -101,7 +101,7 @@ sub filter {
         return 0 if ($major ==   1); # RAM devices
         return 0 if ($major ==   9); # MD devices
         return 0 if ($major ==  58); # LVM devices
-        return 0 if ($major == 254); # LVM2 devices
+        return 1 if ($major == 254); # LVM2 devices and KVM virtio
     }
     if(defined($tmpnam)) {
         return 0 if ($tmpnam =~ /part\d+$/);

ksm-day.png

I also decided to use ksm which is enabled by following line in /etc/rc.local:

echo 1 > /sys/kernel/mm/ksm/run
And of course, now I had to graph it with simple shell ksm munin plugin. Dropping sharing line on this graph makes me think that it wasn't really needed, but we'll see in few more days.

To track other kvm parameters, I used munin-libvirt-plugins which comes with it's own helper script munin-libvirt-plugins-detect which you have to run to enable plugin and generate configuration.

For a web server, I opted to use apache2 and libapache2-mod-fastcgi together with graph_strategy cgi and html_strategy cgi in /etc/munin/munin.conf mostly to save some performance on polling machine. To make it work, I had to copy /etc/munin/apache.conf into /etc/apache2/conf.d/munin and uncomment relevant fast-cgi lines inside. After that, dynamically generated html is available at http://munin.example.com/munin-cgi/ and if you ever run munin-html before, you will still get old (obsolete) html pages if you visit page directly.

Next step would probably be to get rrdcached up and running...

29. 04. 2012.

Jadni naši developeri

Oleg Von Bug u svojoj kolumni u Mreži tvrdi kako:

developerski posao, koji nam se tada činio najboljim i najpametnijim na svijetu, nije bogznašto. Spada svakako u donji segment s računalima vezanih zanimanja današnjice.

Djelomično je u pravu, nekada sam običavao tvrditi kako su developeri najveći rudari među informatičarima. Svi drugi informatičari su puno ležernije dolazili na posao jer rješavanje skoro svakog problema najprije je krenulo od developera. U velikim sistemima obično bi ih doživljavali kao potrošnu robu. Neki bi ih voljeli vrijeđati i nazivati običnim koderima.

Stvari su se malo izmijenile zadnjih godina. Ljudi sve više vremena provode na webu, sve više se bave aplikacijama na svojim mobilnim pametnjakovićima, a aplikacije za tu ciljnu skupinu pojedinci i male skupine agilnih developera mogu puno brže i efikasnije napraviti od ogromnih timova u kojima su developeri samo kotačići na koje se gleda olegovski.

Startupmanija trese svijet, ima tu napuhanih balona, ali činjenica je da je ovo zlatno vrijeme za developere. Oni mogu najbrže unovčiti svoje sposobnosti i stvoriti nove vrijednosti. Kad se pogledaju najbrže rastuće domaće informatičke tvrtke onda vidimo da su ih redom osnovali developeri, proizvod njihovog rada im je glavna roba i bez problema se probijaju na strana tržišta.

Hm, ako developerima, kao donjem segmentu, može krenuti tako dobro, gdje li je onda gornji segment? Oni su već otplovili prema zvijezdama?

Oleg na pijedestal podiže svoje znanje asemblera za 6510 procesor i zbog jednog maturalnog rada misli da može govoriti o developerskom poslu. Ne Oleže, to ne znači da si developer. Ako se nijedna tvoja aplikacija nije srela s konačnim sudom koji se zove Korisnici u produkciji onda se ne možeš nazvati developerom. Ti boluješ od sindroma i ja sam nekada programirao koji se vrlo često javlja među onima koji su se s mikroračunalima sreli osamdesetih godina i počeli su učiti programirati jer je to bila jedna od vrlo rijetkih korisnih stvari koja se je mogla raditi na njima (a trebalo je i opravdati nabavu te skupe stvarčice pred roditeljima), ali nikada nisu završili u tim vodama jer su našli lakši posao. Kako ljudi u godinama vole pametovati tako i sindromaši vole započeti priču eh kad sam ja programirao, to je bilo programiranje, a ne ovo klikanje.

Pogledaju li se trendovi plaća informatičara u SAD-u onda se može vidjeti da index za developere konstantno raste dok za administratore ili project managere variraju i ostaju isti. Prosječna plaća developera je veća nego za spomenute druge dvije kategorije. A novinar može očekivati tek trećinu plaće koju će dobiti developer.

Od pravog novinara očekujem da se posluži činjenicima umjesto što vjeruje svojem sindromu iz prošlog tisućljeća. :-)

12. 04. 2012.

Enable ad-hoc wifi networking on Android

 
Google has disabled wireless ad-hoc networking in Android from day one. Underlying Android libraries and wifi stack support adhoc networking and so far Google has provided no explanation why it still, even after four years, leaves adhoc disabled.
 
There has been huge outcry from Android users over this issue, but there is still no answer from Google Android developers.
 
There are few suggestons on xda-developers forum, and also on Stackoverflow, but most solution so far consisted of using new rom that had ad-hoc support enabled or manually messing about system config files.
 
But wait, there is an app for that!
 
There is an app called WiFi Ad Hoc enabler that should work on most Android devices.
 
If this app works for you, please give it a good review or notify developer of any issues you encounter, but consider that not all Android devices are supported yet.
 
I would be very grateful if you would vote up my answer on Stackexchange.
 
[1] https://code.google.com/p/android/issues/detail?id=82
[2] http://forum.xda-developers.com/showthread.php?t=754961
[3] http://stackoverflow.com/questions/1932150/can-android-do-peer-to-peer-ad-hoc-networking
[4] https://play.google.com/store/apps/details?id=nl.arendmedia.wifiadhocenabler
[5] http://www.arenddeboer.com/wifi-ad-hoc-enabler-for-android/
[6] http://stackoverflow.com/a/10108812/1031514

11. 04. 2012.

Kako napraviti Instagram i prodati ga Facebooku?

Oni developeri kojima je ego veći od sposobnosti će zacijelo reći da taj Instagram i nije nešto posebno i da bi to oni napravili za tjedan dana. O tome piše i Don Dodge u članku I could build Instagram in a week. Zaista, kad jednom netko nešto napravi, kad pokaže put, onda se čini da je sve tako jednostavno. Najbolja rješenja su najjednostavnija, ali malo tko će uspjeti doći do tog jednostavnog rješenja jer će biti zadovoljan onim prvim koje radi ili ne zna stvari rješavati na jednostavan način.

Ali ponekad za uspjeh čak ni tehnologija nije važna. Najbolji primjer je Twitter. Njegovi microblog konkurentni su skoro svi redom imali veće mogućnosti (Pownce je jedan od najboljih primjera), ali na strani Twittera je bila sreća i okolnosti koje su se poklopile baš u tom određenom trenutku.

Karakteristično i za Twitter i za Instagram je da rade samo jednu stvar dovoljno dobro i dovoljno jednostavno. Twitter je čak doslovno primjenio Unix filozofiju koja kaže:

Write programs that do one thing and do it well. Write programs to work together. Write programs to handle text streams, because that is a universal interface.

Instagram je napravio to isto, ali umjesto teksta omogućio je ljudima jednostavno izražavanje uz pomoć slika.

Ono što Don ne spominje u članku, a što smatram glavnim tajnim sastojkom koji je omogućio uspjeh spomenutih servisa je ograničenje. Twitter je ograničio poruku na 140 znakova i natjerao korisnike da se izražavaju jasno i precizno. Ta preciznost nije bila važna u prvo vrijeme kad su korisnici pisali što sada radim (neki još uvijek koriste Twitter na taj način) već kad su počeli pisati što se događa. Da je Twitter ukinuo to ograničenje i korisnicima dozvolio duže poruke ubrzo bi izgubio svoj smisao.

Osim ograničenja na broj filtera Instagram je korisnike ograničio formatom. Slika može biti bilo kojeg oblika sve dok želite da je u obliku kvadrata. Neki drugi slični servisi omogućuju rezanje slike na različite načine, stotine filtera i još puno raznih iživljavanja na slikama. Prekomplicirano. Korisnika treba ograničiti. Treba mu omogućiti da radi samo jednu stvar i ništa više od toga. Naravno da to nije primjenljivo na sve aplikacije, ali za slučaj kad imate hrpu korisnika pokazalo se kao dobar recept.

Klasična greška kod developera je da zanemaruju potrebe korisnika i njihovo mišljenje. Kod izrade aplikacije često mjere prema sebi, a ne prema korisniku. I još su skloni postavljati ograničenja koje im uvjetuje njihovo poznavanje neke tehnologije. Ako radite servis za korisnike onda oni moraju biti mjera. Mogu mogućnosti nekog grida biti fantastične, ali ako on ne ispunjava korisnikova očekivanja onda ste promašili s njim. Treba prepoznati pravu korisničku želju i ispuniti ju. Flickr je u početku bio alat za MMOG, a onda je započeo svoju evoluciju u današnji oblik.

Važno pravilo je i da nema pravila. Ne dozvolite da vas obeshrabre zbog toga jer takva aplikacija već postoji, zbog toga jer imate loš poslovni model ili nemate poslovni plan na više od 100 stranica. Važnije je da doslovno ne kopirate postojeća rješenje već pokušajte biti bolji ili barem drugačiji i jednostavniji. I oku ugodni i upotrebljivi. Nije loša taktika da nađete neki servis koji je dobar, rješava određeni problem, ali je prekompliciran za upotrebu. Napravite lakšu inačicu tog servisa, s manje mogućnosti, ali upotrebljiviju, intuitivniju (Pinterest je zapravo image bookmarking servis kakvih ima na bacanje, ali pogodio je zlatnu žicu). Ovo je vrijeme kad se traži jednostavnost. Zašto Microsoft uvodi Metro sučelje? Zašto Mark gura Unity u Ubuntu? Apple je oduvijek težio tome. Ljudi ne žele brdo mogućnosti koje neće koristiti. Žele jednostavne alate za pojedine poslove.

P.S. Don kaže da Instagram Facebooku vrijedi milijardu dolara. Ja se ne bih složio s njime. Facebook je debelo preplatio Instagram. Vrijeme će to sigurno pokazati.

02. 04. 2012.

When to do git merging or rebasing

This one pops up fairly often, and can indeed be quite confusing – when to use merge versus rebase in git? Here’s the answer.

The story so far …

In merge, you combine two divergent branches back into one. There’s also a special kind of merge called fast-forward, done when a branch being merged is just a continuation of the branch you’re merging into – so the new commits are just pasted on top of the target branch (ie. it is “fast-forwarded”).

In rebase, you change your branch (that’s being rebased) so it looks like it was branched off a new base, not the original one. This involves rewriting the commits, so you’ll end up with different commit IDs.

… and now the conclusion

So, when to use either? The rules are suprisingly simple:

Never rebase public branches

By “public branches” here I mean branches that other people might have checked out. Rebasing rewrites history, and anyone having branches that were checked out of the history you just unmade will be sad, angry or worse. That’s one reason you can’t just push rebased branch on GitHub (unless you force it and sacrifice a kitten). So just say no.

Rebasing private branches is perfectly fine, and in fact often done when squashing or rearranging commits, cleaning up a branch before going public with it, or just updating long-running feature branch (go easy on the last one, though).

Never merge upstream master into your master

By “merge” here I mean a recursive (non-fast-forward) merge, ie. the one that leaves tracks. And the rule is not only for master, but for any upstream tracked branch you may want to merge back into one day.

As a rule of thumb, fork master should always be in sync with upstream master (ie. only do fast forward merges/pulls), only having the commits that are in upstream already. Also, you should never have to merge master (local or remote) into a feature branch. If you need to update an existing feature branch, rebase it rather than merging into int.

Updating public feature branches

What to do if your public branch needs to be updated from upstream? You can’t rebase it since it’s public, and you can’t merge into it since you’ll want to merge it back some day.

Turns out it’s really simple: create a fresh one off of upstream, merge your branch into it, and continue working on a new one.

(This was originally a comment on the How To GitHub: A Complete Guide to Forking, Branching, Squashing and Pulls article Hacker News discussion. The article itself and the ensuing discussions are full of useful advice – if you haven’t already, go read them!).

27. 03. 2012.

Vook - da li je lako napraviti e-knjigu?!

Vook je servis koji bi vam trebao omogućiti jednostavno uređivanje i izdavanje elektroničkih knjiga. Jučer su svoj servis otvorili javnosti pa možete i sami isprobati kako je lako urediti vlastitu knjigu koristeći samo web preglednik. Najveći problem na tom putu je sadržaj, ali to je za neke pisce zanemariva sitnica. Iznos pretplate na njihov servis i nije tako zanemariv, da li je to opravdana investicija?!

Uređivanje je besplatno, a potreba za pretplatom počinje u trenutku kad želite objaviti svoj uradak. Ali sumnjam da će broj onih koji će doći do tog koraka biti dovoljan da opravda bombastične najave kao što su a game-changer, Call it iBooks Author without the marriage to Apple ili Could Vook (and similar ventures) be about to disrupt an entire industry?. Autori tih izjava sigurno nisu pokušali koristiti Vook.

Početak i ne izgleda tako loše, naslov, dodavanje poglavlja. Možete odabrati 4 osnovna stila koji pristojno izgledaju. Nisam se želio izložiti avanturi podizanja neke .doc (hm, na listi podržanih formata nema .rtf-a) datoteke već sam krenuo s prenošenje tekstova u Content editor. Tu su već počeli prvi problemi, editor se počeo svojeglavo ponašati, pa sam malo zavirio u kod. To nije ništa drugo nego CKEditor. Pokušao sam s ubacivanjem slike pa mi je mala slika od 200×150 točkica završila razvučena preko cijele stranice. Nema kontrole za rastezanje slika već morate ručno unositi dimenzije. Sučelje CKEditora je možda dobro za unošenje tekstova za web, ali kad trebate urediti veću količinu teksta nije niti praktičan ni upotrebljiv. Izgleda da se spomenuta jednostavnost odnosi na posao developera i implementaciju editora, a ne na rad s njim.

Nakon što sam unio par tekstova odlučio sam pogledati na što to liči. Odabrao sam generiranje ePub-a i dobiveni dokument pogledao u EPUBReaderu (dodatak za Firefox, bolji mi radi od FBREadera). Neki razmaci su se izgubili pa je tekst izgledao ružnije, prepoznao je samo prva dva podnaslova kod prikaza sadržaja, a ostali su zanemareni. Kako je ePub predviđen za e-čitače isprobao sam dokument na Pandigital Novel readeru (Android OS). Aldiko se mučio i prikazao samo naslovnu stranicu, AReader nije uspio učitati dokument, a Moon+ Reader se pokazao kao najbolji. No i on je prepoznao samo prva dva podnaslova, ali tekst se poprilično raspao i moj prvi pokušaj nije bio previše čitljiv. Eh da, ako vam netko kaže da je AReader najbolji ePub čitač na Androidu (a ta priča se širi) možete mu reći da nije u pravu i preporučiti Moon+ Reader.

I bez posebnih ePub validatora jasno je da Vook generira jako loš ePub dokument s dosta grešaka. To je glavni razlog zbog kojeg ne bi preporučio njegovo korištenje. Ima daleko boljih alata koji generiraju ispravne dokumente. Čak i dodatak za calibre koji iz rss-a stvara ePub radi to daleko bolje i točnije.

Vook nije opravdao ni moja minimalna očekivanja. Ako baš morate, probajte ga. Da vidite kako se to ne radi. Nije isključeno da će neki mazohisti napraviti nešto s njim. Ali bez puno peglanja to neće ići…

04. 03. 2012.

Infrastructure you can blog about

I spent last 5 months planning and building new infrastructure for one of the biggest websites out there. I was working around the clock while developers were rewriting the site, throwing away an ancient code base and replacing it with a modern framework. I found no new interesting topics to write about in that time being completely focused on the project, while the RSS feed of this journal was constantly the most requested resource on the web server. I'm sorry there was nothing new for you there. But I learned some valuable lessons during the project, and they might be interesting enough to write about. Everything I learned about Puppet, which was also a part of this project, I shared in my previous entry. I'll focus on other parts of the cluster this time.

Here's a somewhat simplified representation of the cluster:
Network diagram



Following the traffic path first thing you may ask your self is "why is Varnish Cache behind HAproxy?". Indeed placing it in front in order to serve as many clients as soon as possible is logical. Varnish Cache is good software, but often unstable (developers are very quick to fix bugs given a proper bug report, I must say). Varnish Cache plugins (so called vmods) are even more unstable, crashing varnish often and degrading cache efficiency. This is why HAproxy is imperative in front, to route around crashed instances. But it's the same old HAproxy that has proven it self balancing numerous high availability setups. Also, Varnish Cache as a load balancer is a nice try, but I won't be using it as such any time soon. Another thing you may ask is "how is Varnish Cache logging requests to Syslog when it has no Syslog support?". I found FIFOs work good enough - and remember traffic is enormous, so that says a lot.

Though with a more mature threaded implementation I can't see my self using Rsyslog over syslog-ng on big log servers in the near future. Hopefully threaded syslog-ng only gets better, resolving this dilemma for me for all times. Configuration of rsyslog feels awkward (though admittedly syslog-ng is not a joy to configure either). Version packaged in Debian stable has bugs, one of which made it impossible to apply different templates to different network sources. Which is a huge problem when it's going to be around for years. I had to resort to packaging my own, but ultimately dropped it completely for non threaded syslog-ng which is working pretty good.

Last thing worth sharing are Redis experiences. It's really good software (ie. as alternative to Memcached) but ultimately I feel disappointed with the replication implementation. Replication, with persistence engines in use, and with databases over 25GB in size is a nightmare to administrate. When a slave (re)connects to a master it initiates a SYNC which triggers a SAVE on the master, and a full resync is performed. This is an extremely expensive operation, and makes cluster wide automatic fail-over to a backup master very hard to implement right. I've also experienced AOF corruption which could not be detected by redis-check-aof. This makes BGREWRITEAOF jobs critical to execute regularly, but with big databases this is another extremely expensive operation, especially if performed under traffic. The following has proven it self as a best solution for high performing Redis servers; 4x147GB 15k SAS disks in (h/w) RAID10, and Xeon 5000 series CPUs.

While working on this the running joke was I'm building infrastructure you can blog about (but otherwise do little else with it). But it does do a little more than just look impressive on paper.

01. 03. 2012.

Read two-column pdf files on Kindle

I really like Kindle because it allows me to run my own selection of software on it. However, when I try to persuade other Kindle owners in all the benefits of running custom software, I usually get response like: but it already does everything I need. That might be true, but that's only because you never tried to read two column article on Kindle...

Fortunately, we have alternative pdf reader for Kindle based on muPDF library which is mostly written in lua. This is especially nice since it allowed me to add support for reading two-column pdf layouts which you can see in following video:

Basically, you press F to switch to new layout and then use fiveway buttons to move down the column, or right to move to top of next column, with page change if needed. If you move to left, you will be positioned to bottom of previous column which is useful if you want to read again last thing.

If you like this feature, liberate your kindle and download latest version of pdf reader, drop it in /mnt/us/customupdates and press Shift Shift I to install it from louchpad. Then press Shift P D to start it. Wiki pages of project describe all available shortcuts and there is active thread on mobileread forum.

16. 02. 2012.

HTML input placeholder handling with jQuery

There’s a million of small jQuery snippets which handle input placeholders (ie. the help/explanation text that’s shown until you actually write something in the field), and when HTML5 gets widespread, they’ll all be obsoleted.

But nevertheless, here’s another one.

this post is more for self reference, but if it’s useful to you, be my guest.

10. 02. 2012.

Printing from Koha to Zebra printers on local Windows machine

zebra S4m.jpg As you know by now, I'm somewhat biased towards pixel-exact printing on strange printers. This time around, I was tasked with requirement to make Koha print bar-code labels from web interface on Zebra S4M printers which are locally connected to Windows clients over USB.

At first sight, this seems like an easy task. Zebra printers are supported under CUPS on Linux and OSX, so there shouldn't be any problems, right? For a start I found out that CUPS driver doesn't work well, mostly because it's older that Windows version of driver, and doesn't seem to send all ZPL codes required to print label.
To make thing even worse, since printer is connected locally to Windows machine, it presents itself as Windows GDI printer which doesn't want to print ZPL (printer protocol) directly without wrapping ZPL in magic quotes and enabling it in Windows.

On the other side, Koha tries to print labels using normal print dialog in Windows. This won't work well, because we (again) need pixel exact label as opposed to web page randomly scaled to printer label. To make this worse, client Windows machines are behind firewall, so I can't send label to IP address of client because all I can see in request is IP address of our firewall.

To solve all this problem I decided to deploy following setup:

Since I couldn't use CUPS to produce ZPL for printer, I wrote Printer-Zebra which can convert pbm and pnm formats (easily created from png label using pgntopnm). Even better, it also includes script which can render ZPL printer output back to pbm bitmap which is the only good way to verify that your solution doesn't anti-alias bar-codes or does something similar to reduce print quality on back and white printers. Rasterizer was also very useful when tracking differences between Windows driver output (gathered by printing to File on Windows) and CUPS one.

09. 02. 2012.

Snježni wifi kraljevi

Od danas Hrvatska uz natjecanje Snježna kraljica ima još jedno novo natjecanje a to su Snježni wifi kraljevi ;)
 
U natjecanju mogu sudjelovati svi zainteresirani, cilj je u što ekstremnijim uvjetima postaviti što više nove wifi opreme na krovove zgrada. Pravila su jednostavna a nagrade neprocjenjive.
 
Pogledajte kako je bilo u Osijeku prvom timi iz ekipe OsijekWirelessa koji su se okušali u ovome novome sportu na ovome online albumu.

 

@VladaRH: Što nam je važnije od otvorenog koda?

Danas se održava #VladaUP, otvoreni razgovor o planovima i projektima Vlade RH u razvoju informatizacije i digitalnog društva. Nastupom na društvenim mrežama Vlada je dobila simpatije njihovih članova, ali meni se čini da je taj nastup organiziran upravo zbog stjecanja tih simpatija, a ne zbog toga što će neki ministar poslušati što govori neki tviteraš. Predsjednik Vlade ne smatra potrebnim poznavati ljude iz trećeg ešalona, zar mislite da će do vašeg mišljenja držati?!

U hvatanju simpatija Vladin e-tim naglašava ono što bi se ciljanoj publici moglo svidjeti. Tako je brojač simpatija skočio kada je spomenuto da će se uvoditi otvoreni kod gdje god je to moguće. Program Vlade RH za mandat 2011.-2015. spominje otvoreni kod, ali već u slijedećoj rečenici rade grešku u koracima i spominju besplatni softver. Ako im nije jasno zbog čega se ne može staviti znak jednakosti između otvorenog koda i besplatnog softvera onda sumnjam u tu njihovu strategiju. Na kraju će se sve svesti na poneki novi CMS, možda na zamjenu Microsoft Office paketa LibreOfficeom, ali samo niže rangiranim činovnicima…

Još jedan problem s terminologijom koju kao papagaji ponavljaju naši političari je transparentnost. U spomenutom planu se ona ponavlja daleko više nego riječ otvoreno. Zašto umjesto transparentan ne upotrebljavaju riječ providan? Kad govore o transparentnosti ja zamišljam stakleni izlog u kojem možemo vidjeti ono što nam političari žele prikazati, ali ne možemo ništa s time. Niti pobliže pogledati, niti uzeti u ruke, niti obraditi… Možete to slikati mobitelom, ali pitanje je koliko će se na toj slici vidjeti?! Volio bih da se više koristi riječ otvoreno i sve ono što ona sa sobom nosi.

I tu dolazimo do onoga što je puno važnije od otvorenog koda, a to su otvoreni podaci. Vladi predlažem da u svoj plan pod hitno ubace usvajanje 8 načela otvorenih, javnih podataka. Sve što bi napravili s IT-em pada u vodu, ako podaci opet ne bi bilo javno i lako dostupni.

Načela otvorenih, javnih podataka

  1. Cjelovitost - svi podaci su javno dostupni
  2. Izvornost - podaci se prikupljaju na mjestu gdje nastaju, moraju biti što detaljniji, u neizmijenjenom obliku
  3. Pravovremenost - podaci su dostupni što je prije moguće kako bi se očuvala vrijednost podataka
  4. Dostupnost - dostupnost podataka se mora omogućiti što širem krugu korisnika za što širu primjenu
  5. Mogućnost automatske obrade - podaci moraju biti strukturirani na način da je automatska obrada uz pomoć računala moguća na što jednostavniji način
  6. Bez diskriminacije - podaci su dostupni svima, bez potrebe za bilo kakvom registracijom
  7. Slobodni formati - podaci su dostupni u slobodnim formatima na kojima nijedan entitet nema isključivu kontrolu
  8. Bez licence - podaci ne smiju podlijegati nikakvim autorskim pravima, patentima i ne smiju biti zaštićeni zaštitnim znakom ili poslovnom tajnom. Umjerene mjere privatnosti, sigurnosti i privilegije mogu biti dozvoljeno ukoliko je to opravdano prirodom samih podataka.

Najbolji primjer gdje se krši velika većina ovih načela je Elektronički oglasnik javne nabave. Podatke možete slobodno gledati u On-line popisu objava, ali možete zaboraviti na neku napredniju pretragu (za to može poslužiti Vjetrenjača). Popis objava je iz nepoznatih razloga ograničen na zadnje dvije godine. Što ako je sklopljen okvirni sporazum koji se može sklopiti na razdoblje od četiri godine (a iznimno i duže)? Onda imamo važeći sporazum koji više nije javno dostupan. Sumnjam da je to ograničenje tehničke prirode, prije će biti da je to politička odluka. Kod javne nabave otvaranje ponuda je javno. Bilo bi puno otvorenije kad bi elektronički oglasnik omogućio uvid u ponude koje nisu prihvaćene. To bi mogućnost manipulacije ipak donekle smanjilo.

Pitanja za #VladaUP:

  1. Imaju li u planu donošenje ovih ili jako sličnih načela?
  2. Hoće li ukinuti postojeća ograničenja na Elektroničkom oglasniku javne nabave i objaviti cjelovite podatke?

07. 02. 2012.

Nook Color as Android tablet

nook-ics.jpg For a last month or so I used Barnes & Noble Nook Color as Android tablet. This post will try to explain what is wrong with Android tablets and now to fix this.

For a start, original Android distribution on Nook doesn't make it really Android tablet (no market). But there is easy solution since this device is supported by CynanogenMod 7 for Nook Color to get proper Android distribution. So, let's get started with hints for easier life with your new tablet...

adb doesn't see Nook Color

For a start, you won't see Nook in adb devices listing. This is easily fixed with proper device id in ~/.android/adb_usb.ini like this:

dpavlin@t61p:~/.android$ echo 0x2080 > ~/.android/adb_usb.ini && adb kill-server && adb devices
* daemon not running. starting it now on port 5037 *
* daemon started successfully *
List of devices attached 
2011120012345678        device

Nook Color specific application

There are lot of application which will look quite broken on your Nook when running Android 2.3. Some of them require audio input, GPS or camera and they generally won't work. There is also problem with application which just don't know about wired 1024*600 screen size and produce strange small screen centered on big display.

However, this is just a list of few extremely useful apps which you should install on Nook with CM7:

Once you install all of this, you will be painfully aware that Android 2.3 just isn't OS which works well on tables. So, let's try to see what Google has in source for tablets...

Ice Cream Sandwich

To get most out of Android on tablet, you have to hop over to CM9/ICS Nightly Builds and install unstable builds on ICS on Nook Color. After initial install reboot into recovery, flash Google Applications from gapps-ics-4.0.3-sam-noinit.zip, turn off signature verification and install fix-bootanimation.zip and telephony-permission-fix.zip. Unfortunately browser application doesn't work for me well, and usually segfaults with:

F/libc    ( 2878): Fatal signal 11 (SIGSEGV) at 0x0000001f (code=1)
I/DEBUG   ( 1072): *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
I/DEBUG   ( 1072): Build fingerprint: 'bn/bn_encore/encore:2.3.4/IML74K/228551:user/release-keys'
I/DEBUG   ( 1072): pid: 2878, tid: 2895  >>> com.android.browser 

ICS on Nook currently doesn't have hardware acceleration (but older Androids also doesn't have it) and it freezes from time to time (so you will get quite used to holding power button for 8 seconds or more to turn it off), but ICS is really so much better experience on tablet that I would really recommend it.

Finally a note about hardware performance: Nook Color has 512Mb of RAM and Ti OMAP 3621 @ 800 MHz which makes it probably a bit slow for ICS. As o consequence I wouldn't really recommend any Android laptops which are slower than this for ICS.

Update 2012-02-07: There is also CyanogenMod Kang build with OpenGL enabled which works very well. In fact, so well that it fixes problem in Hacker's keyboard :-)

Meteo wifi mesh točke

 
Krenula je zanimljiva rasprava na CWN (Croatian Wireless Networks) google grupi o Meteo stanicama. Prenosim svoj dio rasprave i pošto vjerujem da će ova tema biti biti zanimljiva i široj geek publici ;)

Ako nekoga zanima i pristup CWN grupi samo se treba javiti i dobije pozivnicu.
 

>
> @Valent: što to točno radite? nisam upućen
 

Za prave profi i manje profi vremenske stanice je definitivno najupućenija Istramet ekipa [1] pošto su oni napravili po Istri čitavo čudo meteo stanica i bolje prognoze imaju od DHMZ-a ;) Bili su i na tv-u [2]. Vjerujem da oni najbojle znaju koje stanice valjaju i koje ne, ovisno o kvaliteti i uvjetima u kojima trebaju raditi.
 
Ono što se radi preko projekta sa ekipom iz Wlan-Slovenije je da se od malih tp-link routera naprave senzorske stanice za sve tipove podataka, pa tako i za meteo podatke [3] ali i za razne druge tipove podataka. Evo kako to može lijepo izgledati [4].
 
Bila je i super usporedba 5 meteo stanica u emisiji Gadget Show u rangu 1000-2000 kn [5] ali emisiju mozes pogledati online jedino ako imas vpn do engleske ;( ali našao sam i komentare na tu emisiju na nekom forumu [6]
 
Po meni najbolje uzeti tp-link wr741 i na njega staviti DS18B20+ senzore kao što to radi ekipa iz Wlan-Slovenije [7] i za par sto kuna imaš online meteo stanicu. Mi smo sada naručili 10 senzore i krećemo u
izradu pločice za 1-wire sabirnicu, tako da ćemo uskoro u Osijeku imati 10-ak meteo wifi mesh stanica.
 
Pozivam i sve ostale da se uključe i u svoja mjesta postave mesh meteo nodove… sada dok je snijeg vani je pravo vrijeme, kada se okopni sve treba biti spremno samo za nakačiti na zidove i krovove ;)
 

Ako vas zanima više projekt Otvorena mreža možete pročitati članak [8]. Svi novi sudionici na ovome međunarodnome projektu su dobrodošli, ako ste u Slavoniji i Baranji samo se meni javite ili pokrenite ogranak ovog projekta i u svome mjestu ili kvartu ako je veći grad u pitanju. Za sva dodatna pitanja stojim vam na raspolaganju.
 

[1] http://www.istramet.com/
[2] http://mojtv.hr/video/v/aTfOKdSGduE/istramet-u-dnevniku-nove-tv.aspx
[3] http://dev.wlan-si.net/wiki/Modifications/SimpleThermometer
[4] https://nodes.wlan-si.net/node/kozolectest/
[5] http://fwd.channel5.com/gadget-show/videos/jon-test/jon-test-weather-stations
[6] http://www.hardytropicals.co.uk/forum/viewtopic.php?f=1&t=8456
[7] http://dev.wlan-si.net/wiki/Modifications/SimpleThermometer
[8] http://kernelreloaded.blog385.com/index.php/archives/projekt-otvorena-mreza/

25. 01. 2012.

28C3: recommended watching

28c3.png

Each year, we get a treat right before end of the year in form of 28C3. This year, I can recommend following lectures as a must-see:

20. 01. 2012.

Joj, knjiga…

U školskog izdavaštvu leže veliki novci. Tako je kod nas, a tako je i u ostalim dijelovima svijeta. Zato ne čudi da je Apple odlučio posegnuti tamo gdje novaca ima. iBooks 2 za iPad omogućava čitanje knjiga koje možete na jednostavan način napraviti s iBooks Author aplikacijom koja želi raditi samo na OS X Lionu. Knjige možete čitati samo na jednom uređaju jer je format zatvoren. Želite li knjigu dijeliti besplatno to možete učiniti, ali prodaja ide samo preko Apple dućana. Problem s prvim mačićima je i taj što su preveliki. 2 poglavlja knjige ‘Life on Earth’ teže nešto manje od 1GB. Apple je odredio limit od 2GB za jednu knjigu, ali pojedini partneri mogu ići do granice od 3GB. Na najmanji model iPada (16GB) moći će se smjestiti tek 6-7 knjiga. To nisu ni sve knjige za jednu školsku godinu.

Činilo mi se logičnim da će svojom remetljivom akcijom Apple najprije ciljati na studente, ali izgleda da on sa svojim partnerima najprije ide na srednje škole. Čak ni u SAD-u ne mogu svi si učenici priuštiti iPad. Valjda je toj odluci presudila činjenica da su knjige za srednju školu jednostavnije i slikovitije?! Jedna infografika pita se da li će Apple spasiti obrazovanje?! Spominje se i istraživanje koje je pokazalo da su učenici koji su imali iPad bolje napredovali u čitanju i pisanju od onih koji ga nisu imali. Ne treba raditi istraživanja da bi se pokazalo kako jedan takav uređaj može djelovati i na suprotan način, da mogućnosti zabave s njim odvuku učenike od učenja.

Na Jabučnjaku su predložili da Hrvatska sve udžbenike digitalizira, tj. pretvori u Appleov format. Kao da nitko do sada nije omogućio izradu elektroničkih knjiga?! Imamo otvoreni epub format, imamo aplikacije za izradu knjiga (Sigil) za taj format, kao i alate (epub-tools) i libove (python-epub-builder) s kojima je moguće vrlo brzo konvertirati knjige iz tekstualnog ili html formata u epub. Da sad ne spominjemo LaTeX. ;-)

Nije baš da smo trebali čekati Apple i njegovu aplikaciju za digitalizaciju udžbenika. Mogli smo to napraviti i puno prije, a udžbenici su mogli biti dostupni u nekoliko različitih formata na način kako je to napravljeno na archive.org stranicama (npr. Hrvatska povijest Ferde Šišića).

Apple u ovom slučaju i nije toliko revolucionaran. Kažu ljudi da je Inkling po mnogo čemu napredniji. Nazivati jučerašnji dan najznačajnijim danom u povijesti izdavaštva zaista mogu samo najveći Apple fanovi.

Mogućnost jednostavnog izdavanja knjiga će stvoriti brdo smeća. Svi i njegov pas će pokušati napraviti knjigu i sanjati kako će svojim uratkom pokoriti svijet. Jasno je da će ta masa iznjedriti i kvalitetne naslove, ali do tada će proći dosta vremena. U prvom valu najvjerojatnije će se pojaviti knjige koje će konkurirati onome što već nudi TouchyBooks. Ali da ste kojim slučajem izdavač da li bi odabrali samo jednu platformu ili bi se radije odlučili za više njih? iPad je zahvatio veliki tržišni udio, ali on se svakim danom smanjuje. Tableti trebaju imati pristupačnije cijene, svaki učenik bi trebao imati svoj tablet i nositi ga u školu umjesto teških školskih knjiga. Apple sa svojim cijenama i zatvorenim rješenjima nije rješenje za osnovno obrazovanje.

13. 01. 2012.

WordPress post subject name in title (Rhianna theme)

 
Kernelreloaded uses Rihanna WordPress theme by Kineda, and I really love it.
 
One thing I still didn’t change from default is the was it displays posts. Currently no matter which page you are on title doesn’t change, and if you bookmark it you will get only blog name not the post name in the title :(
 
I checked the source of the theme and found the culprit in header.php and the default code is:
title ?php bloginfo('name'); ? /title
 
Because of some protections you can’t see full code on my blog, but check out examples at wordpress wp_title blog and how to change it.
 

21. 12. 2011.

batman-adv layer 2 mesh ad-hoc network at NSND Moravice 2011

NSND2011Moravicewifi.png

We had another gathering called Nothing will happen in Moravice, and this time we wanted to be prepared for it. So we got 2 WRT and 2 TP-Link devices with good faith that we will have stable Internet there. However, our telecom provider decided to screw up our order to increase bandwidth from 4Mbit/s to 10Mbit/s for event and instead decided to downgrade our access to 512Kbit/s. So we opted to create following simple network architecture which involved multiple hops to alternative 4Mbit/s upstream and batman-adv mesh setup.

batman-adv is quite cool layer-2 mash network which operates in ad-hoc mode and allows adaptive routing over mash and multiple upstream providers (at DHCP request or renew time, so we made our DHCP lease time down to 5 minutes). Joining network is quite simple:

iwconfig wlan0 mode ad-hoc essid nsnd-batman
ifconfig wlan0 mtu 1528
modprobe batman_adv
batctl if add wlan0

ifconfig wlan0 up
ifconfig bat0 up
dhclient bat0
This will bring any laptop with ad-hoc support (and not all of them have it), and relatively recent kernel (2.6.32 from Debian stable is a bit too old - batman-adv got included in 2.6.33 kernel) up and running on mash network.

My own experience with this experiment is very positive, mostly because we had around 5 clients in mash at any time, compared with overloaded WRTs which handled rest of 40 wifi enabled devices. But, I hope that during next event more people will upgrade to 2.6.33 or newer kernels, so we can have even better mash connectivity.

20. 12. 2011.

Android Samsung Galaxy S2 vs Apple Iphone 4S TCO

 
I have 2 year old smart phone (iPhone 3GS) and mine 2 year contract is almost over, so I’, looking at my options for upgrade for next two years.
 
I really like playing with gadgets but I’m also cost concious, so I’m looking at TCO (total cost of ownership) of my next device.
 
I’m not willing to pay over 200 kn (36$ or 27€) per month for my contract, so these are my options:
 
Samsung Galaxy S2:
T-Mobile with 150 kn contract – handset 2298 kn + 2 year TCO = 5898 kn
VIP with 200 kn contract – handset 1999 kn + 2 year TCO = 6799 kn
 
Apple Iphone 4S 16GB:
T-Mobile with 150 kn contract – handset 1998 kn + 2 year TCO = 5598 kn
VIP with 200 kn contract – handset 1699 kn + 2 year TCO = 6499 kn
 
Maybe our legislative should make it mandatory for everybody to show TCO prices because that is what we pay for.
 

03. 12. 2011.

Liberate your Kindle 3 and get full-screen terminal!

kindle-k3g-myts-6.jpg

As you might know by now, I'm very happy user of Kindle 3 (keyboard) and Kindle DX graphite. One of reasons why I choose those devices was community around Kindle Developer's Corner at mobileread forum. With new generation of Amazon's Kindle device on the way, let me stress that for me older Kindle 3 devices are more interesting since we still don't have the way to run home-brew software on newer Kindle 4.

One of the good things about next generation of Kindles is that older models get sold second-hand at reasonable price, and let me re-iterate: for around 100€ older Kindle 3 with keyboard are great devices. But what would you do with one when you get your hands on? Start a k3libre project to develop and document free libre command-line tools for Kindle development. It's very much work in progress, with useful example scripts which describe framebuffer format, but also a handy step-by-step instruction on how to liberate your Kindle by installing jailbreak and usbnetwork to get root ssh access over usb cable. Next step is launchpad which listens on /dev/input/input? and allows you to bind execution of programs on key-presses. We are doing all this to install to nice full-screen Kindle terminal. You can do most of this work in under an hour, so there is no excuse not to read man pages on your Kindle!

So now that you can run your own software on Kindle, with which would you like to start? I would suggest kindlepdfviewer - a PDF viewer made for e-ink framebuffer devices, using muPDF. It's implemented in lua, so adding new features are rather easy, and latest development include serialization of state into SQLite database and drawing characters on screen! OK, it's in early stage of developments, but already useful on real Kindle, and if you don't like something you can always just edit lua code a bit :-)

26. 11. 2011.

Auto-passing locals to render() in Django

Django 1.3 brought a new template rendering shortcut, render(), which takes care of instantiating RequestContext and passing it to the template renderer.

A pattern in Django views I really like is just passing all the locals to the template. This avoids needless repetition in defining what gets passed to the template. It also keeps me from having views that are too complicated, since I want to minimise the pollution of template context with unneccessary/unrelated variables.

Most of my Django views now end like:

    return render(request, template_name, locals())

Could this be further simplified? Turns out it can, since Python is a dynamic language with pretty good support for introspection. It’s possible for a function to get a reference of the caller’s stack frame which contains their locals. So, we can devise a magical function that would pull locals from the parent’s stack.

Here it is (gist):

  import django.shortcuts
  import inspect

  def renderlocals(template):
      locals = inspect.stack()[1][0].f_locals
      request = locals.get('request')
      return django.shortcuts.render(request, template, locals)

Using renderlocals(), the above usage pattern boils down to:

    return renderlocals(template)

Since I’m always naming my request variable request, renderlocals() can make the assumption it’s called like that, so no need to pass it in manually. Although I could do the same with template name, I usually pass a string directly, so there’s no benefit there.

Would I actually use it throughout my code? I’m not sure about that. It’s a bit shorter, but it’s also magical (in the negative sense) and makes assumptions about the calling code, which might make it more of a problem than benefit in the long run.

But it was a fun thing to do :)

17. 11. 2011.

Python Meet #3

Evo nam još jednog okupljanja Pythonaša i onih koji bi to željeli postati. Python meet #3 će se održati u ponedjeljak, 21. 11. 2011., u KSET-u, Unska 3.

Predgrupa (poznata britanska komičarska grupa) kreće s nastupom u 16 sati, dok će sam meet započeti u 18 sati.

Više informacija o meetu pročitajte na KSET-ovim stranicama.

Vidimo se u ponjedjeljak!

07. 11. 2011.

Info Restart 2011

Ove godine Zagrebački Velesajam pokušat će uskrisiti nekoć sjajan, a u zadnjih par godina umrtvljen, sajam Info. Pod nazivom Info Restart, projekt će se fokusirati na domaću pamet, a ne na kopiranje vijesti o svjetskim trendovima koje su bile aktualne pred 6 mjeseci. Velikim dijelom za restart je zaslužan Radoslav Dejanović (kojeg, vjerujem, domaćoj open source zajednici ne treba predstavljati :).

Mislim da sajam, kako je ove godine koncipiran, ima dosta potencijala. Zato i sam sudjelujem sa svojom tvrtkom Dobar Kod – tamo ćemo se predstaviti na svom štandu, održati i dva predavanja i popričati sa potencijalnim klijentima ali i zaposlenicima :)

Info traje od srijede do subote (dakle nešto kraće nego Interliber), upad je besplatan, bit će hrpa zanimljivih ljudi koji rade totalno kul stvari, mislim da stvar nikako ne biste smjeli propustiti.

Vidimo se na Infu!

05. 11. 2011.

Pulling strings

After one year of managing a network of 10 servers with Cfengine I'm currently building two clusters of 50 servers with Puppet (which I'm using for the first time), and have various notes to share. With my experience I had a feeling Cfengine just isn't right for this project, and didn't consider it seriously. These servers are all running Debian GNU/Linux and Puppet felt natural because of the good Debian integration, and the number of users whom also produced a lot of resources. Chef was out of the picture soon because of the scary architecture; CouchDB, Solr and RabbitMQ... coming from Cfengine this seemed like a bad joke. You probably need to hire a Ruby developer when it breaks. Puppet is somewhat better in this regard.

Puppet master needs Ruby, and has a built-in file server using WEBrick. My first disappointment with Puppet was WEBrick. Though PuppetLabs claim you can scale it up to 20 servers, that proved way off, the built-in server has problems serving as little as 5 agents/servers, and you get to see many dropped connections and failed catalog transfers. I was forced to switch to Mongrel and Nginx as frontend very early in the project, on both clusters. This method works much better (even though Apache+Passenger is the recommended method now from PuppetLabs), and it's not a huge complication compared to WEBrick (and Cfengine which doesn't make you jump through any hoops). Part of the reason for this failure is my pull interval, which is 5 minutes with a random sleep time of up to 3 minutes to avoid harmonics (which is still a high occurrence with these intervals and WEBrick fails miserably). In production a customer can not wait on 30/45 minute pull intervals to get his IP address whitelisted for a service, or some other mundane task, it must happen within 10 minutes... but I'll come to these kind of unrealistic ideas a little later.

Unlike the Cfengine article I have no bootstrapping notes, and no code/modules to share. By default the fresh started puppet agent will look for a host called "puppet" and pull in what ever you defined to bootstrap servers in your manifests. As for modules, I wrote a ton of code and though I'd like to share it, my employer owns it. But unlike Cfengine v3 there's a lot of resources out there for Puppet which can teach you everything you need to know, so I don't feel obligated to even ask.

Interesting enough, published modules would not help you get your job done. You will have to write your own, and your team members will have to learn how to use your modules, which also means writing a lot of documentation. Maybe my biggest disappointment is getting disillusioned by most Puppet advocates and DevOps prophets. I found articles and modules most of them write, and experiences they share have nothing to do with the real world. It's like they host servers in a magical land where everything is done in one way and all servers are identical. Hosting big websites and their apps is a much, much different affair.

Every customer does things differently, and I had to write custom modules for each of them. Just between these two clusters a module managing Apache is different, and you can abstract your code a lot but you reach a point where you simply can't push it any more. Or if you can, you create a mess that is unusable by your team members, and I'm trying to make their jobs better not make them miserable. One customer uses an Isilon NAS, the other has a content distribution network, one uses Nginx as a frontend, other has chrooted web servers, one writes logs to a NFS, other to a Syslog cluster... Now imagine this on a scale with 2,000 customers and 3 times the servers and most of the published infrastructure design guidelines become laughable. Instead you find your self implementing custom solutions, and inventing your own rules, best that you can...

I'm ultimately here to tell you that the projects are in a better state then they would be with the usual cluster management policy. My best moment was an e-mail from a team member saying "I read the code, I now understand it [Puppet]. This is fucking awesome!". I knew at that moment I managed to build something good (or good enough), despite the shortcomings I found, and with nothing more than using PuppetLabs resources. Actually, that is not completely honest. Because I did buy and read the book Pro Puppet which contains an excellent chapter on using Git for collaboration on modules between sysadmins and developers, with proper implementation of development, testing and production (Puppet)environments.

09. 10. 2011.

n2n: connect your networks using P2P VPN

Sometimes, you need to connect two networks in some way. My usual motivation is ability to access machines behind multiple NATs for easy system administration. So far, I used combination of OpenVPN and DynamicForward in ssh with clever use of ProxyCommand and nc with a sprinkle of proxy.pac for Firefox to make everything seemingly work. However, I never successfully managed to tunnel various JavaWebStart based remote consoles which want to connect directly from your machine to remote IP using sockets (for which you have to disable all proxy settings using jcontrol and selecting direct connection).

So this got me thinking. I could configure another OpenVPN for this, but it has many steps and I was lazy. Wouldn't it be great if there is some kind of P2P network like Skype or Hamachi for Linux? Something like this:

n2n_network.png

n2n: a Layer Two Peer-to-Peer VPN is exactly what I was looking for. It allows you to construct IP network over nodes behind NAT. But is it really easier to configure for specific example of accessing private network on another LAN behind NAT? Let's find out.

Steps are simple:

And we are done. In just 6 commands we routed remote LAN 172.18.0.0/16 over our 10.1.2.0/24 n2n interface to our local machine. And you don't have to stop at that. By installing additional edge in some other local network, you can get instant connectivity to your internal administrative network. This is very useful if you want to access your private repositories on local machine or need to open arbitrary sockets between machines.

07. 10. 2011.

Steve

Three years ago, a dear friend called me around 1AM on a random, unassuming Friday and asked what I was going to work on next. I had received great offers from the usual suspects, I told him. Then I off-handedly mentioned how no one from Apple had gotten in touch.

He thought about it for a moment. “Have you e-mailed Steve?”

At 1:46AM, I e-mailed Steve.

I turned 23 a couple of months ago, and I want to work on things that I can be passionate about. Apple is the only company in this industry still making products that people find inspiring. That they give a shit about.

I could do great things at Apple.

Early the next morning I received a phone call; a couple of weeks later, an offer. I took it without thinking twice, and it was one of the best decisions of my life.

Steve brought a sense of childlike wonder to a crowd of millions. What the world lost with his passing cannot be replaced. But his genius, his vision, and the single greatest thing he’s ever built all live on.

Here’s to the crazy one.

05. 10. 2011.

My favorite Firefox Extensions

 
Here are Firefox extensions I use, if you have some good ones that I misses please feel free to suggest.
 
There is also post showing my favorite Chrome extensions.

 
Must-have Firefox extensions:
Scrollbar Anywhere
Download Statusbar
Lastpass
Omnibar (Integrates location bar and search bar into one)
TinEye Reverse Image Search
Search by Image for Google
Tab Mix Plus
Flashblock
Nightly Tester Tools (enable uncompatible plugins)
AdBlock Plus
Adblock Plus: Element Hiding Helper
Session manager
 

Social bookmarking extensions:
VisualizeUs Image sharing service
Diigo Toolbar (online bookmarks)
del.icio.us online bookmarks
Shareaholic | share with Google, Facebook and more
Digg Firefox Extension
StumbleUpon Extension
Missing e – additional Tumblr features
Tumblr Post

 
Anonymity and security Firefox extensions:
No Script
Cookie Button
BetterPrivacy
 

Advanced surfers addons:
GreaseMonkey
Extended Statusbar
ScreenGrab
Better Gmail 2
Dugg mirror
URL suffix
FlashGot
ScrapBook
SwitchProxy
DownThemAll!
Video DownloadHelper
 

Interesting addons:
Fasterfox
Image Toolbar
Clipmarks
BugMeNot
 

Addons for blog writers:
ScribeFire (previously Performancing for Firefox)
Deepest Sender
 

Ugasite govornu poštu

 
Mobilni operateri zarađuju korištenjem usluge govorne pošte koju namjerno ili “slučajno” uključuju svojim korisnicima.
 
Evo kako isključiti uslugu govorne pošte kod Hrvatskih mobilnih operatera:
* T-Mobile: #70# + tipka za poziv
* VIP: ##002# + tipka za poziv
* Tele2: *134*0# i tipka za poziv
* Tomato: ##002# i tipka za poziv
 
Pomognite svojim pritateljima i rodbini da uštede novac i svima im isključite uslugu govorne pošte.
 

03. 10. 2011.

Idemo u Diasporu

Netko za Diasporu odrađuje jako dobar posao oko promoviranja. Svi mediji (pa i naši) su se raspisali o novoj društvenoj mreži i njezinim mogućnostima. Malo je onih koji su svoj tekst temeljili na direktnom kontaktu, sve se manje ili više svodi na prepričavanja jer su se spotaknuli na prvoj stepenici: pozivnici.

To prvo spoticanje je uzrokovano važnim detaljem kojeg su mnogi previdjeli: Diasporina glavna karakteristika je decentralizacija. Nema centralnih poslužitelja ili mjesta gdje se nalaze podaci i aplikacija. Bilo tko, uz odgovarajuća znanja i mogućnosti, može podići svoj pod i pokrenuti svoju malu Diasporu. Ako znanja i mogućnosti nema onda se može odabrati jedan s liste dostupnih podova za kojeg vam nije potrebna pozivnica.

Diaspora je objavljena pod open source licencom i njezin kod je javno dostupan. Nisam baš neki stručnjak za Ruby, malo sam bacio oko na kod (poruke uz commit su vrlo indikativne), malo na model baze, i čini mi se da kvaliteta koda i aplikacije ne odgovara silnoj graji koja se podigla oko Diaspore. Ali ni neki drugi servisi nisu briljirali u svoj počecima, ipak su uspjeli, pa vidimo da kvaliteta koda nije baš nužna za uspjeh.

Ima li uopće potrebe za takvim servisom? Diaspora je meni neki dan pala na pamet kao rješenje kad sam čuo da u osnovnoj školi nastavnici, za potrebe nastave, s učenicima komuniciraju preko Facebooka. To baš i nije primjereno, prvo iz razloga što većina učenika uopće ne bi smjela koristiti Facebook zbog dobnog ograničenja, a drugo što većina djece koristi taj servis bez da su naučili nešto o njemu. Diaspora s pojačanom zaštitom privatnosti bila bi puno bolje rješenje. Uz škole taj servis bi mogle koristiti i udruge te klubovi koji rade s djecom i tako zadržati sve u lokalnim okvirima uz kontrolirani pristup članova.

Diaspora nije jedini projekt te vrste. Appleseed postoji puno duže, ali nije se baš čulo za njega. Bilo bi zanimljivo čuti Diaspora tim kako namjerava izbjeći sudbinu Appleseeda?! Ali to nije sve, aplikacija za društvene mreže ima više nego što mislite, ali za sada nijedna nije napravila za društvene mreže ono što je WordPress napravio za blogove.

30. 09. 2011.

Collecting disk SMART informations from large disk pool

Last few weeks, I was configuring huge ZFS pool of 50 disks over three machines. Aside from benchmarking, I wanted to setup monitoring of this disk pool. smartctl comes as natural candidate for getting smart data, but where should I keep it? I recently learned of git log -p output format which shows nicely changes in your source files, so natural question was can I use git to track smart disk statistics?

As it turns out, getting overview of disk layout is really easy under Linux if you know where to look. /proc/partitions first comes to mind, but it lacks one really important peace of information: disk serial number. It's only peace of information which won't change between reboots when you have to spin up 30+ disks, so you really want to use it as identification for disks, instead of device name for example (which I tried on first try and learned that disks move around).

Good naming of dump files is as important as always. In the end, I opted to use smart.id where id part is from /dev/disk/by-id/scsi-something. Paths in /dev/disk/by-id/ are essential useful when creating storage pools because they also don't change between reboots.

Now that we know where to look for disk identification and serial number, we are ready to start collecting smart data. However, this data is much more useful if coupled with info from controllers, so final version of smart-dump.sh script also supports dumping of controller status for LSI Logic / Symbios Logic and 3ware controllers. Have in mind that collecting smart info from disks does interrupt data transfers, so if you have huge pool you might want to spread those requests (or even issue them in parallel if you want one huge interruption as opposed to several smaller ones).

So was all this worth an effort? In fact, it was! In our sample of 50 3T disks, one disk reported errors after just 192 hours of lifetime. It would probably report it earlier, but this was second time that I run smartctl -t long on it. On the other side, it passed long check on first test which was 8 hours of LifeTime. Even if you read Failure Trends in a Large Disk Drive Population paper from Google, and concluded that smart is lying to you and you could ignore it, please monitor your drives!

29. 09. 2011.

Reamde

I received a copy of REAMDE by Neal Stepehenson, his latest book, two weeks before publication date and slowly worked my way through it. Having finished it I can say I really liked it. A lot of reviewers are disappointed that it wasn't nearly as complex as his earlier work, like Cryptonomicon and Anathem. But it was still a 1200 pages volume of Stephenson awesomeness. This is a thriller set in modern day, not an SF book.

Reason I enjoyed it a lot are the characters, a lot of them were (black or whitehat) hackers, sysadmins, programmers and gamers. Perhaps I felt closer to them than some readers did, who might have expected an epic historical novel or SF from Stephenson.

Book opens up with Richard, a CEO of Corporation 9592 that produces a massive online role-playing game called T'Rain. Somewhat like WoW but with a twist, the idea behind the world and how it was built is one of the best chapters in the book. Some hackers found a way to exploit a vulnerability shared by T'Rain players and wrote malware that encrypts their data with PGP and holds them for ransom. Payment is done in gold in the T'Rain world. At some point they ransom data of some carders, and their handlers who are very bad people and all hell breaks loose. Mobsters and terrorist cells get involved and story jumps to multiple continents. Neal Stephenson once said he likes making a good yarn, and he delivered on it again.

26. 09. 2011.

Zagreb Python Piva #2

Nakon uspješnog prvog Python okupljanja uslijedila je ljetna pauza. Nakon što smo se svi lijepo odmorili, pravo je vrijeme za još jedno Python druženje.

Datum je 29.9, mjesto je pivnica Zlatni Medo (križanje Vukovarske i Savske), vrijeme je 17 sati. Najavu možete pročitati na Python Hrvatska grupi, a ako planirate doći, molimo da javite na listu. Naravno, dobrodošli ste i ako u tek u četvrtak u 17:01 odlučite da biste svratili. The more the merrier :)

Vidimo se u četvrtak!

25. 09. 2011.

Quickstart your Django project in 60 seconds

Sane-default boilerplate to avoid repeating yourself each time you start on a new Django project.

Django comes with a lot of batteries included, but it takes some time to set them up. And usually, the initial few steps are always the same. We can refactor these into a boilerplate empty Django project, and use it as a base for new projects, instead of starting from scratch each time.

That’s what I did with DJ Skeletor. It’s an empty, relocatable (ie. uses no hardcoded paths) Django project, set up to my liking and with a few Django apps that I use in virtually all projects (impatient? jump directly to the examples).

Django settings

Default Django settings organisation is rather simplistic – it’s just one file. But as soon as you deploy the project to somewhere else than the computer you’re writing it on, you’re going to have at least two sets of settings: development and production.

There are several ways to handle this in Django. I prefer the following:

This allows me to have all of the settings code (even per-environment settings) in the git repository. By using the symlink (instead of host name or IP address as some do), I can activate the variant I need without regards to the rest of the environment. This allows me to eg. have several variants of the same project running on the same machine.

Database

A test SQLite database is set up for the development environment. The database file is configured to be test.db in the project root by default.

South

South is an awesome Django app for handling database schema migrations (ie. table/field changes when you modify your models). If you’re using a database with Django, you want to use South as well.

Django Debug Toolbar

Django Debug Toolbar is very handy for inspecting what happens when you request a page from Django. It lists things such as SQL queries executed (including how long did they take and why they were executed), signals, logging, exception, request params, etc. I use it all the time for finding and fixing suboptimal database queries.

The app usually defines a white-list of client IPs for which to be shown. As I’m not on a static IP, I find it more useful to have the toolbar show all the time when in development environment, and never when in production.

Sentry

Sentry helps with exception logging and viewing for your Django project. It can handle multiple Django installs where the logs can be managed from a single place, or it can be used on a per-project basis. The latter is how it’s preconfigured in DJ Skeletor.

Besides logging the exceptions, Sentry can also catch normal logs you create with Python’s logging system. This is also preconfigured in DJ Skeletor.

Example

Enough talk, let’s see some action. First, we’ll create a virtual environment (you do use virtualenv, right? if not, you should) and install prerequisite packages:

    virtualenv --no-site-packages myenv
    cd myenv
    source bin/activate
    pip install django django-debug-toolbar south django-sentry

Next, we’ll clone the boilerplate project:

    git clone https://github.com/senko/dj-skeletor.git myproject
    cd myproject

Let’s activate the development environment and prepare the database:

    cd settings
    ln -s dev.py local.py
    cd ..
    python manage.py syncdb
    python manage.py migrate sentry

All done, let’s run it!

    python manage.py runserver

See? Piece of cake. With boring initial set-up out of our way, we can focus on building an awesome web site or app.

DJ Skeletor is open source and is available on GitHub. Feel free to use it or base your own boilerplate on it – if you do, please share your thoughts in the comments.

Bonus: HTML boilerplate

If you’re a programmer and couldn’t design if your life depended on it, it’s useful to have the user interface boilerplate handy as well.

If you need a clean, well designed (but definitely not unique or artistic) user interface for your HTML app, I heartily recommend Bootstrap, created and open sourced by the fine folks at Twitter.

If you do need to make a proper, unique design, again no need to start from zero: use HTML5 boilerplate which takes care of a myriad little gotchas for you; and there’s a mobile option as well.

21. 09. 2011.

If your server never reboots …

… you never verify that it’ll boot correctly.

The Linode box hosting my VPS had a scheduled maintenance downtime for a couple of minutes yesterday, so they shutdown my VPS and rebooted it afterwards. This was a first downtime since I set it up around 7 months ago. I saw in the VPS management console that the server was correctly rebooted, so I went to sleep, not a care in the world.

BUT

Oops

Why?

Let’s practice root cause analysis with five why’s, shall we?

Lessons learned

Let this post remind me to not cut these corners again. And you, dear reader, check whether you’ve cut them as well.

07. 09. 2011.

ZFS on Linux and pool replication

I have been using ZFS on Linux for some time to provide backup appliance using zfs-fuse. Since then, we got native ZFS implementation on Linux, so I decided to move by backup pool from zfs-fuse to in-kernel ZFS.

Additional reason to move pool over to new machine was to change pool's RAID level. In current ZFS implementation(s) you can't change mirror to RAIDZ1 without re-creating pool and then transfering data over using zfs send and zfs receive. However, when you are creating snapshots for years, and expiring them using script you will have hundreds of snapshots which you need to transfer.

This is where zfs-pool-replicate.pl script comes handy. It uses Net::OpenSSH to connect to two machines (source and destination), list all snapshots on source and transfer them to destination. If you have filesystem without snapshots it will create one @send snapshot which will be transferred. It will also optionally use compression for transfer of snapshot over the network. I am using LZO which is fast compression which nicely transfers 150Mb/s or more over normal 1Gbit/s network without much CPU overheard (and we all have multi-core machines anyway, right?). Current implementation allows you to re-run replication script to transfer only new snapshots creating handy disaster recovery solution.

Current implementation is designed to run from third (management) machine, so I can envision central storage administration tool which will also allow you to transfer LVM snapshots into ZFS snapshots. For now, I'm using shell script for that, but rewriting it in perl would improve error recovery and reporting.

04. 09. 2011.

Odabir JavaScript okruženja za razvoj mobilnih aplikacija

Kao dugogodišnjem ExtJS korisniku meni bi SenchaTouch trebala biti prvi i logični izbora za razvoj mobilnih web aplikacija. Sigurno je to jedno od najdorađenijih i najstabilnijih rješenja. Neki kažu da je malo spora na slabijim uređajima. Ono što je meni malo zasmetalo je što ima podršku samo za WebKit preglednike. Istina, time se pokriva najveći dio tržišta, ali ako se može više…

Jo mi se dopao zbog težnje da se pokriju svi važniji preglednici (cilja se HTML5), dokumentacija je odlično složena, radi odlično u PhoneGapu. Sve je izgledao idealno do probe na mobilnim uređajima. Ili zapinje ili prebrzo okida CSS animacije. Korisnički doživljaj je jedva podnošljivo. Možda će biti bolje?!

Poučen loše sklepanom jQuery UI bibliotekom nisam previše očekivao od jQuery mobile okruženja. Činilo mi se da su uhvatili preveliki zalogaj, pogledajte samo popis podržanih platformi. ExtJS me naučio da se sučelje programiranja u JavaScriptu, a ovdje se definira html5 markup tako da mi je to malo neobično. Ono što je dosta lošije je podrška za standardne događaje koji se zbivaju na ekranu koji se dira prstima. Bez obzira na to jQuery mobile bi mogao biti najkorišteniji u ovoj vrsti.

jQTouch se pojavio među prvima, ali kako je glavni developer zaposlen u Senchi njegov razlog stagnira i nema previše razloga za njegovo korištenje.

The M Project se bazira na jQuery mobile toolkitu, a za njega bi se mogli odlučiti oni koji su bez kompromisa samo za MVC.

Wink toolkit me pozitivno iznenadio. Najvjerojatnije zbog toga jer nisam ništa očekivao od njega. Isprobao sam ga na raznim uređajima (čak i na jednom 1.5 Androdiu) i radi na svima. Nisu na svima podržane sve mogućnosti, ali na impresivnoj listi demonstracija sigurno možete naći nešto što nigdje drugdje niste vidjeli. Ako ništa drugo Wink djeluje najzabavnije.

DHTMLX Touch ne izgleda loše, ali demo aplikacije pokazuju da je detektiranje rada s prstima preosjetljivo i da tu treba malo poraditi. Iz primjera koda prije bih rekao da je ovaj toolkit primjereniji za jednostavnije web aplikacije.

Dojo Mobile sam zaobilazio jer se ni s klasičnim Dojom nisam našao. Dojo Mobile demonstracije ne izgledaju loše, zanemarimo poneke nespretne ikone, ali čini mi se da je cijelo okruženje malo preteško.

Veliki je izbor pa bi je bolje previše ne razmišljati već uzeti bilo što i krenuti s razvojem. Još jedno JavaScript rješenje zaslužuje da ga se spomene mada nema legalnog načina da s njime radite web aplikacije. webOS je u inačici broj 3 predstavio Enyo. Iako je predviđen za razvoj webOS aplikacija mogao bi se bez problema iskoristiti i u ulozi već spomenutih rješenja. Samo bi trebalo izbaciti dijelove koji su vezani uz webOS platformu. Ideja da se to napravi je već spominjana, ali sve ovisi o tome što će HP napraviti s webOS-om. Trenutna licenca to ne dopušta.

01. 09. 2011.

On generic coding style

.. or, much ado about whitespace

Every programming language has at least one standard or preferred code style – most have several, and they’re an endless inspiration for bikeshedding.

I’m about to do just that.

Instead of talking about a specific language or community, I’ll look at some general guidelines that are applicable to every programming language. Of course, there are exceptions, but there has to be a good reason to make the exception.

These are just things I picked along the way and found that they’re useful in general. I’ll try to explain why I think each of the guidelines is important, but YMMV – code style is largely a subjective issue, and I’m not here to preach my way is in any way superior for you. It just works best for me.

Indentation: spaces versus tabs

Spaces and tabs make an ugly mix. In some languages (like Python), mixing them can easily lead to hard-to-find errors. In others, the effect is purely visual, but still ugly.

People have various tab length settings in their editors. Yes, I agree we should all standardize on tab width of 4 (or 8, or 2, or ..), but at this point I don’t think we’ll ever do that. So if you share (as in show or view) code with anyone not following the same style, it’s going to be a mess.

Spaces or tabs? When you’re mainly using tabs, there are still places where a space or two are going to be needed. You’re effectively going to mix them. So don’t, use only spaces.

Okay, that was easy. I also intentionally ignored the fact that some tools require mixing them – make, for example.

Line endings: Unix or Windows?

If you’re only working in and for Windows environment, and you’re not going to need to share code with developers on other operating systems, you can get by by using Windows-style line ending (CR-LF). In fact, it’s probably going to be easier than the alternative.

Otherwise, use Unix line ending (LF) everywhere. It’s the default on both Linux and OS X, and if your (web app) code is going to be served by some cloud server, it’s probably going to be Linux or some other variant of Unix as well.

Whatever you do, don’t ever mix the two. If you have a hybrid team, some people on Windows and some on OSX or Linux, standardize now.

Trailing whitespace

Trailing whitespace on each line can be trouble, because otherwise identical lines can actually be different. This can wreak havoc with your version control, since it’s easy to change them, without changing the actual content of the line, and the version control will hapilly treat them as code changes.

Fortunately, most editors have the option of automatically trimming the white space when saving a file. No reason not to use it.

Line width

This is a tough one. I try to have the content fit in 80 columns. It’s easier to read, as it avoids wrapping (easily mistaken for multiple lines) and horizontal scrolling (downright cumbersome).

This is easier for some languages than for others. I’ve pretty much given up on doing it in HTML. It’s just too verbose for 80 columns to be enough.

So, I try to follow the 80-column rule unless working around it would make the code uglier than if I just let it go beyond col 80. In those cases, I prefer wrapping instead of horizontal scroll.

Terminating newline

A file should end with a single newline. That means, no empty lines after the content, but also not having the last line of the code dangling without an ending newline.

This makes it easier on the editors, nicer when using cat or patch, and makes git not complain. Good enough for me.

File encoding

With everyone supporting it these days (and it being a default on a lot of systems), there’s just no reason not to use UTF-8 encoding. I try to stick to the ASCII part whenever possible, but when I do need it, UTF-8 is the only sane choice.

YMMV

I’m pretty opinionated with regards to these things, as I’m sure you are as well, dear reader. So please do share your preferred settings for the above in the comments (we’ll agree to disagree, thus avoiding any potential flamewars).

Also, if you have an interesting example where some of these MUST be broken (eg. in Makefile), please do share.

29. 08. 2011.

Projekt Otvorena mreža

 
Projekt Otvorena mreža Osijeka podržava udruga Osijek Wireless, no projekt ne pripada isključivo udruzi niti ga udruga želi zadržati samo za sebe. Ovo je projekt svih građana i tko god želi može se uključiti u njega. Ishod i uspjeh ovog projekta ovisi o cijeloj zajednici.
 
Jedan je od najvažnijih ciljeva napraviti platformu koja će biti otvorena za razne druge aktivnosti – od pristupa internetu za turiste i građane i omogućavanja besplatnih telefonskih razgovora unutar mreže do postavljanja senzoričkih platformi za mjerenje bilo koje vrste podataka (temperatura, buka, padaline, i dr.), postavljanje web kamera i sl.
 
Jednako važan cilj ovog projekta jest i edukacija mladih kroz besplatne radionice, a u području novih tehnologija poput rada računalnih žičanih i bežičnih mreža, Linux operativnog sustava, mikroelektronike, programiranja i dr. kroz besplatne edukacije, koje će započeti u rujnu ove godine. Svi koji žele moći će se upoznati s osnovama rada bežičnih mreža i Linux OS-a te kako projekt Otvorena mreža Osijeka radi s tehničke strane.
 

Ovaj projekt pomaže u premošćivanju digitalnog jaza koji je obično najizraženiji u ruralnim krajevima i područjima pogođenima finacijskom krizom.
 
Projekt Otvorena mreža međunarodni je projekt u kojem sudjelujemo zajedno s Austrijom i Slovenijom. Osijek je trenutno prvi grad u Hrvatskoj uključen u ovaj projekt, no uskoro će se uključiti mnogi drugi gradovi i općine. Mnogi gradovi imaju nekoliko internet pristupnih točaka, neki čak i cijele mreže, ali nitko tu mrežu nije iskoristio kao platformu za ostale projekte.
 
Početnu fazu projekta čini postavljanje 100 pristupnih točaka povezanih u cjelovitu mesh mrežu, no to nije cilj projekta, već sredstvo pomoću kojega bi se pravi ciljevi projekta mogli ostvariti.
 
Da ne bude nesporazuma, s tehničke strane dobro znamo kako će projekt biti napravljen, no tehnički je dio samo jedan mali dio cjelokupnog projekta.
 
Projekt je otvoren za suradnju s učenicima, studentima, građanima, Gradom, Županijom, CARNetom, Sveučilištem J. J. Strossmayera i njegovim sastavnicama (ne isključivo samo tehničkim fakultetima), ISP tvrtkama, informatičkim i drugim tvrtkama, te svima ostalim organizacijama i ustanovama.
 
Kako sve ne bi ostalo na razini priče, u sljedećih ćete nekoliko dana moći provjeriti kako je projekt Otvorena mreža osmišljen osobno isprobavajući rad i učinkovitost postavljenih pristupnih točaka.
 
Jedna je pristupna točka već postavljena i nalazi se u probnom radu oko dva mjeseca. Tijekom tog vremena točka se pokazala 100% stabilnom i pouzdanom, čak i pri spajanju većeg broja korisnika . Točka je privremeno bila postavljena na Srednjoškolskom igralištu tijekom održavanja Pannonian Challeng-a.
 
U projekt Otvorena mreža Osijeka nije uključena niti jedna politička stranka, županija, grad (bilo u Hrvatskoj bilo izvan nje), niti je projekt financijski podržan s bilo čije strane. Radi se prvenstveno o projektu građana volontera te će takav primarno i ostati, uz otvorena vrata svima koji se žele priključiti projektu ili ga na bilo koji način poduprijeti.
 
Projekt je organiziran prema meritokratskom načelu gdje osoba koja ima najviše praktičnog znanja iz bilo kojeg područja vodi i snosi odgovornost za taj segment projekta.
 
Kako nije ograničen isključivo na područje grada Osijeka, u projekt se može uključiti bilo koja privatna ili pravna osoba iz bilo kojeg grada.
 
Pri izradi projekta i financijskog plana svih troškova izračunali smo kako je za postavljanje 100 pristupnih točaka potrebno izdvojiti oko 250,000,00 kuna. To uključuje cijenu za svu opremu, internet linkove te minimalne financijske naknade za dvije osobe koje bi radile na održavanju mreže.
 
Također smo izračunali da projekt može biti u potpunosti financijski samoodrživ. Čak i ako bude podržan od strane svakog 10-og građanina Osijeka koji bi donacijom u iznosu od samo 10,00 kuna mjesečno za prve dvije godine i 5,00 kuna mjesečno za naredne godine sudjelovao u projektu, financijska održivost projekta je osigurana.
 
Volonteri projekta ne očekuju nikakvu financijsku dobit sa svoje strane, no za nabavku opreme, internet linkova i održavanje mreže potrebno je odvojiti određena sredstva, a ista se namjeravaju prikupljati kroz razne oblike donacija i sponzorstva, prijavom na natječaje za udruge, ali i kroz izravne donacije onih koji podržavaju ovaj projekt.
 
Pratite razvoj projekta Otvorena mreža na Facebook stranici projekta.

25. 08. 2011.

OpenWRT installation from Tomato

 
I have an older Linksys WRT54GL v1.1 with Tomato firmware. Although I’m a hardcore Linux geek I never used OpenWRT, yeah, I know – shame on me ;)
 
OpenWRT wiki has installation instructions that explain how users should first install 2.4 linux kernel based image, set some nvram options, and then install or update to latest 2.6 based firmware image, but WIKI has no links how to do an update.
 

Tomato firmware can be accessed via telnet, if you enable telnet service by pressing button for 4 seconds or longer.
 
So I set nvram options (nvram set boot_wait=on && nvram set boot_time=10 && nvram commit && reboot)
 
After dowloading latest OpenWRT backfire firmware (brcm-2.4) flashing was straightforward through Tomato Web UI via Update Firmware tab.
 
Two things confused me. First is that nvram options aren’t explained on the wiki, what they do and why is that step necessary. Second is that there are no download links so for first time OpenWRT user this is quite confusing.
 
How do I know where 2.4 kernel based images are located and where are 2.6 kernel images located?!? I was not sure if I was flashing the wrong one and maybe bricking my device.
 
Now even after I used latest backfire 10.03.1-rc5 brcm-2.4 I have 2.4 based kernel image. Where from do I get 2.6 kernel openwrt firmware from? Or I just need to do an update?
 
First impressions of OpenWRT are awesome.
 
I also googled for DD-WRT vs OpenWRT comparison but on forums I just found comaparation of different project ideas (cathedral vs bazaar approach) and no feature or other technical comparison.
 

22. 08. 2011.

Hoće li Toshl baciti 15.000€ ili ipak neće?

Netokracija piše kako je Toshl potrošio 15.000€ na razvoj aplikacije za WebOS i sada prestaje s njezinim razvojem. Kaže se da je jutro pametnije od večeri i malo me čudi kako su odmah odlučili prekinuti razvoj aplikacije bez da su pričekali neko vrijeme da vide kako će se situacija razvijati.

Samo dan-dva kasnije, nakon ludog sniženja, prodalo se 350.000 TouchPad uređaja. Mislite li da je to malo? Motorola Xoom je prodala 100.000 uređaja u prva dva mjeseca. Učinak te prodaje developeri su osjetili već prvi dan. Aplikacije, koje su dan prije imale 10-20 downloada, dan kasnije su skinute nekoliko stotina puta. U Toshlu su odlučili da će jednostavno zanemariti 350.000 potencijalnih korisnika? Druga je stvar ako aplikacija nije dovršena pa su procijenili da im se ne isplati utrošiti još 15.000€ ili više od toga.

Toshl ima aplikacije za iPhone, Android, Symbian, BlackBerry, Maemo i Windows phone. WebOS je tu sedma platforma, a tko zna možda spremaju i Bada inačicu?! Da li bi vi, da imate proizvod poput Toshla, potrošili tolike novce za razvoj aplikacija ili bi se koncentrirali na dvije najmasovnije platforme i ostalima ponudili html aplikaciju s kojom bi mogli raditi sve što i ostali korisnici u svojim pravim aplikacijama?

Još jedna vijest koju mediji prenose kao zanimljivost je ponuda za koju se navodno zainteresirali 1000 WebOS developera. Prvo pitanje koje su zlobnici postavili je da li uopće postoji 1000 WebOS developera na svijetu? Prije bih rekao da je riječ o 1000 ljudi koji bi se besplatno željeli dokopati Windows phone uređaja. Jer kad je besplatno ili vrlo jeftino onda svi uzimaju bez puno pitanja. :-)

Spominje se da WP7 ima 30.000 aplikacija u svojem dućanu što je 5 puta više od 6.500 koliko ima WebOS, tako da od tog privlačenja developera Microsoft zacijelo neće imati puno koristi, osim malo prostora u medijima. Zanimljivo je i to da nijedan od 20.000 članova (uf, izgleda da ipak ima više od 1000 WebOS developera) službenog foruma za Palm developere nije niti spomenuo niti komentirao ovu ponudu.

Luda prodaja bi se mogla nastaviti u Europi jer će se HP riješiti i zaliha Pre 3 uređaja.

20. 08. 2011.

Kamo ide webOS i da li bi kupili TouchPad za $99?

webOS developeri su dobili mail koji je objavljen i na službenom blogu. Slijedeće poglavlje zapravo je održavanje postojećeg stanje. HP je najavio podršku i daljni razvoj kataloga webOS aplikacija. Taj katalog gubi smisao ako neće biti uređaja na koji će se aplikacije moći instalirati. Poruka ne donosi nikakve druge informacije tako da je ovo obraćanje developerima više reda radi.

Ono što bi moglo biti zanimljivo je da bi se TouchPad u slijedećih tjedan-dva mogao nabaviti vrlo povoljno. Kanadski Best Buy je već snizio cijenu najslabijeg modela na $99 i količina predviđena za online prodaju je rasprodana. Ako se i ostale web trgovine povedu za ovim primjerom isplatilo bi ga se naručiti. Sigurno je bolji i jači od jeftinih Android tableta, a ako ionako rasturate svoje uređaje, rootate i jailbreakate ovo bi bilo vrlo zahvalna igračka. Kasnije će to biti ekskluziva u vašem privatnom muzeju računala.

Walmart i HP na svojim stranicama imaju istaknutu cijenu od $99 i out of stock poruku. Izgleda da bi se HP u roku od par dana mogao riješiti cijele zalihe neželjenog uređaja. Istraživanje koje je objavio The New York Times pokazuje da je TouchPad bio drugi na listi najpoželjnijih. Tih 10.4% je daleko manje od iPadovih 94.5%, ali je još uvijek više od svih ostalih. :-)

18. 08. 2011.

HP napušta razvoj tableta i pametnih telefona

Prošlo je tek 16 mjeseci od kupnje Palma, a HP stavlja ključ u bravu. Napušta razvoj tableta i pametnih telefona. TouchPad je izazvao poprilično mlake reakcije, ali više zamjerki je bilo na sam hardware i izvedbu nego na obećavajući WebOS. Pretpostavljam da će svoju hardware diviziju prodati nekoj firmi s istoka, a oni će se uslugama i aplikacijama. Nešto slično kao što je napravio IBM.

Što će se dogoditi s WebOS-om? Izgleda da to ni sami još ne znaju. Najvjerojatnije bi ga prodali za neke novce jer kako opravdati onu kupnju iz prošle godine?

Developeri koji su odabrali tu platformu sada su u nezahvalnom i neizvjesnom položaju. I to je pouka i njima i drugima: nikada se ne vežite samo za jednu platformu.

P.S. Danas je potvrđeno i da je HP kupio Autonomy.

Dodatak: na jučer održanoj konferenciji Leo Apotheker je izjavio “Regarding the future of webOS, we are looking at all of our strategic options regarding the software. The software has been received very well, everyone likes it. We will be looking at all possible business models, from licensing to any other possibility, to look at how to extract value from webOS.”

Auto rsync local changes to remote server

When developing software that’s intended to run on a server, I like to edit the code directly on my laptop, but don’t want to run the development server locally.

Instead, I have a dev setup on a remote server, and copy the local changes as needed, using rsync to copy only the changed bits.

Running rsync is manual work, prone to errors and easy to forget. So I automated it by writing a shell script that runs it whenever I change the directory.

The Script

The script is pretty simple. It uses inotifywait (part of inotify tools on Linux) to detect changes in the current directory and runs a command when that happens. To avoid running multiple commands on a related sequence of events, the script waits a second to see if there are more events coming.

The script itself doesn’t assume which command needs to be run, so it’s useful beyond just triggering rsync. You can find the script on GitHub.

Example usage

When working on a project, I start the watch script with something like:

    onchange.sh rsync -avt --delete . server:/path/

Speeding up rsync+ssh

Since I’m running rsync frequently, I want it to be as quick as possible (even though it’s happening in the background). Since the changes are very small, most of the time spent is in initiating SSH connection to the remote server.

To minimise this, I’m using SSH connection multiplexing. I just ssh into the server, even if I don’t need to do anything there. This keeps the connection open. Subsequent rsyncs over ssh just reuse it.

Portability

Unfortunately, as this uses inotify tools directly, it’s not very portable to non-Linux systems. It’s easy to write the equivalent tool in, say, python using watchdog.

That’s left as an excercise to the reader ;-)

Update: there’s also lsyncd, a full-blown tool for live syncing local with remote folders.

15. 08. 2011.

Slučaj: e-imenik

Dnevnik.hr je objavio prilog, a vijest su kasnije prenijeli Rep.hr i Netokracija i dodali pokoju mrvicu.

Prva sporna činjenica je odluka da će se koristiti Motorola Xoom tablet. Rep.hr navodi izjavu ravnatelja CARNeta da je proveden natječaj. Na popisu objava stvarno postoji poziv na nadmetanje s opisom Tablet računala za potrebe CARNet-a. Ono što jako čudi za ovakvu jednu nabavu da nema nikakve detaljne specifikacije uređaja koji se traži. Obično je ona navedena u dodatnim dokumentima uz objavu, ali uz ovu objavu nema ničega. Kratak opis predmeta nabave nije ništa duži od opisa nadmetanja. Tako da ne možemo dokučiti po kojem su se kriterijima odlučili za baš taj tablet?!

Ako će on služiti samo za spomenutu web aplikaciju i ako bi se u idućih par godina nabavljalo nekoliko tisuća takvih uređaja onda je bilo bolje da su se odlučili za jeftiniji, manji i lakši uređaj. Ovako izgleda kao da je glavni kriterij bio najveća cijena. Zaživi li spomenuti projekt onda bi u masovnoj nabavi trebalo nabaviti prikladniji uređaj, a budući da se radi o web aplikaciji to ne bi trebao biti nikakav problem.

Netokracija piše da na projektu rade 3 programera koji će do rujna imati spremnu PHP aplikaciju za testiranje. Sadašnja tablet računala imaju jako dobru podršku za HTML5 tehnologije tako da bi radije vidjeli rješenje koje bi omogućilo i offline rad (jer veza će puknuti baš onda kada je najviše trebaju) i kasnije sinkroniziranje podataka s glavnom bazom. Ako nema tih mogućnosti onda imamo drugu spornu činjenicu.

3 programera i 6 mjeseci možda izgleda dovoljno, ali siguran sam da nije. Nigdje nema spomena o tome da je tom programiranju prethodio rad X stručnjaka koji su X mjeseci analizirali i izradili projekt. Ako je početak projekta čin programiranja onda ni odlični programeri neće izvući projekt o kojem ne znaju dovoljno.

U komentarima na Dnevnik.hr i Rep.hr javio se i Vladimir Škopljanac koji kaže da je njegova tvrtka izradila besprijekoran internet školski dnevnik koji smo besplatno poklanjali školama. Klik na njegovo ime će vas odvesti na članak u Slobodnoj Dalmaciji gdje možete pročitati koji je njegov poslovni model (naplata roditeljima za pristup). Ima dosta tvrtki u Hrvatskoj koje s državnim i javnim institucijama posluju na taj način da poklanjaju programe (ili ih prodaju za male svote), kasnije šalju račune samo za održavanje.

Ministarstvo nije trebalo prihvatiti ni ponudu Vladimira i njegove tvrtke niti projekt CARNeta. Trebalo je organizirati javnu raspravu, tražiti stručna mišljenja, recenziju struke i tek nakon toga raspisati natječaj s jasno definiranom specifikacijom na kojeg bi se mogao javiti bilo koji pravni subjekt koji zadovoljava uvjete. Ovako sve miriše na još jedan #fail.

13. 08. 2011.

Developer litmus test

Here’s the situation: you need to hire a new developer. You’ve put up a job posting, you’ve got ton of CVs, and even after you discard the ones obviously not suited to the job, you still have a lot more potential candidates than you’d like to interview in person.

One way to trim this even further is to give them a task and see how well they execute it. Unfortunately, this only tests the programming abilities of the candidate. While important, these are not the only skills they need to have. Also, the assignment can easily be gamed – the candidate can ask (or even pay) someone to solve it for them.

The “patches welcome” test

Open source contributors usually start by making a small tweak or fix in the existing project code, not by developing all new codebase. Similarly, new hires usually first work on the existing code, before being put in charge of a new component of the system.

Can we apply the same principle to candidate assignments? I think we can.

We can make up a standalone project that uses the same languages or framework that the new hire will use – something that can be done in a day. We actually implement it, but leave it full of errors (syntax, logic, or valid but obviously poorly performant code).

The setup

Instead of writing corret code and inventing errors, it’s better to just write the whole thing in one go, never bothering to check and fix any syntax or logic errors (in fact, it’s best if you disable syntax highlighting and other code validation checks that your editor might have).

We put the project on a code hosting site and give the candidates no further instructions than “this needs fixing, documenting and unit tests – patches welcome.” We leave the code wide open, so candidates don’t think we’re abusing the test to have the “real” work done.

Then, we wait, see what they come up with.

Benefits

This tests a lot:

  1. whether the candidate can use git (or hg or your preferred vcs) or, failing that, that they can (and do) learn the very basics
  2. whether they can read and understand others’ code and modify/refactor it without making it into a pasta
  3. that the candidate can actually program and fix the code in question
  4. that they know the frameworks or libraries you need them to know
  5. whether they can follow the code/style conventions
  6. that they write unit tests (if applicable to the assignment)
  7. whether they’ve identified valid but poorly performant parts of the code
  8. can they write documentation
  9. whether they split their work in smaller chunks (commits/patches) or give one big code dump at the end

Conveniently, it also serves as a quick intro for your coding practices for the candidate you do end up hiring.

While this does take a bit more involvement up front (lose a day to write the test), I believe this is far more accurate test across various skills needed for a good developer, than just a simple fizzbuzz.

09. 08. 2011.

Jedini razlog za uvođenje otvorenog koda u škole!

Na nedavno otvorenoj Python Hrvatska grupi raspravljalo se i o korištenju Pythona u nastavi. Python je već odavno trebao zamijeniti BASIC u školama jer je jednostavan (kod je na razini pseudo koda), u malo linija koda se može napraviti puno, a zahvaljujući bezbrojnim bibliotekama s njime se može napraviti skoro sve što možete zamisliti da se može napraviti na računalu. Ono što je meni zapelo za oko je da se opet spomenuo problem isplativnosti uvođenja Pythona u škole. Isti problem se spomene i skoro svaki put kad se predlaže uvođenje aplikacija otvorenog koda u škole. Oni zagovaraju otvoreni kod često (pogrešno!) govore o cijeni kao velikoj prednosti.

Postoji li negdje studija koja dokazuje da bi zamjena vlasničkog softvera u nastavi bila neisplativa za škole? Kako to škole određuju da li posluju isplativo ili neisplativo? Zbog čega toliko otpor prema stjecanju novih znanja (kao česti razlog za status quo navodi se problem da bi nastavnici/profesori trebali naučiti nešto novo)? Hej, pa to je škola, ona i postoji zbog toga da se stječu nova znanja. To se ne odnosi samo na učenike, treba ići u korak s vremenom, količina ljudskog znanja se udvostručava svakih par godina, kako će uspješno učiti djecu ako ne nauče ništa novo?!

Djeca su znatiželjna, upijaju kao spužve, postavljaju pitanja i traže odgovore. Ne možete očekivati da vam sve vjeruju na riječ, nešto im morate pokazati i u praksi. Kad sam ja bio dijete rastavio sam svaku igračku koju sam imao kako bih vidio kako radi i zašto radi tako kako radi. S godinama sam rastavljao i popravljao (ne uvijek uspješno) sve što se dalo rastaviti i popraviti. Izmišljali smo i izrađivali vlastite igračke (od čepostrela do drvenih skija), prilagođavali vozilice (bicikle i Tomos motore) potrebama i trendovima. Moj APN 6 je imao aluminjske felge, modificiranu sjedalicu, ojačane amortizere, a nije mi bio problem rastaviti i sastaviti mašinu nekoliko puta dnevno. Zašto sam to radio? Zato što me to zanimalo, veselilo, učio sam i ono najvažnije: zato što sam to mogao napraviti!

S vlasničkim kodom to ne možete napraviti. I dok vama velikima to nije važno (nećete ići sami popravljati auto), djeci, koja uče, to je vrlo važno. Djeca trebaju učiti, trebaju imati mogućnost da vide kako nešto radi, da vide zašto je to tako, a ne nekako drugačije. Trebaju imati mogućnost da mijenjaju, da prilagođavaju, da rasture sve i da ponovno pokušaju sve složiti. Crne kutije u koje se ne može zaviriti nisu za djecu i nisu za škole. Kad govorim o rasturanju i promjeni programa onda ne mislim samo na programiranje. Postoji cijeli niz načina na koji oni mogu promijeniti, prilagoditi.

Jedini razlog zbog kojega otvoreni kod u školama treba zamijeniti vlasnički je njegova otvorenost i mogućnost da s njime možete napraviti što god vam padne na pamet i onda sve to možete slobodno dati drugima da opet s time naprave što hoće ili da to jednostavno slobodno koriste. Bez ograničenja.

Djeci treba sloboda, osjećaj da trebaju i mogu promijeniti stvari. Zašto ih ograničiti i ukalupiti? Zar treba zbog komoditeta nekolicine nastavnika, koji ne žele učiti ništa novo, uništiti inovativnost i zaigranost čitavih generacija? Uvođenje otvorenog koda će se isplatiti, samo što to kratkovidni ne vide.

02. 08. 2011.

Djeco, pazite na Gmail i Google+

The Google Chrome Channel je objavio ovaj video u kojem otac svojoj maloj bebi otvara Gmail korisnički račun i šalje joj poruke. Ako imate veće klince možda ste im otvarali korisničke račune kako bi mogli slati i primati e-mailove ili da mogu koristiti Google Talk. Možda ste samo željeli zauzeti njihovu adresu kako bi za koju godinu imali c00l adresu, a ne nešto poput janko234576354@gmail.com. Sigurno niste razmišljali o tome da postoje neka ograničenja. U uvjetima korištenja nije točno navedena nikakava životna dob, prilikom registracije korisničkog računa nije potrebno unijeti datum rođenja. Izgleda da nema nikakvih problema da svojoj bebi stvarno otvorite Gmail korisnički račun, na kraju krajeva pa sam Google nas potiče na to.

Nije baš tako. U Google+ priči meni se najviše dopao Hangout i njegova jednostavnost pa sam mislio da ga iskoristim za obiteljske video kontakte. Zapelo je već na prvoj osobi, sin još nema 13 godina i nakon unosa datuma rođendana dočekala nas je poruka kako on ne može koristiti Google+. U redu, ne može koristiti ni Facebook i tu bi priči bio kraj da Google nije zablokirao i njegov Gmail račun kojem više nije moguće pristupiti i koji će biti obrisan nakon 30 dana. Postoji mogućnost da se otključavanja ali ona se svodi na korištenje kreditne kartice ili slanje kopije nekog identifikacijskog dokumenta.

Google određuje pravila za svoje servise, ali bi ipak trebao jasno naglasiti, na formi za registraciju, da postoji ograničenje i da mlađi od 13 godina ne mogu imati njihov korisnički račun. Kad su već zaključali račun koji postoji godinama trebali su barem omogućiti izvoz podataka, a ne da korisnike dovode u situaciju sjedi i plači.

Upozorenje: ako vaše dijete ima Gmail korisnički račun, mlađe je od 13 godina i želi ga i dalje sačuvati, neka se ne pokušava priključiti na Google+ jer će mu račun biti blokiran i obrisan nakon 30 dana.

P.S. Baš je super ovaj novi Google Voice i mogućnost da zovete u druge zemlje za sitne novce. Pogledajte malo što se još nudi, neki drugi servisi nude čak i besplatno zvanje što je jeftinije od par centi koje uzima Google. Npr. koristite li Voipbuster za poziv s računala na mobitel u SAD-u nećete platiti ništa što je puno manje od $0.18 koje traži Google.

29. 07. 2011.

DOM text search/replace with jQuery

I recently did a quick hack to modify a bunch of text (phrases) on an already rendered HTML page. It was inconvenient to manually select single elements and modify the text – what I needed was a global search/replace.

Turns out it’s quite easy to build one, so I did. I created a jQuery plugin that can go through all text nodes inside an element, match them against a fixed string or a regular expression, and replace it. The replacement can be a fixed string, a regular expression replacement, or a result of a function. Functions can also be (ab)used to modify the element beyond just changing the text.

You can get the plugin from GitHub, and see it in action on JSFiddle. In case anyone cares, I’m releasing it to Public Domain. It should work across all browsers, although it can be quite slow on big, heavy pages with a lot of text.

Beyond quick hacks, this plugin is quite useful for things like page translation, simple A/B tests and other uses where you need to manipulate text based on its content, not the page structure.

26. 07. 2011.

Novi mobilni OS iz Mozille

Moram priznati da me nervira (zapravo iritira) ta ekipa iz Mozille. Curenje memorije u Firefoxu nikako da poprave, a igraju se s tim brojevima inačice. Sad imam peticu na kojoj mi ne radi većina dodataka, a sada oni objavljuju da je osmica 20% brža od petice. Postoji i Ubuntu ppa repozitorij za nestrpljive i znatiželjne. E pa nisam takav.

Kako Firefox gubi tržišni udio ekipa se dosjetila jadu i sad najavljuju novi mobilni operacijski sustav. Baš nam u ovoj nestašici tih mobilnih OS-ova nedostaje jedan. Izgleda da su za razvoj odabrali šuć-muć metodu (nešto slično kao Appcelerator) po kojoj treba uzeti postojeće sastojke izvornog koda, malo ih promiješati i zapakirati u privlačan paket. Njihov OS bi se bazirao na Androidu, a bio bi nalik webOS-u. Najznačajnija razlika bi bila u tome što bi Gecko engine zamijenio WebKit.

Ukoliko i naprave taj OS ono što će im nedostajati su uređaji. Bez jakog proizvođača bilo kakav mobilni OS je osuđen na propast. A možda oni i računaju na to da će se uvaliti Nokiji nakon što ju Elop uništi.

Možda niste vidjeli ili ste zaboravili da Mozilla u svojem labu ima jako zanimljiv koncept mobilnog uređaja. Ima čak i taj vražji dock o kojem ja pričam godinama da je potreban pametnim telefonima. U džepu nosite sasvim pristojno računalo, nije vam potreban laptop jer se taj pametnjaković može spojiti na dock i uz dodatnu tipkovnicu (prividnu ili pravu) i zaslon omogućiti odrađivanje 95% stvari koje inače radite na računalu.

Repozitorij projekta je otvoren (postoji samo README.md), tu je i wiki, a možete ih pratiti i na Twitteru. Ako u slijedećih 6 mjeseci ne naprave nešto što se može instalirati na rootani Android uređaj onda nema nade za njih.

18. 07. 2011.

Hrvatske Android aplikacije – 2011

Prošlogodišnja lista domaćih Android aplikacija pokazala se vrlo popularnom, no kako se u svijetu mobilnih aplikacija stvari jako brzo mijenjaju, lista je već poprilično zastarjela. Zato sam odlučio napraviti novu listu sa osvježenim podacima za 2011. godinu.

Ovogodišnja lista podjeljena je u dvije kategorije: obične aplikacije i (ne)službene aplikacije portala i medija. Aplikacije sam uvrštavao prema određenim kriterijima, poredane su abecedno, a u zagradi je naveden približni broj instalacija (prema javno dostupnim podacima iz Marketa).

Aplikacije

  • Bela MiVi – spremanje rezultata u Beli (1000 – 5000)
  • Biljeske – pisanje bilješki s mogućnošću pretraživanja (100 – 500)
  • Bonbon info – informacije za korisnike Bonbon mreže (100 – 500)
  • Burza.ZG – trenutne cijene dionica na Zagrebačkoj Burzi (1000 – 5000)
  • Croatian Keyboard – Hrvatska tipkovnica temeljena na Android SDK primjeru (10000 – 50000)
  • Croatian Tourist Guide – pretraživanje turističkih odredišta i smještaja u Hrvatskoj (vuče podatke sa www.crotouristguide.com) (1000 – 5000)
  • Croatian tourist navigator – aplikacija za turiste – smještaj, prijevoz, informacije (1000 – 5000)
  • CRO CityInfo – lakše snalaženje u hrvatskim gradovima (1000 – 5000)
  • CroNightLife – pregled mjesta za izlaske (100 – 500)
  • DEMANO izračun plaća – izračun bruto i neto plaće (500 – 1000)
  • Formit – jednostavno kreiranje online obrazaca (100 – 500)
  • Gastro Croatia – pregled ponude restorana i njihovih kuhinja, specijaliteta u Hrvatskoj (100 – 500)
  • Horvat Andro – aplikacija za Android uređaje koja prikazuje najnovije informacije iz hrvatskog internetskog prostora (10000 – 50000)
  • HNB exchange rate – tečaj Hrvatske Narodne Banke (1000 – 5000)
  • HRT Teletext – aplikacija za čitanje HRT Teleteksta (5000 – 10000)
  • HT Imenik – pretraživanje imenika, restorana, bankomata, hotela ili ljekarni (500 – 1000)
  • HZnet – aplikacija za dohvat, obradu i prikaz voznog reda Hrvatskih željeznica (500 – 1000)
  • Kamata X – izračun potraživanja (500 – 1000)
  • Kid’s Alphabet lite – igra za učenje abecede (5000 – 10000)
  • MAXtv Vodič – vodič za MAXtv programe, upravljanje Snimalicom, pregled sadržaja u Videoteci (1000 – 5000)
  • mPlaćanje – plaćanje parkinga, garaže ili javnog gradskog prijevoza putem SMS-a u raznim gradovima Hrvatske (2911)
  • Peludna prognoza – informacije o sezoni cvjetanja pojedinih biljaka (500 – 1000)
  • Planet 9 – pristup T-Com Planet 9 biblioteci (100 – 500)
  • Poštanski broj – pregled poštanskih brojeva i ureda unutar Republike Hrvatske (1000 – 5000)
  • Praznik – pregled državnih praznika i blagdana po godinama (uključujući Uskrs i Tijelovo) (1000 – 5000)
  • Rijeka Bus – vozni red i mape javnog gradskog prijevoza grada Rijeke (500 – 1000)
  • Rijeka Webcam – pregled slike sa sedam web kamera po Rijeci (500 – 1000)
  • Rodjos – pregled nadolazećih rođendana i obljetnica (500 – 1000)
  • Safe+ – spremanje korisničkih imena i lozinki za web stranice (100 – 500)
  • ShopMaster ‘lite’ – akcije, popusti te lokacije i radno vrijeme za supermarkete u Hrvatskoj, podaci sa supermarketi.info (100 – 500)
  • Slooshaj! – aplikacija za slušanje hrvatskih radio stanica putem Interneta (5000 – 10000)
  • Slušaj Radio! – slušanje hrvatskih radio stanica putem Interneta (10000 – 50000)
  • Virtualni Atlas – prikaz osnovne anatomske strukture mišićno-koštanog sustava (5000 – 10000)
  • Tko me zove – omogućava automatsku identifikaciju pozivatelja ili pošiljatelja SMS poruke koji nije upisan u kontakte na mobilnom uređaju (1000 – 5000)
  • Trambus – lakše snalaženje u javnom prijevozu grada Zagreba automatski računajući rute, locirajući najbliže stanice, prikaz voznog reda, prikaz stanica/linija na karti (1000 – 5000)
  • TVDroid – TV vodič, podržava oko 280 TV postaja u Hrvatskoj i široj regiji te popularne satelitske programe (10000 – 50000)
  • TV Raspored – TV Raspored služi brzom pregledu tjednog TV programa za 6 glavnih programa: HRT 1, HRT 2, NOV@ TV, DOMA TV, RTL i RTL 2 (5000 – 10000)
  • Vodič za vina – vodič kroz vina Badel 1862 (100 – 500)
  • Vrhunsko – informacije o različitim proizvodima i uslugama visoke kvalitete u Hrvatskoj (100 – 500)
  • Zurne sluzbe – pozivanje žurnih službi u Republici Hrvatskoj
  • Aplikacije medija / portala

    Lista sadrži aplikacije koje su namjenjene za praćenje točno određenog portala ili medija. Neke od njih su službene a neke neslužbene.

    Kriteriji uvrštenja

    Broj domaćih aplikacija značajno se povećao od prošle godine pa bi uvrštavanje gomile aplikacija sa Marketa listu učinilo prilično beskorisnom. Zato sam se prilikom slaganja liste vodio za nekoliko kriterija:

    Zahtjev da zadnji update aplikacije bude iz 2011 znači da nisu upale aplikacije poput vrlo popularne 24sata (10000 – 50000 instalacija) ili moje Novine, ali negdje je trebalo povući crtu – veliki broj tih aplikacija možete naći na prošlogodišnjem popisu.

    Trudio sam se da nove liste budu što potpunije, no ukoliko sam propustio koju aplikaciju koja odgovara kriterijima, javite mi u komentarima te ću je dodati.

    13. 07. 2011.

    Hakiranje prema naprijed

    Oni koji me prate na Twitteru mogli su proteklih dana uočiti nekoliko tweetova poslanih pod hashtagom #build06 – riječ je o internom eventu projekta HackFwd, ukupno šestom po redu.

    HackFwd se hrvatskoj publici prvi put predstavio na lipanjskoj Startup Srijedi u Zagrebu, točno na prvu godišnjicu svog postojanja, kad je njihov talent geek David Bizer ukratko pojasnio o čemu je riječ. Pokrenut od strane Larsa Hinrichsa, osnivača jedinog donekle uspješnog LinkedInovog konkurenta Xinga, HackFwd je na prvi pogled još jedan u nizu startup akceleratora (ili inkubatora, kako ih ponekad nazivaju), koji posljednjih godina posebno u Europi niču kao gljive poslije kiše, a koje je potaknuo uspjeh pionirskih projekata kao što su američki Y Combinator te britanski Seedcamp.

    Proces prijave

    Ipak, HackFwd se od sličnih projekata značajno razlikuje po procesu prijave, kao i načinu ulaganja. Za razliku od većine drugih akceleratora, HackFwd nema fiksne natječajne rokove, već je proces prijave uvijek otvoren; također, prijava se izvodi kroz posebnu Web aplikaciju, nazvanu Phase2Generator. Ta aplikacija ima dvije funkcije, a osnovna je da poduzetnicima pomaže da fokusiraju svoj startup odgovarajući na pitanja o poslovnom modelu, tehnološkoj platformi, ciljnoj skupini itd. P2G možete koristiti čak i ako se ne želite prijaviti u HackFwd, a on će vam pomoći da se usmjerite i definirate sve važne aspekte svog startupa, što vam može pomoći i da odlučite trebale ti uopće vanjskog investitora ili ne. Ukoliko se, pak, želite prijaviti kao kandidat za ulaganje od strane HackFwda, u aplikaciji samo trebate dodatno odabrati tu opciju, te izabrati jednog od referera.

     

    The HackFwd team at Build 0.6

    Refereri su druga specifičnost HackFwdovog procesa prijave; iako se prijaviti možete i bez referera, korisno je provjeriti imate li kojeg u svojoj blizini. Funkcija referera je da pogleda prijavljeni startup te ukoliko je potrebno da ga usmjeri na koji se način može približiti kriterijima kojima HackFwd ocjenjuje prijavljene startupe. Također, Lars i ostali članovi upravnog odbora prije će proučiti startup koji je stigao od nekog od referera i koji je dobio njegovu preporuku.

    (Ovdje bih želio napomenuti, za one koji to nisu već saznali preko Twittera i drugih alata, kako je moja malenkost prije nekih mjesec dana primljena u tim HackFwdovih referera, i u tom svojstvu sam pozvan na Build 0.6. Kako sam jedini u ovom dijelu Europe, pozivam sve startupe s područja bivše Jugoslavije koji bi htjeli potražiti financije u ovom projektu, da me odaberu kao referera prilikom popunjavanja Phase2Generatora – a slobodno mi se mogu javiti i prije nego što ga idu popunjavati, s bilo kakvim pitanjima.)

    Pristigli projekti kontinuirano se analiziraju, između ostalog i uz pomoć ostalih referera i drugih stručnjaka nazočnih na Build eventima, koji se inače održavaju svaka tri mjeseca. Tako smo i na upravo održanom Build 0.6 imali priliku pogledati i ocijeniti video pitcheve desetak potencijalnih ulaganja, od kojih su najzanimljiviji bili… Uh, ne smijem reći, ali vjerujte mi na riječ da je bilo dosta zanimljivih, ali i da među startupima iz Hrvatske i ostatka regije ima i znatno kvalitetnijih od nekih koje smo vidjeli. :)

    HackFwd se pri odabiru projekata drži određenog niza kriterija, od kojih je možda najspecifičniji taj da se prvenstveno traže tehnički osnivači, odnosno kako je to David rekao u Zagrebu, očekuje se da svaki osnivač mora biti u stanju pisati programski kod. Čest je slučaj na startupe pokreću ljudi bez tehničkih znanja – marketingaši, prodavači i slično – te potom traže tehničke suosnivače koje će njihove ideje pretočiti u stvarnost. To samo po sebi nije ništa loše, tako su nastali i Amazon i eBay, ali takva je jednostavno politika HackFwda. Od referera se između ostalog očekuje i da procijeni razinu znanja tehničkih osnivača, za što imaju ugovor sa sajtom za testiranje razine tehnološkog znanja Codility.

    Što se tiče razine projekta, od osnivača se očekuje da imaju bar nešto za pokazati, tj. da su napravili bar neke korake u smjeru tehnološkog razvoja – klikabilni demo, temeljni prikaz aplikacije i slično. Važan je i broj osnivača, jer zbog konceptu ulaganja HackFwd ne ulaže u projekt koji ima više od tri osnivača.

    Ulaganje

    Interni naziv za startup koji je ušao u HackFwd i primio ulaganje je HackBox, a ono po čemu je ovaj akcelerator još specifičan jest i oblik ulaganja. Kao prvo, za razliku od drugih akceleratora koji ulažu iznose u rasponu od 20.000-50.000 EUR tražeći zauzvrat udio od oko 5-10%, iznos kojeg ulaže HackFwd izravno je vezan uz broj osnivača: za projekte sa samo jednim osnivačem to iznosi 91.000 EUR, za tim od dva osnivača iznos je 141.000 EUR, a za tri 191.000 EUR. Pritom nije važno kako osnivači međusobno podijele svoj udio, to prepuštaju njima.

    Drugo, u zamjenu za navedenu investiciju HackFwd uzima relativno velik udio – punih 27%, dok dodatnih 3% rezerviraju kako bi se podijelili među mentorima koje HackFwd može preporučiti startupima ako je potrebno. No, iako to naizgled djeluje puno, treba imati na umu da to znači kako primjerice tvrtku s tri osnivača, koja nema još niti proizvod, vrednuje na gotovo pola milijuna eura u samom startu, isključivo na temelju procjene o kvaliteti osnivača.

    U protekloj godini HackFwd je uložio u devet HackBoxova, o kojima možete više pročitati na HackFwdovom siteu.

    Taj site je inače vrlo dobar izvor odličnih resursa i materijala koje vam svakako savjetujem da proučite. Prije svega vas upućujem na stranicu HackFwd Experience, na kojoj možete steći uvid u specifičnosti ovog projekta –  posebno upućujem na dokument What We Offer –  a tu je i niz vrlo korisnih alata kao što je HackFwd blog, kalkulator dilucije, standardni ugovor (odnosno Geek Agreement) te naravno link na Phase2Generator.

    Prijava u HackFwd

    Dakle, ukoliko ste od jednog do trojice programera s jasnom idejom za aplikaciju (po mogućnosti na području Weba ili mobilnih uređaja) koja cilja na potrošačko tržište (B2C) na globalnoj razini, te biste voljeli pokušati osigurati financiranje da tu ideju razvijete do razine proizvoda i uspješnog businessa, pozivam vas da popunite Phase2Generator. A ukoliko ste na području bivše Jugoslavije svakako odaberite mene kao referera, pa ću vam se izravno javiti da popričamo o vašem projektu i analiziramo koliko se uklapa u HackFwdove kriterije.

    Uz malo sreće (i puno truda), možda i vaš projekt bude prihvaćen za ulaganje, pa ćete nam se pridružiti na jednom od narednih Build evenata. Na siteu Passion Meets Momentum nalaze se slike i filmovi sa svih dosad održanih Buildova, a uskoro će biti postavljeni i ovogodišnji, pa slobodno pogledajte, poslušajte savjete i pronađite inspiraciju.

    09. 07. 2011.

    A CLI runner module for Python

    Recently I had to write several Python scripts to be run from command line or cron. They didn’t need elaborate parameter parsing, so I didn’t bother with optparse or argparse modules. I just needed something to get the strings from the command line, interpret the first one as a command, and the rest as the parameters.

    I happen to use this pattern for CLI utilities a lot, so at some point I abstracted it in a small module that does it for you automatically: clirunner.

    The module exports just one class, CLIRunner, which you need to extend and add methods to it – one method for each command. The runner will take care of exposing them as commands, making sure they’re called with the right number of arguments, and provide help to the user. Class and method docstrings are used for the help info.

    CLIRunner does this by using the standard inspect module, which makes it easy to have code poke at itself, look up methods, docstrings and various other interesting introspection bits.

    An example

    Here’s a simple example:

    from clirunner import CLIRunner
    class HelloWorld(CLIRunner):
        "A simple Hello World application."
        def hello(self):
            "Print standard greeting."
            print "Hello World!"
    
    if __name__ == '__main__':
        HelloWorld()
    

    gives:

    $ python hello.py
    HelloWorld - A simple Hello World application.
    Usage: hello.py COMMAND [ARGS...]
    Commands:
        hello - Print standard greeting.
    

    The code is open source, available on GitHub. Use it, fork it, send pull requests.

    04. 07. 2011.

    Fedora in Public Libraries


     
    Our local Linux Users Group in my home town of Osijek has started workshops called knowledge exchange in partnership with our public library. So first step was to install Fusion Linux Fedora Remix on their PCs.
     
    Are there other examples with Fedora being rolled out in public libraries or in some other public institutions? I would be really interested with their experiences.
     
    In my example there are 6 PCs that are used by any member of library, usually those are primary and high school kids. They come here and most of their activities are watching youtube, logging onto facebook and playing flash games.
     
    Their primary OS is Windows XP with Windows SteadyState enabled. I found out that they decided to use Windows SteadyState because they had problem monitoring kids and they would leave p2p apps running and downloading music and video files and come back a day later with hard drives to save them onto. Obviously that is not what they want kids to do so by enabling Windows SteadyState any files downloaded are erased by reboot. This policy probably also removes most virus issues, both because kids don’t plug any usb devices and because any changes are erased.
     
    First issue I came across was that Anaconda installed and GParted wouldn’t resize single windows ntfs partition because there were some errors on hard drive. I tried logging into Administrator account and running chkdsk /f but that didn’t help, even with option that Windows SteadyState merges changes. I didn’t want to disable Windows SteadyState so I reverted to boooting of Windows live CD and running chkdsk /f from repair console. That fixed the issues on all machines.
     
    I didn’t have good experience with Anaconda ntfs resize so I used GParted to resize ntfs partitions. GParted worked perfectly on all machines without issues.
     
    After installing Fusion Linux I did these post install tweaks:
    * Change grub entry “Windows XP” from “other”
    * Change grub entry to Fusion Linux 14 from Fusion Linux 14.1 (2.6.35.13-92.fc14.i686)
    * Put 10 seconds wait in grub menu
    * Enable automatic login
    * Disble screensave password lock
    * Enable automatic updates
    * Put Firefox, Chromium and Teeworlds icons on desktop
     
    What would be best way to enable “Windows SteadyState” equivalent in Fedora? Brute force way would be a simple script that deletes all files in user home folder. Are there some more subtle ways? And how to make some changes permanent while making all other changes transient? Using unionfs seams like a bit of a overkill… Any suggestions are welcome.
     

    Google caught cheating in Android@Home demo

     
    You would expect that Google will use Android@Home protocol in it’s Android@Home demo [1], right?
     
    Well it looks like Google got caught cheating. It looks like Google has actually used equipment from Synapse Wireless [3] and their protocol called Snap [4], and not their own, in-house developed Android@Home protocol.
     
    Why did they do that? My guess is that they have limited developer resources who could code such a complicated protocol and wanted to do field survey how would press, other companies and general public react before they pored expensive development hours into questionably interesting product.
     
    Nice try Google, but it is still cheating.
     
    I would like to share comment from LinuxMCE [5] (most advanced smart home solution and it runs in Linux) forums by Darren:
     
    “Interesting…. but Google would have to buy it and open it up a bit more for it to provide a real alternative.
    From the Synapse website “Synapse Wireless Inc. provides patented hardware and software technology that helps tie together devices for remote monitoring and control.”
    So in terms of an application layer free of patents – not at the moment. But perhaps Google will but the company, open source the stack and donate the patents to one of the open consortium’s.
    We’re still in for a bit of waiting it seems.”
     
    I really hope that either Google buys Synapse Wireless and releases it’s patents to one of open consortium’s or does so with their own (hopefully in development) Android@Home protocol.
     
    [1] Android@Home demo at Google Keynote
    [2] Google’s Android@Home – The plot thickens…
    [3] Synapse Wireless
    [4] Snap protocol
    [5] LinuxMCE

    29. 06. 2011.

    Da li je Nokija mogla krenuti boljim putem?

    Od najave zajedničke suradnje već smo stigli i do slučajno iscurjele slike prvog Nokijinog WP7 uređaja. Najava zajedničke suradnje pratilo kod nekih je izazvalo izljeve oduševljenja jer su zbrojili Microsoft + Nokija = to mora uspjeti. U IT svijetu to nije uvijek tako, ili skoro nikada nije tako. Nokija je napravila jednu veliku grešku u koracima. Godinu, u kojoj se sva predviđanja svode na to da pogode veliki postotak rasta tržišta pametnih telefona, Nokija je odlučila prespavati. Bude imala tu i tamo neke uređaje na platformama kojih se odriče. Developeri napuštaju brod koji tone. Nekima je srcu prirastao OS prekratkog daha pa sad pišu peticije da se sačuva. Dionica pada, tržišni udio se topi kao snijeg u svibnju, i nikako ne možemo samo tako odbaciti nagađanja da je Elop došao u Nokiju kako bi joj srušio cijenu pa da Microsoft potroši što manje novaca u novoj velikoj kupnji.

    Microsoft je također napravio grešku obećavajući Nokiji prava koji ostali proizvođači WP7 uređaja nemaju. Jedan Samsung, koji gura i svoj OS, sigurno neće igrati na WP7 kartu. Slično je i s ostalim proizvođačima kojima se sigurno ne dopada činjenica da su podređeni Nokiji.

    Nokija je definitivno u silaznoj putanji i ne gospodari svojom sudbinom. Da li je moglo biti drugačije? Vjerujem da bi Nokija puno više profitirala da je kupila Palmov WebOS. Imala bi OS koji bi mogao zamijeniti zalutali Symbian. Bolja podrška za developere i jednostavniji razvojni alati zacijelo bi pomogli brzom rastu broja aplikacija. Kvalitetan Nokija hardver i odličan WebOS bili bi dobitna kombinacija. Pretpostavljam da bi Nokija puno brže uhvatila ritam od HP-a i da smo već u prvoj polovici ove godine mogli imati nekoliko uređaja koji bi se našli baš na vrhu vala rasta tržišta pametnih telefona.

    Smiješni su mi analitičari koji predviđaju tržišne postotke tako što oduzmu postotak od Symbiana i dodaju ga u WP7 stupac. Ti su izgleda jako podcijenili snagu HP-a i njegove mogućnosti da progura novu platformu. Priča se o licenciranju WebOS-a. Što ako Samsung, LG i HTC počnu s izradom uređaja na toj platformi? Iako imamo cijelu paletu Android tableta njihov tržišni udio je zapravo smiješno malen. Na jednoj strani tržišta imamo skupe uređaje s ne baš prilagođenim Androidom, a na drugoj strani su jeftini uređaji nedovoljne procesorske snage. To je tržište na kojem bi WebOS mogao započeti svoje dokazivanje. Velika prilika za njega je poslovni svijet u kojem bi pregledno i intuitivno sučelje te odlična integracija s društvenim mrežama i web servisima mogli biti dobitna kombinacija.

    I dok Nokija uživa u godini odmora, TouchPad s WebOS-om bi vrlo lako mogao zasjesti na drugo mjesto na tržištu tableta. Prvo je još predaleko i rezervirano za iPad. I Nokija, zar nije moglo bolje?

    Python Hrvatska

    Ponukani kolegama Rubijašima, i hrvatski Pythoniste (Pythonaši? :) počeli su se lagano okupljati.

    Pred nekoliko tjedana nas je ekipa iz 24 sata digital ugostila organizirajući Python/Django meetup, a danas smo pokrenuli i Google grupu za korisnike Pythona iz Hrvatske.

    Ideja je da grupa posluži ne samo kao help kanal, nego i kao medij za razmjenu iskustava, raspravljanje o stvarima vezanima uz Python (od editora do Django appova, tutoriala gdje i kako hostati Python stranice, ponude ili potražnje Python poslova u .hr i slično), kao i za dogovaranje (hopefully redovitih) okupljanja. Dakle, sva diskusija i komunikacija vezana uz Python je dobrodošla.

    Zasad nas ima 10tak, a kako znamo da korisnika Pythona u Hrvatskoj (kao i onih koji će to tek postati, sorry g. Sirišćević :) ima puno više, pozivamo vas da nam se pridružite i da javite svojim kolegama. The more the merrier!

    Pogledati arhivu liste kao i pridružiti se možete ovdje.

    26. 06. 2011.

    Building a VDR with Arch Linux

    Early in the last decade I had a so called SatDSL subscription, it was very expensive but the only way to get decent bandwidth. With the subscription I received a DVB-S PC tuner, a Technisat SkyStar2. A few years later when the subscription ran out I was left with the tuner and got interested in other ways of using the hardware. Those were some dark times for content providers, encryption systems were getting hacked left and right. The Wired magazine ran a great piece a few years ago about this period. Personally I was more interested in network traffic at the time, as a lot of it was not encrypted.

    I used VDR software back then to build an approximation of a commercial SAT receiver. A friend put together an infra-red receiver for use with LIRC and I was set. With the rising popularity of HDTV and the DVB-S2 standard my current 'receiver' was getting outdated. It had a Duron 1200 CPU, with 300MB of SDRAM and a 320GB of storage. I was putting money on the side for several years to build a replacement (and get an appropriate HD TV set), and finally did it this year. These past few months I used Arch Linux with VDR, and built it piece by piece as a hobby. On the hardware side I used:

    MBO: Asrock M3AUCC
    CPU: AthlonII X3 455
    RAM: 4GB DDR3
    HDD: 1TB disks (RAID1)
    GFX: GeForce GT240 (VDPAU)
    DVB: SkyStar HD2 (DVB-S2 tuners)
    LCD: Philips 43" HDTV
    I didn't go with one of the Ion systems, because I don't watch that much TV, and the box will be put to many other uses (backups, TOR gateway, media streaming, distributed compiling, etc.). Every piece was carefully selected, and folks on the VDR mailing list helped me choose a suitable graphics card for HDTV, with good VDPAU support. As usual with Linux even that careful selection wasn't enough to ensure a smooth ride.

    The sound-card drivers were deadlocking the machine, and it took a few days of experimentation to resolve it. The SkyStar HD2 cards work great with the mantis driver, but support for their infra-red receiver is missing. However experimental support is available through a patch published on the Linux-media mailing list, earlier this year.

    All my previous VDRs were powered by Slackware Linux, and I developed some habits and preferences in running VDR. So I didn't use the ArchVDR project, or VDR packages, although they are good projects. I prefer to keep every VDR installation under a single directory tree, with the one currently in use always being symlinked to /opt/VDR. I swap them a lot, always patching (liemikuutio, ttxtsubs...), and testing a lot of plugins.

    Instead of using runvdr and other popular scripts for controlling VDR I wrote my own script long ago. I call it vdrctl, it's much simpler but provides extensive control over loaded plugins and their own options, and has support for passing commands directly to a running VDR with svdrpsend. As the window manager I used awesome this time, opposed to FVWM that can be seen in this old gallery. Awesome runs in a fullscreen layout, and with some useful widgets.

    For playing other media my long time favorite is Oxine, a Xine frontend well suited for TV sets. But I don't use its VDR support as one might expect (I use the vdr-xine plugin with regular xine-ui), instead I connect VDR with Oxine through the externalplayer-plugin. It's special in that it breaks the VDR connection to LIRC prior to launching an external player allowing to seamlessly control both applications.

    Arch Linux makes it easy to build your own packages of all the media software to include VDPAU support. Official mplayer already has it, Xine is available in the AUR as xine-lib-vdpau and so on. But even more important, the good packaging infrastructure and management makes it easy to build and maintain custom kernels (for IR support ie.). It truly is the perfect VDR platform.

    Site info

    Planet Linux.hr is an aggregation of Linux and Open Source themed blogs written by Croatian people from the whole wide world. Blog entries aggregated on this page are owned by, and represent the opinion of the author.

    Planet Linux.hr je skup blogova sa Linux i open source tematikom koje pisu nasi ljudi u domovini i inozemstvu. Clanci sakupljeni na ovoj stranici su u vlasnistvu i predstavljaju misljenje svojih autora.

    Last time updated: 17. 05. 2012. 03:01

    Aggregated blogs:

    If you want your blog to be aggregated on this planet, contact Senko Rasic.