A nasty trick the belgian payslip can play to you

Nearly everyone gets one surprisingly small monthly pay during his 1st year or so in a company.

In order to understand what happens, one has to know that workers earn their holidays this year for the next year. Once someone quits an employer, he gets a nifty paycheck which includes the monetization of the earned holidays that the employee did not take, yet. Now, once he decides to spend those holidays next year, he usually forgets that they have already been paid by the previous employer. That is, he actually takes an "unpaid" holiday from his current employer, instead of a paid one. Naturally, these days have already been paid before, but who cares, when the money is gone ;-)

All this is a prelude. Here is a nasty trick that makes the payslip look awfully unjustified.

The general rule is to adjust the monthly salary to take into account those "unpaid" holiday days not on a month-by-month basis, but once in a year, the month when the employee has taken more than 50% of the amount of the days off he was entitled to take.

Here's an example. You leave your old employer on December, 31. Next year, you take 5 days off during the first half of the year and then leave on vacation for 10 working days in August. Suppose this August had 20 working days. By the end of August, you will receive your salary for ~ 5 working days, as the salary calculation this month will take into account all the 15 "unpaid" days you have taken off so far.

Tags: 

Some more ActiveRecord bashing

This time, it took me around 8 working hours since the start of a new ruby-based project before I stumbled upon what seems to be a serious bug. The first time I tried to extend an association, activerecord failed with
associations.rb:1368:in `const_set': wrong constant name FooBar::FooBarsAssociationExtension (NameError)
which can be easily reproduced running the following code: {syntaxhighlighter brush:ruby} require 'rubygems' require 'activerecord' module FooBar class Foo

ActiveRecord and the DRY3 principle

ActiveRecord is a beautiful piece of software. But just step aside of the prescribed road, and you are guaranteed to have problems.

This time, my problems began when I started to design the model first. I quickly laid out a couple of screens of objects, wrote the connection line and ran the code.

class SubjectLocator  "String"
end

# a dozen more objects follow...

ActiveRecord::Base.establish_connection(
  :adapter  => "mysql",
  :host     => "localhost",
  :username => "test",
  :password => "test",
  :database => "activerecord"
)

It has not come as a surprise that ruby replied with an exception.

Table 'activerecord.subject_locator' doesn't exist: SHOW FIELDS FROM `subject_locator` (ActiveRecord::StatementInvalid)

What surprised me is that after half an hour of search on the internet, I found no way to boostrap a DB schema out of the model. There were discussions on the rails mailing list. They even went as far as suggesting non-destructive automatic migrations, a feature that exists in Hibernate for at least 5 years already. None dared to implement either.

I am now left with one solution. Apply the DRY3 principle, aka "Do Repeat Yourself 3.times" and start writing the migrations script for my models (repeat!), as well as an SQL schema for my MySQL database that would keep indexes, views and triggers in addition to what I will boostrap from migrations (repeat again!)

Авторское право vs. всенародное обсуждение

Тут Лукьяненко поставил ссылку на высказывание об авторском праве Романа Афанасьева. Что симптоматично, у обоих комментарии отключены. К чему бы это?

ЗЫ: Назовите меня идиотом, но чтобы найти ссылку на этот постинг Лукьяненко, пришлось прошерстить 431 страничку, от id предыдущего постинга до id следующего. Примерно вот так:

for i in `seq 304622 305053`; do
wget http://doctor-livsy.livejournal.com/$i.html
done |grep gringrin *html
Интересно, есть ли какой-нибудь более прямой способ ставить линки на постинги с отключенными комментариями?
Tags: 

rubygems as the biggest obstacle to Ruby's adoption

Everyone and his friend is already aware that installing rubygems to a non-default location was a nightmare just until very recently (that is, version 0.9.5, produced on 2007-11-19).

Now, suppose we try to do something simpler, like err... uninstalling a gem. gem remove mygem yields no results. I do gem --help and... there is nothing about removing a gem in the command line help. Fine. Before deleting manually, let's look it up on the internet. RubyGems User Guide says it should be gem uninstall mygem. How nice!

OLPC: Omnipresent Loyalty Protection & Control

Тут abbra пишет про удачное внедрение OLPC и ненароком сообщает статистику испльзования этих компьютеров детьми. Это значит, что кто-то, даже не родители, а в лучшем случае учителя мониторят детские компьютеры на предмет того, что и когда они написали. А вы бы хотели, чтобы в ваш комп заглядывали без спросу?
Tags: 

Looks like it is not limited to Belgium

There is a whole thread on /. about the pay system failures in US public schools.

As usual with slashdot, you get sometimes a pearl while digging through a multitude of clueless comments. Here is one I found out for you:

Over time you get more and more complex rules for how to calculate pay. The end result is that nobody understands their pay slips anymore and it is nigh impossible to implement and test a system that handles all the exceptional cases.

Groovy documentation and the human mind

How can one not be disappointed with Groovy after looking at its User Guide?

Here is just one example. Can you tell from the StreamingMarkupBuilder documentation how it works? I bet no. After looking through the code snippets on the page and figuring out I could not understand a line of code there, I wondered what is the mkp variable that appears twice on the page.

It took me some time to get through the Groovy class hierarchy up to the BaseMarkupBuilder.java just to find the mkp namespace declaration.

 namespaces.put("mkp", "http://www.codehaus.org/Groovy/markup/keywords");   // pseudo namespace for markup keywords

After googling for mkp markup keywords, I found a page that explains in a few words the design of markup builders. Nothing more, nothing less. Now, I know everything I had to know about mkp and markup builders. The thing is, it is a post of the developer who just committed the markup builders feature. The documentation is supposed to be better that that but it not even worse, it is blatantly misleading.

Controlling the size of the $PWD in bash, version 2

Er... after reading the insightful comments at debian-administration.org, I figured out a much shorter version which is also easier to understand. Tested on GNU bash, version 3.1.17(1)-release (i486-pc-linux-gnu).

{syntaxhighlighter brush: bash} function truncate_pwd { newPWD="${PWD/#$HOME/~}" local pwdmaxlen=$((${COLUMNS:-80}/4)) if [ ${#newPWD} -gt $pwdmaxlen ] then newPWD=".+${newPWD: -$pwdmaxlen}" fi } PROMPT_COMMAND=truncate_pwd PS1="${ttyname}@\h:\${newPWD}\\$ " {/syntaxhighlighter}

Pages