Archive for 2012

Monthly Donations: LibreOffice and The Pegasus Foundation

Wednesday, December 26th, 2012

It’s the jolly festive time of year and I’m mostly spending time with my family and consuming lots of pierogi, but at this very moment I’m taking a break from that to take care of the monthly donations.

This time I’m donating to LibreOffice, the free and open source office suite. It’s the Phoenix that arose from the ashes of, when the latter fell prey to the behemoth Oracle, and it’s yet another open source application that I use almost every day. The Document Foundation, which is the organization behind LibreOffice, is currently collecting funds for their 2013 budget, and my little contribution is going to support that.

My second donation is to The Pegasus Foundation, based in Warsaw, dedicated to saving horses bound for slaughter. The Foundation is in operation since 2002 and has rescued more than 170 horses, giving them a new life in children hippotherapy centers or allowing them to live out their remaining years in a safe place.

Happy Birthday Perl

Tuesday, December 18th, 2012

Happy 25th Birthday, Perl! I made you a card:

perl -C -e'print map+(v9635 x8^unpack B8).(v10)[++$n%9],(unpack

Building a Search Web App with Dancer and Sphinx

Friday, December 14th, 2012

In this article, we’ll develop a basic search application using Dancer and Sphinx. Sphinx is an open source search engine that’s fairly easy to use, but powerful enough to be deployed in high-traffic sites, such as Craigslist and Dailymotion.

In keeping with this year’s Dancer Advent Calendar trend, the example app will be built on Dancer 2, but it should work just as well with Dancer 1.

Alright, let’s get to work.

The Data

Our web application will be used to search through documents stored in a MySQL database. We’ll use a simple table with the following structure:

CREATE TABLE documents (
    title varchar(200) NOT NULL,
    contents_text text NOT NULL,
    contents_html text NOT NULL,
    PRIMARY KEY (id)

Each document has an unique ID, a title, and contents, stored as both plain text and as HTML. We need the two formats for different purposes — HTML will be used to display the document in the browser, while plain text will be fed to the indexing mechanism of the search engine (because we do not want to index the HTML tags, obviously).

We can populate the database with any kind of document data — for my test version, I used a simple script to fill the database with POD documentation extracted from Dancer distribution. The script is included at the end of this article, in case you’d like to use it yourself.

Installation and Configuration of Sphinx

Sphinx can be installed pretty easily, using one of the pre-compiled .rpm or .deb packages, or the source tarball. These are available at the download page at — grab the one that suits you and follow the installation instructions.

When Sphinx is installed, it needs to be configured before we can play with it. Its main configuration file is usually located at /etc/sphinx/sphinx.conf. For our purposes, a very basic setup will do — we’ll put the following in the sphinx.conf file:

source documents
    type        = mysql
    sql_host    = localhost
    sql_user    = user
    sql_pass    = hunter1
    sql_db      = docs

    sql_query   = \
        SELECT id, title, contents_text FROM documents

index test
    source          = documents
    charset_type    = utf-8
    path            = /usr/local/sphinx/data/test

This defines one source, which is what Sphinx uses to gather data, and one index, which will be created by processing the collected data and will then be queried when we perform the searches. In our case, the source is the documents database that we just created. Thesql_query directive defines the SELECT query that Sphinx will use to pull the data, and it includes all the fields from the documents table, except contents_html — like we said, HTML is not supposed to be indexed.

That’s all that we need to start using Sphinx. After we make sure the searchd daemon is running, we can proceed with indexing the data. We call indexer with the name of the index:

$ indexer test

It should spit out some information about the indexing operation, and when it’s done, we can do our first search:

$ search "plugin"

index 'test': query 'plugin ': returned 8 matches of 8 total in 0.002 sec

displaying matches:
1. document=19, weight=2713
2. document=44, weight=2694
3. document=20, weight=1713
4. document=2, weight=1672
5. document=1, weight=1640
6. document=13, weight=1640
7. document=27, weight=1601
8. document=28, weight=1601

Apparently, there are 8 documents in the Dancer documentation with the word plugin, and the one with the ID of 19 is the highest ranking result. Let’s see which document that is:

mysql> SELECT title FROM documents WHERE id = 19;
| title                                              |
| Dancer::Plugin - helper for writing Dancer plugins |

It’s the documentation for Dancer::Plugin, and it makes total sense that this is the first result for the word plugin. Sphinx setup is thus ready and we can get to the web application part of our little project.


Monthly Donations: Vim/ICCF Holland and the Animal Shelter in Bydgoszcz

Thursday, November 29th, 2012

We’re getting close to the end of the worldmonth, which is when I usually do my monthly donations — so let’s get to it.

The open source project that I’m supporting this time is Vim, the text editor of choice for many programmers. I thought it’s a perfect moment to make it this month’s project because of two reasons:

  1. I recently switched (back) to using Vim as my primary editor/IDE
  2. Vim just celebrated its 21st birthday (three days ago — Happy Birthday!)

The donation that I’m sending is not actually going to Vim, but to ICCF Holland, which is an organization devoted to helping children in Uganda. All financial support for Vim is transferred to them — which is awesome. Thanks and best wishes to Bram Moolenar, the author of Vim, all the contributors to the project, and to the volunteers of ICCF Holland!

I’m also supporting the Animal Shelter in Bydgoszcz, which has a long tradition of caring for unfortunate cats and dogs, and finding them new homes. Thanks to all the employees and volunteers of the shelter for their work!

ImgAreaSelect 0.9.9

Tuesday, November 27th, 2012

I have finally released the new version of imgAreaSelect, numbered 0.9.9, which is intended to be the last version in the 0.x line (the next one is going to be a glorious 1.0 release).

The new version fixes a few minor issues, and is tested to work with the latest version of jQuery (1.8.3). As always, lots of thanks to all the people that sent me feedback and helped me with debugging.

I also promised to give you an update on the mobile version of the plugin. Well, it’s in a somewhat stalled state. I can’t get back to really working on it, because my beloved testing environment went broken — specifically, I can no longer test on an iOS browser. Since I don’t own any iOS devices, I used to do testing on an iPhone/iPad simulator, on Mac OS X running on a VirtualBox virtual machine. But, on my new system, I can’t get the VM to work. I spent countless hours reconfiguring the machine, creating new instances and reinstalling the OS, but so far nothing worked.

Anyway, I’m still determined to get back on it and get the mobile version to a release state, so either I’m going to get this bloody VM to work soon, or I might just end up getting an Apple device (gasp!). I also considered building a Hackintosh, but this might lead to the same problems that I’m having with the VM — ain’t nobody got time for that.

Monthly Donations: The Mozilla Foundation and the “Gift of Heart” Foundation

Sunday, October 28th, 2012

I’m not having a particularly enjoyable weekend, as my organism is battling gastroenteritis and I’m pretty much non-operational, but I’ve summoned up some strength to do the monthly donations.

My first donation goes to the Mozilla Foundation, which is most famous for being behind the Firefox web browser, but also has a number of other open-source software products, and does a lot for keeping the Web open and innovative. What I’d like to thank them for is one open-source application that I use on a daily basis — and that is Thunderbird, the e-mail client. I’ve been using it for over six years on a number of machines and I’ve convinced a few friends and work colleagues to switch to it from other e-mail applications. For the past two years or so I’ve also been using it as a calendar application, thanks to the excellent Lightning add-on.

The second donation that I’m making this month is to the “Gift of Heart” Foundation, located in Skała near Kraków, which helps homeless and abused animals (mainly horses and dogs) in cooperation with animal shelters in their region. With my donation, I’m virtually adopting a beatiful five year old female dog by the name of Puma.

Thanks and best wishes to the Mozilla Foundation and the “Gift of Heart” Foundation for their work.

Update on ImgAreaSelect

Wednesday, September 26th, 2012

I’ve received numerous e-mails in the past couple of days asking me when the new version of ImgAreaSelect will be released. I wanted to make that happen this last weekend, but, well, precious technology failed me. My laptop, which I’ve been using as a development workstation for the past few months, started overheating really badly, up to the point of becoming unusable. I’m waiting to get it fixed, and until then I have to use an old netbook that’s only good for e-mail and web browsing, so I have to take a little break from development.

Actually, I was going to take a break anyway — I’m on a short hiking trip from today until the end of the week. But, I hoped to roll out the new version of ImgAreaSelect before leaving for the trip, and the overheating trouble thwarted that plan.

The good news is, I managed to push some code to GitHub before the problems started. The current version in the master branch is the release candidate for 0.9.9, and it fixes one major issue with IE 9 and jQuery 1.8. I also created a separate branch for the mobile variant, and the code in that branch has basic support for touch events.

For now, please get those versions from GitHub, and I’ll make proper releases when I get back from the trip and sort out the problem with my laptop. I’ll keep you posted.

Supporting KeePassX and the “Sfora” Foundation

Thursday, September 20th, 2012

Hey, do you know what time it is? It’s time for another round of donations to free/open source software projects and charity organizations!

This month’s supported open source project is another excellent piece of software that I use on a daily basis — KeePassX password manager. It’s a cross-platform application that safely stores all your passwords and helps you manage them. It comes with some additional goodies, such as the password generator, which saves you the burden of coming up with “clever passwords”. I’ve been using KeePassX for more than two years on multiple machines and it’s been working great. Thank you, KeePassX Team, good job!

My second donation goes to the “Sfora” Foundation (“sfora” in Polish means a pack of dogs), who runs an animal shelter and organizes sterilization campaigns for stray dogs in Warsaw. Their philosophy is to protect and care for homeless animals, and at the same time work towards reducing the number of animals born into homelessness. The Foundation was recommended to me as a trustworthy organization by my friendly neighborhood veterinarian, who knows a few people involved in their activities. Best wishes to all the good people of the Fundation, and thank you for your hard work.

Twitter Lists Box User Script

Wednesday, September 19th, 2012

For some time now, I’ve been using Twitter on a daily basis. I’m far from being a hardcore twitterer (or whatever the term is), but I do spend a couple minutes every day reading new stuff that appears on my feed.

When I browse tweets on my desktop machine, I usually don’t use any apps — I just visit the Twitter website and don’t need anything more fancy than that. However, the list of people that I follow has grown over time, and I recently started missing one useful feature that the Twitter website used to have — easy access to lists. I have created a few private lists and put most of the followed people on them, and being able to quickly open a list to read just the tweets of people on that list was really convenient.

Back in the old days (that is, like a year ago), Twitter used to display lists in the sidebar, next to the timeline. But, then they were removed, and instead buried several clicks away in the interface. Probably because the vast majority of Twitter audience simply wasn’t using lists, Twitter had no interest in making that feature easily accessible. (Some people were speculating that lists will be completely removed at some point — but I hope that won’t happen.)

Luckily, user scripts have been invented to deal with situations like this. I found one existing script that kind of did what I wanted, but since it only supported public lists (mine are private), it didn’t meet my needs — so I ended up quickly putting together my own version. Welcome back, sidebar lists:

If you’d like to use the script, grab it from or from GitHub. Tested to work in Firefox and Chrome.

Monthly Donation Time: cURL and the “Friends to the Animals” Foundation

Thursday, August 30th, 2012

This month I’m not going to wait till the very last minute with my donations. Let’s do it.

The open source project that I’m supporting this month is cURL, a powerful swiss-army knife kind of utility for transferring data using various protocols. It’s most often used as command-line HTTP-testing tool, but it does waaay more than just that — look at the list of its features and be amazed. Lately I’ve been doing a lot of work with web APIs, and cURL has helped me with testing lots of times. Thanks and kudos to Daniel Stenberg, the original author and project leader, and to all the contributors!

Traditionally, my second donation is not related to open source or any technology stuff, and traditionally it is to an animal charity. I’m donating to the “Friends to the Animals” Foundation in Katowice, dedicated to helping mistreated animals and raising awareness of animal welfare issues. Their website lists many stories of animals that were saved by them — I was touched by the story of Manio, a cat that fell out of a window on 10th floor and survived with just a broken leg, but his owners could not afford to pay for his treatment and wanted to put him down. The Foundation took Manio in, had him operated, and is now taking care of him while he’s recovering. Get well soon, Manio!

  • Archives

  • Categories

  • Meta

  • Latest Tweets

    Warning: Illegal string offset 'last_access' in /usr/local/www/ on line 334

    Warning: Illegal string offset 'time_limit' in /usr/local/www/ on line 334

    Warning: Illegal string offset 'last_access' in /usr/local/www/ on line 336

    Warning: Illegal string offset 'twitter_api' in /usr/local/www/ on line 234

    Warning: Illegal string offset 'user_token' in /usr/local/www/ on line 262

    Warning: Illegal string offset 'user_secret' in /usr/local/www/ on line 263

    Warning: Illegal string offset 'consumer_key' in /usr/local/www/ on line 264

    Warning: Illegal string offset 'consumer_secret' in /usr/local/www/ on line 265

    Warning: Illegal string offset 'twitter_username' in /usr/local/www/ on line 270

    Warning: Illegal string offset 'show_retweets' in /usr/local/www/ on line 272

    Warning: Illegal string offset 'exclude_replies' in /usr/local/www/ on line 275

    Warning: Illegal string offset 'twitter_data' in /usr/local/www/ on line 282

    Warning: Illegal string offset 'twitter_data' in /usr/local/www/ on line 350

    Warning: Illegal string offset 'twitter_data' in /usr/local/www/ on line 351
    Twitter outputted an error:
    Warning: Illegal string offset 'time_format' in /usr/local/www/ on line 484
  • Follow odyniec on Twitter