• Learning to read Dotsies - a new way of reading

    On my daily visit to Hacker News one of the top news items has caught my eye: Learn to read a binary font by reading a story, and this led me to Dotsies.com.

    What is Dotsies and how does it work?

    According to their homepage, Dotsies is a binary font, that uses dots (or squares) drawn in a specific order to represent letters. So you should be able to cram more information into the same space and use your screen real estate more efficiently. It makes sense, as all letters are of the same width (2-4 pixels wide it seems), thus taking up less horizontal space, but how practical and easy to learn is it?

    A letter is built as a 1x5 block structure where each cell is binary, that is it can be full or empty. The font covers just 26 letters, thus encoding with 2^5=32 encoding capacity is sufficient to encode the alphabet. Other characters are not encoded and words are separated by spaces.

    How to learn to read Dotsies?

    Actually learning to read Dotsies is not as hard as it seems. The learning curve is pretty shallow, as the learning material is designed to introduce symbols gradually, so the transition to reading binary blocks is smooth. The author suggests spending some time learning letters (for 20 minutes) and reading simple words (10 minutes). The learning platform (memorize.com) used for learning letters and words is surprisingly effective and is using flash cards, matching and multiple choice techniques to help you learn and remember.

    After you finish getting familiar with the font, you can head back to Dotsies.com, scroll down to the training text and get going! You should notice that even from the start you’ll be reading letters, that are split into the same binary blocks (see the image), so you’re getting used to reading in blocks from the start. Of course regular letters are gradually replaced by plain blocks as you go.

    First impressions

    Personally, it wasn’t too hard, but at the same time it wasn’t easy. Memorizing the letters (even putting the information to the short-term memory) took about 30 minutes and learning to read words took about 15 minutes. Then I moved onto reading the training text, which took me a whopping 2 hours to finish.

    Once you start reading the training text, you may think it’s not that bad, but as more and more letters are replaced, it starts to confuse you, thus I recommend to have the alphabet nearby to check which letter you’re looking at.

    Closing thoughts

    Although it was fun, interesting and beneficial (mental exercise is important) to learn reading Dotsies, at least at first I can’t say that it is practical. You certainly won’t be reading 500 wpm any time soon, I think you’d be lucky if you’d reach 50 wpm in first few days of using it. But I agree with the author that it is not yet clear if it is faster reading that way, because it’s not apparent until many people spend some time getting used to it and share their experiences. He also suggests remembering how you learned reading in the first place.

    I have mixed feelings about learning to read Dotsies. It was fun and interesting, but that’s it, just a fun experiment. But if you found this interesting, go to Dotsies.com to find out more about it.

  • Learning programming languages with Koans

    Sometimes getting familiar with programming languages is not that easy, even with Python. You read some tutorials, try some examples, maybe even write a few test programs. But if you don’t have a plan on how to attack learning progress - you’re sort of in trouble.

    Learning with Koans

    A great way of learning a new language and understanding its concepts is by doing so-called Koans.

    You get a number of tests (Test Driven Development to the rescue!) and you have to write code that passes those tests. Simple enough? Maybe.

    For last four days I’ve gone through Greg Malcolm’s Python Koans. It’s been a lot of fun and I’ve learnt quite a bit about Python. It is also important that you can track and measure your learning progress at all times.

    For the most part you just need to fill in the blanks to make tests pass, however on some occasions you need to write implementation code rather than test code.

    At the moment of writing there are 291 tests in 36 lessons, but don’t let these numbers scare you, it’s not as hard as you think.

    The part that I liked most was learning more about decorators. I learned that not only you can decorate with functions, you can decorate with classes as well. The hardest parts probably were “Accessing attributes” and “Proxy object project” because they involved overriding standard getattr and setattr methods and involved a set of fun things to deal with.

    Problems with Koans

    Even though doing koans is helpful in understanding concepts and getting a better grasp on syntax and constructions, I don’t think that it will be enough to only do Koans. It is not a silver bullet. Don’t get me wrong, I don’t say that they’re worthless, but as I mentioned, for the most part you’ll be only filling in blanks. Also there’s another problem. You can go through most of it without even thinking, just run the code and an  AssertionError will tell you the right answer. I must admit, that I cheated like that with exception texts as knowing the error is not enough - you need to type error text precisely.

    Final thoughts

    Regardless of the cons I mentioned above, I really recommend you to look for Koans for a language you’re currently learning and try it yourself. Find your way to enlightment!

    Python Koans is a port of Ruby Koans by EdgeCase. You can find similar koans for other languages on Github. Here is a list of a few I found:

  • Fixing Skype "P2P connect failed" on Ubuntu 11.10

    Skype on Linux systems never really seemed to be a first class citizen in Skype ecosystem. For years it was in beta, even now with 2.2 version it is still a beta version. Linux version didn’t get eye-candy Windows and OSX versions received, but it’s kind of OK. Maybe it’s just my personal experience, but I’ve experienced quite a lot of Skype problems during my years of Linux usage.

    The most recent one is “P2P connect failed” when I attempted to log in. It have been a problem with my network or a problem with Skype servers, except it wasn’t, as on Windows machine it worked properly.

    Searching for solutions on Google revealed, that it may be solved by removing whole ~/.Skype directory, but in such case you would be removing your whole history. That is not what we want, right?

    The solution

    The solution is very easy, you just need to remove 2 files: shared.lck and shared.xml **Make sure that Skype application is shut down before continuing. **Removing these two files can be done very easily, just run this command:

    rm ~/.Skype/shared.*

    That’s it! Launch Skype again and you should be greeted with “Terms and agreements” window, after which you should be able to log in.

  • Free Unlimited Airport WiFi

    Have you ever been in an airport and it had free WiFi, but it was limited by time or by bandwidth? Well, this article might bring good news to you, because it is possible to bypass such limits, often quite easily (such as this particular case.)

    I cannot guarantee that this will work for everyone, certainly it won’t work in every single situation. At an airport where I am currently at you can get free WiFi connection, but only for an hour (2x 30 minute sessions). So what do you do when you run out of time and still need some WiFi? Well, if you use Linux, you might try this:

    Install macchanger

    They probably identify devices by their MAC addresses, so if we’ve reached the limit on our own MAC, we might get some more time if we get another MAC address, right?

    So let’s get to it. Open up your terminal and install macchanger:

    sudo apt-get update && sudo apt-get install macchanger

    Once it’s done, we need to turn off our WiFi device and change the MAC address. So turn off WiFi on your laptop and run this command:


    This should show you all of the available internet devices. Find yours, it should be something like wlan{number}, mine is wlan0. Run this command:

    sudo ifconfig wlan0 down

    To change our MAC address we need to run this:

    sudo macchanger -r DEVICE

    Instead of DEVICE you need to type in your device name. Since in my case it is wlan0 I ran this command:

    sudo macchanger -r wlan0

    What this does is sets your MAC address to a randomly generated one (temporarily.) Then let’s bring up our device with:

    sudo ifconfig wlan0 up

    Of course instead of wlan0

    you need to type in your device name. Then just turn on your laptop WiFi, clean out your browser cache and any recently stored cookies and you should be all set.

    I hope this works for you, because it certainly did work in my case.

  • Nginx with PHP (FCGI) - A lightweight web server

    Nginx (pronounced Engine-X) is a lightweight web server, simple to use and configure. It’s perfect for handling static content, but is capable of much more (e.g. reverse proxy for mail protocols, FastCGI and etc.).

    Nginx can handle quite a bit of load, thus it is used for high-load applications. You can read about it in webfaction.com blog: A little holiday present: 10,000 reqs/sec with Nginx!

    According to their Wiki page, Nginx now serves 12.18% (22.2M) of all domains worldwide.

    Here’s a bit more on Nginx:

    Nginx and Lighttpd are probably the two best-known asynchronous servers and Apache is undoubtedly the best known process-based server. […] The main advantage of the asynchronous approach is scalability. In a process-based server, each simultaneous connection requires a thread which incurs significant overhead. An asynchronous server, on the other hand, is event-driven and handles requests in a single (or at least, very few) threads.

    While a process-based server can often perform on par with an asynchronous server under light loads, under heavier loads they usually consume far too much RAM which significantly degrades performance. Also, they degrade much faster on less powerful hardware or in a resource-restricted environment such as a VPS.

    Pulling numbers from thin air for illustrative purposes, serving 10,000 simultaneous connections would probably only cause Nginx to use a few megabytes of RAM whereas Apache would probably consume hundreds of megabytes (if it could do it at all).

    I suggest you to read about it more here: http://www.wikivs.com/wiki/Apache_vs_nginx

    Installing Nginx

    **Before we start: **I will be installing Nginx on Ubuntu 11.10 machine, so if you’re using a different OS or Linux flavor (e.g. RedHat), not everything may apply to you.

    To install Nginx you just need to fire up your Terminal (you may use Ctrl+Alt+T) and execute this command:

    sudo apt-get update && sudo apt-get install nginx

    This will download and install Nginx from Ubuntu repositories. It’s the easiest and quickest method, however authors recommend building it from source. That’s it! Nginx now should be installed, up and running (well, you might need to run it with sudo nginx command). Just point your browser to and you should see “Welcome to nginx!” text. If you do - we’re done with installing.

    Installing and configuring FastCGI

    To install PHP FastCGI we’ll just need to run this command:

    sudo apt-get install php5-cgi

    To spawn FastCGI processes, we’ll need to use these two scripts (Original author), provided on Nginx wiki:

    #! /bin/sh
    # Provides:          php-fastcgi
    # Required-Start:    $all
    # Required-Stop:     $all
    # Default-Start:     2 3 4 5
    # Default-Stop:      0 1 6
    # Short-Description: Start and stop php-cgi in external FASTCGI mode
    # Description:       Start and stop php-cgi in external FASTCGI mode
    # Author: Kurt Zankl <[email protected]>
    # Do NOT "set -e"
    DESC="php-cgi in external FASTCGI mode"
    # Exit if the package is not installed
    [ -x "$DAEMON" ] || exit 0
    # Read configuration variable file if it is present
    [ -r /etc/default/$NAME ] && . /etc/default/$NAME
    # Load the VERBOSE setting and other rcS variables
    . /lib/init/vars.sh
    # Define LSB log_* functions.
    # Depend on lsb-base (>= 3.0-6) to ensure that this file is present.
    . /lib/lsb/init-functions
    # If the daemon is not enabled, give the user a warning and then exit,
    # unless we are stopping the daemon
    if [ "$START" != "yes" -a "$1" != "stop" ]; then
            log_warning_msg "To enable $NAME, edit /etc/default/$NAME and set START=yes"
            exit 0
    # Process configuration
            # Return
            #   0 if daemon has been started
            #   1 if daemon was already running
            #   2 if daemon could not be started
            start-stop-daemon --start --quiet --pidfile $PIDFILE --exec $DAEMON --test > /dev/null \
                    || return 1
            start-stop-daemon --start --quiet --pidfile $PIDFILE --exec $DAEMON \
                    --background --make-pidfile --chuid $EXEC_AS_USER --startas $DAEMON -- \
                    $DAEMON_ARGS \
                    || return 2
            # Return
            #   0 if daemon has been stopped
            #   1 if daemon was already stopped
            #   2 if daemon could not be stopped
            #   other if a failure occurred
            start-stop-daemon --stop --quiet --retry=TERM/30/KILL/5 --pidfile $PIDFILE > /dev/null # --name $DAEMON
            [ "$RETVAL" = 2 ] && return 2
            # Wait for children to finish too if this is a daemon that forks
            # and if the daemon is only ever run from this initscript.
            # If the above conditions are not satisfied then add some other code
            # that waits for the process to drop all resources that could be
            # needed by services started subsequently.  A last resort is to
            # sleep for some time.
            start-stop-daemon --stop --quiet --oknodo --retry=0/30/KILL/5 --exec $DAEMON
            [ "$?" = 2 ] && return 2
            # Many daemons don''t delete their pidfiles when they exit.
            rm -f $PIDFILE
            return "$RETVAL"
    case "$1" in
            [ "$VERBOSE" != no ] && log_daemon_msg "Starting $DESC" "$NAME"
            case "$?" in
                    0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;;
                    2) [ "$VERBOSE" != no ] && log_end_msg 1 ;;
            [ "$VERBOSE" != no ] && log_daemon_msg "Stopping $DESC" "$NAME"
            case "$?" in
                    0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;;
                    2) [ "$VERBOSE" != no ] && log_end_msg 1 ;;
            log_daemon_msg "Restarting $DESC" "$NAME"
            case "$?" in
                    case "$?" in
                            0) log_end_msg 0 ;;
                            1) log_end_msg 1 ;; # Old process is still running
                            *) log_end_msg 1 ;; # Failed to start
                    # Failed to stop
                    log_end_msg 1
            echo "Usage: $SCRIPTNAME {start|stop|restart|force-reload}" >&2
            exit 3

    Save this script as /etc/init.d/php-fastcgi

    And we’ll need to save this one as /etc/default/php-fastcgi

    # Settings for php-cgi in external FASTCGI Mode
    # Should php-fastcgi run automatically on startup? (default: no)
    # Which user runs PHP? (default: www-data)
    # Host and TCP port for FASTCGI-Listener (default: localhost:9000)
    # Environment variables, which are processed by PHP

    After doing that, we’ll need to add this script to autostart to run this automatically every time the machine starts. Run these two commands in your Terminal:

    <code>sudo chmod +x /etc/init.d/php-fastcgi
    </code>sudo update-rc.d php-fastcgi defaults

    And let’s launch it:

    <code>sudo /etc/init.d/php-fastcgi start</code>

    Configuring Nginx

    We are ready to go! We just need to tweak Nginx configuration a bit.

    First of all let’s create a demo file, which we’ll use to check if it works. For the sake of simplicity, let’s use /var/www folder for this. Run this command:

    echo '<?php echo phpinfo(); ?>' > /var/www/index.php

    Then let’s modify the default vhost. Open the configuration file /etc/nginx/sites-enabled/default

    Find root /usr/share/nginx/www; **and replace it with **root /var/www/;

    Add these lines inside server { … }

    location ~\.php$ {
        fastcgi_index index.php;
        fastcgi_param SCRIPT_FILENAME /var/www/$fastcgi_script_name;
        include fastcgi_params;

    Lastly we’ll need to restart nginx:

    /etc/init.d/nginx restart

    Go to and if you can see the phpinfo() page - congratulations, you’ve done it!

    Additional resources

    While reading up on Nginx I found some pages, which may be helpful for you: