<?xml version="1.0" encoding="iso-8859-1"?>
<rss version="2.0"><channel><title>Square Wheel Blog</title><link>http://squarewheel.pl/</link><description>A blog about programming (and sometimes other stuff)</description><pubDate>Thu, 21 Jan 2010 19:34:15 GMT</pubDate><generator>PyRSS2Gen-1.0.0</generator><docs>http://blogs.law.harvard.edu/tech/rss</docs><item><title>Zenkaku_Hankaku bug</title><link>http://squarewheel.pl/posts/17</link><description>&lt;div class="document"&gt;
&lt;p&gt;I've just run into a weird bug on my Gentoo box. After some recent update the grave key stopped working. It did produce tildes when pressed with shift, but without a modifier it produced no output. Analysis with xev showed that the key was recognized as Zenkaku_Hankaku. Some more research revealed that it was due to this line in &lt;tt class="docutils literal"&gt;/usr/share/X11/xkb/keycodes/evdev&lt;/tt&gt; and &lt;tt class="docutils literal"&gt;/usr/share/X11/xkb/keycodes/xfree86&lt;/tt&gt;:&lt;/p&gt;
&lt;pre class="literal-block"&gt;
alias &amp;lt;HZTG&amp;gt; = &amp;lt;TLDE&amp;gt;;
&lt;/pre&gt;
&lt;p&gt;Posting this just in case somebody else is struggling with the same problem.&lt;/p&gt;
&lt;/div&gt;
</description><guid isPermaLink="true">http://squarewheel.pl/posts/17</guid><pubDate>Thu, 21 Jan 2010 19:34:15 GMT</pubDate></item><item><title>After RuPy 2009</title><link>http://squarewheel.pl/posts/16</link><description>&lt;div class="document"&gt;
&lt;p&gt;I'm back from &lt;a class="reference external" href="http://rupy.eu/"&gt;RuPy 2009&lt;/a&gt; in Pozna&#324;. The conference was really good, much better than I anticipated.
Unfortunately some talks that seemed interesting were cancelled.&lt;/p&gt;
&lt;p&gt;The talk by David Goodger on communities (and puzzles) was really great. Kristian Rother's talk on
development in Bioinformatics lab provided some insights on software development processes in groups
of non-professional developers, followed with some interesting discussions during coffee breaks.&lt;/p&gt;
&lt;p&gt;On the second day, the talk about RabbitMQ was nice, though neccessarily it covered just pretty basic stuff.
The lecture on Python packaging ecosystem (by Tarek Ziade) was very informative and useful. Also, Tarek answered
questions about customizing distutils to needs of specific projects (I will definitely try them out).&lt;/p&gt;
&lt;p&gt;I took a shot at doing a lightning talk during the second session, but screwed it up; should have prepared the talk better.&lt;/p&gt;
&lt;p&gt;Besides official talks, the chats during breaks made the conference even better.&lt;/p&gt;
&lt;p&gt;Also, thanks to all the nice people at &lt;a class="reference external" href="http://www.poznan.dominikanie.pl/duszpasterstwa.php?id=402&amp;amp;m=da"&gt;Duszpasterstwo Akademickie&lt;/a&gt; (University Ministry) at Order of Saint Dominic for helping
Marcin and me with companionship, hot tea and even a tour of Pozna&#324; on Sunday evening.&lt;/p&gt;
&lt;/div&gt;
</description><guid isPermaLink="true">http://squarewheel.pl/posts/16</guid><pubDate>Mon, 09 Nov 2009 21:44:16 GMT</pubDate></item><item><title>nginx and an undefined variable</title><link>http://squarewheel.pl/posts/15</link><description>&lt;div class="document"&gt;
&lt;p&gt;Just a couple of days ago I've run into a tricky bug with nginx. One of the virtual servers defined a variable in its configuration (via &lt;tt class="docutils literal"&gt;set&lt;/tt&gt; keyword). When creating a new virtual host by copying the site file I've removed the set line, but not the usage (&lt;tt class="docutils literal"&gt;fastcgi_param&lt;/tt&gt; line). This caused a random sequence of bytes to be put into that variable. PHP serving those FCGI requests handled it gracefully, but I spent quite a long time trying to figure out why this variable was garbled.&lt;/p&gt;
&lt;/div&gt;
</description><guid isPermaLink="true">http://squarewheel.pl/posts/15</guid><pubDate>Mon, 02 Nov 2009 00:28:08 GMT</pubDate></item><item><title>A toy ORM in PHP</title><link>http://squarewheel.pl/posts/14</link><description>&lt;div class="document"&gt;
&lt;p&gt;I've released yet another toy project: an attempt to create a PHP ORM. It is hosted on &lt;a class="reference external" href="http://bitbucket.org/pstradomski/axiomatic/"&gt;BitBucket&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;The project grew out of disappointment with Doctrine and its numerous bugs (problems with isset, saving already deleted object etc). It uses mostly well-known patterns: Unit of Work, Identity Map, Mapper and more. Internal methods are unfortunately public due to some limitations of PHP (no package access nor friend classes), with alternatives (using reflection or classkit or much more sophisticated design) felt like unneccessary complication.&lt;/p&gt;
&lt;p&gt;There is almost no documentation yet, feel free to drop a line if you are interested in the project.&lt;/p&gt;
&lt;/div&gt;
</description><guid isPermaLink="true">http://squarewheel.pl/posts/14</guid><pubDate>Fri, 30 Oct 2009 20:26:45 GMT</pubDate></item><item><title>TwillManager</title><link>http://squarewheel.pl/posts/13</link><description>&lt;div class="document"&gt;
&lt;p&gt;&lt;tt class="docutils literal"&gt;TwillManager&lt;/tt&gt; is a side project created at our company (&lt;a class="reference external" href="http://www.codesprinters.com"&gt;Code Sprinters&lt;/a&gt;), written in Python
(with &lt;a class="reference external" href="http://www.cherrypy.org/"&gt;CherryPy&lt;/a&gt;, &lt;a class="reference external" href="http://www.makotemplates.org/"&gt;Mako&lt;/a&gt;, &lt;a class="reference external" href="http://sqlite.org/"&gt;sqlite&lt;/a&gt; - and, of course,
&lt;a class="reference external" href="http://twill.idyll.org/"&gt;Twill&lt;/a&gt; - scripted headless web browser).&lt;/p&gt;
&lt;p&gt;Its main purpose is to monitor web applications - every few seconds (interval can be defined) it runs the script, which can load up a page,
verify links, submit forms etc. - and if the script fails, sends out an e-mail notification. The status of all the defined watches is also available
through a simple web interface. The application is in very early stage, though usable nonetheless. The code can be downloaded from Github:
&lt;a class="reference external" href="http://github.com/codesprinters/twillmanager/tree/master"&gt;http://github.com/codesprinters/twillmanager/tree/master&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;Credit due to Adam Byrtek for the idea of the application and Krzysztof Walo, together with whom I've implemented this app.&lt;/p&gt;
&lt;/div&gt;
</description><guid isPermaLink="true">http://squarewheel.pl/posts/13</guid><pubDate>Thu, 20 Aug 2009 00:04:46 GMT</pubDate></item><item><title>Academia</title><link>http://squarewheel.pl/posts/12</link><description>&lt;div class="document"&gt;
&lt;p&gt;Two interesting posts (rants?) about current status of Computer Science in the academic world: &lt;a class="reference external" href="http://www.lambdassociates.org/blog/decline.htm"&gt;Why I am Not a Professor&lt;/a&gt; and &lt;a class="reference external" href="http://unqualified-reservations.blogspot.com/2007/08/whats-wrong-with-cs-research.html"&gt;What's wrong with CS research&lt;/a&gt;. I have to agree with most points in the first one (while not with the second one).&lt;/p&gt;
&lt;p&gt;I've also witnessed, at my University, the practice of scaling/normalizing exam results, the inflation of grades &#8211; and sometimes poor quality of the courses themselves. So... any reason to stay in the academia &#8211; except for the possibility to do the few courses I didn't manage to do earlier due to sharing my time between studying and working at Code Sprinters?&lt;/p&gt;
&lt;div class="section" id="rst_edit-2009-08-22"&gt;
&lt;h2&gt;Edit (2009-08-22):&lt;/h2&gt;
&lt;p&gt;Also, &lt;a class="reference external" href="http://www.phdcomics.com/comics.php?f=1215"&gt;http://www.phdcomics.com/comics.php?f=1215&lt;/a&gt;&lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;
</description><guid isPermaLink="true">http://squarewheel.pl/posts/12</guid><pubDate>Mon, 03 Aug 2009 23:35:18 GMT</pubDate></item><item><title>Routes in PHP.</title><link>http://squarewheel.pl/posts/11</link><description>&lt;div class="document"&gt;
&lt;p&gt;Yet another small piece of code: implementation of simple route mechanism in PHP: &lt;a class="reference external" href="http://bitbucket.org/pstradomski/php-routes/"&gt;Bitbucket repository&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;It doesn't try to be a dispatch mechanism - just returns the list of matching variables (or null if no match) and allows url generation. Couple it with whatever way of finding controllers (classes, functions) you want.&lt;/p&gt;
&lt;/div&gt;
</description><guid isPermaLink="true">http://squarewheel.pl/posts/11</guid><pubDate>Wed, 22 Jul 2009 00:10:32 GMT</pubDate></item><item><title>Screw the anonymous</title><link>http://squarewheel.pl/posts/10</link><description>&lt;div class="document"&gt;
&lt;p&gt;Yet another post not related to programming (I'll try to post something about programming soon).&lt;/p&gt;
&lt;p&gt;A good rule of thumb:&lt;/p&gt;
&lt;blockquote&gt;
Don't send anonymous messages; regard authors of anonymous letters as either ill-mannered or cowards.&lt;/blockquote&gt;
&lt;p&gt;Recently I received two letters (the first one is more a manifesto I guess...); both sent by a group of people dissatisfied with the way one of local organizations is governed. It's nice that those people care about our little society... but I believe those letters should be signed with real names, not with vague term &amp;quot;group of concerned people&amp;quot;.&lt;/p&gt;
&lt;p&gt;I understand there are some situations where protecting one's identity is necessary - eg. corporate &lt;a class="reference external" href="http://en.wikipedia.org/wiki/Whistleblower"&gt;whistleblowers&lt;/a&gt; or witnesses of some crimes (where criminals could get their revenge on them). But in case of local politics? In my opinion - no way. Similarly, not in discussion on the Internet. I believe (you might disagree with me) that if you have the courage to call other people idiots or morons then you should have the guts to show your real name. Assume some responsibility for what you write.&lt;/p&gt;
&lt;p&gt;And yes, &lt;a class="reference external" href="http://en.wikipedia.org/wiki/Anonymous_(group)"&gt;Anonymous&lt;/a&gt;, this includes you.&lt;/p&gt;
&lt;hr class="docutils" /&gt;
&lt;p&gt;Post Scriptum:&lt;/p&gt;
&lt;p&gt;OK, this is a kind of rant. I know. And I know that a couple of years ago I was posting on some messageboards with shortened nicks not containing my full name. Guess I qualified in &amp;quot;ill-mannered&amp;quot; crowd then.&lt;/p&gt;
&lt;/div&gt;
</description><guid isPermaLink="true">http://squarewheel.pl/posts/10</guid><pubDate>Fri, 19 Jun 2009 23:53:52 GMT</pubDate></item><item><title>Wielko&#347;ci wzgl&#281;dne (in Polish)</title><link>http://squarewheel.pl/posts/9</link><description>&lt;div class="document"&gt;
&lt;p&gt;W krótkiej przerwie w pisaniu pracy magisterskiej...&lt;/p&gt;
&lt;p&gt;Gazeta Wyborcza pisze (&lt;a class="reference external" href="http://wyborcza.pl/1,75248,6663288,O_place_na_noze.html"&gt;O p&#322;ac&#281; minimaln&#261; na no&#380;e&lt;/a&gt;):&lt;/p&gt;
&lt;blockquote&gt;
P&#322;aca minimalna osi&#261;gnie po&#322;ow&#281; p&#322;acy &#347;redniej za 14
lat - zak&#322;ada Ministerstwo Pracy.&lt;/blockquote&gt;
&lt;p&gt;Przeformu&#322;ujmy nieco to zdanie:&lt;/p&gt;
&lt;blockquote&gt;
Ministerstwo Pracy ostrzega: za 14 lat &#347;rednia p&#322;aca spadnie do  dwukrotno&#347;ci p&#322;acy minimalnej.&lt;/blockquote&gt;
&lt;p&gt;I na tym polega urok wielko&#347;ci wzgl&#281;dnych.&lt;/p&gt;
&lt;/div&gt;
</description><guid isPermaLink="true">http://squarewheel.pl/posts/9</guid><pubDate>Tue, 02 Jun 2009 14:42:10 GMT</pubDate></item><item><title>Primitive captcha added.</title><link>http://squarewheel.pl/posts/8</link><description>&lt;div class="document"&gt;
&lt;p&gt;I've just had to add a primitive captcha to this blog. Turns out that even though only a few people read it spambots try to add advertising comments to the articles. Hope this fixes the problem - if not I'll have to add &lt;a class="reference external" href="http://recaptcha.net/"&gt;ReCaptcha&lt;/a&gt; here.&lt;/p&gt;
&lt;/div&gt;
</description><guid isPermaLink="true">http://squarewheel.pl/posts/8</guid><pubDate>Fri, 29 May 2009 14:57:30 GMT</pubDate></item><item><title>Releasing "onion"</title><link>http://squarewheel.pl/posts/7</link><description>&lt;div class="document"&gt;
&lt;p&gt;As mentioned &lt;a class="reference external" href="http://squarewheel.pl/posts/1"&gt;in the first post&lt;/a&gt; and on my old &lt;a class="reference external" href="http://squarewheel.wordpress.com/2008/06/02/reinventing-the-square-wheel-again/"&gt;Wordpress blog&lt;/a&gt; I'm doing some research into web applications for my thesis &#8212; and in the process I'm writing my own framework. Well, the part that is not related to my thesis (dealing with continuations) was just made public. You can read the API documentation and download it from &lt;a class="reference external" href="http://squarewheel.pl/onion/"&gt;http://squarewheel.pl/onion/&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;The name? Well, the framwork follows a layered architecture. And onions have layers. Just like ogres.&lt;/p&gt;
&lt;p&gt;The basic idea was to try to get a framework as minimalistic as possible to avoid it getting in my way when doing real thesis-related work. It's almost bare WSGI, but instead of having each component in the chain accept &lt;tt class="docutils literal"&gt;(start_response, environ)&lt;/tt&gt; tuple it accepts &lt;a class="reference external" href="http://pythonpaste.org/webob/"&gt;WebOb&lt;/a&gt; Request object and returns Response. It also contains simple dependency lookup code to help with decoupling different application components.&lt;/p&gt;
&lt;p&gt;I can't publish the part that is directly related to my thesis (and the code is almost finished now :) ) until I finish the thesis and resolve some issues with university holding copyright on it.&lt;/p&gt;
&lt;p&gt;By the way &#8212; this blog is powered by that code (minus the thesis part), so it's enough to prove that it's possible to write an application in that framework.&lt;/p&gt;
&lt;/div&gt;
</description><guid isPermaLink="true">http://squarewheel.pl/posts/7</guid><pubDate>Tue, 26 May 2009 19:19:29 GMT</pubDate></item><item><title>Guessing is bad (sometimes)</title><link>http://squarewheel.pl/posts/6</link><description>&lt;div class="document"&gt;
&lt;p&gt;&#8220;Be strict with what you generate, be permissive with what you accept&#8221; is a quite popular opinion when it comes to input/output from libraries, network protocols etc. But is it such a good idea? Because of it we are stuck with web as it is now, with bad markup everywhere &#8211; because it works (mostly). And yet even more problems arise.&lt;/p&gt;
&lt;p&gt;A week ago I was hit by similar situation, but at a library API level. &lt;a class="reference external" href="http://framework.zend.com/manual/en/zend.date.html"&gt;Zend_Date&lt;/a&gt; constructor accepts string representation of date and a format specifier (optional). Without explicitly specified format, it tries to guess the correct one.&lt;/p&gt;
&lt;p&gt;Thus it interpreted '2009-03-31' correctly as 31st March. But the very next day unit tests for one piece of code broke. Zend_Date interpreted '2009-04-01' as 4th January instead of 1st April.&lt;/p&gt;
&lt;p&gt;To quote the &lt;a class="reference external" href="http://www.python.org/dev/peps/pep-0020/"&gt;Zen of Python&lt;/a&gt;:&lt;/p&gt;
&lt;pre class="literal-block"&gt;
In the face of ambiguity, refuse the temptation to guess.
&lt;/pre&gt;
&lt;/div&gt;
</description><guid isPermaLink="true">http://squarewheel.pl/posts/6</guid><pubDate>Tue, 07 Apr 2009 22:00:08 GMT</pubDate></item><item><title>A little known tool: newgrp</title><link>http://squarewheel.pl/posts/5</link><description>&lt;div class="document"&gt;
&lt;p&gt;Documentation of various linux programs often states that after adding user to some unix group
you need to re-login in order to use new privileges. Although this is definitely the easiest
option, it is still possible to enhance user's groupset without re-logging.&lt;/p&gt;
&lt;p&gt;After adding user to the group you can use &lt;tt class="docutils literal"&gt;newgrp group_name&lt;/tt&gt;. This is an old tool (from the time when unix
users could use privileges of only one group at a time) that changes the current group for user. Additionally,
it tries to add the group to the current &lt;em&gt;groupset&lt;/em&gt; for the user.&lt;/p&gt;
&lt;p&gt;For example:&lt;/p&gt;
&lt;pre class="literal-block"&gt;
$ id
uid=1000(pawel) gid=1000(pawel)
grupy=6(disk),10(wheel),11(floppy),18(audio),
19(cdrom),27(video),80(cdrw),85(usb),100(users),
443(plugdev),1000(pawel),1004(www),1005(ssmtp),
1006(vboxusers),1007(kvm)

$ newgrp wireshark
$ id
uid=1000(pawel) gid=1008(wireshark)
grupy=6(disk),10(wheel),11(floppy),18(audio),
19(cdrom),27(video),80(cdrw),85(usb),100(users),
443(plugdev),1000(pawel),1004(www),1005(ssmtp),
1006(vboxusers),1007(kvm),1008(wireshark)
&lt;/pre&gt;
&lt;p&gt;Unfortunately, the current group changed. To have it back to user's default group just run &lt;tt class="docutils literal"&gt;newgrp&lt;/tt&gt; again:&lt;/p&gt;
&lt;pre class="literal-block"&gt;
$ newgrp
$ id
uid=1000(pawel) gid=1000(pawel)
grupy=6(disk),10(wheel),11(floppy),18(audio),
19(cdrom),27(video),80(cdrw),85(usb),100(users),
443(plugdev),1000(pawel),1004(www),1005(ssmtp),
1006(vboxusers),1007(kvm),1008(wireshark)
&lt;/pre&gt;
&lt;p&gt;This only affects the current shell, but should be enough to just run a single program (like &lt;tt class="docutils literal"&gt;wireshark&lt;/tt&gt; or some cd burninig software like &lt;tt class="docutils literal"&gt;k3b&lt;/tt&gt;).&lt;/p&gt;
&lt;p&gt;Oh, and just plain &lt;tt class="docutils literal"&gt;su - mylogin&lt;/tt&gt; would also work - but it asks for a password :)&lt;/p&gt;
&lt;/div&gt;
</description><guid isPermaLink="true">http://squarewheel.pl/posts/5</guid><pubDate>Thu, 02 Apr 2009 14:43:38 GMT</pubDate></item><item><title>Playing with design: Object-oriented HTML helpers</title><link>http://squarewheel.pl/posts/4</link><description>&lt;div class="document"&gt;
&lt;p&gt;HTML helpers are simple functions, that generate HTML fragments. They were made popular by Ruby on Rails (eg. &lt;a class="reference external" href="http://apidock.com/rails/ActionView/Helpers/UrlHelper/link_to"&gt;link_to&lt;/a&gt; helper). Similarly they were adopted in Pylons as &lt;a class="reference external" href="http://pylonshq.com/docs/en/0.9.7/thirdparty/webhelpers/#module-webhelpers"&gt;Webhelpers&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;In theory helpers should be just simple functions &#8211; the output should depend just on arguments to the function. This works well for most cases, but sometimes there is a need to reach for values provided by other classes &#8211; eg. it would be nice if form-generating helper could obtain the value of &lt;a class="reference external" href="http://en.wikipedia.org/wiki/Cross-site_request_forgery"&gt;CSRF&lt;/a&gt;-protecting field from the object that provides such protection, or access the URL-generating object (eg. in a &lt;tt class="docutils literal"&gt;link()&lt;/tt&gt; helper)&lt;/p&gt;
&lt;p&gt;One could just avoid those situations by forcing user to supply those arguments &#8211; but it can become inconvenient at some point. Another solution would be to just call functions that provide those values (URL generator or CSRF token generator) directly, but this would tie helpers to specific objects/implementations (what if user switches to another URL scheme and wants to use his own generator?).&lt;/p&gt;
&lt;p&gt;In OOP world standard practice for such situations is to use either dependency injection or dependency lookup &#8211; but when using plain functions a new problem arises &#8211; how to inject dependency to a function? In python this is doable, one could just inject it to a module-global variable. In the toy framework I'm writing now I wanted to avoid this, because it prevents sharing the same module between two applications running in the same interpreter. I also wanted to avoid thread_local variables as much as possible.&lt;/p&gt;
&lt;p&gt;The obvious solution I used is to make those helpers methods of some object &#8211; it is then possible to inject dependencies into that object. My current implementation has a &lt;tt class="docutils literal"&gt;HelperSet&lt;/tt&gt; class that has a handle to dependency-lookup code and an abstract &lt;tt class="docutils literal"&gt;Helper&lt;/tt&gt; class. &lt;tt class="docutils literal"&gt;HelperSet&lt;/tt&gt; is constructed during application initialization and various helpers are added to it &#8211; depending which of them programmer wants to use:&lt;/p&gt;
&lt;pre class="literal-block"&gt;
helpers = HelperSet(config)
helpers.add_helper(FormsHelper)
helpers.add_helper(ListsHelper)
&lt;/pre&gt;
&lt;p&gt;That object is later injected into view and available to templates:&lt;/p&gt;
&lt;pre class="literal-block"&gt;
${h.forms.textarea_obj(post_form['body'], id='post-body', rows=40, style='width:100%')}

${h.forms.submit('submit', 'Save')}
&lt;/pre&gt;
&lt;p&gt;A call to &lt;tt class="docutils literal"&gt;add_helper&lt;/tt&gt; method constructs a new instance of given helper class and exposes it through an attribute on &lt;tt class="docutils literal"&gt;HelperSet&lt;/tt&gt; object. The constructed instance also gets a reference to the set so it can use it's handle to dependencies registry.&lt;/p&gt;
&lt;/div&gt;
</description><guid isPermaLink="true">http://squarewheel.pl/posts/4</guid><pubDate>Sat, 21 Mar 2009 17:27:04 GMT</pubDate></item><item><title>Deprecating sliding_sessions</title><link>http://squarewheel.pl/posts/3</link><description>&lt;div class="document"&gt;
&lt;p&gt;As Alberto &lt;a class="reference external" href="http://squarewheel.wordpress.com/2007/11/03/session-cookie-expiration-time-in-rails/#comment-29"&gt;pointed out&lt;/a&gt; in one of the posts on my old wordpress blog, my &lt;tt class="docutils literal"&gt;sliding_sessions&lt;/tt&gt; plugin will not work with Rails 2.3.&lt;/p&gt;
&lt;p&gt;After short investigation it turns out the plugin is now completely obsolete and replaced with functionality in Rails itself.&lt;/p&gt;
&lt;p&gt;If you need to set expiration period for sessions through all controllers in your application, simply add the following option to your &lt;tt class="docutils literal"&gt;config/intializers/session_store.rb&lt;/tt&gt; file:&lt;/p&gt;
&lt;pre class="literal-block"&gt;
:expire_after =&amp;gt; 60.minutes
&lt;/pre&gt;
&lt;p&gt;If you need to set different expiration time in different controllers or actions, use the following code in action or some before_filter:&lt;/p&gt;
&lt;pre class="literal-block"&gt;
request.session_options = request.session_options.dup
request.session_options[:expire_after] = 5.minutes
request.session_options.freeze
&lt;/pre&gt;
&lt;p&gt;Duplication of the hash is needed only because it is already frozen at that point, even though modification of at least &lt;tt class="docutils literal"&gt;:expire_after&lt;/tt&gt; is possible and works flawlessly.&lt;/p&gt;
&lt;p&gt;The old plugin (for Rails &amp;lt;= 2.2) is here: &lt;a class="reference external" href="http://squarewheel.pl/files/sliding_sessions.zip"&gt;sliding_sessions.zip&lt;/a&gt;&lt;/p&gt;
&lt;/div&gt;
</description><guid isPermaLink="true">http://squarewheel.pl/posts/3</guid><pubDate>Wed, 18 Feb 2009 18:13:50 GMT</pubDate></item><item><title>Some problems with MySQL and collation</title><link>http://squarewheel.pl/posts/2</link><description>&lt;div class="document"&gt;
&lt;p&gt;Just had a minor &amp;quot;WTF&amp;quot; moment with MySQL, related to collation. It turns out that in the default unicode collation (&lt;tt class="docutils literal"&gt;utf8_general_ci&lt;/tt&gt;) accents are ignored (but not all of them). Yes, I should have checked in the &lt;a class="reference external" href="http://dev.mysql.com/doc/refman/5.0/en/charset-unicode-sets.html"&gt;documentation&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;This is a problem for us, as &lt;tt class="docutils literal"&gt;UNIQUE&lt;/tt&gt; indices do not allow two different words, because mysql consider them equal. This means we need to use &lt;tt class="docutils literal"&gt;utf8_bin&lt;/tt&gt; &#8212; &lt;tt class="docutils literal"&gt;utf8_polish_ci&lt;/tt&gt; won't work for the task.&lt;/p&gt;
&lt;p&gt;Here are samples of some queries in different collations:&lt;/p&gt;
&lt;pre class="literal-block"&gt;
mysql&amp;gt; SET &amp;#64;&amp;#64;collation_connection = 'utf8_general_ci';
Query OK, 0 rows affected (0.00 sec)

mysql&amp;gt; SELECT &amp;quot;Mo&#380;e&amp;quot; = &amp;quot;Moze&amp;quot;; -- Polish &#379; is considered equal to Z
+------------------+
| &amp;quot;Mo&#380;e&amp;quot; = &amp;quot;Moze&amp;quot;  |
+------------------+
|                1 |
+------------------+
1 row in set (0.00 sec)

mysql&amp;gt; SELECT &amp;quot;&#321;awka&amp;quot; = &amp;quot;Lawka&amp;quot;; -- But &#321; is different from L
+--------------------+
| &amp;quot;&#321;awka&amp;quot; = &amp;quot;Lawka&amp;quot;  |
+--------------------+
|                  0 |
+--------------------+
1 row in set (0.00 sec)

mysql&amp;gt; SET &amp;#64;&amp;#64;collation_connection = 'utf8_unicode_ci';
Query OK, 0 rows affected (0.00 sec)

mysql&amp;gt; SELECT &amp;quot;Mo&#380;e&amp;quot; = &amp;quot;Moze&amp;quot;;
+------------------+
| &amp;quot;Mo&#380;e&amp;quot; = &amp;quot;Moze&amp;quot;  |
+------------------+
|                1 |
+------------------+
1 row in set (0.00 sec)

mysql&amp;gt; SELECT &amp;quot;&#321;awka&amp;quot; = &amp;quot;Lawka&amp;quot;;
+--------------------+
| &amp;quot;&#321;awka&amp;quot; = &amp;quot;Lawka&amp;quot;  |
+--------------------+
|                  0 |
+--------------------+
1 row in set (0.00 sec)

mysql&amp;gt; SET &amp;#64;&amp;#64;collation_connection = 'utf8_bin';
Query OK, 0 rows affected (0.00 sec)

mysql&amp;gt; SELECT &amp;quot;&#321;awka&amp;quot; = &amp;quot;Lawka&amp;quot;;
+--------------------+
| &amp;quot;&#321;awka&amp;quot; = &amp;quot;Lawka&amp;quot;  |
+--------------------+
|                  0 |
+--------------------+
1 row in set (0.00 sec)

mysql&amp;gt; SELECT &amp;quot;Mo&#380;e&amp;quot; = &amp;quot;Moze&amp;quot;;
+------------------+
| &amp;quot;Mo&#380;e&amp;quot; = &amp;quot;Moze&amp;quot;  |
+------------------+
|                0 |
+------------------+
1 row in set (0.00 sec)

mysql&amp;gt; SET &amp;#64;&amp;#64;collation_connection = 'utf8_polish_ci';
Query OK, 0 rows affected (0.00 sec)

mysql&amp;gt; SELECT &amp;quot;&#321;awka&amp;quot; = &amp;quot;Lawka&amp;quot;;
+--------------------+
| &amp;quot;&#321;awka&amp;quot; = &amp;quot;Lawka&amp;quot;  |
+--------------------+
|                  0 |
+--------------------+
1 row in set (0.00 sec)

mysql&amp;gt; SELECT &amp;quot;Mo&#380;e&amp;quot; = &amp;quot;Moze&amp;quot;;
+------------------+
| &amp;quot;Mo&#380;e&amp;quot; = &amp;quot;Moze&amp;quot;  |
+------------------+
|                0 |
+------------------+
1 row in set (0.00 sec)
&lt;/pre&gt;
&lt;p&gt;So now it's time to change most VARCHARS in about 100 tables.&lt;/p&gt;
&lt;/div&gt;
</description><guid isPermaLink="true">http://squarewheel.pl/posts/2</guid><pubDate>Thu, 12 Feb 2009 19:10:30 GMT</pubDate></item><item><title>A new blog!</title><link>http://squarewheel.pl/posts/1</link><description>&lt;div class="document"&gt;
&lt;p&gt;The &amp;quot;Square Wheel blog&amp;quot;, previously available at &lt;a class="reference external" href="http://squarewheel.wordpress.com"&gt;Wordpress&lt;/a&gt; has moved to a new site &#8211; &lt;a class="reference external" href="http://squarewheel.pl"&gt;http://squarewheel.pl&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Reasons? Well, first of all, I'm developing a new python web framework (and yes, I know there are hundreds of those already) for my Master's thesis. I'll probably publish the part not related to my research soon, and the part directly related to the thesis as soon as possible (probably six months after graduation). And when writing a framework I need an application to use it, just to make sure it works. Well, this blog is the first attempt at such application, to test the basic part of the framework (not the part directly related to my research topic).&lt;/p&gt;
&lt;p&gt;Moreover on &lt;a class="reference external" href="http://www.wordpress.com"&gt;wordpress.com&lt;/a&gt; I couldn't host &lt;tt class="docutils literal"&gt;.zip&lt;/tt&gt; files, so I had to put them on my &lt;a class="reference external" href="http://www.ii.uj.edu.pl"&gt;university&lt;/a&gt; web server. This blog will not have such limitation.&lt;/p&gt;
&lt;p&gt;I know this blog is still in it's infancy &#8211; no RSS feed, ugly UI and so on. I hope it will improve. Also, I'll try to post more regularly.&lt;/p&gt;
&lt;p&gt;Edit:&lt;/p&gt;
&lt;blockquote&gt;
&lt;ul class="simple"&gt;
&lt;li&gt;RSS Feed added &#8212; experimental version at &lt;a class="reference external" href="http://squarewheel.pl/posts/feed"&gt;http://squarewheel.pl/posts/feed&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/blockquote&gt;
&lt;/div&gt;
</description><guid isPermaLink="true">http://squarewheel.pl/posts/1</guid><pubDate>Fri, 30 Jan 2009 22:38:20 GMT</pubDate></item></channel></rss>