Viser opslag med etiketten Programming languages. Vis alle opslag
Viser opslag med etiketten Programming languages. Vis alle opslag

mandag den 4. maj 2009

Python setlocale on Windows XP

In a development project we had some problems with guessing the correct locale string on Windows XP, and there seems to be no copy'n'paste solution on the web, so here it is:


# Import sys packages.
import locale
import os


local = 'da_DK' # Danish locale unix: 'da_DK'
if os.name is "nt":
    local = "Danish_Denmark"
# Danish locale on Windows: "Danish_Denmark" or "Danish"




 

locale.setlocale(locale.LC_ALL, local)


See the following links for inspiration on how to guess your locale:

http://msdn.microsoft.com/en-us/library/hzz3tw78(VS.80).aspx 

http://msdn.microsoft.com/en-us/library/39cwe7zf(VS.80).aspx

lørdag den 30. juni 2007

The Purple Dragonbook

I went to the post office today to pick up a package from Amazon UK. The package contained the purple Dragonbook (Compilers Principles, Techniques, and Tools) by Aho, Lam, Sethi, and Ullman which is a classic in compiler design. Being a phd studendent working on programming languages it is a must have, and since a new edition has recently been published it was obvious to buy the book. I have agreed to review the book for the computer science association in Denmark (Datalogforeningen) which will be in danish, I expect to write a short summary here in English.

From the first look at the book I must say that I am excited. It looks really nice. I read some of the parts concerning parsers and it all seemed to make perfect sense from a first calsual reading. The reason I read about parser was my curiousity towards why approx. 200 pages out of approx. 1000 where devoted to lexical analysis and parsing. It seems a lot but from my first reading they also get into some of the stuff which is often left out of other compiler books.
I look forward to read the rest of the book and I will write a post when that happens.

Have a nice weekend.

fredag den 29. juni 2007

Back from San Diego

Last week I returned from a great trip to San Diego where I visited the FCRC Conference. I attended the History of Programming Language conference (HOPL-III), the Programming Language Design and Implementation (PLDI), and finally I presented a paper at the Programming Language and Analysis for Security workshop, which was the main purpose of my trip.

The HOPL conference was a big hit, many good talks on why or why not succes of programming languages like AppleScript, Lua, Modula-2 and Oberon, ZPL, Erlang, C++, Haskel and Beta. For the first time I saw Niklaus Wirth the maker of Pascal, the first programming language I learned. He seemed a bit uncontent with the present state of programming language too much abstraction and too little focus on fast implementations. I disagree. Raising the level of abstraction is natural and good programming style, the compiler should do the hard work of optimizing the code.

PLDI was a good experience many good presentations. There where a lot of presentations after 10 hours of talks my head was spinning and dangrously close to mental overload. I meet a lot of people doing interesting research nice to experience the state of art this close.

PLAS was a good experience the presentation went well, and the questions easy to answer. The other presentations where interesting so it was a good day.

San Diego is a nice city. It felt like a good place to be, especially the Gas lamp quater was nice. Lots of resteurants and shops. And the weather was great, 25-35 degress celcious and a nice refreshing wind.

I have placed some pictures from my trip, see the menu on the right and select pictures. The hotel was fine but the decoration sucks big time looks like something some the early 80's :)

tirsdag den 29. maj 2007

New version of the Java 5 SableCC grammar

I have made a small change to the Java 5 grammar in order to fix a bug concerning the ellipsis operator... see the file java5.sablecc for further information.

torsdag den 10. maj 2007

First Paper Accepted!!! :)

I got my first paper accepted. It was submitted to the Programming Language and Analysis for Security Workshop 2007, PLAS'07, and got accepted. This is very cool, and means that I will go to San Diego in June - nice rigth :)

I have just finished the last changes to the paper and submitted the final version which you can find on my Publications page, see the menu at the rigth.

onsdag den 18. april 2007

Java 5 Grammar for Sablecc 3.2

I have somehow come upon this Java 5 Grammar for Sablecc. I can't remember where I found it, thus I can not remember the name of the author, and nothing is mentioned in the file. If you know of who is the author, please do not hesitate to contact me.

I have choosen to publish it here since I have found it more than difficult to find a working implementation of the Java 5 grammar for Sablecc, and by doing so I hope others will not get into as much trouble finding it as I did.

[Edit June 8th. 2008] I have now identified the author of the grammar, Stefan Mandel, and contacted him. The grammar is released under the LGPL, and I have added a copyright notice.