Archive for January, 2007

eircom broadband prices

2007-01-27

I moved in to a new flat about 2 weeks ago, but I still didn’t get an Internet connection. There’s only one Internet provider available in this area, which is eircom (usually typed in lowercase), the biggest Irish telecom.

They have three broadband packages in their offer: 1Mbit, 2Mbit and 3Mbit. I usually try to compare the packages. With internet connection, I usually make a chart with bandwidth and price. Here’s a chart for eircom:

Eircom broadband prices

Difference between first and second package is: twice as much bandwidth, €5 more monthly fee. This surely makes people prefer 2Mbit over 1Mbit.

Their next package, 3Mbit should be constructed in such a way that at least some people would prefer to get 3Mbit instead of 2. So, what’s the difference? Well, it’s 50% more bandwidth and 60% more expensive.

Those prices make no sense. I wonder who sets them and why.

How wonderful it is to be loved!

2007-01-21

I still love you

Sitting straight

2007-01-21

Joanna sent me a link to an article about sitting straight at the desk. It says that sitting straight is bad for backs. Why?

Levent Caglar from the charity BackCare, added: “In general, opening up the angle between the trunk and the thighs in a seated posture is a good idea and it will improve the shape of the spine, making it more like the natural S-shape in a standing posture”.

I disagree with the article, or rather with the conclusion. Sitting straight is good for back. The reason for the researchers to say otherwise is that most of people can’t keep their lower spine in the right position. It’s best to show an example, perhaps with a little exaggeration:

When sitting like this, the spine has its natural, S-like shape. It’s seemingly easy, but in fact it’s not. Most of Europeans can’t do this. And for sure, most of them can’t do that for more than just few minutes.

Most of the people, to set their spine in S-shape, need to lean back. Paraphrasing the article, I would say: Being stiff ‘bad for backs’.

Perl: argument passing weirdness

2007-01-19

The project I’m currently working on is using Perl scripts. I usually use Python for scripting, but introducing another programming language didn’t seem like a good idea, so I decided to write in Perl.

At first, I was struck with $all @the %decorators which make the code @$difficult $to @#read. Nothing to do about it.

Next thing, a very strange way of reading function arguments. You don’t define them, all the stuff comes in something with a friendly name of @_ which is basically a lump of arguments. It’s your job to make it useful. And it isn’t necessarily easy to do.

Let me give you an example. I’ll start off with a Python function that prints a list to the screen:

a = ['a', 'b', 'c', 'd']
print a

When executed, it prints this:

['a', 'b', 'c', 'd']

A corresponding Perl code looks like this:

@a = ('a', 'b', 'c', 'd');
print "@a∖n";

And produces:

a b c d

As you can see, Python code is a little cleaner, as it doesn’t have @decorators and you don’t need to surround the list with “all the weird stuff∖n” to get the list on the screen in a comprehensive form.

Let’s get back to our code. Let us write a function that takes a list as an argument and prints it. In Python:

def one_list(list_a):
    print list_a

It’s pretty straightforward. We need to write the name of our function, then the arguments (currently just one) in the brackets and then the function body. The same in Perl:

sub one_list {
    my @list_a = @_;
    print "@list_a∖n";
}

What’s strange here is that there is no way to specify the list of arguments that the function accepts. There’s only the lumpy @_ variable which contains a list that the function was called with. You don’t actually know, how was the function called, because it could be one_list(@a) as well as one_list(‘a’, ‘b’, ‘c’, ‘d’) and you can’t tell any difference in the @_. That’s why I call it a lump.

Now that we have a function which accepts a list, let’s try two lists. With Python, we can just extrapolate what we had before. One more thing in the brackets, voila, two lists ready to use.

def two_lists(list_a, list_b):
    print list_a
    print list_b

What about Perl? Can we extrapolate the one_list function? Perhaps I’m spoiled, but usually as I learn how to declare a function with one argument, I don’t need to learn anything more to write a two-argument one. So, I’ve tried this…

sub two_lists {
    my ($list_a, $list_b) = @_;
    print "@list_a∖n";
    print "@list_b∖n";
}

…no error message. And… somehow, @list_a swallowed the second argument, leaving @list_b empty. The two list were just concatenated somewhere on the way and function sees just one list instead of original two. Ouch.

Finally, a friend brought a solution. It looks like this:

sub two_lists {
    my ($list_a_ref, $list_b_ref) = @_;
    my @list_a = @$list_a_ref;
    my @list_b = @$list_b_ref;
    print "@list_a∖n";
    print "@list_b∖n";
}

What it does, is it reads references to the lists and then uses weird @$ syntax to dereference them, er, make them usable.

In this example, there are additional lines of code that wouldn’t have to be there if… well… never mind.

Whatever the reason, instead of simply declaring a list of arguments, I have to wrestle with @_ and references.

Life with Python was so easy… I think you can now understand this picture (even though it was Perl 5 in the examples):

Perl 6

Programming with Perl looks more like something weird, geeky and obscure. It’s easy to write “Hello, world”, but one you want to write any complex data structure, references and inconsistent syntax will quickly get you down. Since data structures are difficult to handle in Perl, you will tend to write complex procedures, making your program difficult to read and understand and therefore difficult to maintain. It’s the opposite to what Eric Raymond says about handling complexity.

Perl seems to be a quintessence of what I don’t like in programming languages.

New year, new job, new country

2007-01-15

The new year brought lots of new things to me. A new job in a new country, an all that comes along with it. I needed to cancel my flat rent in suburbs of Warsaw, go to Dublin and find myself a place to live.

It all went fine, as I’m currently sitting in a nice apartment in a residential area, about 30 minutes walk from UCD, where I work.

In my new exciting job, I am developing a software package called Genepi, which is designed to perform statistical analysis of genetic data. It is licensed under terms of the General Public License. I am very happy about it ― it’s like a dream come true.

So far, I was mostly writing on my Polish blog, which is being read by my Polish friends and family. Unfortunately, I wasn’t able to write both Polish and English blogs. The Polish blog will probably remain my personal blog for the time being.

My trip to Ireland seems to be much easier than the previous one to Denmark. I don’t know exactly, why is that. Maybe it’s that I have more money now? Or more experience? Or simply more luck? Whatever the reason, it is all easy and nice.

Goodbye, Poland

2007-01-04

Flying swans, 440px

(author: Toni Alvarez, source)