/ #blog 

Finding a URL in a text

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 https:// 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 ...

Jens-Christian Fischer
/ #blog 

Pesky Deletion Stubs

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. ...

Jens-Christian Fischer
/ #blog 

Optimizing FireFox

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

Jens-Christian Fischer
/ #blog 

Attention: Don't look at this game

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 ...

Jens-Christian Fischer