Rails 0.13 released

Quoting David Heinemeier Hansson: with so much new stuff in there it’s not even funny. I suppose I just need to bang my head against the wall a few more times, first, to receive a little bit of motivation to finally finish the fourth day of Four Days on Rails and second, to receive a little bit of inspiration to develop a useful (at least for me, for a start) Rails application that has a little bit more of code apart from scaffold

Here’s the official announcement.

The shocking truth

First, it was Daniel Auteuil in 36 Quai des Orfèvres. I’ve heard him cry and that alone was sufficient to be sure it was him. Then, after three or four words, I knew it was Morgan Freeman narrating the story in Million Dollar Baby. And that’s when I realized the shocking truth… I’m a movie addict! I watch way too many movies. I know way too many directors and actors. I spent way too much time on this. But what can I do? I simply love it.

Are there special clinics for people like me?

PS: I like watching movies not knowing much about them, apart from their IMDb rating, so I don’t watch trailers, nor read movie reviews, nor watch tv shows about movies. Putting it in another words – I don’t cheat. I just guess.

Review: Simple Men (1992)

Visit IMDb for more details about Simple Men

Right after seeing this movie I have realized that I’ve been mixing up Richard Linklater with Hal Hartley. In fact, I thought they were both the same person as their movies are so much alike. You may characterize their work as being a philosophical suburban grotesque as one IMDb reviewer has said. And he is so right. Almost all of the work done by both directors falls into this category and Simple Men is no different.

The story is actually quite absurd, as it follows two brothers travelling from New York to Long Island. One in search of their father, other trying to escape from the police. While absurd may it not sound, absurd in fact it is. Other thing to mention are the quotes from the movie. Here’s the one I like the most:

– You shouldn’t do that [kiss me].
– Why not?
– Because I’m your father’s girlfriend.
– My father is a womanizer. He’s a married man and he stood you up.
– You have no respect for your father.
– I don’t know him, but I respect his taste in women.
– So then go and make love to your mother.

Simple Men is filled with similar dialogs from top to bottom. The movie is a very enjoyable ride. As they say Long Island is a state of mind. Or was it New York?

Simple Men (1992)

Rating: 8/10

Shuffle your Dreamhost rewards page

Back at the day Jesse Ruderman wrote a script putting the block containing “You currently have $X.XX of Rewards payments built up!” at the top of the Dreamhost rewards page. Now some people might find it useful, but there are also other people (like me), without any payments built up (yet…), who would like to see the “Referral Reports” block at the top. Here is the greasemonkey script that does exactly that: shuffle.your.dreamhost.rewards.page.user.js

While considering the code of those two similar scripts, with all due respect to Jesse, I think that my solution is more general and simpler at the same time (always KISS), meaning that it allows you to reorder all of the blocks in any way you want (and it’s done in a painless way too).

There’s also a word of advice to myself (and maybe to others as well) – or in other words, a reminder. When creating greasemonkey scripts, the simpler hack you use, the better your script will be. It’s really futile trying to protect your script from the HTML changes. You just can’t predict every single one of them. All of those scripts are just hacks, that can be broken with just a slight change in the HTML code. So you shouldn’t worry about your script not being robust enough. That’s ok. You will have to fix it at some point in the future anyway.

Have fun!

Poland on Google Maps

Google Maps now features satellite photos of the whole wide world, which means that Poland is also there! And on top of that some of the bigger cities (like Kraków, Warszawa, Gdańsk) have pictures available at the maximum zoom level (which means they are extremely detailed). At this rate Google Maps will dominate all geo/mapping applications in two years tops.

Here are some of my most important places:

Damn, this is fun! I have notified all of my friends showing them various places and all of them were like “wow… this is great”. In fact, it’s more than that. It’s AWESOME.

As usual, Marek Futrega spotted it first.

Review: It All Starts Today (1999)

Visit IMDb for more details about It All Starts Today

A very touching movie about a schoolmaster of a local kindergarten in a small and very poor French town, where unemployment rate reached 34% (more than in Poland, incredible!). Daniel Lefebvre (played by Philippe Torreton), the schoolmaster, has to fight with the Social Security System, Child welfare and even the mayor of the city, to actually make some change. Unfortunately, it only gets worse and worse. This frustrating task brings him on the verge of an emotional breakdown.

It all Starts Today lasts for nearly two hours, but it doesn’t lose its pace even for a single minute. We see Daniel in constant motion, dealing with large arrays of problems. And there are lots of them, ranging from personal dilemmas, troubles with both kindergarten and local children to dealing hostile attitude of Child welfare employees towards him (when in fact they should cooperate, instead of fighting each other).

This is a serious political drama straight in your ass face. Only this time it is not directed by Ken Loach, nor Mike Leight, but by a French director Bertrand Tavernier. We can clearly see his inspiration by the works of those two. It only makes this movie more worth one’s while.

Simply said, it just blew me away.

Ça commence aujourd’hui/It All Starts Today (1999)

Rating: 10/10

Hapland

Whew! I have just finished Hapland 1. A lot of effort had to be put in to actually complete it! This game is unbelievably hard. I ditched it two times only to return after a couple of days – but as the saying goes – nothing beats the fresh mind. Each time I moved a few steps closer to the goal. And, of course, each time I got blocked at some point. However, I am a very stubborn and ambitious person, so when I had my goal set to finish this game, I intended to do so. And so I did. FINALLY! So now it’s time for Hapland 2, which seems to be much more complicated (which means that I’ll be more than happy to finish it within a month).

Hapland 1 game

This game is way too addictive…

And now for the thing that came here for:

Trace your referrers in real-time

One of the magic things about Dreamhost is the ability to login to your account using ssh. Apart from standard things that you can do with it, like compile and install any program that you like (excluding those, which require root access, of course), you can also experience a little bit of magic if you run this command:

tail -f current-httpd-accesslog

There is really something special about tracking your website’s visitors as they come. And, of course, the most interesting thing is actually knowing where they come from (also known as referrers). The problem with this command is that it prints lots of garbage on the screen (like timestamps, response codes, sizes, etc.). The problem is that you cannot grep your real-time tailed log. Why? Don’t ask me, I’m not a Linux guru. You just can’t and that’s it. You can, however, write a script, which deals with that in its own way. And this is what I’ve been writing for the whole day. It was both fun and painful to learn for the n-th time all those shell hacks and quirks. Was it worth it? Sure it was! As a result I came up with this little bash script to trace your referrers in real-time. You can download it or view it below. I must warn you, though. It is highly addictive. Really…

#!/bin/bash

# ========================================================================
# REAL-TIME WEBSITE REFERERS TRACER
# ========================================================================
#
# What?
#   Real-time website referrers tracer is a shell script that lets you
#   trace your visitors as they come. Script works in an ultra compact
#   four-columns view :)
#
# Why?
#   Because you cannot do 'tail -f access_log | grep something' and you
#   really want to grep out most of the stuff that your httpd puts in
#   the logs.
#
# Requirements:
#   - website (with not too low and not too high traffic),
#   - shell account on the server where your website is hosted,
#   - access to httpd logs that use the COMBINED format.
#
# Installation:
#   - copy anywhere in your home directory,
#   - edit the script and set the 'log' variable so it actually
#     points to your current httpd log,
#   - make sure the script has execute rights (chmod +x trace-referers).
#
# Running:
#   - just run the script and watch the screen.
#
#
# Version: 0.2 (2005-06-18)
# Author: Paweł Gościcki, http://pawelgoscicki.com
#
# No copyright rights. You can do whatever you want with this. You may even
# claim this scrip has been written by you from the very beginning ;)
#
# If you, however, improve it, send me a copy (paul_AT_pawelgoscicki.com).
#
# Based heavily on the tgrep script by Ed Morton (morton_at_lsupcaemnt.com):
# http://unix.derkeiler.com/Newsgroups/comp.unix.shell/2004-01/0818.html


# CONFIGURATION
# =============

# Where your httpd log file is
log="current-httpd-accesslog"

# What files to exclude (request for those files won't be shown, regexp syntax)
exclude="\.gif|\.jpg|\.png|\.ico|\.css|\.js"

# Width of request and referrer columns (set it to match your terminal's width)
col_width=35


# MAIN SCRIPT
# ===========

# Check if log file actually exists (and is readable)
if [ ! -r "${log}" ]; then
echo "Cannot access log file: $log"
exit 0
fi

# After startup we will output few lines
start=`wc -l < "${log}"`
start=$(( $start - 30 ))
if (( ${start} < 0 ))
then start=$((0))
fi

# Main loop
while :
do
  end=`wc -l < "${log}"`
  end="${end##* }"
  if (( ${end} > ${start} ))
  then
    start=$(( $start + 1 ))
    sed -n "${start},${end}p" "${log}" | egrep -v "${exclude}" | \
    awk -v col_width=$col_width '{

      # we are only interested in GET/POST requests
      if ( match($0, /\"(GET|POST).*?\"/) > 0 )
      {
        split($0, fields, "\"")

        # IP_ADDRESS
        tmp = $1
        while ( length(tmp) < 15 ) tmp = tmp " "
        printf "%s", tmp " "
    
        # HTTP_REQUEST (GET/POST)
        tmp = substr(fields[2], 0, index(fields[2], "HTTP/") - 1 )
        tmp = substr(tmp, index(tmp, " ") + 1, col_width)
        while ( length(tmp) < col_width ) tmp = tmp " "
        printf "%s", tmp " "
    
        # REFERER (the juice)
        tmp = fields[4]
        while ( length(tmp) < col_width ) tmp = tmp " "
        printf "%s", tmp " "
    
        # USER_AGENT
        printf "%s", fields[6]
    
        # new line at the end
        printf "\n"
      }
    }'

    start=${end}
  fi

  # this is an endless loop executed every second
  sleep 1
done

Your current hosting provider does not support ssh access? You might then want to read my other post about hosting with dreamhost for as little as 9$/year. Have fun!

Rolling with Ruby on Rails on Dreamhost

As of yet it is unofficial, but Dreamhost has indeed added support for Ruby on Rails (v0.12.1) together with FastCGI!

I have just tested it briefly and it works as it is supposed to.

If you want to turn FastCGI on, you must log in into your Dreamhost panel and go to Domains -> Web. Single checkbox and FastCGI is enabled. Couldn’t be simpler.

Dreamhost, regarded by many as the hosting company is indeed staying on the cutting edge, being the first major player to support Rails.

UPDATE: It’s now official.

(via)