Development

Articles related to programming and software development

PHP and UTF-8: A Guide - Announcement

I started to write a guide on using PHP with UTF-8. It's on German, but I plan to translate it within the next couple of days.


Yet another browser! Safari On Windows

As you might have heard, Apple's Safari browser now is available for Windows, too. So there is yet another browser to support for us web developers. Hallelujah!

Unfortunately, the current build seems terribly broken, as the following screenshot shows (Click to enlarge):

Screenshot of this site with Safari Beta for Windows

Posted on June 12, 2007 in

Apache Xerces' weird error message

For one of my projects I'm using Apache's Xerces C++ XML Parser and run into this strange error:

The primary document entity could not be opened.

Took me a while to figure out that Xerces simply wants to say "File not found" here, because I was was calling parse() with the data to be parsed, while Xerces expects a file name here. Silly me.

However: Here's how to parse an XML string using Xerces SAX parser. you need to use a MemBufInputSource:

Posted on April 4, 2007 in

When Internet Explorer displays a white page...

.. this may be because of a wrong script tag. Actually, both Internet Explorer 6 and 7 will fail, if you use the script tag like this:

PS: This is primary a note to myself, since I get trapped by this over and over again...

Posted on March 27, 2007 in

PHP: Beware of Variables Inside Strings

One of the rather useless discussion among software developers is if to use PHP variable parsing when building string or not. That is if you should write your code like this:

<?php $value = 15; $text = "Value is $value, isn't it?"; ?>

Or better like this?

<?php $value = 15; $text = 'Value is ' . $value . ', isn\'t it?'; ?>

Well, some claim that the first version, using variables inside strings, is slower, while the others point out the second code is less readable.

A matter of taste, I think, since both readable code and performance are important some way or another.

However, this PHP memory bug gives me the creeps: The first code will not free the memory used until the end of script execution. So you better don't use code like this within loops.

Posted on February 28, 2007 in

The Holy Grail CSS Layout Fix for IE7

In Search of The Holy Grail describes an easy way to create a three-column, source-ordered, table-less layout with a fluid column in the middle. It is used by the Comic Marktplatz, for example. However, there is an annoying bug with the shiny new Internet Explorer 7. IE7 has a problem in understanding the left column rule of

margin-left: -100%;

Instead of considering the width of the surrounding div container, IE7 inserts the width of the body, which leads to the left column being moved out of sight to the far left. Here's how to fix it.

Posted on November 8, 2006 in |

And again: Is C++ really faster?

I was pointing to articles about if low level optimization really makes sense and if C++ is really faster than higher level languages several times. But of course this will be a never ending debate, and it still continues. This time C and C++ should be the best languages for higher level mathematics problems. Unfortunately this is not the case.

Posted on November 4, 2006 in

Focus first Form field with jQuery

I somehow like the jQuery JavaScript library. Have a look at the jQuery code for the Zebra-Table-Showdown: Ain't this a beauty?

However, when it comes to focusing the first (visible) field on a form, things are not that elegant. I got it working, though. Here's my current attempt:

Posted on October 19, 2006 in

Visual C++.NET 2003 and Broken Managed Assemblies

This is some really annoying bug in Visual Studio .NET 2003 (SP 1), took me two hours of my life: If the intermediate directory is set to something like ".obj/$(ConfigurationName)", the Assembly created will be broken, since it "does not contain a CLI header" - so the error message. It seems something is going completly wrong during compilation, since the dll is only 3 to 4 kB in size. If you omit the leading dot and set the intermediate directory to "obj/$(ConfigurationName)", it works.

Posted on September 26, 2006 in

std::clock(), threading, and Linux

I had a strange experience with the boost::timer class the other day, since it never elapsed within a certain thread. As it turns out, this was because std::clock() itself doesn't tick but returns the same value over and over again - a value that probably indicates the time the tread was started. The solution is rather simple: I implemented the boost::timer interface based upon boost::xtime from the boost threading library like this:

Posted on September 9, 2006 in

Syndicate content