Wed, 26 Sep 2007
Beware of Patro.CZ
We have decided to buy a new electric kettle. Because we drink a lot of green tea, we went for a kettle with thermostatic regulation, so that it can switch itself off at 80 degrees Celsius instead of 100. I have used Patro.CZ e-shop many times, but this time it was a really unpleasant experience.
The kettle arrived, but we have soon realized that its thermostat is way off. Using thermometer we have found that when set to 80°C, the water really had around 63°C, and when set to 90°C, the real temperature was at 75°C. The Czech law allows the consumer to send goods from an Internet order back in 14 days with no questions asked (provided that it is not damaged, etc.). So we have decided to sent it back (so far I have not sent anything back to Patro.CZ). Few days ago it has arrived back with the following explanation: "According to our technician, the kettle shows signs of heavy usage". WTF? We have used it maybe up to 20 times, including the temperature measurement, and initial cleaning of the kettle.
In order to save my nerves, I have decided to fix the kettle myself: I have disassembled it, and after tightening a spring inside the temperature is more accurate (it is off by maybe 5°C, which is acceptable). As an additional bonus, I have learned how the kettle looks like in the inside and how it works.
And in order to not let Patro.CZ get out of this case so easily, I wrote this blog post: if you want to order something from them, beware that they may unlawfuly reject your returned goods.
Tue, 25 Sep 2007
Syntax Error in a ... Comment?
A followup to my yesterday's post about object-oriented code in Java. In fact, I have considered entering this year's FIbot competition. The only drawback is that it is in Java. I have tried to compile their sample code, and here is another blog-post on how Java is bad:
[javac] Tile.java:4: unmappable character for encoding UTF8 [javac] * Created on 6. ?ervenec 2007, 18:14 [javac] ^
So even though Java people reinvent their own XML-happy wheel (ant
instead of make
- further reading on replacing make
here),
they still cannot XML-encode the information
about the charset of source code
into their Makefile
-alike. Or better, into the source code
itself (Perl has been doing this for years, you can even use multiple
charsets in different parts of the source file, just notify the parser with
the appropriate "use encoding
" pragma).
Anyway, the first language which barfs with a syntax error inside a comment. Talk about brain damage.
The absurdity of the situation is even bigger when you realize that this comment (saying the file creation date in Czech) is one of those superfluous comments, presumably created by some stupid IDE: it does not add any useful information (such an information would be valuable maybe inside a version control system, but not in the source code itself), and it apparently is a syntax error in some locales.
BTW, anybody interested in forming a FIbot team with me? Preferably someone who can tolerate Java.
Mon, 24 Sep 2007
Objects Considered Harmful
From time to time I feel a strong urge to write an article describing how object-oriented programming is bad. Well, this post is not a full analysis, just a simple example. I have tried to read some Java code (maybe I am becoming a masochist :-), and found this:
/** * Get X position. * Shortcut for getPosition().getX(); * * @return X position */ public int getX() { return x; }
It is nine lines (and nine more for Y) so that they can write something like this:
myobj.getX() + myobj.getY();
instead of the following:
myobj.x + myobj.y;
I wonder why some programming languages tend to attract people who like to write mid-layers. Java is probably the worst one, but also Python with its Zope and Plone mammoths, and Ruby with RoR are similar. Wrapping wrapped wrappers into the wrapper code. I have yet to see something like this in Perl (yet OOP is widely used in Perl). I think accessors and mutators are amongst the worst habits in OOP. Most often they are just like the above code - dummy wrappers for the class member variable. Maybe Java people have some sort of mighty IDE, which generates such a write-only garbage for them.
In a related news (related to the mid-layer problem), see this post about trying to use Ruby on Rails (another midlayer-happy framework).
Comming soon on your favourite flamebait channel: Wrapping SQL Database to Objects Considered Harmful. Stay tuned.
Mon, 17 Sep 2007
Command of the Day
I will probably show my own level of ignorance here, but let me show you an useful utility which can improve the integration of the command line and desktop:
Meet xclip
,
a command-line utility for manipulating X11 selections from the command line.
If you wondered how text with tabs (such as diff(1)
output)
could be copied and pasted using X11, here it is:
diff -u old.file new.file | xclip
There are more options (such as reading the selection from the command line). Hope this helps (seen in this article at KernelTrap).
Fri, 14 Sep 2007
Networking Preview
Our network here at Faculty of Informatics is connected to the outside world by a not-so-small Linux-based router (10 subnets mapped using 802.1q to three gigabit and one 100 Mbit physical interfaces of the router). From time to time I wonder what will we do should this router reach its packet forwarding load limit. Today I have found some hints on how will the networking gear of the future look like:
See DaveM's presentation about the Sun Neptune dual-port 10GbE network card. Fortunately, the future is not in TCP offload engines (useless for a router), but in being successful in exploiting parallelism. I.e. how to use the single device from multiple CPUs or cores, how to distribute IRQs, etc. I hope his work ends up in the mainstream kernel soon. The only remaining problem is to get some 10GbE switches to upgrade our backbone...
Mon, 03 Sep 2007
OpenBSD Licensing
So we are in a middle of another licensing flame war. To summarize: Jiří Slabý has posted a patch narrowing the Atheros Linux kernel driver license to GPL (some header files were BSD licensed, and the rest was GPL or BSD dual-licensed before). This caused a big uproar in the OpenBSD community, including Theo de Raadt's accusation of Alan Cox giving advice to break the law.
Narrowing the license (i.e. forking the development) is usually not very polite, and I hope Jiří had good reasons to do so. However, ethics aside, the original author of the Atheros HAL code has already said that he is perfectly OK with taking the code under GPL for the Linux kernel.
But what makes me think "WTF?" are not the licensing details, but the overall attitude of the OpenBSD people (Theo, especially): they appeal to ethics (and, in Theo's case, law), when their license clearly allows taking the software and making it proprietary. And with relicensing to GPL only, it is not even made proprietary, just a bit more restrictive. This is not the only case of Theo de Raadt actually demanding something other than their license says. See his OpenSSH funding request as an example. If they so much care about what people do with their software, and whether they give back their changes, why they did not write it into their license (e.g. use GPL instead)? Is it a "not invented here" syndrome?