Archive for the ‘programming’ Category
Monday, February 6th, 2012
Flickr’s navigation and layout have been a source of increasing frustration for me. I find myself copy-pasting search phrases, usernames and tags on flickriver all the time.
To put an end to this endless copy-pasting, I put together a small userscript that adds links to flickriver on flickr pages.

It’s just a few lines of ghetto flavored javascript, but it does what it is supposed to. It works on Chrome/Chromium, Firefox and Opera. I don’t know (don’t care) if it will work on other browsers.
Download it here.
In case you want to further improve it, feel free to fork it on github:
https://gist.github.com/1748810.
Tags: flickr, flickriver, greasemonkey, javascript, scriptish, userscript
Posted in computer stuff, programming | No Comments »
Sunday, December 11th, 2011
For reasons beyond my understanding, and despite their relative ubuiquity, state machines are still largely disregarded by a huge slice of programmers.
Many problems can be modeled using a state machine, the most common one is the maintenance of a database table column which holds some kind of state. Many programmers don’t realize that they are in presence of a state machine and end up throwing bits of code accross the codebase to flip state whenever necessary. They are basically resourcing to a messy ad-hoc implementation of a state machine without realizing it. Personally I’ve been tearing my hair off because of this countless times.
Simply put, if you’re going to use ad-hoc code to flip states among three or more possible values, you are going to make mistakes and ultimately render you codebase unmanageable.
(more…)
Tags: finite state automaton, javascript, state machine
Posted in computer stuff, programming | No Comments »
Monday, September 12th, 2011
Every other week I find myself solving some kind of problem that involves matrix operations or other linear algebra concepts. I still have my old TI-89 from when I was a student. It’s a handy calculator, no doubt about that, older people will even call it a luxury. But quite frankly, I don’t know why we should use calculators considering the speed of an average personal computer. Or even a cellphone in case you’re thinking about throwing the portability argument.
Anyway, rants aside, I was bored so I put together a tiny javascript library with basic linear algebra functions.
(more…)
Tags: algebra, javascript, mathematics, ualgebra.js
Posted in computer stuff, Mathematics, programming | No Comments »
Tuesday, September 6th, 2011
Galleria is an awesome slideshow gallery built on top of jquery.
After trying out about 10 different picture slideshow plugins for wordpress I couldn’t find one that would do what exactly what I want. For some reason, none of the plugins I tried was able to display more than one gallery in the same page. I wonder what use scenarios fall into that stupid restriction. Personally I don’t see any point on installing a picture slideshow plugin and use it once, but that’s just me.
So I ended up rolling my own. I googled around and picked galleria out of many javascript slideshow scripts, and wrapped it in a wordpress plugin.
Grab it from github.
Demo slideshow:
Tags: galleria, jquery, plugin, slidesho, wordpress
Posted in computer stuff, programming | 4 Comments »
Wednesday, March 16th, 2011
So… After a great deal of procrastination, I’m releasing a deb package of azulejo with some new window tilling actions.
This is still very unstable/experimental. To take advantage of the new features, you must delete your ~/.azulejorc.js in case you’re already using azulejo.
Here goes the current list of keyboard shortcuts:
Super+2 Place two windows side by side
Super+3 Place a window on the left half of the screen and two on the right half
Super+4 Arrange four windows two by two
Super+R Rotate windows' positions i.e. cycle windows
Super+H Resize and move current window to the left
Super+K Resize and move current window to the right
Super+Y Resize and move current window to left upper corner
Super+U Resize and move current window to right upper corner
Super+B Resize and move current window to left lower corner
Super+N Resize and move current window to right lower corner
Download deb package.
Tags: azulejo, gnome, openbox, python, tilling, wnck, xfce
Posted in computer stuff, Gnome, programming | 1 Comment »
Thursday, February 17th, 2011
PHP maps filenames into urls, this is a very handy feature and many applications simply use that for all their request handling needs. Practical as it can be, it’s quite limited.
Mapping url patterns into functions or Object methods is simple and easy. I’ll comment as I go…
(more…)
Tags: dispatcher, php, url
Posted in computer stuff, programming | No Comments »
Sunday, February 6th, 2011
I implemented window rotation on azulejo. This is something that doesn’t come with Winsplit Revoltion, but anyone who used a tilling window manager will be familiar with it.
Azulejo does not maintain a layout (sometimes called algorithm or tilling mode mode) so I had to resource to a bit of improvisation.
(more…)
Tags: azulejo, gnome, linux, openbox, python, tilling, winsplit revolution, wnck
Posted in computer stuff, Gnome, programming | No Comments »
Sunday, December 19th, 2010
Since my first contact with WNCK library, I’ve been willing to put together a proper solution for all my window tiling needs. After a bit of research I put together bunch of cool pieces of software and glue them together with python.
The result: a tinny application – less than 200 LoC so far – that runs on the background and listens to some defined keyboard shortcuts. Once such a keybind is pressed, it performs some user defined tilling operations.
This is still extremely experimental, yet usable. I tested it on gnome and fluxbox, appears to be working on both without any major problem. The project is hosted at bitbucket, you can download the latest usable release here.
Usage
Run azulejo.py, it will bind the following keyboard shortcuts globally:
Super+2 – Tile last two windows side by side
Super+3 – Tile last three windows
Super+4 - two by two window tile
Super+h – move current window to the left half of the screen
Super+k - move current window to the right half of the screen
Please note, due to a bug, you might need to run azulejo.py twice the first time you use it.
Tags: azulejo, fluxbox, gnome, keybind, tilling, wnck
Posted in computer stuff, Gnome, programming | 2 Comments »
Thursday, September 30th, 2010
After trying out a zillion linux tilling tools, I came to the conclusion that none of them is quite what I want. What I want is something like Winsplit Revolution. It offers powerful window management using the keyboard but does not stay on the way of those who still want to do stuff with their windows using a mouse like they always did.
I’ve been playing around with wnck’s python bindings and it’s great fun. I managed to tile two windows side by side by running a small script. This is the most basic tiling operation and, in my opinion, it’s deadly useful.
(more…)
Tags: gnome, python, tiling, wnck
Posted in computer stuff, programming | 3 Comments »
Sunday, May 30th, 2010
My lame sudoku solving script can now be use in a more intuitive way through an html form. I kept it retro-compatible so the old url interface can still be used. I also implemented initial rule checking to prevent invalid puzzles from causing weird results.
Source is hosted at bitbucket. Social code hosting is cool, from now on all my code bits will be pushed to bitbucket.
Tags: per, programming, puzzle, sudoku
Posted in computer stuff, programming | No Comments »