Home

mikhailian

Recent Entries

6/17/08 12:36 pm - Cinema as the source of mnemonic identifiers

There are only three films that impacted my life to the point that they are day and night living around me in speaking and dressing habits, posters, wallpapers, ring tones, logins and passwords, class names and variables. One Russian, one French and one English. One per culture I learned.

Tags:

6/7/08 02:52 pm - галопам па гістарычным помнікам

Маршрут Ивянец - Валожын - Доды - Іўе - Навагрудак - Мір

Фота тут

5/23/08 05:18 pm - Explore your Windows LAN from Linux

mkdir ~/fusesmb
fusesmb ~/fusesmb
sleep 3600 # wait until fusesmb caches the network shares
ls -1R ~/fusesmb > shared-files.lst # -1 is "minus one", not "minus l"
Tags:

5/16/08 02:59 pm - The best ever comparative review of the Ajax libraries

5/11/08 03:23 pm - Tutorial on NetBSD 4.0 i386 setup in kvm.

Create a 10G disk image:

qemu-img create -f qcow2 netbsd-4.0-i386.qcow2 10G

Avoid hangup on boot with --no-acpi and the default network card timeout by trying out a different card, e.g. -net nic,model=ne2k_pci:

kvm -hda netbsd-4.0-i386.qcow2 -cdrom i386cd-4.0.iso --no-acpi -net user -net nic,model=ne2k_pci

Walk through the installer.

Install additional packages with pkg_add:

export PKG_PATH=ftp://ftp.netbsd.org/pub/NetBSD/packages/4.0/i386
pkg_add vim ctwm firefox wget

Include them in path:

echo "PATH=$PATH:/usr/pkg/bin" >>/etc/profile
. /etc/profile

Install the latest stable pkgsrc:

wget ftp://ftp.netbsd.org/pub/pkgsrc/pkgsrc-2008Q1/pkgsrc-2008Q1.tar.gz
tar xzf pkgsrc-2008Q1.tar.gz -C /usr

Make sure that pkgsrc fetches binary packages for dependencies, when possible:

echo ".ifdef BSD_PKG_MK
BINPKG_SITES=ftp://ftp.NetBSD.org/pub/NetBSD/packages/4.0/i386
BINPKG_SITES+=/usr/pkgsrc/packages/All
.endif" > /etc/mk.conf

Configure pkg_online to be able to search for packages

cd /usr/pkgsrc
cvs -d:pserver:anonymous@pkgsrc-wip.cvs.sourceforge.net:/cvsroot/pkgsrc-wip login
cvs -z3 -d:pserver:anonymous@pkgsrc-wip.cvs.sourceforge.net:/cvsroot/pkgsrc-wip checkout -P wip
cd /usr/pkgsrc/wip/pkg_online
unset PKG_PATH
make package DEPENDS_TARGET=bin-install

Search for additonal packages

pkg_online_find :s:pptp

P.S. Thanks to Aleksey Cheusov <vle@gmx.net> for implementing and making available pkg_online.

Tags:

5/5/08 10:58 am - Attack on the tax calculation: it is the law, dude!

I must admit that I was wrong in my previous stance over the tax calculation issue. Apparently, The Ministry of Finance has nothing to do with such a strange calculation process. It is prescribed by the law.

Article 134 CIR 92

§ 2. La quotité du revenu exemptée d'impôt est imputée par contribuable 
sur les tranches successives du revenu, en commençant par la première.

What I took for ingenuity was plain stupidity.

5/4/08 02:28 am - A man-in-the middle attack on tax calculation in Belgium

I am probably missing some background knowledge, but the salary calculation process in Belgium looks like it has been subverted by Ministry of Finance officials.

This is better seen by example

The so-called key formula for the tax prepayment calculation (précompte professionnel) for the year 2008 (income year 2007) states that the first 5220 EUR are exempt from taxes.

Now, let us work by example. We will do the calculation for someone called Jacques who earned 10000 EUR in 2007. We proceed by subtracting 5220 EUR from his earning and we pay taxes on the rest, that is, the 4780 EUR.

This amount falls entirely within the lowest tax range, that has the tax rate of 26,75 %.

4780*0.2675 = 1278.65

So Jacques supposedly has to pay 1278.65 in taxes. Right? Wrong!

The calculation procedure is defined by the Ministry of Finance as follows

First, Jacques calculates his taxes on the total of his earnings. 10000 EUR are split in two ranges. The first 7550 EUR is taxed at the rate of 26,75%. Everything over 7550 EUR up to 10250 EUR of earnings is taxed at the rate of 32,1%.

7550*0.2675 + 2450*0.3210 = 2806.08

Second, Jacques subtracts from the result the amount that he would have paid if the first 5220 EUR were taxable at the lowest tax rate, that is

2806.08 - (5220*0.2675) = 1409.73

The difference between both calculations is

1409.73 - 1278.65 = 131.08

That is, 131.08 EUR earned by Jacques have fallen in the deep pockets of the state solely because of a particular interpretation of the law that the Ministry of Finance has made. I have no other explanation for this phenomenon.

4/17/08 05:29 pm - Кому в Беларуси жить хорошо? Да никому.

Кровавая история на тему от тюрьмы и от сумы не зарекайся.

Tags:

4/16/08 05:10 pm - Ещё одна тема для флешмоба

На работе:
$ find ~ -type f -print0 | xargs -0 file -i -b | sort |uniq -c |sort -nr| head
  41880 text/plain; charset=us-ascii
  23507 text/xml
  12471 image/png
   8990 text/x-c++; charset=us-ascii
   8576 text/x-c; charset=us-ascii
   3743 text/html
   3064 image/gif
   2025 application/octet-stream
   1975 application/x-zip
   1965 application/java

4/11/08 09:40 pm - Пофлешмобим?

~$  history | awk '{print $2}' | sort | uniq -c | sort -rn | head
    356 cd
    309 vim
    217 mutt
    131 svn
    107 ls
     99 gem
     63 cat
     48 screen
     45 mysql
     39 ssh
Tags:

3/28/08 01:15 pm - Empirical proof of the Conway's law has been published

An old software project management axiom, otherwise known as Conway's law stated that any piece of software reflects the organizational structure that produced it. Forty years after Melvin Conway formulated it, it has been empirically validated by a team of Harward Business School researchers.

They compared several software products, including open-sourced and closed-sourced ones, and concluded that distributed teams tend to develop more modular products.

3/27/08 02:39 pm - Жёстко они в Microsoft работают, жёстко...

Выдали мне не так давно на работе компьютер dualboot: Windows XP и Ubuntu.

И действительно, оказалось полезно, из Ubuntu я пару раз запускал Windows XP через kvm. В первый раз она просила её активировать. Ну дай думаю активирую -- я ведь раньше этого не делал, может положено так. Через несколько месяцев вдруг понадобилось в Windows XP опять зайти. Сделал ребут, запускаю виндовс -- а она говорит, что надо опять активироваться. Ну ладно думаю. Давай. И тут она отвечает, что количество активаций истекло и через 3 дня она типа самоуничтожится.

Так и остался я у разбитого корыта с одним Ubuntu на машине. Windows теперь запускать страшно, вдруг она не дай бог на меня настучит в местный офис Microsoft.

3/22/08 01:06 am - Service vouchers status quo for 2007

According to ONEM, there's been 53 mln service vouchers sold in Belgium in 2007.

At the price of € 6.70, this makes for € 355.1 mln of expenses for belgian households.

For each service voucher, the state pays € 20 to the serviceing company, which amounts to € 704.9 mln in immediate losses for the state ((20-6.70)*53000000) . The hourly payrate at service vouchers companies is around € 9.50. Which leaves € 10.50 per cheque or € 556.5 mln in total for the serviceing company to cover the overhead of running the business and for profit margins.

3/18/08 05:25 pm - langue/parole(fr) => language/discourse(en)

Everyone and his friends are afraid of calling the langue and parole concepts of Saussure by their English names.

After giving in some thought and trying different translations in the discussions, I came out with language and discourse and the optimal translations. Feel free to criticize.

3/17/08 11:12 pm - IE6 and shaman dances

Tired of trying to fix a bug that resulted in the display of an empty blank area instead of a floating image, I run to the best developer's friend which gave me an answer, no explanation attached.

Now what the heck is the logic behind the bug and, especially, its fix? God knows.

P.S. I bought a beer for the author. This bug pissed me off for a whole month.

3/17/08 10:53 am - How much Freedom?

On Freedom management.

The employee should be given as much control over his work as he can bear. This meets the requirement for the planning in that there should be just enough planning to induce day-to-day tasks, no more.

More freedom brings more responsibility and emotional involvement, by creating a sense of ownership between the employee and the product.

The freedom may morph into frustration if the employee takes on the challenges he can not endure.

3/17/08 10:03 am - The granularity of planning

More on Chaos control.

The most dangerous outcome of the underplanning is employee frustration. Without clear day-to-day targets, employees loose interest in the work. Some become anxious, not willing to take on responsibilities beyond what they consider their assignment.

The danger of the overplanning is that detailed plans are hard to change.

The rigidness of the plan is proportional to the time spent on it, as the only reason not to change plans is often sheer inertia of those that invested already a lot of time to write it up, in the first place.

An ideal planning phase is short and concise, and the planing granularity is barely sufficient to distribute the day-to-day assignments to the employees.

3/16/08 03:56 pm - The essence of a IT project manager's work

A project manager plays with two major forces: Chaos and Freedom. When a project starts, nothing is clear, the previous stages like business analysis and user requirements collection have likely been a complete failure and collected input won't help much the team and the manager. At this point, the manager has to control the Chaos and reduce it to the minimum, by creating an environment where everyone know exactly what to do, how to do it and how much time would it take.

So he starts to plan, as the work moves on. The days roll out, and he slowly realizes that there is not much left of the initial planning, and the team is swirling out in different directions. This is where the Freedom control takes precedence. The manager has to give everyone enough Freedom so that every morning employees felt the urge to scratch an itch, while still working in the planned direction.

He slowly realizes that the Chaos/Freedom ratio is unique for each employee, and he has to work out a personal approach to everyone if the wants the team to work at full throttle.

By the time everything is crystal clear in his mind, and all the errors have been consumed and learned from, the project ends, and the manager moves on the next one or bails out.

2/28/08 11:09 am - The dualism of Rails and Ruby

I finally figured out why I hate Rails. It is the most authoritative web development platform ever, developed on one of the most liberal languages.

Tags: ,

2/1/08 09:22 am - Using the debian package of tomcat in etch

For many years already, Java developers running Debian ignored the Tomcat bundled with Debian in favor of a manual installation. Nowadays, with the availability of Sun Java 1.5 in Etch, it is time to reconsider this.

Install Tomcat with aptitude install sun-java5-jdk tomcat5 tomcat5-admin tomcat5-webapps.

Edit /etc/default/tomcat5 to change the JAVA_HOME and TOMCAT5_SECURITY environment variables.

JAVA_HOME=/usr/lib/jvm/java-1.5.0-sun
TOMCAT5_SECURITY=no

Note that you should consider reenabling the SecurityManager for production environments.

Now, you may install webapps into /var/lib/tomcat5/webapps and start tomcat with /etc/init.d/tomcat5 start

1/19/08 09:03 pm - Лучшие фото фотосайта на рабочем столе, дубль 2

Ну вот и ещё один дубль. Восьмого января фотосайт изменил структуру сайта и поломал так полюбившийся многим photosight wallpaper под Windows, а также скрипты дла автоматической установки "фото дня" на рабочий экран, используемые пользователями других OS.

Впрочем, от упрямого айтишника ничто не спасёт. Вот новый скрипт под Gnome Desktop для всеобщего пользования:

cd /tmp
ID=`wget -q -O - http://www.photosight.ru/wallpaper/week.wp` && \
wget -q -N  http://img-`date '+%Y-%m'`.photosight.ru/`date '+%d'`/$ID.jpg && \
gconftool-2 -t str --set /desktop/gnome/background/picture_filename /tmp/$ID.jpg && \
gconftool-2 -t str --set /desktop/gnome/background/picture_options "centered"

А вот версия под KDE по мотивам комментария [info]strangestone

cd /tmp
ID=`wget -q -O - http://www.photosight.ru/wallpaper/week.wp` && \
wget -q -N  http://img-`date '+%Y-%m'`.photosight.ru/`date '+%d'`/$ID.jpg && \
dcop kdesktop KBackgroundIface setWallpaper /tmp/$ID.jpg 4

1/17/08 08:31 pm - Using GNU screen's multiuser feature, version 2

The folks at debian-administration have shown me the light, once again.

It turns out that enabling a multiuser remote console is much simpler than what I previously thought. Just login, run screen and tell the other(s) to run screen -x while being logged with the same login name.

1/16/08 08:28 am - The KISS principle, dissected

The expression Keep It Simple, Stupid has a negative connotation, coming from the ambiguity between

  • Keep It Simple AND Stupid
  • Keep It Simple, YOU, Stupid

that the original wording suggests.

1/15/08 09:43 pm - ActiveRecord as an implementation of a design pattern straight out of the book

ActiveRecord has been built straight from the Martin Fowler's Single Table Inheritance design pattern. Period. This is fine for simple applications with that can live with the database design imposed by the application framework.

Once the developer tries to think throughly the database design, he immediately hits the limits of the STI paradigm. Here's an example.

One common method to define a hierarchical relation in Object-Relational Mapping where a child can have only one parent is to put the reference to the parent in the child table. This is a common and very efficient way to map a class hierarchy into database tables in Hibernate, for instance. The resulting tables can then look as follows:

CREATE TABLE `foos` (
  `id` int(11) NOT NULL auto_increment,
  PRIMARY KEY  (`id`)
);
CREATE TABLE `bars` (
  `id` int(11) NOT NULL auto_increment,
  `foo_id` int(11) NOT NULL,
  PRIMARY KEY  (`id`)
);
CREATE TABLE `bazs` (
  `id` int(11) NOT NULL auto_increment,
  `foo_id` int(11) NOT NULL,
  PRIMARY KEY  (`id`)
);

Note that this table structure allows to efficiently retrieve bars and bazs from foos, as well as ascend to foos from bars and bazs.

If you are bound to ActiveRecord, it imposes a solution with one table having one additional id to identify the parent and a string to identify the type of the child. All fields belonging to bars and bazs will appear in the same table, intermixed.

CREATE TABLE `foos` (
  `id` int(11) NOT NULL auto_increment,
  `foo_id` int(11) NOT NULL,
  `foo_type` char(4) NOT NULL,
  PRIMARY KEY  (`id`)
);

This approach has many disadvantages, the most obvious one is that it may be necessary to remove restrictions on some columns that behave differently in different children. For example, using default NULL on fields that are shared between classes behind bazs and bars, whether or not one of the requires them.

1/8/08 09:47 pm - Who benefits from the service vouchers (dienstcheques, titres-services)

PHBs, stay away. This is as complicated as the Type C work permit gamble, Type B vs. immigration legal loophole or the intrinsics of the payslip calculation.

Here is the idea of service vouchers in a 100 words. A few years ago, you could find someone to clean your house or iron your shirts by a word-of-mouth. After the job was done, you paid them in cash 8 € per hour and you were done. Nowadays, you first buy service vouchers from a multinational, state-assigned monopoly at the price of 6.70 €. You then call a service provider which is a company licensed by the state to accept service vouchers for house holding services. They make you sign a contract and they send their employee to you. Every visit, you give the cleaner as many service vouchers as the hours worked. The cleaner returns the service vouchers to his employer and the employer claims from the state 20 € per voucher. You, as a customer are not done yet as well, you can subtract the amount you paid for service vouchers in your personal yearly tax form, which decreases the real price of service vouchers down to 4,69 €.

At first sight, there's a clear gain from the customer's point of view. The service gets cheaper. However, the customer loses time in paperwork and is somewhat bound by the contract from now on. There's also an intuitive expectation of decreased service quality, as the service becomes less personal.

On the other hand, the state clearly loses 13,30 € per working hour, and some more money in personal taxes, which makes the service vouchers program look slightly unrealistic. Where's the catch?

Officially, the idea of service vouchers was defended on the following grounds:

  • Black market workers that had no right to health insurance and social services become permanent employees of service companies. This will let them benefit from all social support a worker gets, including the right to receive unemployment money in case they are fired.
  • Customers now deal with companies instead of individuals, which makes the dispute resolution easier, and the service - more reliable.
  • As for the fact that the state artificially supports an unrealistic business model by paying 13,00 € per working hour to private companies, the explanation was that all this money returns to the state in the form of various taxes that the employer and the worker are subject to.

Unofficial but more realistic reasons are less pleasant to hear.

  • Service vouchers plan is an instrument that was going to allow Guy Verhofstadt and his government to attain the goal of 200,000 increase in work places that they set back in 2003. The idea is simple. Make illegal workers work legally and count them as new work places.
  • The state takes control over what was a black market by dumping prices. This allows it to squeeze off tens if not hundreds of thousands of illegal immigrants that did this job for a living. Combined with other measures, this enables the state to better control everyone who lives on its territory.
  • Service vouchers plan lets the government bind extra money it had without having to spend it on a more adventurous task like a state reform.
  • The creation of a new business model subject to licensing would also benefit many politicians and their pet businesses could use their privileged position to milk the state cash cow at will, by jumping early into the artificially created business niche.

1/1/08 08:24 pm - A nasty trick the belgian payslip can play with 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.

12/29/07 01:26 am - 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:
require 'rubygems'
require 'activerecord'

module FooBar
	class Foo < ActiveRecord::Base
		has_many (:bars) do
			def by_name(name)
				find(:all, :conditions => ["name = ?", name])
			end
		end
	end

	class Bar < ActiveRecord::Base
	end
end
This can be fixed by removing the module FooBar declaration, but can one imagine living without modules? Knowing the Ruby community, I bet that this bug will stay unfixed for a while. Time for AnUgLyPaTcHpArTy!

12/27/07 11:17 am - 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 < ActiveRecord::Base
  composed_of :href, :class_name => "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!)

12/26/07 12:22 am - A concise description of the belgian salary calculation

The shortest version I could come up with. A more "formal" calculator in Ruby takes ~350 SLOCs

Read more... )

12/25/07 01:33 pm - Авторское право vs. всенародное обсуждение

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

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

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

Tags: ,

12/11/07 10:53 am - 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!

12/3/07 07:44 pm - OLPC: Omnipresent Loyalty Protection & Control

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

А вы бы хотели, чтобы в ваш комп заглядывали без спросу?

10/8/07 10:05 am - 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.

9/23/07 01:40 am - 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.

9/13/07 03:48 pm - 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).

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}\\$ "

9/7/07 11:43 pm - Controlling the size of the $PWD in bash

I just fixed a 6-year old bug in the 5 lines of code that I use at least 100 times a day, every day, including weekends and holidays. Now, I can finally publish it.

function truncate_pwd
{
 if [ $HOME == $PWD ]
 then
   newPWD="~"
 elif [ $HOME ==  ${PWD:0:${#HOME}} ]
 then
   newPWD="~${PWD:${#HOME}}"
 else
   newPWD=$PWD
 fi

  local pwdmaxlen=15
  if [ ${#newPWD} -gt $pwdmaxlen ]
  then
    local pwdoffset=$(( ${#newPWD} - $pwdmaxlen  ))
    newPWD=".+${newPWD:$pwdoffset:$pwdmaxlen}"
  fi
}

PROMPT_COMMAND=truncate_pwd
PS1="${ttyname}@\[${HOST_COLOUR}\]\h\[${RESET_COLOR}\]:\${newPWD}\\$ "

Just put the above snippet of code into ~/.bashrc

Debian shows the absolute path in the command prompt by default, and it can be really long, sometimes.To fix this, we can limit the command prompt to show only the last x characters using only the variable expansion features of bash 2.0.5+. Since this code does not fork out sed, tr or wc, it is blazingly fast.

9/3/07 12:50 am - Java sucks where Python rulez

There's been a long-standing commitment from Sun to make Java backwards-compatible. It made introducing new features in Java painful (generics), and fixing bugs (java.sql.Timestamp vs. java.lang.Date) impossible. On the other hand, that huge Java Class Library really needs refactoring and compatibility breaking is the only way to improve the developer experience.

Python development goes on in a completely different manner. They are set on producing a partially incompatible version called "Python 3000" that will fix the major design flows of the language (e.g. crappy i18n).

I hope Java does the same or dies.

Tags: ,

8/29/07 11:36 am - I am nerdier than 95% of all people ;-)

I am nerdier than 95% of all people. Are you a nerd? Click here to find out!

8/27/07 09:39 am - Choose your linux distribution

The Linux Distribution Chooser test gave me Debian and Ubuntu in precisely that order. Yuppie!

8/26/07 08:38 pm - Using GNU screen's multiuser feature

I am regularly doing the LLOD support over phone+remote console to the production support guys. Our software runs on virtualized headless Fedora 5 instances that are accessible solely by ssh, as it should naturally be.

It turns out to be a waste of time to the person on the other end, as he just listens to me explaining what I do, without really seeing what goes on.

So, I decided to use GNU screen to share the console between us.

I log in as a user and start screen on the command line. Then, I enter ^A:multiuser on[RET]. That is, I type Ctrl-a, then I type a : to enter the screen's build-in command line. I can now activate the multiuser mode by typing multiuser on in the screen's command line that appears in reverse color at the bottom of the console window. To execute, I hit Return.

The other guy just has to log in with the same user and type screen -x to connect to my screen session running in multiuser mode.

8/26/07 12:25 am - Что делать?

В течение долгих лет у меня идёт вялотекущий спор с che по поводу причин оттока интересных людей из Беларуси. Из года в год уезжают отличные собутыльники, идеальные коллеги, люди, выделяющиеся из общей среды умением отдыхать и работать, смекалкой и бодрым настроением. Остаются чуть более ленивые, привязанные к семье, чуть более неуверенные в себе. Замечательная статья с продолжением [info]plaschinsky отвечает на вопрос "Кто виноват?". Как ни крути, молодёжь растёт на канонах, далёких от современного уклада беларусского общества. Многие не находят себе места во взрослой жизни, но только некоторым удаётся сорваться с места и попробовать себя на новом месте, в чужой среде.

Так вот, вопрос, который задаёт che и на который у меня до сих пор нет чёткого ответа -- "Что делать?". Что нужно изменить в Беларуси, чтобы уменьшился отток интересных людей?

8/19/07 11:37 am - Finding a usable code search engine

Google Code Search
Pros
  • links to the code in the same package
Cons
  • Limited set of languages, e.g. no Groovy search
  • No in-page links to other classes
  • Virtually no code highlighting, only comments are highlighted.
Koders.com
Pros
  • In-page links to other classes' search and direct links to the class definition of the searched class
  • Code highlighting all the languages
Cons
  • No package navigation from the matched code
Krugle
Pros
  • Code highlighting for the most popular languages (C, C++,Java,Pascal)
  • Navigation sidebar with the file tree of the package
Cons
  • No in-page links to other classes
Tags:

8/17/07 03:01 pm - What is the thousand separator in french numerals?

Linux says, it's U0020 aka SPACE

$ grep mon_thousands_sep /usr/share/i18n/locales/fr_FR
mon_thousands_sep         "<U0020>"

Java says, it's U00A0 aka NO-BREAK SPACE as the following code returns "160", better known as as in &#160; or &nbsp;

NumberFormat numberFormat = NumberFormat.getInstance(Locale.FRANCE);
            System.out.println(numberFormat.format(new BigDecimal(1000)).codePointAt(1));

Also,

NumberFormat numberFormat = NumberFormat.getInstance(locale);
if (numberFormat instanceof DecimalFormat) {
  DecimalFormat decimalFormat = (DecimalFormat) numberFormat;
  decimalFormat.setParseBigDecimal(true);
  bd = (BigDecimal) decimalFormat.parse(string);
}

parses only U00A0 as the thousands separator.

Where's the truth, brother?

8/17/07 12:45 am - JSF, dead born, resurrected by hormonal injections

I tried to look over the internet for an article critical of JSF technology. Surprisingly I found nothing worth mentioning.

This is really strange, as JSF lends itself easily to critics. The whole idea if JSF looks suspicious. It was built as a Java answer to the Web Forms concept from Microsoft. The whole buzz around JSF was about being able to use a GUI editor to build web pages à la MS Visual Studio.NET.

Current JSF implementations integrate a number of design decisions that make it virtually impossible for developers to build a well-behaved web application.

As an example, instead of following the basic REST principles, JSF encapsulates every action into a POST request. MyFaces goes even further in its extensions to JSF, regularly making POST requests from within JavaScript code and breaking the navigation completely.

Someone had to think hard to make every JSF show the previous JSF page URL in the location bar of the browser, so that the user gets lost completely.

8/17/07 12:04 am - I am living the worst developer's nightmare

Supporting that crappy product I had to code first.P.S. Oh my GNU!

8/11/07 02:03 pm - My ideal development team

When choosing between features, deadlines and maintainability, they always choose maintainability.

They have settled on a development methodology, be it Evo, Scrum XP or some home-made cocktail and follows that methodology rigorously.

They do not let themselves run by MS Project plans but rather by a backlog of features and by on-site customer demands.

8/10/07 01:41 pm - An ode to the welfare state slaves

Dear literate welfare state slave,

Today, I met a welfare state king. He popped up in my office around lunch time, keeping in his hands a fat workbook with the logo of the local trade union on the cover.

Without presenting himself, he asked whether we were hiring. I said that, AFAIK, we were not hiring. He then asked me whether I could write in his workbook that we can not consider him for a position at our company. I said that I can not do so and the managing director was out on lunch. The man excused and left promptly.

While speaking to me, the man showed me a few pages in his workbook. It had an special layout inside, every page was split into two columns, every column had four cases where one could put a date, a few words, and a signature. The whole workbook, even its internal layout, was produced typographically and some of the cases were already filled by other people's text.

7/27/07 11:35 am - yet another dumb test

You scored as Belgian,

Which European nationality should you have
created with QuizFarm.com</table>

7/15/07 04:22 pm - Shameless editors

This is an image taken at the shopping mall yesterday.

For those who do not speak French, the folder cover says "Stop copying me".

Er...

6/22/07 02:21 pm - Прошу ещё одного совета

Первый вопрос про оффлайновый органайзер и список дел очень успешно разрешился советами перейти на Evolution. Выяснилось, что Evolution довольно стабилен, просто не надо было пользоваться Ubuntu. Удобнейшая интеграция с Clock Applet + возможность вести несколько календарей в разных цветах растопили моё сердце за несколько минут. Вот только списки дел могли бы быть иерархическими, впрочем, нет в мире совершенства.

Так что я осмелюсь задать ещё один вопрос. Не подскажет ли кто книжку по реляционным базам данных и по языку SQL, в которой бы простым языком разъяснялись базовые понятия. Например, про то, что существует 4 основных типа JOIN'ов, 3 уровня изоляции, и почему тех именно четыре, а этих -- три. Пока нашёл ссылку на одну вроде как стоящую книжку -- Joe Celko - SQL for Smarties

Powered by LiveJournal.com