About this blog…

I am employed by Netnod as head of engineering, research and development and am among other things chair of the Security and Stability Advisory Committee at ICANN. You can find CV and photos of me at this page.

As I wear so many hats, I find it being necessary to somewhere express my personal view on things. This is the location where that happens. Postings on this blog, or at Facebook, Twitter etc, falls under this policy.

The views expressed on this post are mine and do not necessarily reflect the views of Netnod or any other of the organisations I have connections to.

Python and Unicode

As some of you saw, I did write earlier about problems I had with wide Unicode codepoints. That was because the Python I use is not compiled for support for it. Naive as I was, I thought that this was one of the things that was fixed for Python 3.x, but it was not. Because of this, codepoints with more than 16 bit values are stored as surrogate pairs, so it was possible to do a workaround. Not pretty, and possibly not the most efficient python code out there (note that it uses some data structures that I have already created elsewhere):

 def unicodeCaseFold(c): result = "" maxlen = len(c) i = 0 while(i<maxlen): if((maxlen-i) > 1 and ord(c[i:i+1]) >= 0xD800 and ord(c[i:i+1]) <= 0xFA0D): # Lets guess this is a surrogate pair value = ord(c[i:i+2]) j = i + 2 else: value = ord(c[i:i+1]) j = i + 1 if(value in unicodeSpecialCaseFoldingDict): result = result + unicodeSpecialCaseFoldingDict[value] else: result = result + c[i:j].lower() i = j return(result) 

Updated: Some “<” and “>” where not visible earlier as I forgot to encode them properly in HTML… Now fixed. Updated: Corrected some bugs in the code. […]

Python and unicode is not always fun

Regardless of what programming language one use, there are always small irritating things that one have to keep track of. I have most certainly misunderstood something here, but wide unicode characters are not managed properly in Python 3.0.1 I think. Let me know what I have missed please.

 $ python Python 3.0.1 (r301:69597, Feb 14 2009, 19:03:52) [GCC 4.0.1 (Apple Inc. build 5490)] on darwin Type "help", "copyright", "credits" or "license" for more information. >>> c = chr(0x10400) >>> c '&#55297;&#56320;' >>> print("%x" % ord(c)) 10400 >>> for i in c: ... print("%x" % ord(i)) ... d801 dc00 >>> type(c) <class 'str'> 

[…]

I am back — I hope

As you have noticed (I hope) I have not been blogging for a while. To be honest, I have not even checked my RSS feeds the last three weeks. Simply because the first two weeks where too full of work, and the last couple of days I took some time completely off. Simply to take care of myself. Be selfish. Today, Friday, I start working again, and hope that it can be “normal” again, whatever normal is. Instead of here writing about what I have done, I will post a few shorter posts about it. So it will be easier for you dear readers to ignore what you are not interested in. And, we all like short posts, right? […]

Finurlig namngivning på konferensrum

(Bl.a.) Näringsdepartementet har flyttat in i det gamla posthuset på Vasagatan i Stockholm. Där har någon tänkt efter lite innan de bestämde var konferensrummen skulle ligga. Man kan nämligen komma dit utan att gå in i den delen av huset som arbetsplatserna ligger i. De ligger i två plan direkt till vänster innanför ingången, där det nedre planet ligger en trappa ner. Vad heter då konferensrummen? Jo, på det nedre planet ligger Piggvaren, Makrillen och Ålen (där förhandlingar mellan regeringen och oppositionen sker vad gäller energi och klimat enligt Bloggen Departementet). På planet där man kommer in heter de saker som Dyningen, Vattenspegeln och Springkällan. Ytterliggare upp (plan 3) kommer tex Rosmarinen, plan 4 Förgätmigejen, plan 5 Granen och slutligen plan 7 Höken. Man kan undra vad konferensrummen ska heta om de bygger takvåning, för att inte tala om vad rummen skulle heta i källaren… […]

Way back when…

We all remember how it was when we where young. We all had 10 miles to school. We had to walk through the djungel, wade through water, eat only small rocks, and now and then sleep in a cave on the way home when we quit school late. Lotten has checked how far she was walking to school, and discovered it was not at all 10 miles, but maybe a thousand meters. Hey! I thought, I had 10 miles to school! So I checked. You can see on the map below how I had to walk. On my own I must say, crossing one (or two) major roads when being 6, 7 and 8 years old (at 1, 2 and 3 on the map). I can see I did not have 10 miles either. Only maybe 500 meters, 600 meters and 2km. Disappointing… Memories are better as memories I guess, and they should stay that way. Or else I have to stop talk about me fighting with bears and tigers just because I wanted to finish my math test. Updated: As you can see on the map, I can not even measure correctly. Correct distances are probably 300 meters, 400 meters and 1km. How I walked to school when I was young(er) […]

Ingemar Johansson has passed away

The first, and so far only, world champion in heavyweight boxing from Sweden has died. He passed away on Jan 30, 2009. On 26th of juni, 1959, in front of 30 000 people on Yankee Stadium, he knocked Floyd Patterson two minutes and three seconds into the third round. He was born 22nd of september 1932, and I will as certainly many people from Sweden remember him as a very nice, calm, friendly person from Gothenburg (with a typical dialect) that also some jokes has originated from. Like that he is claimed to turn down an offer to get 1/3 of the revenue of a gala because he wanted at least 1/4. He will be deeply missed. I have already missed Ingemar as he has been sick for a few years. His face on television, or on the radio, always made me smile. A great guy. What more can I say? Ingemar Johansson, from Wikipedia under Creative Commons […]

Horace Engdahl i Riksdagen

Jag måste gratulera Horace Engdahl till ett riktigt bra tal som han höll i Riksdagen vid invigningen av Märkesåret 1809 den 15 januari 2009. Han kallade det Det glömda året, och beskrev på ett mycket intressant tiden runt 1809. Han inledde:

 I Sverige och Finland bereder vi oss att högtidlighålla tvåhundraårsminnet av året 1809. Jag säger inte fira: ordet tar emot, trots den glädje och stolthet som båda nationerna kan känna över sin väg genom seklerna fram till dagens oberoende och välstånd. För om man har gjort sig hemmastadd i de fruktansvärda åren 1808-1809, om man har lyssnat till rösterna från dem som då levde i vår del av världen, så att dessa människor ter sig lika verkliga som ni och jag, då vill man inte skämta och hurra. Det var en ödesstund för vårt land. Aldrig har Sverige varit så nära att försvinna från kartan som den gången. 

Läs i lugn och ro. Som de säger på engelska: This is good stuff! Horace Engdahl (photo from wikipedia) […]

Do not play games in the subway

As you can see on this video, playing some virtual games on your cellphone can be expensive. Original article at Youku.Com. […]

Johnny Wahlqvist is celebrated by City Council

Johnny Wahlqvist, the new world champion in power lift with 332.5kg in bench in the +125kg class, was congratulated by the city council in the city he lives, Simrishamn. I think it is good that the city recognizes the efforts people living in the city is doing. Sport or otherwise. More of that! And of course, my congratulations to Johnny! Johnny himself, picture from his homepage […]

Earthquake in southern Sweden?

At around 05:19 UTC I woke up because the house was shaking. Cats where running around like crazy. It was a slow long movement, slightly slower than when a truck drives by. Very similar to what I have felt in California, so my reaction was immediately that it was an earthquake. Rest of family woke up. On the radio, they are reporting people calling them. And people call 112 so that it is impossible to call them for real emergencies. At 05:46, the news agency TT in Sweden report that also in Copenhagen it was possible to feel the movement, but not much more. Once again we see that people react and want information when things happens. I just checked https://www.krisinformation.se/ where the last information is from Dec 13. Swedish Radio was at 05:53 showing one short text about it. Also Expressen writes about it. So once again we see that the services that are supposed to report on things could not handle the load. Instead we have to rely on news agencies, and they have about 30-35 minute delay, and rely on TT, and some of them (like Aftonbladet) is so loaded one can not access them. Updated: At 05:58 Swedish Radio had to ask people to stop calling 112. Updated: At 06:00 Swedish Radio on the news report that the earthquake was 4.7 on the Richter scale. Enough to create cracks in houses. Updated: At 06:00 one could on TV4 website directly see the news program where people where interviewed. News from Swedish Television is only available after the transmission. Updated: Now we’ll see whether the agency in Denmark, Geus, or the organisation in Sweden, SGU, will be the first talking about what happened. Updated: At around 06:15 more news about the quake started to be published on various news agencies. Reports from said the quake had a centra about 60km east of Malmö, and 9km northeast of Ystad. Updated: Found information on the website of emsc-csem. Date time 2008-12-16 at 05:20:00.4 UTC, Location 55.56 N ; 13.95 E. Updated: USGS report a different location, +55° 37′ 13.08″, +13° 37′ 13.80″. Updated: The center was about 10.8 km south-east of where I live. Here is a map over the area where I live, as you can see on the map below.
View Larger Map […]