<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0">
   <channel>
      <title>Dobrica Pavlinušić&apos;s Weblog / Blog</title>
      <link>http://blog.rot13.org/</link>
      <description>Personal weblog about technology, Open Source, perl, GNU etc...</description>
      <language>en</language>
      <copyright>Copyright 2008</copyright>
      <lastBuildDate>Tue, 03 Jun 2008 13:25:49 +0100</lastBuildDate>
      <generator>http://www.sixapart.com/movabletype/</generator>
      <docs>http://blogs.law.harvard.edu/tech/rss</docs> 

      
      <item>
         <title>Subversion downgrade and permission errors</title>
         <description><![CDATA[We had a double-disk failure on RAID5 array last week (yes, it does happen). One of things that got affected was our source code repository.
<p>
So, we reinstalled etch and installed subversion, did <tt>svnadmin verify</tt> on repository and all seemed well until we tried to commit using <a href="http://svnbook.red-bean.com/en/1.1/ch06s04.html">SVN DAV</a>. Apache's error log was full of errors like this:
<pre>
Could not create activity /svn/repo/!svn/act/9526cf2d-4893-4b35-a843-4c0f2d9f8bc6. [500, #0]
could not open dbm files. [500, #120022]
Can't open activity db: APR does not understand this error code [500, #120022]
</pre>
<em>But, permissions where correct!</em> In utter desperation, I even tried <tt>chmod 777</tt> on repository (kids, don't try this at home!) but it didn't help.
<p>
What <em>did help</em> was:
<pre>
mkdir repo.new
svnadmin create repo.new
svnadmin dump repo | svnadmin load repo.new
mv repo repo.old
mv repo.new repo
</pre>
Checking created repository with <tt>diff</tt> showed that it was indeed changed:
<pre>
Binary files repo.old/dav/activities and repo/dav/activities differ
diff -rw repo.old/db/current repo/db/current
1c1
< 59 r9 1
---
> 62 ra 1
Only in repo/db/revprops: 60
Only in repo/db/revprops: 61
Only in repo/db/revprops: 62
diff -rw repo.old/db/revs/10 repo/db/revs/10
4c4
< id: aq.0.r10/17
---
> id: e1.0.r10/17
6c6
< pred: aq.0.r8/1443323
---
> pred: e1.0.r8/1443490
16c16
< dir b0.0.r8/1443476
---
> dir av.0.r8/1443643
</pre>
and so on, for pages and pages.
<p>
I don't feel very good about changes, but repository was created with newer version from backports, and this time we used version from etch (thus downgrading from 1.4.6 to 1.4.2).
<p>
The whole point of this post is to help some random Google user with downgrade of subversion. So, here you have it!]]></description>
         <link>http://blog.rot13.org/2008/06/subversion_downgrade_and_permission_errors.html</link>
         <guid>http://blog.rot13.org/2008/06/subversion_downgrade_and_permission_errors.html</guid>
        
          <category domain="http://www.sixapart.com/ns/types#category">howto</category>
        
        
          <category domain="http://www.sixapart.com/ns/types#tag">subversion</category>
        
         <pubDate>Tue, 03 Jun 2008 13:25:49 +0100</pubDate>
      </item>
      
      <item>
         <title>Group by data in shell pipes</title>
         <description><![CDATA[My mind is just too accustomed to RDBMS engines to accept that I can't have <a href="http://www.google.com/search?q=sql+group+by">GROUP BY</a> in my shell pipes. So I wrote one <a href="http://svn.rot13.org/index.cgi/perl/view/trunk/groupby.pl"><tt>groupby.pl</tt></a>.
<p>
Aside from fact that it somewhat looks like perl golfing (which I'm somewhat proud of), let's see how does it look:
<pre>
dpavlin@llin:~/private/perl$ ps axv | ./groupby.pl 'sum:($6+$7+$8),10,count:10,min:($6+$7+$8),max:($6+$7+$8)' | sort -k1 -nr | head -10 | align
440947 /usr/lib/iceweasel/firefox-bin        1 440947 440947
390913 /usr/sbin/apache2                    11  22207  39875
180943 /usr/bin/X                            1 180943 180943
135279 /usr/bin/pinot-dbus-daemon            1 135279 135279
122254 mocp                                  2  25131  97123
 84887 pinot                                 1  84887  84887
 78279 postgres:                             5  10723  21971
 70030 /usr/bin/perl                         6   6959  15615
 50213 /bin/bash                             7   6351   7343
 49266 /usr/lib/postgresql/8.2/bin/postgres  2  24631  24635
</pre>
This will display total usage for process, it's name, number of such processes and range of memory usage. We can then use old friend <a href="http://svn.rot13.org/index.cgi/scripts/view/trunk/sum.pl"><tt>sum.pl</tt></a> to <a href="http://blog.rot13.org/2008/05/bag_of_useful_scripts.html">produce console graph</a>, but I already wrote about it.
<p>
So, let's move to another example, this time for <a href="http://openvz.org">OpenVZ</a>. Let's see how much memory is each virtual machine using (and get number of processes for free):
<p>
<pre>
$ vzps -E axv --no-headers | ./groupby.pl 'sum:($7+$8+$9*1024),1,count:1'
2209504127 0 265
611768242 212024 38
162484775 212037 19
170797534 212052 38
104853258 212226 26
712007227 212253 21
</pre>
But wouldn't it be nice to display hostnames instead of VEID numbers? We can, using <tt>--join</tt> and <tt>--on</tt> options (which are really backticks on steroids):
<pre>
$ vzps -E axv --no-headers | ./groupby.pl 'sum:($7+$8+$9*1024),1,count:1' --join 'sudo vzlist -H -o veid,hostname' --on 2                                 
2146263206 0 259
675835528 saturn.ffzg.hr 40
162484775 arh.rot13.org 19
170797534 koha-dev.rot13.org 38
104853258 koha.ffzg.hr 26
712011323 zemlja.ffzg.hr 21
</pre>
Which brings us to final result:
<pre>
$ vzps -E axv --no-headers | ./groupby.pl 'sum:($7+$8+$9*1024),1,count:1' --join 'sudo vzlist -H -o veid,hostname' --on 2 | sort -rn | align | ./sum.pl -h
0                  260   2105M OOOOOOOOOOOOOOOOOOO                  2105M
zemlja.ffzg.hr      21    679M OOOOOO-------------------            2784M
saturn.ffzg.hr      35    512M OOOO--------------------------       3296M
koha-dev.rot13.org  38    162M O------------------------------      3459M
arh.rot13.org       19    154M O--------------------------------    3614M
koha.ffzg.hr        26     99M ----------------------------------   3714M
</pre>
So, here you have it: <em>SQL like query language for your shell pipes</em>.]]></description>
         <link>http://blog.rot13.org/2008/05/group_by_data_in_shell_pipes.html</link>
         <guid>http://blog.rot13.org/2008/05/group_by_data_in_shell_pipes.html</guid>
        
          <category domain="http://www.sixapart.com/ns/types#category">code</category>
        
          <category domain="http://www.sixapart.com/ns/types#category">hack-of-the-week</category>
        
        
          <category domain="http://www.sixapart.com/ns/types#tag">OpenVZ</category>
        
          <category domain="http://www.sixapart.com/ns/types#tag">perl</category>
        
          <category domain="http://www.sixapart.com/ns/types#tag">shel</category>
        
         <pubDate>Thu, 22 May 2008 14:46:14 +0100</pubDate>
      </item>
      
      <item>
         <title>Bag of useful scripts</title>
         <description><![CDATA[<blockquote>
Why does console refuse to die?
<br>- It's because of pipes!
</blockquote>
This post is result of my long addiction to console applications. Somehow, when I want to get a quick view of things on my system, I always turn to pipes and do something with them. In that process, I developed few of useful scripts for use within shell pipes, and I would like to introduce my readership to them.
<h1>PostgreSQL database size</h1>
When I want to see size of all databases on my system or size of tables in one database I turn to <a href="http://svn.rot13.org/index.cgi/scripts/view/trunk/pg_size">pg_size</a>. It's a short and sweet script which will do a little shell magic (take a look in it) and display size of all databases on system (without any options) or size of all tables in database and number of rows (when used like <tt>pg_size database_name</tt>) like this:
<pre>
dpavlin@llin:~$ pg_size dellstore2 | grep -v sql_
4890624 customers 20000
3153920 orderlines 60350
2678784 cust_hist 60350
991232 products 10000
966656 orders 12000
450560 inventory 10000
8192 categories 16
0 reorder 0
</pre>
This is all nice and well, but doesn't really gives us the right overview, so move along for...
<h1>Nice console graphs</h1>
First, a caveat: this tools assumes that it will get number, space, and optional description. Output above seems to fit into this description, so let's try it:
<pre>
dpavlin@llin:~$ COLUMNS=80 pg_size dellstore2 | grep -v sql_ | sum.pl -h
customers 20000    4776k OOOOOOOOOOOOOOOO                                 4776k
orderlines 60350   3080k OOOOOOOOOO-----------------                      7856k
cust_hist 60350    2616k OOOOOOOOO---------------------------               10M
products 10000      968k OOO-------------------------------------           11M
orders 12000        944k OOO----------------------------------------        12M
inventory 10000     440k O-------------------------------------------       12M
categories 16      8192b ---------------------------------------------      12M
reorder 0              0 ---------------------------------------------      12M
</pre>
This gives us nice output: description (followed by number of rows from above output), and running total of size in human readable form (if you don't like it, remove <tt>-h</tt> flag and you will get raw numbers).
<p>
Let's take another example (if you are still reading this and not interested in PostgreSQL database size). Let's see how much traffic did pppd transfer over very slow GPRS link on 8-day vacation:
<pre>
dpavlin@llin:~$ grep 'pppd.*: Sent' /var/log/messages | awk '{ print $7 + $10 " " $1 " " $2 }' | sum.pl -h
May 5         0                                                               0
May 5       39k                                                             39k
May 5     7512k OO                                                        7551k
May 6     6352b --                                                        7558k
May 6       20k --                                                        7579k
May 6     1183k ---                                                       8762k
May 8     6869k OO---                                                       15M
May 8       70k -----                                                       15M
May 9     3596k O------                                                     18M
May 9     1998k -------                                                     20M
May 10      32M OOOOOOOOOOOO--------                                        53M
May 10      13k --------------------                                        53M
May 11      44M OOOOOOOOOOOOOOOOO--------------------                       98M
May 12      12M OOOO--------------------------------------                 111M
May 13    7120k OO-------------------------------------------              118M
May 13      20M OOOOOOO----------------------------------------------      139M
</pre>
<em>Much more interesting!</em> A long time ago, I had a bunch of quick one-lines which used <a href="http://svn.rot13.org/index.cgi/scripts/view/trunk/sum.pl">sum.pl</a> to produce output from various other system counters, but somehow it got lost.
<p>
As I get only few comments on my blog, if you find this useful, leave one. I have few other examples, like the one which shows top 5 memory eaters on my system:
<pre>
dpavlin@llin:~$ ps v | awk '{ print $8 " " $9 " " $10 }' | sort -rn | ~/private/perl/sum.pl | head -5
# RSS %MEM COMMAND
10.6 /usr/lib/iceweasel/firefox-bin 165092 OOOOOOOOOOOOOO                165092
4.3 perl                             67240 OOOOOO---------------         232332
0.5 awesome                           8504 ---------------------         240836
0.4 irssi                             6632 ----------------------        247468
0.3 vi                                5888 ----------------------        253356
</pre>
but, if this is not interested to my readership, tell me so, and I will stop spamming your already full RSS reader with console output! <tt>:-)</tt>]]></description>
         <link>http://blog.rot13.org/2008/05/bag_of_useful_scripts.html</link>
         <guid>http://blog.rot13.org/2008/05/bag_of_useful_scripts.html</guid>
        
          <category domain="http://www.sixapart.com/ns/types#category">code</category>
        
          <category domain="http://www.sixapart.com/ns/types#category">hack-of-the-week</category>
        
        
          <category domain="http://www.sixapart.com/ns/types#tag">PostgreSQL</category>
        
          <category domain="http://www.sixapart.com/ns/types#tag">ppp</category>
        
          <category domain="http://www.sixapart.com/ns/types#tag">shell</category>
        
         <pubDate>Thu, 15 May 2008 21:41:19 +0100</pubDate>
      </item>
      
      <item>
         <title>State of linux wifi (first week with OLPC)</title>
         <description><![CDATA[So It has been a week from time when borrowed OLPC entered my family of computers. I have Thinkpad T60 with Atheros AR5212 (which works with atk5k driver from 2.6.25, nice work!) and Eee PC with Atheros (which works with special madwifi patch).
<p>
Since 802.11s just landed into upstream kernel git, I was eager to take a look at this mash network thing. Oh, how ignorant I was. OLPC uses 802.11s protocol which is different from <a href="http://www.open80211s.org/">official implementation of 802.11s</a> and with good reason: they are using embedded processor in wifi card do to mash protocol for them (saving power and enabling mash to work when laptop is suspended). I could have installed <a href="http://www.olsr.org/">olsr</a> on OLPC, but I'm really trying to have bigger mash which is compatible with unmodified OLPCs.
<p>
Because my time is limited, I would like to work in user-land if at all possible, and since wpa_supplicant can work on unmodified kernels, it would be nice to have that level of support for OLPC mash also. After a lot of browsing (and reading few really great wifi hacking sites), I concluded that only hope is <a href="http://www.radiotap.org/">radiotap</A> which is more-or-less supported on every pcmcia wifi card that I have (prism based 802.11b card and rt2500). I had also found <a href="http://penumbra.warmcat.com/_twk/tiki-index.php?page=packetspammer">simpliest possible code which uses radiotap</a> to start with.
<p>
Now, I would just need another OLPC to save some network traces and start experimenting <tt>:-)</tt>
<p>
Aside from that, I switched totally to OLPC for this week, and amazingly enough, I didn't miss my Eee PC one tiny bit. Although a bit slower than Eee, OLPC screen is bigger (and better in black and write mode on sunlight) which helps a lot with web pages. Browser performance is amazing, so I have little doubt that we will be able to support most of web sites on OLPC without much problem. OOH, I did notice a couple of excessive round-tips on one of my web sites, while surfing on it, but that's for best anyway :-)
<p>
<em>Update:</em> According to <a href="http://lists.infradead.org/pipermail/libertas-dev/2008-May/001537.html">message on libertas-dev mail list</a> there is effort to use kernel's 802.11s implementation which makes my effort in supporting OLPC variant obsolete.]]></description>
         <link>http://blog.rot13.org/2008/04/state_of_linux_wifi_first_week_with_olpc.html</link>
         <guid>http://blog.rot13.org/2008/04/state_of_linux_wifi_first_week_with_olpc.html</guid>
        
          <category domain="http://www.sixapart.com/ns/types#category">hack-of-the-week</category>
        
        
          <category domain="http://www.sixapart.com/ns/types#tag">linux</category>
        
          <category domain="http://www.sixapart.com/ns/types#tag">olpc</category>
        
          <category domain="http://www.sixapart.com/ns/types#tag">wifi</category>
        
         <pubDate>Wed, 30 Apr 2008 00:17:37 +0100</pubDate>
      </item>
      
      <item>
         <title>First day with OLPC</title>
         <description><![CDATA[Part of my day job (and reason why I love it) is working with guys from <a href="http://olpccroatia.org/">OLPC Croatia</a> in spreading a word and intention of this project. Yesterday we had great presentation in Varaždin and they are interested in pilot project.

With news <a href="http://arstechnica.com/news.ars/post/20080422-exodus-of-key-figures-from-olpc-a-troubling-sign-for-project.html">like this</a> it seems that we are fighting windmills. I hope that we are not wrong to invest time and effort into this since my first day of experience with little green thing is very positive.

For a start let me clear some doubts: it is slow machine. Keyboard is really different (much worse than Eee PC for example), but if you don't press it harder than needed (which was my problem) it's actually O.K. It's also heavier than Eee PC (which somehow I noticed carrying it around) but other than that it <b>great machine</b>.

Having said that, I had problems with associating to my AP (so I used scripts for that), but as a real Linux user, I decided to take a look at it. From that point on, things improved: first i noticed very nice upgrade mechanism with allowed me to upgrade to build 703 which works great. This build is not final, so it comes without any Actions (think of them as applications installed on OLPC), but installation of Action pack from USB stick is really easy (it's also possible to upgrade system using USB stick if you don't have network).

The only show-stopper problem that I now have is <b>how to buy OLPC</b>? I don't even know if we can order just 2000 units for pilot program, but I would really love to have ability to buy device for me and other interested developers in CARNet. Having said that, <b>if you do have OLPC which you are not using, it can find new home with interested developer</b>.

Aside from that, hi-res black and white screen is just beautiful, machine performs extremely well if you have in mind that it's basically 430Mhz pentium machine with 256Mb or RAM and 1Gb of flash. It seems like too little, but if you use OLPC as network connected digital notebook (with sharing!) it works beautifully. It best mobile device I had since palm back in last century.

Every little thing of this machine is designed great: kudos do development team. One small thing is that you can rotate screen in both directions (Toshiba, take note of this!). Hardware keys on both sides of display actually make usage a joy (and decrease a need to touch keyboard).

If we from moment move on from hardware to <a href="http://wiki.laptop.org/go/Sugar">Sugar</a>, it really great user interface which I would love to see on other laptops (before you ask, I did try it on Debian and it does work, I will take another look after I will have to return laptop).

I really hope that this project will live on and enable us to deploy units to elementary schools and hopefully achieve some benefit for students (which I'm somehow sure we'll have <tt>:-)</tt>]]></description>
         <link>http://blog.rot13.org/2008/04/first_day_with_olpc.html</link>
         <guid>http://blog.rot13.org/2008/04/first_day_with_olpc.html</guid>
        
          <category domain="http://www.sixapart.com/ns/types#category">personal</category>
        
        
          <category domain="http://www.sixapart.com/ns/types#tag">olpc</category>
        
         <pubDate>Wed, 23 Apr 2008 16:52:24 +0100</pubDate>
      </item>
      
      <item>
         <title>First Croatian Perl Workshop</title>
         <description><![CDATA[First of all, we had <a href="http://conferences.yapceurope.org/hrpw2008/">first ever Croatian</a> perl workshop. Thanks to all the people who showed up, we had attendance of about ten.

Organizing a workshop event turned out to be much more work then I anticipated, and various other tasks stopped me from preparing for it as good as I should. Also, small number of people force me to re-consider my lectures about perl. On one hand, I really, really, tried to spread perl (and had good fortune of being at right place at right time to get <a href="http://groups.google.com/group/zagrebpm">Zagreb.pm</a> off the ground), but with such low attendance, I must conclude that perl is used only by about 20 people in Zagreb. This seems somehow disturbing. Comparing size of Zagreb with Moscow turned out to show about same proportion, so I was just overly optimistic.

I also gave half an hour presentation about Jifty, based on <a href="http://svn.jifty.org/svn/jifty.org/talks/talks/yapcna07.pdf">Building a Jifty app in a jiffy</a> by Kevin Falcone and showed some examples of <a href="http://svn.rot13.org/index.cgi/Arh">my</a> <a href="http://svn.rot13.org/index.cgi/A3C">jifty</a> <a href="http://svn.rot13.org/index.cgi/Perly">apps</a> (I actually didn't talk about last one, just mentioned it as integration of external javascript -- CodePress in this example).

I also have to thank to <a href="http://andy.sh/">Andrew Shitov</a> from Moscow.pm who have managed to prepare several very interesting topics which, in my opinion, made this event worthwhile. If it wasn't free I would ask my money back <tt>:-\</tt>]]></description>
         <link>http://blog.rot13.org/2008/04/first_croatian_perl_workshop.html</link>
         <guid>http://blog.rot13.org/2008/04/first_croatian_perl_workshop.html</guid>
        
          <category domain="http://www.sixapart.com/ns/types#category">personal</category>
        
        
          <category domain="http://www.sixapart.com/ns/types#tag">Zagreb.pm</category>
        
          <category domain="http://www.sixapart.com/ns/types#tag">perl</category>
        
          <category domain="http://www.sixapart.com/ns/types#tag">personal</category>
        
         <pubDate>Tue, 15 Apr 2008 23:57:41 +0100</pubDate>
      </item>
      
      <item>
         <title>VRač - virtualno računalo</title>
         <description><![CDATA[Really funny name of post, isn't it? It should mean something to people who understand Croatian: it's virtual computer. This fun toy begin it's existence as Orao emulator. In the process, I wrote 6502 and Z80 emulator (actually only perl xs bindings for <a href="http://fms.komkon.org/EMUL8/">existing cpu emulators</a>) and implemented Orao, Galaksija and Galeb using it.

Various machines are in different stage of usability. Orao emulation is working (without tape support), Galaksija is too slow to be useful (also doesn't have tape) and Galeb doesn't have keyboard or tape support.

I would be very grateful for hardware information about those machines if you can spare some time writing them. I'm somewhat hope that source code of this emulators might serve as historic reference how this machines where constructed.

Lately, I have also found <a href="http://www.mess.org/">mess</a> project, but soon after that I also noticed that I need about six times as much to implement changes in it. C is just not my language, so actually <b>only</b> hope for preservation of those computers is good documentation (which is something mess community is striving also). 

On the other hand, currently CPU emulation library is not license compatible with GPL so I won't probably push this to CPAN any time soon but I would love to find another implementation (PowerPC anyone?) and basically create thin layer of perl code which can express different architectures.

Having written <em>all that</em> now it's time to show you how to compile dam thing!

<pre>
svn co svn://svn.rot13.org/VRac/
cd VRac
perl Makefile.PL
make
make orao
</pre>

And you will have working Orao emulator in a second. You can also try <tt>make galaksija</tt> or <tt>make galeb</tt>.

<small>
This post was originally written on <tt>2007-09-05</tt> when I wanted to announce this project after playing with it over the summer. Since I never finished emulation of Galaksija or Galeb, I left it in draft mode for too long. Now that first Croatian Perl Workshop is coming along I will talk about this project, so it's just fair to announce it, so you can have preview about what my lecture will be.
</small>]]></description>
         <link>http://blog.rot13.org/2008/03/vrac_virtualno_racunalo.html</link>
         <guid>http://blog.rot13.org/2008/03/vrac_virtualno_racunalo.html</guid>
        
          <category domain="http://www.sixapart.com/ns/types#category">code</category>
        
        
          <category domain="http://www.sixapart.com/ns/types#tag">galaksija</category>
        
          <category domain="http://www.sixapart.com/ns/types#tag">galeb</category>
        
          <category domain="http://www.sixapart.com/ns/types#tag">orao</category>
        
          <category domain="http://www.sixapart.com/ns/types#tag">virtualization</category>
        
         <pubDate>Sun, 23 Mar 2008 13:51:00 +0100</pubDate>
      </item>
      
      <item>
         <title>Predavanje: SQL od početnika do relacijskog maga</title>
         <description><![CDATA[Danas sam na Razmjeni vještina održao <a href="http://wiki.razmjenavjestina.org/razmjenavjestina/index.cgi?sql_od_po%C4%8Detnika_do_relacijskog_maga">maratonsko četverosatno predavanje</a> koje je nadam se bilo donekle korisno. Nažalost, nismo stigli ući u detalje onoliko koliko bih želio, ali ako ništa drugo ponovo sam koristio <a href="http://pgestraier.projects.postgresql.org/">pgrestraier</a> (koji se nekako indeksira previše sporo, morati ću pogledati zašto) i još jedan zgodan projektić koji sam napisao prošle godine za studente u Zadru <a href="http://svn.rot13.org/index.cgi/pg-getfeed/view/getfeed.sql">pg-getfeed</a> koji je zapravo mala perl stored procedura kojim možete raditi SQL upite na RSS feedovima.]]></description>
         <link>http://blog.rot13.org/2008/03/predavanje_sql_od_pocetnika_do_relacijskog_maga.html</link>
         <guid>http://blog.rot13.org/2008/03/predavanje_sql_od_pocetnika_do_relacijskog_maga.html</guid>
        
          <category domain="http://www.sixapart.com/ns/types#category">hack-of-the-week</category>
        
          <category domain="http://www.sixapart.com/ns/types#category">hr</category>
        
          <category domain="http://www.sixapart.com/ns/types#category">personal</category>
        
        
          <category domain="http://www.sixapart.com/ns/types#tag">PostgreSQL</category>
        
          <category domain="http://www.sixapart.com/ns/types#tag">perl</category>
        
          <category domain="http://www.sixapart.com/ns/types#tag">razmjenavjestina</category>
        
          <category domain="http://www.sixapart.com/ns/types#tag">sql</category>
        
         <pubDate>Sat, 15 Mar 2008 23:01:50 +0100</pubDate>
      </item>
      
      <item>
         <title>irc-logger - memory augmentation for #irc</title>
         <description><![CDATA[Initially <a href="http://svn.rot13.org/index.cgi/irc-logger/revision/?rev=4">created in 2006</a> this handy tool is best described with original commit message:

<blockquote>IRC bot which replace human memory</blockquote>

Here is a quick run-down through available features:

<ul>
<li>web archive with search</li>
<li>irc commands: last, grep/search, stat, poll/count</li>
<li><tt>tags//</tt> in normal irc messages (tagcloud, filter by tag, export as RSS feed)</li>
<li>announce <tt>/me</tt> messages to <a href="http://twitter.com/dpavlin">Twitter</a> (yes, lame, but that was <a href="http://svn.rot13.org/index.cgi/irc-logger/revision/?rev=53">a year ago</a>) 
<li>tags are available as html links for embedding (in wikis)</li>
<li>RSS feed from messages with tags (also nice for embedding)</li>
<li>irssi log import (useful for recovery in case of failure of machine or service :-)</li>
<li>announce new messages from RSS feeds (nice for wiki changes, blog entries or commits)
</ul>

It has grown quite a bit from initial vision to recall last messages on the web (and it does go through some hoops to produce nice web archive). Adding of tags allowed easy recall of interesting topics but in a way now it provides an central hub for different content connected to irc.

It's written in perl using POE and it's probably not best example of POE usage. It is also somewhat PostgreSQL specific but works well for our small comunity at <tt>#razmjenavjestina</tt> irc channel. Since I have seen some interest in it this blog post might serve as announce of it's existence.

I will probably add some documentation to <a href="http://wiki.rot13.org/rot13/index.cgi?irc-logger">it's wiki page</a> and add real muti-channel support (most of code is in there, but web archive needs filtering by channel). If you are interested to <tt>/invite</tt> it to your channel, drop me a note.]]></description>
         <link>http://blog.rot13.org/2008/03/irc-logger_-_memory_augmentation_for_irc.html</link>
         <guid>http://blog.rot13.org/2008/03/irc-logger_-_memory_augmentation_for_irc.html</guid>
        
          <category domain="http://www.sixapart.com/ns/types#category">code</category>
        
          <category domain="http://www.sixapart.com/ns/types#category">hack-of-the-week</category>
        
        
          <category domain="http://www.sixapart.com/ns/types#tag">irc</category>
        
          <category domain="http://www.sixapart.com/ns/types#tag">perl</category>
        
         <pubDate>Fri, 07 Mar 2008 23:44:17 +0100</pubDate>
      </item>
      
      <item>
         <title>Sync part of subversion repository</title>
         <description><![CDATA[I had a particular problem at work: we have upstream subversion repository which we access over ssh tunnel (using svn protocol) which contains two branches in which we are interested and various other stuff we don't care about (and don't want to mirror).

On other hand, we also wanted to have local copy of all changes (preserving history) and local commit messages and <a href="http://freshmeat.net/projects/svnweb/">SVN::Web</a> interface.

In original idea, I also wanted to keep revision numbers as-is (so I can just checkout our local version and be done), but this wasn't possible. One solution that we examined is to use <a href="http://tokyo2007.yapcasia.org/sessions/2007/02/pushmi_subversion_replication.html">Pushmi</a> and make local copy, but we didn't want all the other changes.

Other idea was to use <tt>svndumpfilter</tt> to sync only two branches we are interested in (it will create dummy commits for revision which are outside our branches), but since branches are result of copy from parts of the tree we don't want to sync, it didn't work either.

Did I mentioned that our svn repository can access upstream only through carefully crafted ssh tunnels? Mess, right?

So, in the end, solution was hybrid:

<ul>
<li>make local copy of two upstream branches using svk (loosing original order of commits, even if we are commiting into same svk mirror copy at our side)</li>
<li>install post-commit hook in upstream repository which will call (over https) svk sync at our side (I would probably use SMTP to trigger that, but our machine with svn repository doesn't accept outside e-mail)</li>
<li>install local post-commit hook to send e-mail notifications</li>
</ul>

Rest of this post are instructions on how to do this. Since I learned a thing of two doing this, I hope it might be also useful for others.

First create <tt>svn-pull.sh</tt> shell script which will run under <tt>user</tt> which has ssh keys to login to upstream firewall (1.2.3.4 in this example) and setup tunnels to upstream svn server (10.1.1.1):

<pre>
#!/bin/sh
ssh -L 13690:10.1.1.1:3690 1.2.3.4 sleep 2 &
pid=$!
SVKROOT=/home/user/.svk svk sync -a
kill $pid
</pre>

Now setup mirrors of branches we care about:

<pre>
svk mirror svn://127.0.0.1:13690/project/carnet-foo /project/foo
svk mirror svn://127.0.0.1:13690/project/carnet-bar /project/bar
</pre>

This is all nice, but we need to trigger it from <tt>www-user</tt> which is done with following in <tt>/etc/sudoers</tt>:

<pre>
www-data ALL=(user) NOPASSWD:/home/user/svn-pull.sh
</pre>

and add simple cgi script which will trigger sync operation:

<pre>
#!/bin/sh
echo -e "Content-type: text/plain\n\r\n\r"
sudo -u user /home/user/svn-pull.sh
</pre>

I used <tt>ScriptAlias</tt> in apache to make it visible at <tt>https://svn-ours.example.com/upstream-svn-update</tt>. No need on obsucate URL, since it's behind SSL for added points. IP address limit might also be a good idea:

<pre>
  &lt;Location /upstream-svn-update&gt;                   
        Order allow,deny
        Allow from 1.2.3.4
  &lt;/Location&gt;
</pre>

Now install post-commit hook in upstream repository. We care only for files which have <tt>/carnet</tt> in path since branches which we are interested have that prefix:

<pre>
svn log -v -r $REV file://$REPOS | grep ' /carnet' 2>/dev/null \
    && wget -q -O /dev/null https://svn-ours.example.com/upstream-svn-update
</pre>

You will notice that there are no locking or any other tweaks, since all tools have those capabilities anyway, so we are really just using <em>RPC via cgi over https</em> in fact. 

Nice and easy, once you know how to do it! It seems like a few bits of configuration all over the place, but I hope that it employs KISS - keep it simple and stupid at it's best.

<em>Update:</em> OK, now we have local repository (with different revisions), but <tt>svn switch --relocate</tt> doesn't work because those repositories are not same (makes sense, eh?)

Following steps are quick explanation now to copy <tt>.svn</tt> directories from new repository:

<pre>
cd /srv/carnet-foo
# update repository to last upstream version
svn update
# delete old .svn directories
find . -name ".svn" -exec rm -Rf {} \;
# checkout new repository
cd /srv
svn co svn://svn-ours.example.com/carnet-foo carnet-foo.new
# copy new .svn files to old repository
cd carnet-foo.new
find . -wholename "*/.svn/*" | cpio -pvd ../carnet-foo/
# cleanup
cd /srv
rm -Rf carnet-foo.new
# following shouldn't return any differences
cd carnet-foo
svn diff
</pre>]]></description>
         <link>http://blog.rot13.org/2008/03/sync_part_of_subversion_repository.html</link>
         <guid>http://blog.rot13.org/2008/03/sync_part_of_subversion_repository.html</guid>
        
          <category domain="http://www.sixapart.com/ns/types#category">hack-of-the-week</category>
        
        
          <category domain="http://www.sixapart.com/ns/types#tag">subversion</category>
        
          <category domain="http://www.sixapart.com/ns/types#tag">svk</category>
        
          <category domain="http://www.sixapart.com/ns/types#tag">svn</category>
        
         <pubDate>Tue, 04 Mar 2008 21:28:53 +0100</pubDate>
      </item>
      
      <item>
         <title>Negroponte u Zagrebu</title>
         <description><![CDATA[Nekako pomalo nezapaženo je prošlo <a href="http://olpccroatia.org/index.php/Negroponte_u_Zagrebu">vrlo zanimljivo predavanje Nicholasa Negropontea u Zagrebu</a>. O organizaciji konferencije ne treba trošiti riječi, ali želio bih djelomično prokomentirati neke nedoumice o OLPC ideji.

Za početak zaboravite na laptop. Da, znam teško je. Ili je lijep ili ružan. Ili spor. Zaboravite na laptop. Dobro?

Ideja je promijeniti način školovanja. Negroponte očigledno to želi naročito napraviti u zemljama "trećeg svijeta" (što je, prisjetimo se malo bila i Hrvatska nekada u doba Jugoslavije) zbog toga što tamo većinom vlada još Viktorijansko poučavanje 19. stoljeća koje šibom utjeruje znanje.

<small>
Svi citati su moji sjećanja na sadržaj predavanja, a ne nikakav prijevod materijala (koji su bili snimljeni, pa se možemo nadati da ćemo ih moći nekada i pogledati).
</small>

<blockquote>...učenicima se do četvrtog razreda izgubi ta žar u očima koju imaju kada prvi pita dođu u školu...
</blockquote>

To je kreativistički način podučavanja (ili poticanje istraživanja) koji se onda može vidjeti i u drugim aktivnostima koje nemaju veze sa računalima. Čuli smo primjer da djeca koja nauče programirati (program nikada ne proradi od prve!) dobiju novu vještinu <em>debuggiranja</em> koju onda koriste i u testovima ispravnog pisanja riječi. Njih zanima <em>zašto</em> su pogriješili te dvije riječi i nije im dovoljno što su sve ostale točne.

Slijedeća priča pokušava opisati situaciju na drugi način:

<blockquote>
Postojao je narod koji nije imao pismo. U jednom trenutku vođe naroda odlučile su da treba uvesti pismo, pa su uvele po jednu olovku i svaku školu.

Kako to nije urodilo plodom, odlučili su u svaku školu staviti po jedan razred koji je imao po jednu olovku na svakom stolu.

Naravno, svi znamo da je bolji način dati svakom učeniku olovku.
</blockquote>

Dakle, sve rasprave da li je OLPC ili Asus EEE PC bolji, jednostavno promašuju cijeli cilj. Nije čak ni stvar u tome da je OLPC dva puta jeftiniji ($200 * 5 = 1000 kn) od Asusa nego jednostavno u tome da je jeftin laptop jedini način da <em>svaki</em> učenik dobije svoju olovku.

OLPC laptop je zapravo samo jako zanimljiva implementacija te ideje.

Zamislite sat u školi upoznavanja sa znakovima, ulicama i prostorom oko sebe:

Djeco, nacrtajte ulice oko škole i znakove koje ste vidjeli na njima (prisjetimo se, OLPC ima podršku za grupno crtanje). Nakon što su nacrtali ulice i napisali imena, može se spomenuti da je standardna orijentacija karata prema sjeveru i zašto crtamo baš tako, a onda, s obzirom da je lijep i sunčan dan, djeca mogu krenuti u obilazak škole i koristeći više OLPC-a istovremeno (zgodnim programom koji smo vidjeli koji može mjeriti udaljenosti između dva uređaja) upisati na svoje mape točne udaljenosti.

Mapa onda sama može korigirati odnose (prisjetimo se, svi OLPC-ovi su povezani tako da se mapa sama obnavlja svima) i na kraju imaju neku ideju o tome kako prostor možemo zapravo prikazati kao skicu (npr. tramvajske pruge) a različito kao mapu sa stvarnim omjerima.

Usput, naravno možemo pogledati i horizontalnu i vertikalnu signalizaciju (zebre, semafori), i npr. snimiti filmić.

Možda nisam siguran u program kojeg predmeta bi ovakav zanimljiv zadatak spadao, ali mislim da mu nedostaje samo "pametna mapa" koja bi mogla biti jednostavna aplikacija na OLPC-u. Da li čujem glasove zainteresiranih pythonaša? <tt>:-)</tt>]]></description>
         <link>http://blog.rot13.org/2008/03/negroponte_u_zagrebu.html</link>
         <guid>http://blog.rot13.org/2008/03/negroponte_u_zagrebu.html</guid>
        
          <category domain="http://www.sixapart.com/ns/types#category">hr</category>
        
          <category domain="http://www.sixapart.com/ns/types#category">personal</category>
        
        
          <category domain="http://www.sixapart.com/ns/types#tag">olpc</category>
        
          <category domain="http://www.sixapart.com/ns/types#tag">razmjenavjestina</category>
        
         <pubDate>Mon, 03 Mar 2008 23:51:46 +0100</pubDate>
      </item>
      
      <item>
         <title>Converting PDF to Flash for web page flipping</title>
         <description><![CDATA[What did I do last two days or so? I have been looking for solution to convert pdf magazine archive from simple pdf downloads into something more Web 2.0 like. As a first instinct, I hoped that I will find JavaScript solution, and do simple rendering into bitmaps.

But, then I remembered that almost everybody has Flash plugin by now (at least more people than pdf reader or plugin) and Flash also can do smooth scaling. How ward would be to find Flash picture viewer with nice page-flipping transitions.

Half way in that journey I stumbled upon <a href="http://www.openlibrary.org/">Open Library</a> which has very nice interface (and is pure JavaScript!) which was supposed to be available under GPL, but source is not available. It would be cool to re-use this reader, but if there is no source compressed version available on site isn't much help. I sent e-mail to developer, and now I'm hoping for some pointers.

Than I found several commercial flash page flipping offers (strange how flash community is strictly separated to Open Source and commercial part without much cross-over). If there is so much solution to turn pdf into flash, one of them must be Open Source, right?

<em>And there is!</em> <a href="http://www.swftools.org/">SWFTOOLS</a> is great suite of programs (available in Debian) which has automatic generation of swf files from pdf and even ability to add navigation elements over it. To cut it short, here is little snippet for example usage:

<pre>
rm tmp/*
pdf2swf -p 1-20 -s insertstop magazine.pdf -o tmp/pages.swf
swfcombine -o tmp/pages+nav.swf SimpleViewer.swf viewport=tmp/pages.swf
jpeg2swf loader.jpg -o tmp/loader.swf
swfcombine -o tmp/magazine.swf PreLoader.swf loader=tmp/loader.swf movie=tmp/pages+nav.swf
cd tmp && swfdump --html magazine.swf > magazine.html
cd -
</pre>

It's sweet and simple, but navigation which SimpleViewer is giving me is... Somewhat too simple. I would like to have buttons for zoom in/out (or slider) and page number for example. However, other than accidental exposure to <a href="http://haxe.org/">haxe</a> I don't know a first thing about Flash. There are at least two CPAN modules with swf support, and I have seen flv media player in one of them, but they look incredibly complicated to me, almost like the source which produce SimpleViewer itself.

I would love to design something in Inkscape and than convert that to bits of logic (if possible externally controlled by JavaScript), but I don't even know where to start looking for information. I'm only interested in solutions which are scriptable and runnable without human intervention under Linux.

There are quote a few pages to convert, and it seems that pdf2swf has limit of 65535 objects which translate to about 20 pages out of 100+ pages magazine, so splitting it into single pages seems like much better approach (and users will have less content to download). If this is plain JavaScript, I would preload one page for quick response, but is that concept even supported in Flash?

To make things worse, there is <a href="http://www.sitepoint.com/blogs/2007/07/20/javascript-sprite-animation-using-jquery/">great tutorial over at SitePoint</a> how to make page flipping using jQuery which I know and like.

Am I wasting time trying to find free (as in speech) Flash development environment which would feel good to me? Should I go with my instincts and stick with JavaScript? Time will tell... For a start I will try to convert presentations on my homepage to flash as a initial try...

<b>Update:</b> To make thing clear, I converted <a href="http://www.rot13.org/~dpavlin/presentations.html">pdf files from my presentations</a> to flash using method described above. Now I would like to replace arrows on top-left with more complex navigation, something like <a href="http://pdfmenot.com/view/http://www.rot13.org/~dpavlin/presentations/pbf2007_bioperl.pdf">PdfMeNot has done</a>.

<b>Update^2:</b> This was easier than I thought it will be. Following examples on swftools site I found <a href="http://technoargia.free.fr/swftools/examples/viewer_home/viewer_home.html">two</a> <a href="http://technoargia.free.fr/swftools/examples/extended_viewer/E_viewer.html">great</a> viewers, and if that is not enough, I found <a href="http://www.code4net.com/archives/000114.html#114">original author</a> of viewer used at PdfMeNot (scroll down to find <a href="http://www.code4net.com/downloads/fdview.zip">download link</a>).]]></description>
         <link>http://blog.rot13.org/2008/02/converting_pdf_to_flash_for_web_page_flipping.html</link>
         <guid>http://blog.rot13.org/2008/02/converting_pdf_to_flash_for_web_page_flipping.html</guid>
        
          <category domain="http://www.sixapart.com/ns/types#category">hack-of-the-week</category>
        
        
          <category domain="http://www.sixapart.com/ns/types#tag">flash</category>
        
          <category domain="http://www.sixapart.com/ns/types#tag">pdf</category>
        
         <pubDate>Thu, 21 Feb 2008 02:07:00 +0100</pubDate>
      </item>
      
      <item>
         <title>Disappointed in php -- again!</title>
         <description><![CDATA[Taint checking? <a href="http://marc.info/?l=php-internals&m=116621380305497&w=2">Just say no</a>, according to php developers (I must admit, I stopped reading after first two replies).

<a href="http://pixybox.seclab.tuwien.ac.at/pixy/">Pixy</a> tries to address that (in Java, sic!) and fails on my test code. Only hope left (as it seems) is generation of AST tree using <a href="http://www.phpcompiler.org/">phc</a> or using <a href="http://pecl.php.net/package/Parse_Tree">Parse_Tree</a>. Both look like a workable way to get AST tree, but I really wouldn't like to implement taint analysis for language which I don't particularly like.

Any suggestions from idle readers of my blog?

OOH, this day would be more-or-less complete waste if I didn't stumble upon <a href="http://code.google.com/p/hypertable/">hypertable</a> which seem like nice implementation of bigtable in sane language (C/C++). Now if I could just find bunch of machines to run it on...
]]></description>
         <link>http://blog.rot13.org/2008/02/disappointed_in_php_again.html</link>
         <guid>http://blog.rot13.org/2008/02/disappointed_in_php_again.html</guid>
        
          <category domain="http://www.sixapart.com/ns/types#category">personal</category>
        
        
          <category domain="http://www.sixapart.com/ns/types#tag">php</category>
        
          <category domain="http://www.sixapart.com/ns/types#tag">security</category>
        
         <pubDate>Thu, 07 Feb 2008 23:56:28 +0100</pubDate>
      </item>
      
      <item>
         <title>Simpliest possible thing to do with Open Source projects</title>
         <description><![CDATA[Just send a <em>thanks</em> to author. Really.

Quick comment is also nice. For more knowledgeable users bug reports and suggestions are of course always welcomed. I think I never actually wrote about <a href="http://wiki.rot13.org/rot13/index.cgi?patch_svn2cvs_doesn_t_handle_directory_deletion_and_other_stories">fabulous bug report</a> from Samuel Gélineau that I got for svn2cvs. Sorry about that.

I wrote my thanks today. Did you?]]></description>
         <link>http://blog.rot13.org/2008/01/simpliest_possible_thing_to_do_with_open_source_projects.html</link>
         <guid>http://blog.rot13.org/2008/01/simpliest_possible_thing_to_do_with_open_source_projects.html</guid>
        
          <category domain="http://www.sixapart.com/ns/types#category">personal</category>
        
        
          <category domain="http://www.sixapart.com/ns/types#tag">razmjenavjestina</category>
        
         <pubDate>Wed, 23 Jan 2008 18:12:13 +0100</pubDate>
      </item>
      
      <item>
         <title>GNU fdisk broken?</title>
         <description><![CDATA[I have been backing up whole disk image from Eee PC, and mounting it using loop file system to access partition in it. However, I have problems with GNU fdisk which reports 4Gb image as:

<pre>
Disk /backup/eee/hda: 3 GB, 3997486080 bytes
255 heads, 63 sectors/track, 486 cylinders, total 7807590 sectors
Units = sectors of 1 * 512 = 512 bytes

          Device Boot      Start         End      Blocks   Id  System 
/backup/eee/hda1              63     4803435     2409718   83  Linux
/backup/eee/hda2         4819563     7759395     1469947   83  Linux
/backup/eee/hda3         7775523     7775460           0    c  FAT32 LBA
/backup/eee/hda4         7791588     7791525           0   ef  EFI FAT
</pre>

For a start, disk size is wrong:

<pre>
$ ls -al hda
-rwxrwxrwx 1 dpavlin root 4001292288 2008-01-20 00:59 hda
</pre>

And then, even more wrong, offsets of partition seem to be wrong. When same image is examined using fdisk from <tt>util-linux</tt>, sectors are reported like this:

<pre>
Disk hda: 0 MB, 0 bytes
255 heads, 63 sectors/track, 0 cylinders, total 0 sectors
Units = sectors of 1 * 512 = 512 bytes
Disk identifier: 0x332b332a

Device Boot      Start         End      Blocks   Id  System
  hda1              63     4819499     2409718+  83  Linux
  hda2         4819500     7775459     1477980   83  Linux
  hda3         7775460     7791524        8032+   c  W95 FAT32 (LBA)
  hda4         7791525     7807589        8032+  ef  EFI (FAT-12/16/32)
</pre>

And this is correct (let's ignore size for now). I can verify this by mounting second file system as:

<pre>
sudo mount hda 1 -o loop,offset=`expr 4819500 \* 512`
</pre>

This seems to be off-by-one error. There is <a href="http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=442332">bug reported against Debian package</a> which seems related, but than again, in my case I'm examining same disk image.
]]></description>
         <link>http://blog.rot13.org/2008/01/gnu_fdisk_broken.html</link>
         <guid>http://blog.rot13.org/2008/01/gnu_fdisk_broken.html</guid>
        
          <category domain="http://www.sixapart.com/ns/types#category">hack-of-the-week</category>
        
        
          <category domain="http://www.sixapart.com/ns/types#tag">linux</category>
        
         <pubDate>Sun, 20 Jan 2008 17:14:19 +0100</pubDate>
      </item>
      
   </channel>
</rss>
