Andy's insights

Opinions, thoughts, archivements

Sun, 09 Oct 2011

Git and Subversion

Thomas Ferris Nicolaisen published a very interesting talk about livin with Git and Subversion in parallel on Vimeo

On his website there is the text with the content of the video.

He shows to to work with a bidirectional setup with Git and Subversion: Automatically migrating commits into a Git repository and how to add the subversion repository into individuell developers repositories to commit back to subversion. This is a bit different from the approach used by Jon Loehliger in his book Version control with Git where a single gate keeper repository is used between Subversion an Git.

posted at: 15:40 | path: /development | permanent link to this entry

Wed, 21 Apr 2010

Javascript scanner for xgettext

I’ve spend quite a few hours to build Gettext support into our huge Javascript application at work. One missing part was a Javascript scanner for the xgettext command.

After looking into the source I decided to extend the Gettext utility by myself. (After all I read the Dragon Book ).

It was quite simple to build a Javascript scanner module based on the existing Python scanner. All scanners don’t try to fully parse the source code but to only parse as much as needed to divide comments from code and identify the gettext function calls (_("...")) and extract it’s argument(s).

The first version already ran through our code base of about 40k lines without any errors. But running it on another project revealed that I need also to identify regular expression statements like /a"b'c/. If the RegExp statement contains unbalanced string quotation marks (’ or “) then the scanner barks and misses following translateable strings. So I spend more time fixing those special cases. The scanner is now ready to test in production environments.

My next step is to port back the current code to 0.17 and fix the symbol error in this backport that prevents to compile it on ELF based systems.

If you are interrested, the module can be obtained from my public GIT repository at github:

http://github.com/AndyStricker/gettext-javascript

I’m still trying to get it upstream into the gettext distribution. So far I got no reaction, but I’m patient. At least other possible users asked my about this new feature.

posted at: 23:41 | path: /development | permanent link to this entry

Sat, 29 Nov 2008

Finite state machine XML dialect

I just discovered the SCXML a W3C working draft. This sounds like a good idea.

No, I don’t like XML designed to be hand crafted. We need obviously front end tools to actually generate those XML files. I think about graphical connect-your-boxes-tools (e.g. Dia ) as well as text based tools like the SMC .

Well, let’s look closed at SMC: Why do we need an XML dialect while this is an already text based FSM description? The reason is quite simple: to dynamically load a state machine description based on the (well designed) SMC syntax we need a fully grown parser. If we use SCXML we can simply use a XML parser. Then we load the state machine dynamically in our application. Or we write or own backend to generate the FSM source code in our desired target language.

The funny thing about this all is that I wrote a proof-of-concept FSM generator in early 2008 which used a SCXML like XML dialect I designed. It wasn’t that complex, but enough to describe SDL State machines. I also wrote a export for Dia to translate SDL diagrams into my FSM XML Syntax. If I only known about SCXML before…

My motivation was to have a simple tool to easy decribe a FSM in my applications without the need to use a complex SDL or UML tool chain. While you can implement your state machines with simple switch (state) {} statements, it’s easier to have a specialized tool for this that allows you to easily modify the states as well as to generate a graphical representation of the state machine (e.g. with GraphViz ).

How did I found SCXML? Well, I came across the Qt SCXML Engine .

posted at: 09:05 | path: /development | permanent link to this entry

Sat, 30 Sep 2006

String Hash Function

I played a bit with string hashing functions for application like dictionaries. The result was a quite simple function with not too bad results: few collisions.


uint32_t
computeHash(const char *name, size_t namelen)
{ #define CONSIDER 32 uint32_t value = 0; int i;

if (name == NULL) return 0; /* take the first bytes of the string as initial value */ memcpy(&value, name, MIN)); /* include the length in start value somehow */ value ^= namelen & 0xaaaa; value ^= (namelen & 0×5555) << 16; for (i = sizeof(value); i < MIN; i++) value ^= name[i] + (name[i] << (i & 0×0f)); return value; }

posted at: 18:11 | path: /development | permanent link to this entry

Sun, 30 Apr 2006

Memory Allocation

Ever wondered how memory allocation works? How to get informations and more. While searching on web for function to get the current memory size from within a process I’ve found this good article: Advanced Memory Allocation

And there is a really good article in c’t 9/2006 s. 186 about heap overflows.

posted at: 00:10 | path: /development | permanent link to this entry

Tue, 07 Mar 2006

Defects in popular Open Source Software

Stanford University and Coverity are counting defects perl kilo line of code (Defects/KLOC) in popular OSS. I don’t know the criterias. Therefore the absolute values are not very interresting. Beside that it’s a good source to compare the listed programs and get an idea of the security.

http://scan.coverity.com/

posted at: 09:12 | path: /development | permanent link to this entry

Sun, 05 Mar 2006

How to transfer OSS developpment to corporate projects

Just seen on a Slashdot Story:
What corporate projects should learn from Open Source .

Nice Ideas.

posted at: 16:20 | path: /development | permanent link to this entry