<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:georss='http://www.georss.org/georss' xmlns:gd='http://schemas.google.com/g/2005' xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-7687451710468453402</id><updated>2011-10-10T18:38:39.481+02:00</updated><category term='linux'/><category term='apache'/><category term='bit'/><category term='orthography'/><category term='idea'/><category term='scala'/><category term='phpBB'/><category term='gentoo'/><category term='C'/><category term='tutorial'/><category term='resolver'/><category term='DRY'/><category term='spellchecker'/><category term='ssh'/><category term='lisp'/><category term='language'/><category term='art'/><category term='open source'/><category term='bash'/><category term='dcop'/><category term='kde'/><category term='life'/><category term='biwak'/><category term='PHP'/><category term='zmrok'/><category term='git'/><category term='xul-runner'/><category term='python'/><category term='DSL'/><category term='unix'/><category term='tips'/><category term='tst'/><category term='llvm'/><category term='CppUnit'/><category term='colour scheme'/><category term='joke'/><category term='WTF'/><category term='vim'/><category term='eclipse'/><category term='hg'/><category term='lap year'/><category term='amarok'/><category term='less'/><category term='LaTeX'/><category term='code generation'/><title type='text'>Less sleep, more science!</title><subtitle type='html'></subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://krzysiek-goj.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7687451710468453402/posts/default?max-results=100'/><link rel='alternate' type='text/html' href='http://krzysiek-goj.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>Krzysiek</name><uri>http://www.blogger.com/profile/12449324463465045582</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='27' height='32' src='http://4.bp.blogspot.com/_J0H1XnYiUnU/SN5oY2w0XyI/AAAAAAAAABk/S5Qf-t5NpGs/s1600-R/n694712085_153240_7977.jpg'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>18</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>100</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-7687451710468453402.post-5038040152588813009</id><published>2011-03-12T20:53:00.002+01:00</published><updated>2011-03-14T00:23:19.394+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='linux'/><category scheme='http://www.blogger.com/atom/ns#' term='git'/><category scheme='http://www.blogger.com/atom/ns#' term='unix'/><category scheme='http://www.blogger.com/atom/ns#' term='hg'/><category scheme='http://www.blogger.com/atom/ns#' term='less'/><title type='text'>zsh tips</title><content type='html'>&lt;h3&gt;Invoke 'less' smartly&lt;/h3&gt;&lt;p&gt;One of the nice little things about Git is that if the output of a command is long, then it is displayed in less. If output of a command is short, it is just displayed (there is no interactive Git involved). One can make Mercurial suck less by emulating this behavoiur with &lt;a href="http://mercurial.selenic.com/wiki/PagerExtension"&gt;Pager extension&lt;/a&gt;.&lt;p&gt;Would be it nice to have this automatic less for everything, not just hg and git? Add this one line to your .zshrc:&lt;/p&gt;&lt;pre&gt;AL() { $* 2&gt;&amp;1 | less -FSRX }&lt;/pre&gt;&lt;p&gt;Now you can call commands like &lt;code&gt;AL ls /tmp/mydir&lt;/code&gt; and enjoy having pager only when you need it. &lt;code&gt;-R&lt;/code&gt; option makes less not mess up colour escapes.&lt;/p&gt;&lt;h3&gt;Have easy access to newest download&lt;/h3&gt;&lt;p&gt;I set chrome to automatically download everything to ~/downloads folder. I often want to do something with newest downloaded file (like open it or move somewhere else).&lt;/p&gt;&lt;pre&gt;alias -g @@NDL='~/downloads/*(.om[1])'&lt;/pre&gt;&lt;p&gt;You can use anything that is unlikely to collide with anything else instead of &lt;code&gt;@@NDL&lt;/code&gt; (which stands for Newest DownLoad). Now you can use it like:&lt;/p&gt;&lt;pre&gt;acroread @@NDL&lt;br /&gt;mv @@NDL .&lt;/pre&gt;&lt;p&gt;Parenthesis after glob is qualifier. Dot stands for file, &lt;code&gt;om&lt;/code&gt; Ordered by Modification. One is there because om[0] always matches current directory.&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7687451710468453402-5038040152588813009?l=krzysiek-goj.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://krzysiek-goj.blogspot.com/feeds/5038040152588813009/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7687451710468453402&amp;postID=5038040152588813009' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7687451710468453402/posts/default/5038040152588813009'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7687451710468453402/posts/default/5038040152588813009'/><link rel='alternate' type='text/html' href='http://krzysiek-goj.blogspot.com/2011/03/zsh-tips.html' title='zsh tips'/><author><name>Krzysiek</name><uri>http://www.blogger.com/profile/12449324463465045582</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='27' height='32' src='http://4.bp.blogspot.com/_J0H1XnYiUnU/SN5oY2w0XyI/AAAAAAAAABk/S5Qf-t5NpGs/s1600-R/n694712085_153240_7977.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7687451710468453402.post-5845949832649899815</id><published>2009-11-11T21:19:00.001+01:00</published><updated>2009-11-11T21:26:28.781+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='gentoo'/><category scheme='http://www.blogger.com/atom/ns#' term='xul-runner'/><category scheme='http://www.blogger.com/atom/ns#' term='eclipse'/><title type='text'>64-bit Linux + Eclipse Galileo crash - fix</title><content type='html'>&lt;p&gt;A short one.&lt;/p&gt;&lt;p&gt;I had this problem some time ago, and today I've seen someone else on #eclipse IRC channel to have it.If you are running 64-bit Linux (esp. Gentoo) and Eclipse Galileo and your eclipse keeps crashing with&lt;b&gt;XPCOM error -2147467262&lt;/b&gt;, then fear no more. this is what you should do:&lt;/p&gt;&lt;ol&gt;    &lt;li&gt;turn off all Eclipse instances&lt;/li&gt;    &lt;li&gt;delete following files:&lt;ul&gt;        &lt;li&gt;&lt;pre&gt;WORKSPACE/.metadata&lt;/pre&gt;&lt;/li&gt;        &lt;li&gt;&lt;pre&gt;~/.mozilla/eclipse&lt;/pre&gt;&lt;/li&gt;        &lt;li&gt;&lt;pre&gt;~/.eclipse&lt;/pre&gt;&lt;/li&gt;    &lt;/ul&gt;&lt;/li&gt;    &lt;li&gt;add &lt;code style="white-space: pre;"&gt;-Dorg.eclipse.swt.browser.XULRunnerPath=/usr/lib64/xulrunner-1.9.1/libxpcom.so&lt;/code&gt;        to the end of your eclipse.ini file (actual path to your libxpcom.so may be different)&lt;/li&gt;    &lt;li&gt;you are done. You may use your Eclipse safely&lt;/li&gt;&lt;/ol&gt;&lt;p&gt;This tip is based on comments 11 and 12 in &lt;a href="http://bugs.gentoo.org/show_bug.cgi?id=275375#c11"&gt;this bug report&lt;/a&gt;.&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7687451710468453402-5845949832649899815?l=krzysiek-goj.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://krzysiek-goj.blogspot.com/feeds/5845949832649899815/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7687451710468453402&amp;postID=5845949832649899815' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7687451710468453402/posts/default/5845949832649899815'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7687451710468453402/posts/default/5845949832649899815'/><link rel='alternate' type='text/html' href='http://krzysiek-goj.blogspot.com/2009/11/64-bit-linux-eclipse-galileo-crash-fix.html' title='64-bit Linux + Eclipse Galileo crash - fix'/><author><name>Krzysiek</name><uri>http://www.blogger.com/profile/12449324463465045582</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='27' height='32' src='http://4.bp.blogspot.com/_J0H1XnYiUnU/SN5oY2w0XyI/AAAAAAAAABk/S5Qf-t5NpGs/s1600-R/n694712085_153240_7977.jpg'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7687451710468453402.post-1881571188786960086</id><published>2009-05-20T19:59:00.006+02:00</published><updated>2009-05-20T20:58:57.354+02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='amarok'/><category scheme='http://www.blogger.com/atom/ns#' term='linux'/><category scheme='http://www.blogger.com/atom/ns#' term='dcop'/><category scheme='http://www.blogger.com/atom/ns#' term='ssh'/><category scheme='http://www.blogger.com/atom/ns#' term='kde'/><title type='text'>Controlling roommate's music with ssh and dcop</title><content type='html'>This is rather old one, but I didn't publish it here before.&lt;br /&gt;&lt;br /&gt;Both my roommates use Amarok as their music player. I'm OK with music they listen to for 90% of time, but their big, fat playlists hide some real monsters. And they both have a bad habit of leaving the room with Amaroks playing in shuffle mode.&lt;br /&gt;&lt;br /&gt;This is why I created two little scripts to pause/change the song without leaving the comfort of my chair.&lt;br /&gt;&lt;br /&gt;Here is one, for Paweł (username pavlo) and his widescreen laptop kuandatun (kuandatun it's supposed to mean "wide ass" in Chineese).&lt;br /&gt;&lt;br /&gt;&lt;code&gt;&lt;br /&gt;#!/bin/zsh&lt;br /&gt;ssh kuandatun "/opt/kde3/bin/dcop --all-sessions --user pavlo amarok player $*"&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;I have kuandatun in &lt;tt&gt;/etc/hosts&lt;/tt&gt;, my &lt;tt&gt;.ssh/config&lt;/tt&gt; knows that it should log in as pavlo to his machine and I have my public key listed in his &lt;tt&gt;.ssh/authorized_keys&lt;/tt&gt;. Now, changing shitty song on his computer is as easy as &lt;code&gt;AmarokPawla next&lt;/code&gt;.&lt;br /&gt;&lt;br /&gt;The less evil use of this script is getting title, lyrics or artist of currently playing song.&lt;br /&gt;&lt;br /&gt;EDIT: this is going to be obsolete soon, when they switch to amarok2, which uses D-Bus instead of DCOP, but it's basically the same trick&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7687451710468453402-1881571188786960086?l=krzysiek-goj.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://krzysiek-goj.blogspot.com/feeds/1881571188786960086/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7687451710468453402&amp;postID=1881571188786960086' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7687451710468453402/posts/default/1881571188786960086'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7687451710468453402/posts/default/1881571188786960086'/><link rel='alternate' type='text/html' href='http://krzysiek-goj.blogspot.com/2009/05/controlling-roommates-music-with-ssh.html' title='Controlling roommate&apos;s music with ssh and dcop'/><author><name>Krzysiek</name><uri>http://www.blogger.com/profile/12449324463465045582</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='27' height='32' src='http://4.bp.blogspot.com/_J0H1XnYiUnU/SN5oY2w0XyI/AAAAAAAAABk/S5Qf-t5NpGs/s1600-R/n694712085_153240_7977.jpg'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7687451710468453402.post-637874893036944902</id><published>2009-03-27T16:16:00.004+01:00</published><updated>2009-03-28T18:58:32.672+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='art'/><category scheme='http://www.blogger.com/atom/ns#' term='vim'/><category scheme='http://www.blogger.com/atom/ns#' term='colour scheme'/><category scheme='http://www.blogger.com/atom/ns#' term='zmrok'/><title type='text'>Introducing Zmrok</title><content type='html'>It was neither sleep, nor science. It was pure art. Ladies and Gentleman, I present you the Zmrok colour scheme:&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/_J0H1XnYiUnU/SczmYmfb8yI/AAAAAAAAAEY/KH1VVhdqBKQ/s1600-h/screenshot.png"&gt;&lt;img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 400px; height: 221px;" src="http://4.bp.blogspot.com/_J0H1XnYiUnU/SczmYmfb8yI/AAAAAAAAAEY/KH1VVhdqBKQ/s400/screenshot.png" border="0" alt=""id="BLOGGER_PHOTO_ID_5317878570341364514" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;features: &lt;ul&gt; &lt;li&gt;it looks good&lt;ul&gt; &lt;li&gt;well, I like it ;-)&lt;/li&gt; &lt;/ul&gt; &lt;/li&gt; &lt;li&gt;it's small: &lt;ul&gt; &lt;li&gt;it's hackable&lt;/li&gt; &lt;li&gt;it's easily portable to other editors&lt;/li&gt; &lt;/ul&gt; &lt;/li&gt; &lt;/ul&gt;&lt;br /&gt;&lt;br /&gt;Source can be viewed and downloaded at &lt;a href="http://student.agh.edu.pl/~goj/hg/zmrok/"&gt;my mercurial repo&lt;/a&gt; or &lt;a href="http://www.vim.org/scripts/script.php?script_id=2592"&gt;vim.org&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;Zmrok is Polish for twilight, check out TextMate's (or pastie.org's) twilight colour scheme if you still wonder why it's named this way ;)&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7687451710468453402-637874893036944902?l=krzysiek-goj.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://krzysiek-goj.blogspot.com/feeds/637874893036944902/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7687451710468453402&amp;postID=637874893036944902' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7687451710468453402/posts/default/637874893036944902'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7687451710468453402/posts/default/637874893036944902'/><link rel='alternate' type='text/html' href='http://krzysiek-goj.blogspot.com/2009/03/introducing-zmrok.html' title='Introducing Zmrok'/><author><name>Krzysiek</name><uri>http://www.blogger.com/profile/12449324463465045582</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='27' height='32' src='http://4.bp.blogspot.com/_J0H1XnYiUnU/SN5oY2w0XyI/AAAAAAAAABk/S5Qf-t5NpGs/s1600-R/n694712085_153240_7977.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://4.bp.blogspot.com/_J0H1XnYiUnU/SczmYmfb8yI/AAAAAAAAAEY/KH1VVhdqBKQ/s72-c/screenshot.png' height='72' width='72'/><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7687451710468453402.post-4226834227474100771</id><published>2008-12-14T20:42:00.009+01:00</published><updated>2008-12-15T17:09:44.338+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='open source'/><category scheme='http://www.blogger.com/atom/ns#' term='vim'/><category scheme='http://www.blogger.com/atom/ns#' term='scala'/><title type='text'>Open source is great</title><content type='html'>I'm proud and happy to proclaim my &lt;a href="http://www.vim.org/scripts/script.php?script_id=2401"&gt;Russian PLansliterated&lt;/a&gt; vimscript &lt;b&gt;dead&lt;/b&gt;. Some nice guy have taken a look at it and developed a &lt;a href="http://www.vim.org/scripts/script.php?script_id=2469"&gt;superior solution&lt;/a&gt;, so &lt;i&gt;Russian PLansliterated&lt;/i&gt; shared a destiny of my pygments' lexer for Scala.&lt;br /&gt;&lt;br /&gt;An interesting meta-solution emerges:&lt;br /&gt;&lt;ol&gt; &lt;li&gt;Realize that you have a quite general problem&lt;/li&gt; &lt;li&gt;Write &lt;i&gt;15-30 min hack&lt;/i&gt; solution to it. It may work a little crappy, but it's good if it's easy to read and extend.&lt;/li&gt; &lt;li&gt;Open source it&lt;/li&gt; &lt;li&gt;Wait...&lt;/li&gt; &lt;li&gt;Next time you'll have the same problem someone has improved your solution beyond the recognition, so you can dump the old one.&lt;/li&gt; &lt;/ol&gt;&lt;br /&gt;&lt;br /&gt;It seems that improving something that exists is psychologically easier that starting from scratch. My new slides about Scala (&lt;a href="http://student.agh.edu.pl/goj/scala.pdf"&gt;download them&lt;/a&gt;, &lt;a href="http://student.agh.edu.pl/~goj/hgwebdir.cgi/biwak_scali/"&gt;browse the source&lt;/a&gt; or &lt;a href="http://biwak-agh.blogspot.com/2008/12/slajdy-ze-scali.html"&gt;watch them online&lt;/a&gt;) were made using pygments with new shiny lexer developed by someone &lt;a href="http://dev.pocoo.org/projects/pygments/ticket/367"&gt;pissed off&lt;/a&gt; by quality of an old one. Open Source is great, isn't it?&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7687451710468453402-4226834227474100771?l=krzysiek-goj.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://krzysiek-goj.blogspot.com/feeds/4226834227474100771/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7687451710468453402&amp;postID=4226834227474100771' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7687451710468453402/posts/default/4226834227474100771'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7687451710468453402/posts/default/4226834227474100771'/><link rel='alternate' type='text/html' href='http://krzysiek-goj.blogspot.com/2008/12/open-source-is-great.html' title='Open source is great'/><author><name>Krzysiek</name><uri>http://www.blogger.com/profile/12449324463465045582</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='27' height='32' src='http://4.bp.blogspot.com/_J0H1XnYiUnU/SN5oY2w0XyI/AAAAAAAAABk/S5Qf-t5NpGs/s1600-R/n694712085_153240_7977.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7687451710468453402.post-4804875806509963355</id><published>2008-11-15T19:25:00.002+01:00</published><updated>2008-11-17T13:26:01.643+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='idea'/><category scheme='http://www.blogger.com/atom/ns#' term='DSL'/><category scheme='http://www.blogger.com/atom/ns#' term='llvm'/><category scheme='http://www.blogger.com/atom/ns#' term='language'/><title type='text'>Programming language idea</title><content type='html'>Well, it's an idea about programming language without a programming language.&lt;br /&gt;&lt;br /&gt;Think about writing a script that generates assembly. It's doable.  Sometimes it's even *almost* sane thing to do, eg. when working on spellchecker I've had a crazy idea about generating code that does dictionary lookup for a hardcoded word set (It's no rocket science, just compare, jump, compare, jump...). But it's so low level and not cross-platform.&lt;br /&gt;&lt;br /&gt;I've done some C generation from Python several times (eg. to make last year's april fool's joke - it's on this blog). The problem is that C is often not flexible enough (GCC would choke on 100MB file for dictionary; TCO, call/cc and other fancy stuff is hard...). Not C, not assembly...&lt;br /&gt;&lt;br /&gt;There is &lt;a href="http://llvm.org"&gt;LLVM&lt;/a&gt; - a perfect target.&lt;br /&gt;&lt;br /&gt;Moving on: a scripting language that would generate all this mess.&lt;br /&gt;&lt;br /&gt;It should be very, very meta one. Like lisp, but with syntax. A pluggable one.&lt;br /&gt;&lt;br /&gt;My idea is to write a language that would have pluggable lexer (one lexer would switch to another one when it would encounter some sequence of characters - think of reader macros on steroids), then a huge layer of macros (tons of macros. Like Nemerle). Add a lispy semantics on top of it (few orthogonal concepts that combine together nicely) and my evil plan is 10% complete.&lt;br /&gt;&lt;br /&gt;You would be able to create literal syntax for your new, shiny DSL inside your script, then semantics that would generate optimal machine code for it and boom!&lt;br /&gt;&lt;br /&gt;It would enable some crazy stuff. Think of all super-duper assertions library creator would be able to enforce compile time with it! You like that D enables you have optional purity control? You can add it to your script.&lt;br /&gt;&lt;br /&gt;It wouldn't be general purpose tool (it would probably be to wired and demanding to do everyday work), but I can see applications where you have to be extremely fast (OS kernels, games) or you are very domain-specific stuff (think of all those code-generating tools like lex, bison, antlr).&lt;br /&gt;&lt;br /&gt;More or less related things to do/blog about in future:&lt;br /&gt;    - DBus + gvim - a possible step towards an headless IDE&lt;br /&gt;    - Actor-based OS&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7687451710468453402-4804875806509963355?l=krzysiek-goj.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://krzysiek-goj.blogspot.com/feeds/4804875806509963355/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7687451710468453402&amp;postID=4804875806509963355' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7687451710468453402/posts/default/4804875806509963355'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7687451710468453402/posts/default/4804875806509963355'/><link rel='alternate' type='text/html' href='http://krzysiek-goj.blogspot.com/2008/11/programming-language-idea.html' title='Programming language idea'/><author><name>Krzysiek</name><uri>http://www.blogger.com/profile/12449324463465045582</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='27' height='32' src='http://4.bp.blogspot.com/_J0H1XnYiUnU/SN5oY2w0XyI/AAAAAAAAABk/S5Qf-t5NpGs/s1600-R/n694712085_153240_7977.jpg'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7687451710468453402.post-8965592257414229937</id><published>2008-11-15T18:08:00.006+01:00</published><updated>2008-11-17T13:25:34.325+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='C'/><category scheme='http://www.blogger.com/atom/ns#' term='orthography'/><category scheme='http://www.blogger.com/atom/ns#' term='biwak'/><category scheme='http://www.blogger.com/atom/ns#' term='bit'/><category scheme='http://www.blogger.com/atom/ns#' term='spellchecker'/><category scheme='http://www.blogger.com/atom/ns#' term='life'/><category scheme='http://www.blogger.com/atom/ns#' term='python'/><category scheme='http://www.blogger.com/atom/ns#' term='tst'/><category scheme='http://www.blogger.com/atom/ns#' term='LaTeX'/><title type='text'>random stuff</title><content type='html'>Beep, beep! I'm still (more or less) alive.&lt;br /&gt;&lt;br /&gt;University takes me lots of time, which is my primary excuse for not blogging&lt;br /&gt;for so long time. Projects are like gas - they fill up all available space&lt;b&gt;&lt;i&gt;^H^H^H^H^H&lt;/i&gt;&lt;/b&gt; time.&lt;br /&gt;&lt;br /&gt;Interesting (for geeky enough definition of "interesting") stuff I've done recently:&lt;br /&gt;&lt;ul&gt;&lt;br /&gt;    &lt;li&gt;&lt;a href="http://student.agh.edu.pl/~goj/hgwebdir.cgi/pjn_lab02/"&gt;Spellchecker&lt;/a&gt;. It's a quite smart one -- written in python and C, it uses trie (ternary search tree) for storing dictionary. It's super-fast to load data (there are no pointers, so loading it is just one read of binary file, and you can use it).&lt;br /&gt;    &lt;br /&gt;Then you can use TST to quickly (it's quicker than hashmap) check if a word belongs to vocabulary or retrieve (it's still bleeding fast) a list of words that are no further (in Levenstein's (edit) distance) than misspelled one.&lt;br /&gt;&lt;br /&gt;Then it uses longest common subsequence algorithm to get parts that don't match and compares those parts using knowledge about typical spelling errors in Polish. It can correct "grzegrzułka", "zomp" and "fzhut". In summary: it's cool.&lt;/li&gt;&lt;br /&gt;    &lt;li&gt;I'm preparing a &lt;a href="http://student.agh.edu.pl/~goj/hgwebdir.cgi/biwak_scali"&gt;talk about scala&lt;/a&gt;.  It's work in progress. You can see some slides &lt;a href="http://student.agh.edu.pl/~goj/scala.pdf"&gt;here&lt;/a&gt;. I'll give this talk on 3th December as a part of &lt;a href="http://biwak-agh.blogspot.com"&gt;BIWAK&lt;/a&gt;&lt;/li&gt;&lt;br /&gt;    &lt;li&gt;Oh, yes, &lt;a href="http://biwak-agh.blogspot.com"&gt;BIWAK&lt;/a&gt;. We (BIT science club) have started a series of talks called BIWAK.&lt;/li&gt;&lt;br /&gt;    &lt;li&gt;Oh, yes, science club. I've done some work on platform game with cool physics, but there is nothing cool to show off yet.&lt;/li&gt;&lt;br /&gt;    &lt;li&gt;I've published &lt;a href="http://student.agh.edu.pl/~goj/hgwebdir.cgi/dotrc"&gt;some of my .rc files&lt;/a&gt;&lt;/li&gt;&lt;br /&gt;    &lt;li&gt;Hooray new swimming pool! Hooray &lt;a href="http://pl.wikipedia.org/wiki/Dolinki_Podkrakowskie"&gt;hiking&lt;/a&gt;! Hooray birthdays and weddings. Hooray real life.&lt;/li&gt;&lt;br /&gt;&lt;/ul&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7687451710468453402-8965592257414229937?l=krzysiek-goj.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://krzysiek-goj.blogspot.com/feeds/8965592257414229937/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7687451710468453402&amp;postID=8965592257414229937' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7687451710468453402/posts/default/8965592257414229937'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7687451710468453402/posts/default/8965592257414229937'/><link rel='alternate' type='text/html' href='http://krzysiek-goj.blogspot.com/2008/11/random-stuff.html' title='random stuff'/><author><name>Krzysiek</name><uri>http://www.blogger.com/profile/12449324463465045582</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='27' height='32' src='http://4.bp.blogspot.com/_J0H1XnYiUnU/SN5oY2w0XyI/AAAAAAAAABk/S5Qf-t5NpGs/s1600-R/n694712085_153240_7977.jpg'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7687451710468453402.post-8987798552702384623</id><published>2008-09-22T00:51:00.009+02:00</published><updated>2008-09-22T02:24:54.981+02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='resolver'/><category scheme='http://www.blogger.com/atom/ns#' term='life'/><title type='text'>Back to Poland</title><content type='html'>&lt;span style="font-weight: bold;"&gt;&amp;lt;terminator-voice&amp;gt;&lt;/span&gt;I'm back!&lt;span style="font-weight: bold;"&gt;&amp;lt;/terminator-voice&amp;gt;&lt;/span&gt;&lt;br /&gt;10 weeks of my internship at Resolver Systems passed like ten days. It was amazing experience - I learned a lot and I had great time. Many thanks to all my co-workers, you are great!&lt;br /&gt;&lt;br /&gt;I had a great opportunity to attend first day of PyCon UK - it was really cool. I got some ideas I'd like to transplant to SFI festival.&lt;br /&gt;&lt;br /&gt;TODO:&lt;br /&gt;- expand this post&lt;br /&gt;- LLVM&lt;br /&gt;- programming language ideas&lt;br /&gt;- vim + python&lt;br /&gt;- more&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7687451710468453402-8987798552702384623?l=krzysiek-goj.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://krzysiek-goj.blogspot.com/feeds/8987798552702384623/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7687451710468453402&amp;postID=8987798552702384623' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7687451710468453402/posts/default/8987798552702384623'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7687451710468453402/posts/default/8987798552702384623'/><link rel='alternate' type='text/html' href='http://krzysiek-goj.blogspot.com/2008/09/back-to-poland.html' title='Back to Poland'/><author><name>Krzysiek</name><uri>http://www.blogger.com/profile/12449324463465045582</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='27' height='32' src='http://4.bp.blogspot.com/_J0H1XnYiUnU/SN5oY2w0XyI/AAAAAAAAABk/S5Qf-t5NpGs/s1600-R/n694712085_153240_7977.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7687451710468453402.post-2855479986142418976</id><published>2008-06-21T02:20:00.010+02:00</published><updated>2008-06-21T03:08:01.488+02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='LaTeX'/><category scheme='http://www.blogger.com/atom/ns#' term='DRY'/><title type='text'>LaTeX thoughts and lack of time</title><content type='html'>I haven't written here for quite a long time — it's because of current semester's ending. I had a lot of work to do with my projects (btw: &lt;a href="http://youtube.com/watch?v=H4PQWWV73-k"&gt;it's one of them&lt;/a&gt;; &lt;a href="http://youtube.com/watch?v=zKPK8XE9B-k"&gt;another video&lt;/a&gt;). For every project one has to write a documentation. And I know only one way to write documents that doesn't suck hard. It's the way of TeX. I have written quite a lot of LaTeX documents last month. Here is what I learned:&lt;br /&gt;&lt;ul&gt;&lt;li&gt;\newcommand and \newenvironment are your friends&lt;/li&gt;&lt;li&gt;Making your comands and env names uppercase lets you avoid clashes with predefined ones.&lt;br /&gt;&lt;/li&gt;&lt;li&gt;Try to be semantic from very beginning if it's easy. For example: you mention electronical parts or Java classes all over your document. Add \newcommand{\Class}[1]{#1} in the beginning of your document and wrap all class names with \Class{}. It would be easy do make all class names typed with some special font later on.&lt;/li&gt;&lt;li&gt;If your documents take a lot of time to compile&lt;ul&gt;&lt;li&gt;break it intro few files and \input them. Comment out inputs you don't work on currently.&lt;br /&gt;&lt;/li&gt;&lt;li&gt;use draft option&lt;br /&gt;&lt;/li&gt;&lt;/ul&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-weight: bold;"&gt;Thinking about writing documents in TeX as of programming helps a lot!&lt;/span&gt;&lt;ul&gt;&lt;li&gt;Being a nazi with DRY principle makes your document sources look very semantic and the output is prettier. You do more tweaking if you can do it in one place instead of 20 places.&lt;/li&gt;&lt;li&gt;Do the simple thing that gives you desired result. If you repeat yourself ⇒ abstract out repetition intro new command(s) and/or environment(s).&lt;/li&gt;&lt;li&gt;Refactor!&lt;/li&gt;&lt;/ul&gt;&lt;/li&gt;&lt;/ul&gt;&lt;br /&gt;&lt;br /&gt;There are some things I wanted to write about, but I haven't got time. Here is my public TODO list:&lt;br /&gt;&lt;ul&gt;&lt;li&gt;Why Eiffel standard library is so cheesy that it makes me want to write program in brainf*ck instead of Eiffel (which is quite a nice language), and what can we learn from that (in &lt;span style="font-style: italic;"&gt;"I promise, I'll never code something similar"&lt;/span&gt; way of learning)&lt;/li&gt;&lt;li&gt;Why hovercrafts rock and how it is like to discharge 8 Duracell bateries in 20 minutes of playing with your homemade, bluetooth controlled one. (It's much more &lt;a href="http://www.blogger.com/sowa.jogger.pl"&gt;Witek's&lt;/a&gt; one than mine, but still)...&lt;br /&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-style: italic;"&gt;Hooray, yet another post about monads!&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-style: italic;"&gt;Hooray, yet another post about Scala!&lt;/span&gt;&lt;/li&gt;&lt;li&gt;Erlang, OOP and functional programming&lt;/li&gt;&lt;li&gt;I switched to zsh&lt;br /&gt;&lt;/li&gt;&lt;/ul&gt;&lt;br /&gt;Maybe one day one of those will turn intro full-blown post. Maybe.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7687451710468453402-2855479986142418976?l=krzysiek-goj.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://krzysiek-goj.blogspot.com/feeds/2855479986142418976/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7687451710468453402&amp;postID=2855479986142418976' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7687451710468453402/posts/default/2855479986142418976'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7687451710468453402/posts/default/2855479986142418976'/><link rel='alternate' type='text/html' href='http://krzysiek-goj.blogspot.com/2008/06/latex.html' title='LaTeX thoughts and lack of time'/><author><name>Krzysiek</name><uri>http://www.blogger.com/profile/12449324463465045582</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='27' height='32' src='http://4.bp.blogspot.com/_J0H1XnYiUnU/SN5oY2w0XyI/AAAAAAAAABk/S5Qf-t5NpGs/s1600-R/n694712085_153240_7977.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7687451710468453402.post-1197541002033824796</id><published>2008-05-02T03:31:00.002+02:00</published><updated>2008-05-02T19:41:58.731+02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='vim'/><category scheme='http://www.blogger.com/atom/ns#' term='python'/><title type='text'>organize your python imports in vim</title><content type='html'>My first script at vim.sf.net. You can grab it &lt;a href="http://vim.sourceforge.net/scripts/script.php?script_id=2225"&gt;here&lt;/a&gt;. Source code of it and unittests (&lt;a href="http://www.somethingaboutorange.com/mrl/projects/nose/"&gt;nose&lt;/a&gt; is great!) are on my &lt;a href="http://student.agh.edu.pl/~goj/hgwebdir.cgi/vimport/"&gt;mercurial repo&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;Have fun!&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7687451710468453402-1197541002033824796?l=krzysiek-goj.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://krzysiek-goj.blogspot.com/feeds/1197541002033824796/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7687451710468453402&amp;postID=1197541002033824796' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7687451710468453402/posts/default/1197541002033824796'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7687451710468453402/posts/default/1197541002033824796'/><link rel='alternate' type='text/html' href='http://krzysiek-goj.blogspot.com/2008/05/organize-your-imports.html' title='organize your python imports in vim'/><author><name>Krzysiek</name><uri>http://www.blogger.com/profile/12449324463465045582</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='27' height='32' src='http://4.bp.blogspot.com/_J0H1XnYiUnU/SN5oY2w0XyI/AAAAAAAAABk/S5Qf-t5NpGs/s1600-R/n694712085_153240_7977.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7687451710468453402.post-7326461915057620263</id><published>2008-04-20T03:55:00.001+02:00</published><updated>2008-04-20T03:58:25.374+02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='bash'/><title type='text'>bash fun vol. 2</title><content type='html'>Forget previous post. Bash has functions: &lt;code&gt;goj@abulafia ~ $ tail ~/.bashrc &lt;br /&gt;function apply() {&lt;br /&gt;  cmd=$1&lt;br /&gt;  shift&lt;br /&gt;  for x in $*; do $cmd $x; done&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;function go() {&lt;br /&gt;  $@&lt;br /&gt;  cd ${!#}&lt;br /&gt;}&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;Much better now. :)&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7687451710468453402-7326461915057620263?l=krzysiek-goj.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://krzysiek-goj.blogspot.com/feeds/7326461915057620263/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7687451710468453402&amp;postID=7326461915057620263' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7687451710468453402/posts/default/7326461915057620263'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7687451710468453402/posts/default/7326461915057620263'/><link rel='alternate' type='text/html' href='http://krzysiek-goj.blogspot.com/2008/04/bash-fun-vol-2.html' title='bash fun vol. 2'/><author><name>Krzysiek</name><uri>http://www.blogger.com/profile/12449324463465045582</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='27' height='32' src='http://4.bp.blogspot.com/_J0H1XnYiUnU/SN5oY2w0XyI/AAAAAAAAABk/S5Qf-t5NpGs/s1600-R/n694712085_153240_7977.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7687451710468453402.post-7028447482891659702</id><published>2008-04-14T22:44:00.011+02:00</published><updated>2008-04-15T10:54:02.734+02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='bash'/><title type='text'>bash fun</title><content type='html'>Quote by Terrence Parr: &lt;blockquote cite="http://www.cs.usfca.edu/~parrt/"&gt;My Motto: "Why program by hand in five days what you can spend five years of your life automating?"&lt;/blockquote&gt;&lt;br /&gt;&lt;br /&gt;We do a lot of actions that make a directory interesting for us and then we want to cd intro that directory. Consider:&lt;br /&gt;&lt;br /&gt;&lt;code&gt;hg init my_repo; cd my_repo&lt;br /&gt;mkdir -p a/b/c/d; cd a/b/c/d&lt;br /&gt;mv my_file /tmp; cd /tmp&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;Boring, repetitive and not DRY.&lt;br /&gt;&lt;br /&gt;Lesson 1: You can do something like this:&lt;br /&gt;&lt;code&gt;mkdir -p a/b/c/d; cd !$&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;Better, but not good enough for me. I'd like to type&lt;br /&gt;&lt;code&gt;go hg init my_repo&lt;br /&gt;go mkdir -p a/b/c/d&lt;br /&gt;go mv my_file /tmp&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;So we need to create a short bash script, don't we?&lt;br /&gt;&lt;br /&gt;How do we get last argument of the script (we'll need that). Provided that &lt;code&gt;$1&lt;/code&gt; is the first argument, &lt;code&gt;$2&lt;/code&gt; - second and &lt;code&gt;$#&lt;/code&gt; - argument count and &lt;code&gt;$@&lt;/code&gt; all arguments as an array... yes, you guessed it. It's &lt;code&gt;${!#}&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;How nice and intuitive. Try those: &lt;code&gt;$$# ${$#} ${${#}} $@[$#]&lt;/code&gt;.&lt;br /&gt;&lt;br /&gt;So do we have all that we need?&lt;br /&gt;&lt;code&gt;goj@abulafia tmp $ cat go&lt;br /&gt;#!/bin/bash&lt;br /&gt;$@&lt;br /&gt;cd ${!#}&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;&lt;code&gt;goj@abulafia &lt;b&gt;tmp&lt;/b&gt; $ ./go echo ~&lt;br /&gt;/home/goj&lt;br /&gt;goj@abulafia &lt;b&gt;tmp&lt;/b&gt; $&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;Epic FAIL. ./go script is executed in child shell. When it terminates it's parent's CWD is unaffected. We have to source it:&lt;br /&gt;&lt;br /&gt;&lt;code&gt;goj@abulafia &lt;b&gt;tmp&lt;/b&gt; $ . ./go echo ~&lt;br /&gt;/home/goj&lt;br /&gt;goj@abulafia &lt;b&gt;~&lt;/b&gt; $&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;But this syntax sucks. Luckily, &lt;b&gt;alias&lt;/b&gt; is our friend:&lt;br /&gt;&lt;br /&gt;&lt;code&gt;goj@abulafia tmp $ echo 'alias go=". go-source-me"' &gt;&gt; ~/.bashrc &lt;br /&gt;goj@abulafia tmp $ mv go ~/bin/go-source-me&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;You have to have ~/bin in your PATH.&lt;br /&gt;&lt;br /&gt;&lt;code&gt;goj@abulafia tmp $ go echo ~&lt;br /&gt;/home/goj&lt;br /&gt;goj@abulafia ~ $&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;Ta-dam!&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7687451710468453402-7028447482891659702?l=krzysiek-goj.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://krzysiek-goj.blogspot.com/feeds/7028447482891659702/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7687451710468453402&amp;postID=7028447482891659702' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7687451710468453402/posts/default/7028447482891659702'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7687451710468453402/posts/default/7028447482891659702'/><link rel='alternate' type='text/html' href='http://krzysiek-goj.blogspot.com/2008/04/bash-fun.html' title='bash fun'/><author><name>Krzysiek</name><uri>http://www.blogger.com/profile/12449324463465045582</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='27' height='32' src='http://4.bp.blogspot.com/_J0H1XnYiUnU/SN5oY2w0XyI/AAAAAAAAABk/S5Qf-t5NpGs/s1600-R/n694712085_153240_7977.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7687451710468453402.post-8957789600093472830</id><published>2008-04-02T00:02:00.021+02:00</published><updated>2008-11-15T19:03:45.178+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='C'/><category scheme='http://www.blogger.com/atom/ns#' term='orthography'/><category scheme='http://www.blogger.com/atom/ns#' term='joke'/><category scheme='http://www.blogger.com/atom/ns#' term='python'/><category scheme='http://www.blogger.com/atom/ns#' term='apache'/><category scheme='http://www.blogger.com/atom/ns#' term='code generation'/><title type='text'>April Fool's day</title><content type='html'>As last year, I managed to make my year's forum unreadable for April Fool's day. Awful, pink theme from last year was yesterday joined by truly horrible spelling and flipped avatars. :&gt;&lt;br /&gt;&lt;br /&gt;Here are the results: &lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://bp3.blogger.com/_J0H1XnYiUnU/R_KxeLjvLHI/AAAAAAAAAAY/hDLZRBfxlWo/s1600-h/forum.png"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer;" src="http://bp3.blogger.com/_J0H1XnYiUnU/R_KxeLjvLHI/AAAAAAAAAAY/hDLZRBfxlWo/s400/forum.png" alt="" id="BLOGGER_PHOTO_ID_5184401253113736306" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;Here is a little HOWTO. It may be useful for something practical, or for next year. Basically, you have to use &lt;a href="http://httpd.apache.org/docs/2.0/mod/mod_ext_filter.html"&gt;mod_ext_filter&lt;/a&gt; see the sed example.&lt;br /&gt;&lt;br /&gt;Polish spelling mistakes are different to English ones. They are (mostly) caused by fact, that there are (for historical &amp;amp; (maybe) other slavic languages "compatibility" reasons (is legacy a proper word?)) few sounds that have the two spellings, like &lt;i&gt;ź-rz&lt;/i&gt; and &lt;i&gt;u-ó&lt;/i&gt;, &lt;i&gt;h-ch&lt;/i&gt;. It makes it very easy to inject typos to polish text.&lt;br /&gt;&lt;br /&gt;We are talking about HTML pages. You cannot break html, eg &lt;tt&gt;&amp;lt;a chref="..."&amp;gt;&lt;/tt&gt; would be BAD. So we don't touch anything inside html tags, comments and entities. This makes it hard to use regexps. If I were to write this joke's filter program once again I would use &lt;a href="http://flex.sourceforge.net/"&gt;flex&lt;/a&gt;. But I wrote a short and slow (2,2 seconds to process a page - unacceptable) automata-based python script, and then (when it turned out how bad it performs) added lighting-fast (0,01 s/page) C-code generation to it. Generating code for automata is very easy.&lt;br /&gt;&lt;br /&gt;&lt;a href="http://student.agh.edu.pl/%7Egoj/hg/ortozawal/"&gt;code is here&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;small&gt;Code generation itself is a bit over-engineered, too. I shouldn't have cared about beautiful indentation &amp;amp; proper newlines. I should have used &lt;a href="http://www.gnu.org/software/indent/"&gt;GNU indent&lt;/a&gt; instead.&lt;/small&gt;&lt;br /&gt;&lt;br /&gt;Apache configuration:&lt;br /&gt;&lt;pre&gt;ExtFilterDefine ortozawal mode=output intype=text/html cmd="/usr/local/bin/ortozawal"&lt;br /&gt; ExtFilterDefine ungzip-filter mode=output intype=text/html cmd="/bin/gunzip -"&lt;br /&gt; ExtFilterDefine gzipme-filter mode=output intype=text/html cmd="/bin/gzip"&lt;br /&gt; ExtFilterDefine flip-image  mode=output cmd="/usr/bin/convert - -flip -"&lt;br /&gt;&lt;br /&gt; &amp;lt;Location "/forum"&amp;gt;&lt;br /&gt;     SetOutputFilter ungzip-filter;ortozawal;gzipme-filter&lt;br /&gt; &amp;lt;/Location&amp;gt;&lt;br /&gt;&lt;br /&gt; &amp;lt;Location "/forum/images"&amp;gt;&lt;br /&gt;     SetOutputFilter flip-image&lt;br /&gt; &amp;lt;/Location&amp;gt;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;gunzip-filter-gzip is a filthy trick. You can probably avoid it by proper filter configuration. If you know how, please drop me a comment.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7687451710468453402-8957789600093472830?l=krzysiek-goj.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://krzysiek-goj.blogspot.com/feeds/8957789600093472830/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7687451710468453402&amp;postID=8957789600093472830' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7687451710468453402/posts/default/8957789600093472830'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7687451710468453402/posts/default/8957789600093472830'/><link rel='alternate' type='text/html' href='http://krzysiek-goj.blogspot.com/2008/04/april-fools-day.html' title='April Fool&apos;s day'/><author><name>Krzysiek</name><uri>http://www.blogger.com/profile/12449324463465045582</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='27' height='32' src='http://4.bp.blogspot.com/_J0H1XnYiUnU/SN5oY2w0XyI/AAAAAAAAABk/S5Qf-t5NpGs/s1600-R/n694712085_153240_7977.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://bp3.blogger.com/_J0H1XnYiUnU/R_KxeLjvLHI/AAAAAAAAAAY/hDLZRBfxlWo/s72-c/forum.png' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7687451710468453402.post-6942041175871805530</id><published>2008-03-01T15:39:00.000+01:00</published><updated>2008-03-01T16:15:48.713+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='lisp'/><category scheme='http://www.blogger.com/atom/ns#' term='python'/><title type='text'>small, pythonic lisp</title><content type='html'>Grab it &lt;a href="http://student.agh.edu.pl/~goj/hg/pyscm/summary"&gt;here&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;It's &amp;lt; 256 LOC toy lisp. Nothing super-fancy. If you don't count unit tests and &lt;a href="http://www.artima.com/weblogs/viewpost.jsp?thread=101605"&gt;Guido's mm.py&lt;/a&gt; it's even &amp;lt; 128 LOC.&lt;br /&gt;&lt;br /&gt;It's quite pythonic. When you write &lt;code&gt;eval&lt;/code&gt; in LISP it's just a big &lt;code&gt;cond&lt;/code&gt;. It translates directly to if/elif/elif/... which doesn't look good. I used dict of functions instead, which looks better in my eyes. Uses as many Python features as possible. Python functions, python lists. etc.&lt;br /&gt;&lt;br /&gt;Talking about Python and lisp lists:&lt;br /&gt;&lt;code&gt;&lt;pre&gt;&lt;br /&gt;class slist(object):&lt;br /&gt;    class iterator(object):&lt;br /&gt;        def __init__(self, lst):&lt;br /&gt;            self.lst = lst&lt;br /&gt;        def next(self):&lt;br /&gt;            if self.lst:&lt;br /&gt;                result = self.lst.car&lt;br /&gt;                self.lst = self.lst.cdr&lt;br /&gt;                return result&lt;br /&gt;            else: raise StopIteration&lt;br /&gt;&lt;br /&gt;    def __iter__(self):&lt;br /&gt;        return slist.iterator(self)&lt;br /&gt;&lt;br /&gt;    def __init__(self, a, b=None):&lt;br /&gt;        self.car = a&lt;br /&gt;        self.cdr = b&lt;br /&gt;&lt;br /&gt;    def __str__(self):&lt;br /&gt;        return '(%s)' % ' '.join(str(elem) for elem in self)&lt;br /&gt;&lt;br /&gt;list_123 = slist(1, slist(2, slist(3)))&lt;br /&gt;a, b, c = list_123&lt;br /&gt;&lt;/pre&gt;&lt;/code&gt;&lt;br /&gt;Yes, this is just a linked list, not a true scheme cons, since it doesn't support improper lists, I posted it just to show how Python iterators are neat.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7687451710468453402-6942041175871805530?l=krzysiek-goj.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://krzysiek-goj.blogspot.com/feeds/6942041175871805530/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7687451710468453402&amp;postID=6942041175871805530' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7687451710468453402/posts/default/6942041175871805530'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7687451710468453402/posts/default/6942041175871805530'/><link rel='alternate' type='text/html' href='http://krzysiek-goj.blogspot.com/2008/03/small-pythonic-lisp.html' title='small, pythonic lisp'/><author><name>Krzysiek</name><uri>http://www.blogger.com/profile/12449324463465045582</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='27' height='32' src='http://4.bp.blogspot.com/_J0H1XnYiUnU/SN5oY2w0XyI/AAAAAAAAABk/S5Qf-t5NpGs/s1600-R/n694712085_153240_7977.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7687451710468453402.post-5069366874280109455</id><published>2008-02-29T13:23:00.000+01:00</published><updated>2008-02-29T14:18:04.128+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='WTF'/><category scheme='http://www.blogger.com/atom/ns#' term='lap year'/><category scheme='http://www.blogger.com/atom/ns#' term='PHP'/><category scheme='http://www.blogger.com/atom/ns#' term='phpBB'/><title type='text'>Lap year's WTF</title><content type='html'>Well, we all know phpBB is evil. Html code it generates makes you sick. It's a great example of spaghetti design antipattern. And it's written in PHP.&lt;br /&gt;&lt;br /&gt;Today (it's 29th February) many &lt;i&gt;phpBB by Przemo&lt;/i&gt; forums have blown. It's because of lap year and their "whose birthday is it" function.&lt;br /&gt;&lt;br /&gt;Warning. Clicking link below may even make you vomit.&lt;br /&gt;&lt;a href="http://paste-bin.com/13132"&gt;I'm ugly, think again&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;Yes, they didn't use standard &lt;code&gt;date("L")&lt;/code&gt;, yes they did their own calculations (using &lt;code&gt;sqrt&lt;/code&gt;?!?), and yes, they f*ck*d it badly. Awful switch full of magic numbers (hello, PHP is a junk, but it has loops and arrays) is just a minor ugliness.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7687451710468453402-5069366874280109455?l=krzysiek-goj.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://krzysiek-goj.blogspot.com/feeds/5069366874280109455/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7687451710468453402&amp;postID=5069366874280109455' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7687451710468453402/posts/default/5069366874280109455'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7687451710468453402/posts/default/5069366874280109455'/><link rel='alternate' type='text/html' href='http://krzysiek-goj.blogspot.com/2008/02/lap-years-wtf.html' title='Lap year&apos;s WTF'/><author><name>Krzysiek</name><uri>http://www.blogger.com/profile/12449324463465045582</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='27' height='32' src='http://4.bp.blogspot.com/_J0H1XnYiUnU/SN5oY2w0XyI/AAAAAAAAABk/S5Qf-t5NpGs/s1600-R/n694712085_153240_7977.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7687451710468453402.post-367788880101657028</id><published>2008-02-09T14:51:00.000+01:00</published><updated>2008-02-29T13:22:56.754+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='C'/><category scheme='http://www.blogger.com/atom/ns#' term='tutorial'/><title type='text'>int *(*(*(*b)())[10])();</title><content type='html'>&lt;p&gt; I've just read Terence Parr's &lt;a href="http://www.antlr.org/wiki/display/CS652/How+To+Read+C+Declarations"&gt;post&lt;/a&gt; titled "How To Read C Declarations".  The quoted "Golden Rule" makes reading declarations really easy even for a drunk ape, but it's one of the kind I dislike.  It gives you some "magical" steps to follow (&lt;a href="http://www.ericgiguere.com/articles/reading-c-declarations.html"&gt;here&lt;/a&gt; are the same rules stated more verbosely in an awful, BASIC-ish GOTO-step-N manner) with no explanation why this way, no another.  &lt;/p&gt; &lt;p&gt; Here is the missing explanation: &lt;/p&gt; &lt;p&gt; Declaration reflects how you use declared expression (how you get the value of it), so in &lt;code&gt;int tab[];&lt;/code&gt; tab is an array (you index it) of integers.  &lt;code&gt;int (*tab)[];&lt;/code&gt; is a pointer to an array (you dereference it, then index). &lt;code&gt;int *(tab[]);&lt;/code&gt; is an array of pointers &amp;mdash; you have to index it, then dereference.  &lt;/p&gt; &lt;p&gt; How about &lt;code&gt;int *tab[]&lt;/code&gt;? You have to know &lt;a href="http://en.wikipedia.org/wiki/Operators_in_C_and_C%2B%2B"&gt;operator precedence&lt;/a&gt; &lt;/p&gt; &lt;p&gt; It's not that hard as in looks like. In our case the rule of thumb is: &lt;strong&gt;"Postfix binds stronger than prefix."&lt;/strong&gt;, so you read &lt;code&gt;int *tab[]&lt;/code&gt; as array of pointers. "Postfix binds stronger than prefix" is the reason why you look &lt;q&gt;right, then left&lt;/q&gt;, in "Golden rule".  &lt;/p&gt; &lt;p&gt; Easy, isn't it? Now you know this post's title reads &lt;q&gt;pointer to the function returning pointer to an array of pointers to functions returning pointers to integers&lt;/q&gt;. 10 is redundant in this case. (It's &lt;a href="http://www.ericgiguere.com/articles/reading-c-declarations.html"&gt;no 5 from here&lt;/a&gt;, I'm so lazy...).  &lt;/p&gt; &lt;p&gt; Of course you'll find out that the &lt;q&gt;Golden rule&lt;/q&gt; is an obvious result of sentences above.  It's convinient to read declarations that way, but IMO it's very bad to actually think about declarations only in terms of &lt;q&gt;now jump out of the parenthesis&lt;/q&gt;.  &lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7687451710468453402-367788880101657028?l=krzysiek-goj.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://krzysiek-goj.blogspot.com/feeds/367788880101657028/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7687451710468453402&amp;postID=367788880101657028' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7687451710468453402/posts/default/367788880101657028'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7687451710468453402/posts/default/367788880101657028'/><link rel='alternate' type='text/html' href='http://krzysiek-goj.blogspot.com/2008/02/int-b10.html' title='int *(*(*(*b)())[10])();'/><author><name>Krzysiek</name><uri>http://www.blogger.com/profile/12449324463465045582</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='27' height='32' src='http://4.bp.blogspot.com/_J0H1XnYiUnU/SN5oY2w0XyI/AAAAAAAAABk/S5Qf-t5NpGs/s1600-R/n694712085_153240_7977.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7687451710468453402.post-4535202187868997733</id><published>2008-02-01T17:08:00.000+01:00</published><updated>2008-02-29T13:22:35.478+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='vim'/><category scheme='http://www.blogger.com/atom/ns#' term='tips'/><title type='text'>Vim stuff</title><content type='html'>Vim is great, but quite hard to master. My experience is that there usually is a lot of "how did you do that?" when working with another vimmer. There goes a random list of some useful commands I taught (or learned) recently:&lt;br /&gt;&lt;dl&gt;&lt;br /&gt;&lt;dt&gt;&lt;b&gt;^r&lt;/b&gt;&lt;i&gt;X&lt;/i&gt; in command and insert mode.&lt;/dt&gt;&lt;dd&gt;Puts the content of &lt;i&gt;X&lt;/i&gt; register. Typical use case: select something with &lt;b&gt;*&lt;/b&gt; and then &lt;b&gt;:%s/^r//new stuff/g&lt;/b&gt;&lt;/dd&gt;&lt;br /&gt;&lt;dt&gt;punctuation: &lt;b&gt;;&lt;/b&gt; and &lt;b&gt;,&lt;/b&gt;&lt;/dt&gt;&lt;dd&gt;repeats last &lt;i&gt;tTfF&lt;/i&gt; motion, like everyone's favourite dot repeats last command&lt;/dd&gt;&lt;br /&gt;&lt;dt&gt;rectangle visual mode&lt;/dt&gt;&lt;dd&gt;&lt;b&gt;^v&lt;/b&gt; or &lt;b&gt;quadruple&lt;/b&gt;&lt;sup&gt;1&lt;/sup&gt; click. Often easier and faster, than macros&lt;/dd&gt;&lt;br /&gt;&lt;dt&gt;macros&lt;/dt&gt;&lt;dd&gt;&lt;b&gt;q&lt;/b&gt;. Everyone know them &lt;tt&gt;:help q&lt;/tt&gt;&lt;/dd&gt;&lt;br /&gt;&lt;dt&gt;&lt;b&gt;^o&lt;/b&gt;&lt;/dt&gt;&lt;dd&gt;Jumps intro normal mode for one command. Typical usecase: editing middle of the line &lt;b&gt;^oo&lt;/b&gt;.&lt;/dd&gt;&lt;br /&gt;&lt;dt&gt;&lt;b&gt;^v&lt;/b&gt;&lt;i&gt; any_key&lt;/i&gt; in insert and command mode&lt;/dt&gt;&lt;dd&gt;Puts the Vim representation for that key. Useful for editing .vimrc&lt;/dd&gt;&lt;br /&gt;&lt;dt&gt;&lt;b&gt;J&lt;/b&gt; in normal mode&lt;/dt&gt;&lt;dd&gt;joins current line and next line&lt;/dd&gt;&lt;br /&gt;&lt;dt&gt;&lt;b&gt;^a ^x&lt;/b&gt; in normal mode&lt;/dt&gt;&lt;dd&gt;increment/decrement a number&lt;/dd&gt;&lt;br /&gt;&lt;dt&gt;&lt;b&gt;&amp;amp;&lt;/b&gt; and &lt;b&gt;\1&lt;/b&gt;, &lt;b&gt;\2&lt;/b&gt;...&lt;/dt&gt;&lt;dd&gt;in &lt;i&gt;to&lt;/i&gt; part of substitution&lt;/dd&gt;&lt;br /&gt;&lt;dt&gt;&lt;b&gt;"*&lt;/b&gt;&lt;/dt&gt;&lt;dd&gt;X11 clipboard&lt;/dd&gt;&lt;br /&gt;&lt;dt&gt;&lt;b&gt;^p&lt;/b&gt; &lt;b&gt;^n&lt;/b&gt; and &lt;b&gt;^x&lt;/b&gt;&lt;i&gt;lot_of_keys&lt;/i&gt; like &lt;b&gt;^xf&lt;/b&gt;&lt;/dt&gt;&lt;dd&gt;completions&lt;/dd&gt;&lt;br /&gt;&lt;dt&gt;&lt;tt&gt;autocmd&lt;/tt&gt;s in your .vimrc&lt;/dt&gt;&lt;dd&gt;see .vimrc examples below&lt;/dd&gt;&lt;br /&gt;&lt;dt&gt;not a command: &lt;a href="http://dengmao.wordpress.com/2007/01/22/vim-color-scheme-wombat/"&gt;Wombat&lt;/a&gt;&lt;/dt&gt;&lt;dd&gt;&lt;pre style="font-family: sans-serif; font-style: italic; font-size: 8pt;"&gt;My text is brilliant&lt;br /&gt;My vim is pure.&lt;br /&gt;I saw a Wombat.&lt;br /&gt;Of that I'm sure.&lt;br /&gt;[...]&lt;br /&gt;&lt;br /&gt;You're beautiful. You're beautiful.&lt;br /&gt;You're beautiful, it's true.&lt;/pre&gt;&lt;/dd&gt;&lt;br /&gt;&lt;/dl&gt;&lt;br /&gt;&lt;hr /&gt;&lt;br /&gt;Some macros from my .vimrc that I found very useful:&lt;br /&gt;&lt;code&gt;&lt;br /&gt;" done with current line&lt;br /&gt;inoremap &amp;lt;c-cr&amp;gt; &amp;lt;c-o&amp;ht;o&lt;br /&gt;&lt;br /&gt;"XML, HTML, JSP&lt;br /&gt;autocmd FileType xml,html,xhtml,jsp,htmldjango inoremap &amp;lt;C-b&amp;gt; &amp;lt;Esc&amp;gt;"tciw&amp;lt;&amp;lt;C-o&amp;gt;"tp&amp;gt;&amp;lt;CR&amp;gt;&amp;lt;/&amp;lt;C-o&amp;gt;"tp&amp;gt;&amp;lt;Esc&amp;gt;O&lt;br /&gt;autocmd FileType xml,html,xhtml,jsp,htmldjango inoremap &amp;lt;C-a&amp;gt; &amp;lt;Esc&amp;gt;"tciw&amp;lt;&amp;gt;&amp;lt;/&amp;gt;&amp;lt;Esc&amp;gt;"tPF&amp;gt;"tPla&lt;br /&gt;autocmd FileType xml,html,xhtml,jsp,htmldjango inoremap &amp;lt;C-s&amp;gt; &amp;lt;ESC&amp;gt;"tciw&amp;lt;/&amp;gt;&amp;lt;ESC&amp;gt;h"tPa&amp;lt;Space&amp;gt;&amp;lt;Space&amp;gt;&amp;lt;Left&amp;gt;&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;Side note: python syntaxfile file (at least in vim 7.0 in my SuSE) seems to be a little outdated:&lt;br /&gt;&lt;code&gt;autocmd FileType python syn keyword Constant True False None&lt;br /&gt;autocmd FileType python syn keyword Keyword with&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;Meta tip:&lt;br /&gt;type &lt;tt&gt;:help &lt;i&gt;one_or_two_random_keys&lt;/i&gt;&lt;/tt&gt; from time to time. prefix with &lt;tt&gt;i_&lt;/tt&gt; for insert mode stuff.&lt;br /&gt;&lt;hr /&gt;&lt;br /&gt;&lt;sup&gt;1&lt;/sup&gt; - yes. QUAD-ruple. Click, click, click, click. Four clicks in a row %-| . Open Office does have quadruple click too. Who uses mouse, anyway...&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7687451710468453402-4535202187868997733?l=krzysiek-goj.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://krzysiek-goj.blogspot.com/feeds/4535202187868997733/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7687451710468453402&amp;postID=4535202187868997733' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7687451710468453402/posts/default/4535202187868997733'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7687451710468453402/posts/default/4535202187868997733'/><link rel='alternate' type='text/html' href='http://krzysiek-goj.blogspot.com/2008/02/vim-is-great-but-quite-hard-to-master.html' title='Vim stuff'/><author><name>Krzysiek</name><uri>http://www.blogger.com/profile/12449324463465045582</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='27' height='32' src='http://4.bp.blogspot.com/_J0H1XnYiUnU/SN5oY2w0XyI/AAAAAAAAABk/S5Qf-t5NpGs/s1600-R/n694712085_153240_7977.jpg'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7687451710468453402.post-1845917822012449062</id><published>2008-01-14T00:53:00.001+01:00</published><updated>2008-04-02T00:03:24.769+02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='CppUnit'/><category scheme='http://www.blogger.com/atom/ns#' term='DSL'/><category scheme='http://www.blogger.com/atom/ns#' term='python'/><title type='text'>DSL for CppUnit tests</title><content type='html'>It's amazing what activities can one invent, just to have something to do but learn...&lt;br /&gt;I've just written an external DSL to ease writing CppUnit tests. It's not finished, but it works.&lt;br /&gt;&lt;br /&gt;There is one thing I particularly hate about CppUnit: you have to name every test in fixture at least twice - once when it's created, and another time when it's added to the suite. OK, it's C++, we don't have reflection to do this stuff automatically, preprocessor is to dumb to fix it too... but it still sucks. It's repetitive and error prone. And you can end with tests that are never called, because you have forgotten to add them to suite.&lt;br /&gt;&lt;br /&gt;Blah. I think I'm clear.&lt;br /&gt;&lt;br /&gt;I wanted to have something simple - generated code should be very similar to our source - tests bodies themselves should be just copied intro right places and so on. No full-blown C++ parsers... no C++ parser at all. Just something that is a little more than preprocessor macros.&lt;br /&gt;&lt;br /&gt;And here it goes:&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;@includeHeaders&lt;br /&gt;&lt;br /&gt;@beginFixture TestSum&lt;br /&gt;Sum *sum;&lt;br /&gt;@setUp {&lt;br /&gt;   sum = new Sum();&lt;br /&gt;}&lt;br /&gt;@tearDown {&lt;br /&gt;   delete sum;&lt;br /&gt;}&lt;br /&gt;@test "empty sum of nothing should be zero" {&lt;br /&gt;CPPUNIT_ASSERT_EQUAL(0, sum-&amp;gt;getResult());&lt;br /&gt;}&lt;br /&gt;@test "simple sum of 1+2+3" {&lt;br /&gt;sum-&amp;gt;add(1);&lt;br /&gt;sum-&amp;gt;add(2);&lt;br /&gt;sum-&amp;gt;add(3);&lt;br /&gt;CPPUNIT_ASSERT_EQUAL(6, sum-&gt;getResult());&lt;br /&gt;}&lt;br /&gt;@endFixture&lt;/pre&gt;&lt;br /&gt;translates to&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;#include &amp;lt;cppunit/TestCase.h&amp;gt;&lt;br /&gt;#include &amp;lt;cppunit/extensions/HelperMacros.h&amp;gt;&lt;br /&gt;&lt;br /&gt;class TestSum: public CppUnit::TestFixture {&lt;br /&gt;CPPUNIT_TEST_SUITE( TestSum );&lt;br /&gt;CPPUNIT_TEST( empty_sum_of_nothing_should_be_zero );&lt;br /&gt;CPPUNIT_TEST( simple_sum_of_1_2_3 );&lt;br /&gt;CPPUNIT_TEST_SUITE_END();&lt;br /&gt;&lt;br /&gt;public:&lt;br /&gt;Sum *sum;&lt;br /&gt;void setUp() {&lt;br /&gt;   sum = new Sum();&lt;br /&gt;}&lt;br /&gt;void tearDown() {&lt;br /&gt;   delete sum;&lt;br /&gt;}&lt;br /&gt;void empty_sum_of_nothing_should_be_zero() {&lt;br /&gt;   CPPUNIT_ASSERT_EQUAL(0, sum-&amp;gt;getResult());&lt;br /&gt;}&lt;br /&gt;void simple_sum_of_1_2_3() {&lt;br /&gt;   sum-&amp;gt;add(1);&lt;br /&gt;   sum-&amp;gt;add(2);&lt;br /&gt;   sum-&amp;gt;add(3);&lt;br /&gt;   CPPUNIT_ASSERT_EQUAL(6, sum-&amp;gt;getResult());&lt;br /&gt;}&lt;br /&gt;};&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;Simple as that.&lt;br /&gt;&lt;br /&gt;&lt;a href="http://student.agh.edu.pl/%7Egoj/hg/cppunit/"&gt;Mercurial repo.&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;Time to finish this longish post before it took me more time to blog about it, than to actually write it...&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;cut!&lt;/span&gt;&lt;br /&gt;My first post on my first blog is finished. Applause!&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7687451710468453402-1845917822012449062?l=krzysiek-goj.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://krzysiek-goj.blogspot.com/feeds/1845917822012449062/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7687451710468453402&amp;postID=1845917822012449062' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7687451710468453402/posts/default/1845917822012449062'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7687451710468453402/posts/default/1845917822012449062'/><link rel='alternate' type='text/html' href='http://krzysiek-goj.blogspot.com/2008/01/dsl-for-cppunit-tests.html' title='DSL for CppUnit tests'/><author><name>Krzysiek</name><uri>http://www.blogger.com/profile/12449324463465045582</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='27' height='32' src='http://4.bp.blogspot.com/_J0H1XnYiUnU/SN5oY2w0XyI/AAAAAAAAABk/S5Qf-t5NpGs/s1600-R/n694712085_153240_7977.jpg'/></author><thr:total>0</thr:total></entry></feed>
