2007-10-19

Obituary

Burli, my beloved pet and fellow died today, in the high age of over 5 years, exceeding the life expectancy of a gerbil.
He was a lovely gerbil. When he first met Buschu - my single female gerbil I had at that time - he easily made friends with her. At first, she always ran away from him, he ran around a bit and ran towards her again. That went on for about half an hour, when I decided to put them into the transport box, so she couldn't run away. In the transport box, he slowly approached her, his head bent down. He put his nose under her snote, flattening himself completly. She started to sniff around his snote and inspected him. About a minute he let it go on, then rose back up.
From that moment on, they've been together. Ten very lovely young gerbils were soon after the result of that bond, 4 of which I kept.
From what I can tell, he was a good father to them. At least for instance I one day found him and his sons and daughters happily sitting on my bed, chewing on my bedding. He escaped his cage many more times. He was an outright expert at escaping. But never to run away, he always came back.
Another day, I walked into my room, at the moment I opened the door I heard my mom squeal, a second after something whooshed between my legs. Apparently burli had escaped once again from his cage and made it to my mothers working room (which at the time was the room besides my bedroom) and couldn't go back because I had closed the door. I don't know how, but he must have noticed that the door was opened and ran back.
One morning I found him waiting besides the cage. He - of course - was escaped from it, but as it seemed couldn't get back in. So he had waited by the cage until I put him back in. He didn't make any attempt to run away when I grabbed him.
He also very much loved crackling things. In my new apartment he was often allowed to run around freely. When there was a plastic bag or some piece of paper you'd often hear him playing around with it.
Amazingly he once made it into my laundry basket. NB, the basket is about 70cm (28 inches) high, there was nothing next to it to climb. I still don't know how he managed that.

And now he's gone.

Dear burli, beloved pet, fellow and friend
I hope you rest in peace and are reunited with your children and wife

2007-09-17

Crybabies

Ruby2 is at the doors, bringing many presents in form of welcome changes. But then there is the one change I consider a bowdown to stupidity, ignorance and lazyness:
String#[] with a single argument will no longer return the ASCII value of the char at that position.
I wonder why? We have that functionality already, twice even, str[x,1] does it and str[x..x] too.
It seems it's a kneejerk reaction to continuos whining of stupid people and those who can't be bothered with RTFM.
Some percentage of the coders considers it unintuitive, that str[x] returns the ASCII code. Now that part is perfectly fine.
But I wonder what happens when you encounter that. I'd expect anybody with at least a little bit of brain to consult the documentation at that point, where you can clearly read how String#[] behaves. When you do that you commit to memory that str[x] will return the ASCII value and - depending on how often you use it - you'll use it wrongly once, twice or maybe three times.
So who would possibly want it to change and in turn duplicate existing and perfectly fine behaviour, dropping a different behaviour that becomes more difficult to get that way?
My conclusion: whiny stupid bitches (is there a matching male form of bitch?).

2007-09-11

Simple higher order methods

Sometimes there's an itch that you just have to scratch. One of them hit me today, luckily I already had the matching scratch ready. My itch was, that while Ruby has that very nice module Enumerator, it only works with classes that provide a .each method. So you can have enum.map { ... }, which operates on each. But what if you have a class that can iterate over various things? E.g. a String could iterate over bytes, chars, words or lines. A directory could iterate over files, directories or all entries.
My solution to the problem: Iterator.
class Iterator
include Enumerable

class Iteration
def initialize(&block)
@block = block
end
def yield(*args)
@block.call(*args)
end
end

def initialize(&iterator)
@iterator = iterator
end

def each(&block)
@iterator.call(Iteration.new(&block))
end
end

With that you can enable a method to return an Iterator with a single statement, which in turn allows you to do things like: dir.entries.select { ... }, where dir.entries returns an Iterator.
Example use:
def each_custom
if block_given? then
@custom.each { |element| yield(element) }
else
Iterator.new { |iter| @custom.each { |element| iter.yield(element) } }
end
end

2007-09-10

Progress

"Progress doesn't come from early risers - progress is made by lazy men looking for easier ways to do things."
Robert Heinlein

2007-09-03

Black magic

Today when I refactored some of my legacy code, I accidentally ran into the problem that I tried to let the outer class inherit from an inner class, like: class OuterClass < OuterClass::InnerClass. I mentioned in on #ruby-lang, mostly as an anecdotal remark, but LoganCapaldo actually came up with a solution for it:
parent = Class.new
Foo = Class.new(parent)
Foo.class_eval { Foo::Bar = parent }

class Foo < Foo::Bar
class Bar
def a
1
end
end
end

p Foo.new.a

Now I don't know if I should bow before such ingenuity or run away screaming from this darkest of the black coding magics :)

Significance

It doesn't matter from where you come.
Neither where you are.
It's all about where you go.

2007-08-25

Stupid Questions

And another one on IRC. There's the saying that there's no such thing as a stupid question. That's wrong.
My list of stupid questions, ordered by stupidity:
-May I ask a question? (You just did...)
-Somebody used XYZ? (Of course, if somebody created XYZ, then obviously somebody used XYZ...)
-Anybody around who could help me with XYZ? (Ask and you shall see...)

2007-08-24

The cross-poster scourge

I quite frequently use IRC. Often because I enjoy helping people or solve small problems. IRC has some scourges, one of them are cross-posters. You might say: but there's no harm in cross posting? That poor guy just tries to increase his chances for a reply.
I beg to differ. Cross-posting at the same time in different channels is disrespecting the other users. It's devaluing the time they spend trying to help.
Why?
Because you try to think of a solution for that poor guys problem just to either get the answer "Ah, sorry, I already got a solution elsewhere" or no answer at all. Because all too often, after getting an answer, that "poor" fellow doesn't care to look what's going on in IRC anymore. A simple message that they've gotten a solution would help soothing the problem. But in my experience almost nobody bothers to do that.
My solution to the problem? I've got none. But since I'm not inclined to help somebody with no respect for my time, I simply don't help if I see somebody asking the same question in multiple channels at the same time.

Small sidenote: I have no issues with people asking in one place, waiting for a reply, getting none and then moving on.

2007-07-10

Nothing to hide

After 3 weeks of military plus one week of contracted sickness, I'm back.
Not much to write as of now, but a link disassembling the 'nothing to hide' argument.
http://papers.ssrn.com/sol3/papers.cfm?abstract_id=998565

2007-06-09

Dr. House

I love watching Dr. House. I love him. He's a jerk in my opinion, but I still love him. Why? I'm not yet entirely sure. Some aspects I love about him are how he provocates people and gets a reaction. His dogma of "everybody lies", it's as sad as true. How he rationalizes things people usually completly forget would better be rationalized.
Examples?
Dr. Cameron: "You want me to tell a man whose wife is about to die that she may have cheated on him?"
Dr. House: "No, I want you to be polite and let her die."
Straight.
But maybe what I like most is, that he does what I don't dare to.

Morons II

After a discussion with a friend yesterday, I came to the conclusion, that my post wasn't clear enough. I try to clarify a bit.
I don't care about: people hear that they do stupid things, they feel stupid.
I do care about: people hear that they do stupid things, they understand they were told to be stupid.
Spot the difference?
What I'm saying is, people are outright incapable of making a difference between criticism on their actions and criticism on their person. By my observation it's worse with negative criticisms.

Morons

Quiz question: I tell a guy what he does is moronic, do I tell him he was a moron?
a) Yes. Doing moronic stuff implies being a moron.
b) No. Even non-morons can do moronic stuff.
c) I'm a moron, I can't decide.

a) is wrong. Sorry for you if you chose c).
Somebody who does something moronic, is told so and sticks to it against better knowledge IS a moron. Everybody who improves upon knowing that fact is not.

2007-06-03

Arguments

Ever had an argument with somebody where you got into a phase proving him wrong but he would in no way acknowledge that he even might be wrong?
Or better yet, ever run into the opposite situation where you where clearly proven wrong and wouldn't acknowledge that?
I occassionally run into the former. And I'm not talking about those cases where 2 people simply have different opinions and both think the others opinion sucks.
I'm talking about situations where you can prove the other wrong. I observed that behavioural pattern fairly often. Seriously, whats the deal? Is it damaging peoples ego if they have to admit being wrong? I observed several patterns when it became obvious that one was wrong:
- Denial without further arguments: "No, you're wrong, I'm right"
- Ad hominem attacks: "If you weren't an idiot you'd see that I'm right"
- Silence
So for those lonesome readers that have somehow stranded here - what's your opinion? Why do people behave that way? What are your experiences?
That's all for today, only the questions. Maybe on another day I'll have some possible answers.

2007-06-02

First post!

"So what's that other blog about? Why does that guy even bother to write a blog?" - Valid questions you might ask. To be honest, if you're reading this blog you've already beaten my expectations.
I have this blog as a vent for my personal thoughts. Maybe as a backlog. I'm not yet sure about what things I will write. Probably about People, Religion, Ethics, Politics and last but not least IT.
Most probably I won't write more than once in a month.

Anyway, have fun reading