The whole day I was working on figuring out the question I needed to ask to find out what my problem was or wether I had a problem. I finally found my question and got my answer.
Did you ever notice that all the good ideas occur to you while either trying to go to sleep, taking a hot bath or on your way home from work? Well I regularly notice, but still noone will let me go to sleep more often or soak in a hot tub all day. Going home from work is also a very time-limited activity if you live 10 minutes from your workplace (by bike! going slow!).
Anyhow I might have come to my solution much faster had I thought of the (newfound?) possibility to see the source of the java class libraries in eclipse (I am really sure it wasn’t always that way) or alternatively read the javadoc of the Socket class twice (see title). This way I spent half of the day thinking up a question … but I learned something and at least now I am sure that Sockets work exactly that way.
The question? Well I asked “Is it possible to get neither a connect nor a connection refused?” Answer: “Yes of course.” Rather trivial, I know but I really do not want to explain the reasons behind the question. Well I am really like a newborn networking genius. Who expects a newborn to talk tcp when it’s a week old? The questions will become less trivial soon, I promise 😉
I should have spent more time on the documentation for java 5.0 because I could have saved myself the trouble of implementing stuff the old way: Enums
Constant-specific methods are reasonably sophisticated, and many programmers will never need to use them, but it is nice to know that they are there if you need them.
“reasonably sophisticated” sounds good, doesn’t it? I like the concept very much. So I guess I am prone to over-use it. I’ll be careful, thanks for the hint 😉
Right now I can’t shake the feeling that they are all greedy little monkeys just out to get my money. (and nowadays preferably my money as opposed to my insurance’s money!)
By the way I would really like to blame someone for all this …
Right now I am compensating by eating a tasty piece of ‘winter’ cake from the bakery.
Something I missed? Mozilla.org is absolutely slow today. Well it wasn’t this morning? DOS? Too many fans? Something else? Hey, I want a new thunderbird ….Want want want ….. do you hear my consumerist screaming?
update: the moment I wrote this article the site is back? weird? no just the same as the trucks pulling left whenever I get scared they might …. telepathy I say!
related: /opt rules!!!
The WoW preorder package for Europe is sold out at amazon.de …. so the pre-orders for the pre-orders are sold out. And the US has launched and people are waiting 2 hours to go online on one of the 40+ servers (8x as many as diablo2) … You know I’ll be mad if I don’t get my collector’s edition. Want collector’s edition. I want one. All the hype is sick. Well all the other people hyping it are sick. Not me. No.
Hopefully this has been the last time I had such trouble with encodings. I think I finally managed to understand what caused all the troubles and how to avoid them in the future.
- dpkg-reconfigure locales (mine are 75-78, notably de_DE.utf-8)
- export LANG=de_DE.utf-8
- “file” actually checks iso/utf-8 files correctly (otherwise use hexdumps and encoding manpages!)
- Read in java files with encoding set correctly! (use iconv to convert strange input files to something java understands)
- Write out java files with encoding set correctly, yes force it! Between 4 and 5 you can have full control over conversion of encodings
- Yes there are java io classes that let you set encoding
- Configure database driver correctly. jdbc.encoding=utf-8 (it does not matter database doesn’t know utf-8)
- Use the same encoding whereever you can!!!
- Configure your shell+terminalprogram to display encoding correctly (see 1)
- Remember: utf-8 uses multibyte characters that’s the strange button in your terminal program
- Don’t forget to configure log4j to write utf-8 encoded files (really helps with debugging)
- Set your eclipse (or netbeans or what) to utf-8 encoding
- Configure your ant file so that your source-code is read as utf-8 in case you have utf-8 Strings in your classes …
- Don’t forget to write your encoding inside your xml header in your xml files.
- If you don’ like utf-8 substitute with your favorite encoding.
- MOST IMPORTANT: use the same encoding everywhere for your stuff. If something fails later, you know it’s not your stuff.
- Sometimes check your stuff on a different machine without any locales set just so you know you managed to program your java independent from your local settings!
- Aehm: without thorough tests you are doomed! And listen when your
tests scream: ERROR!
- Believe me when I say: ISO is not enough!
That’s the stuff I learned from all my troubles with encodings. Any questions? I think I may be able to answer a few at least where it concerns java and shell configuration 😉
A bug you cannot a reproduce is a bug you cannot safely fix!
That is what I learned for today.
An interesting (new to me) ant task is
Now that I own the “Pragmatic Project Automation” book I have started to streamline and automate my build process to finally bring everything under control.
While surfing the ant documentation for new tasks I stumbled upon the
BuildNumber task. What it does is really simple. It simply keeps a count of how often it was called.
This is a basic task that can be used to track build numbers.
It will first attempt to read a build number from a file (by default, build.number in the current directory), then set the property build.number to the value that was read in (or to 0, if no such value). It will then increment the number by one and write it back out to the file. (See the Property File task if you need finer control over things such as the property name or the number format.)
While preparing the project for a new release (yeah I am working with head and release branches now, I am trying not to repeat error-prone behavior of the past), I got the build.number up to 180 on that branch. I am using the task in my ‘prepare’ target which is run everytime I call ant
My first release-release is online and …. of course right after deploying it, I had to fix a minor bug. But it is only one bugfix this time, and a small one and I was in control of the code 95% of the time. Which is a much better ratio then my normal ‘code swimming for the olympics’ type of bug-fixing 😉
Via pesky apostrophe arrives a funny quote from Rice Is Named Secretary of State (washingtonpost.com)
Aides said Bush and Rice know each other so well they have conversations based on body language, with maybe four words exchanged.
I sure would like to see one of those.
Anyone who has seen 24 and is not constantly reminded of Sherry Palmer?
Hier noch der Rollenspiel Shopping Tip des Monats: Unknown Armies. Ein Rollenspiel ueber Macht und Konsequenzen. Na ja ihr muesst wohl noch ein bisschen warten, denn der aktuelle Erscheinungstermin ist Januar 2005.
Ich werde mir auf jeden Fall eines holen! Und ihr solltet auch. UA ist ein geniales Rollenspiel und die deutsche Übersetzung wurde von Tim und Co mehr oder weniger nebenher in Heimarbeit gemacht!