Gone skiing
I’m off to a week of snow and skiing… See you on March 8th

Add comment February 28th, 2004
I’m off to a week of snow and skiing… See you on March 8th

Add comment February 28th, 2004
I was on a bug hunt the last couple of hours. When I looked at a web page served by our application server, it’s content showed up. When I pressed reload, only the summary of the content showed up. Somehow, someone changed my ( my! ) private variable somewhere. I sprinkeld the code liberally with print statements (ahh – nothing goes over a good dose of those) because the app would be quite cumbersome to run in the debugger.
Nada – I could see that the second time, the content size was reduced to a couple of bytes. But no clue who did that to me.
After some consideration, I decided to look at the code again. And IDEA helped me spot the problem in 30 seconds:
Place the cursor on any expression (in this case on the name of my private variable that got changes). Press CTRL-SHIFT-F7 and all occurences of that expression are highlighted in the editor. Scroll down, take a look and voila: there it was, an assignment to the variable in the wrong function.

As it always is: Good tools are a real asset!
Add comment February 26th, 2004
How do you find a URL in a normal text and turn it into a HTML link using regular expressions? That was the challenge I faced recently. Oh – and of course not only well formed url’s (with the http:// in front of them, but any kind of url.
Why invent something, when there’s google to search? I found Ben Forta’s “How to match a URL” but unfortunately it was way to forgiving in what it parsed, so I had to expand it a bit. Here are the results of a couple of hours of labor:
UPDATE: There was a nasty bug, that truncated all urls where the host started with the letters of one of the TLD’s to the reminder … www.invisible.ch got truncated to visible.ch. The code below is corrected and simplified a bit (removed a couple of unneeded groups)
([\s]|^|<p>)
(https?://)?
(([\w]+?[-\w\.]+?\.)+
(a[cdefgilmnoqrstuwz]|b[abdefghijmnorstvwyz]|
c[acdfghiklmnoruvxyz]|d[ejkmnoz]|e[ceghrst]|
f[ijkmnor]|g[adefghilmnpqrstuwy]|h[kmnrtu]|
i[delmnoqrst]|j[emop]|k[eghimnprwyz]|
l[abcikrstuvy]|m[acdghklmnopqrstuvwxyz]|
n[acefgilopruz]|om|p[aefghklmnrstwy]|qa|
r[eouw]|s[abcdeghijklmnortvyz]|t[cdfghjkmnoprtvwz]|
u[ugkmsyz]|v[aceginu]|w[fs]|y[etu]|z[amw]|
com|edu|mil|gov|org|net|int|info|biz|name|pro
|museum|aero|coop){1})+
(:\d+)?
(/([\w/_\.]*(\?\S+)?)?)?
([\s]|</p>|<br />|$)
and then replace it with:
$1>a href="$2$3$6$7"<$2$3$6$7>/a<$10
Let’s dissect this monster a bit, to see how it works:
([\s]|^|<p>)
Here we are looking for the beginning of the expression: Either a whitespace character (the [\s]) or the beginning of the line ( ^ ) or an opening paragraph tag ( <p;> ). If something matches this expression, it is stored in group number 1 ($1) for the replacmenet later.
(https?://)?
Next we are looking for the http scheme. The ? after the s means, either one or none of the preceding characters (which is the “s”). This part matches both “http://” and “https://”. The question mark after the bracket group means either one or none of the following, making the scheme optional.
(([\w]+?[-\w\.]+?\.)+
This part matches the host name and — if found — stores it in a numbered group. A host must start with a word character ( [\w]. We continue to match on word characters ( +? ). Because both “-” and “.” are allowed in host names, we then expand the match to include these two characters ( [-\w\.]+? ) and match as long as we can. The whole group must at least match once.
So far we match things like “abc.def” or “a-b.de.f.g”. The original regexp stopped here, but we are interested to have valid TLD (top level domains) so the next expresion matches the valid top level domains:
(a[cdefgilmnoqrstuwz]|b[abdefghijmnorstvwyz]|
c[acdfghiklmnoruvxyz]|d[ejkmnoz]|e[ceghrst]|
f[ijkmnor]|g[adefghilmnpqrstuwy]|h[kmnrtu]|
i[delmnoqrst]|j[emop]|k[eghimnprwyz]|l[abcikrstuvy]|
m[acdghklmnopqrstuvwxyz]|n[acefgilopruz]|om|
p[aefghklmnrstwy]|qa|r[eouw]|s[abcdeghijklmnortvyz]|
t[cdfghjkmnoprtvwz]|u[ugkmsyz]|v[aceginu]|
w[fs]|y[etu]|z[amw]|
com|edu|mil|gov|org|net|int|info|biz|name|pro|
museum|aero|coop){1})+
This looks worse than it it. Let’s start at the end: (com|edu…. |coop) matches the known three- and more letter TLD’s. The beginning matches the 240 different two-letter country TLD’s. Instead of spelling out all 240 combinations, we use the slightly abbreviated form: a[bcd] which matches “ab”, “ac” and “ad”. Repeat ad nauseaum.
(:\d+)?
This part matches an (optional) port number (like :8080). The \d matches on a digit and the + says: repeat as long as there are digits.
(/([\w/_\.]*(\?\S+)?)?)?
This piece matches any path’s it the url ( foo.com/path ). The match has to start with a “/” followed by any combination of “word characters” (a-z, A-Z, 0-9), underscores or dot’s, followed by either a question mark ( \?) or any non-whitespace (\S) character. That means, that paths with optional parameters ( ?foo=bar&head=tail ) or funky characters ( 123,2334.html ) match.
Then there are a number of closing parentheses, that wrap up the different parts of the url and make them optional (with the ? ).
([\s]|</p>|<br />|$)
Finally the url is ended, when we match whitespace [\s] or a closing paragraph or a break or the end of the line ( $ )
Now that wasn’t as bad, was it?
The replacment then is really simple:
$1>a href="$2$3$6$7"<$2$3$6$7>/a<$10
Remeber the groups I talked about earlier? The $1, $3 etc. represent those groups. So $1 is a variable that contains the content of the first match that was specfied in brackets in the searching regexp. (in this case, it contains the whitespace or start of line or paragraph tag). $2 contains the “http” scheme, $3 the host name, $6 the port number and $7 the path component. $10 finally contains whatever was after the url
So here you are: a search and replace expression that will fish out valid url’s of a text and turn them into html links.
Add comment February 20th, 2004
I’m watching over a Notes based Faxserver at a client. There is a lot of personel data imported daily from a SQL database. The process has been taking longer and longer and longer, not finishing and occasionally crashing the server.
Babysitting the process, dropping in occasional log messages (something the original developers didn’t do) and doing some educated guesses shows me, that the refreshing of a view is taking in excess of 4 hours.
Some searching on Notes.net points to deletion stubs as a possible problem. Now – how to get rid of them?
Enter Delstubs by Julian’s NSFTools.com.
Here’s the result from the first run:
3924920 of 3924920 records searched
3892146 stubs found
Total space used @ 100 bytes per stub = 389214600 bytes
Time to use the /r removal option…
Let’s see the performance after this treatment ;-)
Add comment February 17th, 2004
Here’s collection of a lot of useful bookmarklets / links for the webdeveloper. Allows you to change the way forms work, view headers, outline your pages, validate your html/css and much much more.
Works with Mozilla and Firefox.
Webdeveloper Plugin. Get it!
Add comment February 17th, 2004
In Mozilla FireFox: type “about:config” in the adressbar and the hunt those settings and change them accordingly:
user_pref("general.smoothScroll", true);
user_pref("network.image.imageBehavior", 0);
user_pref("network.http.max-connections", 48);
user_pref("network.http.max-connections-per-server", 16);
user_pref("network.http.pipelining", true);
user_pref("network.http.pipelining.firstrequest", true);
user_pref("network.http.pipelining.maxrequests", 100);
user_pref("network.http.proxy.pipelining", true);
user_pref("nglayout.initialpaint.delay", 100);
by Geek Styke via Simon and his blogmarks
Add comment February 11th, 2004
I said: Don’t! Don’t go to CrazyMachines. Don’t download the demo. Don’t play it. Don’t rush out and buy the game… [1]

[1]
If you do and live in a country other than “Deutschland (Deutschland)” (like “Deutschland (Schweiz)” you will get errors when installing (An error about “Transform” and “Transformpfade”). Just switch to the “Deutschland (Deutschland) scheme and you’ll be fine for the install)
Also if you do: prepare to spend a couple of hours in front of the computer, not working
Buy Crazy Machines at Amazon.de
2 comments February 10th, 2004
This server was down a bit during the day when I installed the new 3Ware RAID IDE Controller and moved a couple of directories to a mirrored disk. The process was more or less painless but I learnt a couple of interesting tid-bits.
Computers don’t turn themselves on, when they don’t have power. That means – if nothing happens on pressing the BRS, check that the connector from the power supply is firmly seated in the motherboard. (Turns out that I partially unplugged mine when fumbling with additional IDE cables.
A midi tower is not enough for a server Nobody thought that a midi sized PC would have more than 2 IDE 3.5″ drives, so no provisions are made to add more. With some creative use of existing space, a folded piece of paper as electrical insulation and hope that nobody will rattle the box too much, the second mirrored drive lies in a 3.5″ floppy bay (of which there are two for some reason, but no provions for holding a harddisk. Go figure.
RAID is simpler than it seems Power up the computer, go to the RAIDs card BIOS, select the two drives, select create RAID1, select Done. The Linunx installation recognizes a 3Ware driver. At a root prompt “/dev/sda” which automagically loads the SCSI drivers (this RAID looks like a SCSI disk to the OS), fdisk to create partitions, mount it, mkreiserfs, copy the data over, enter the new paths in /etc/fstab instead of the old ones, reboot – done.
You should update your blog I know how to solve the slowness of this server I blogged about it – but I didn’t enter all necessary information. Bad. The blog is my external memory, so I’d better keep it up to date…. (which I have done now)
Add comment February 9th, 2004
invisible is not only the name of this blog, but also the name of my company “invisible Jens Christian Fischer”. I do consulting, Lotus Notes / Domino mainly, intranets, web development and so on. (If you need a consultant in this area, send me an email)
My wife’s company is called “visible”.
Both are what is called “Einzelfirmen” – they are companies that belong to individuals and as such, the company is me, and I’m the company.
Well – it makes sense for our companies to merge. We announce the forming of the new company “InVisible GmbH” as of today.
Unfortunately that means that the blog has to move to a new location, as you may have noticed, the new URL is blog.invisible.ch.
Add comment February 6th, 2004