Bert JW Regeer (畢傑龍)

IE 6 and 7

I made a quick and simple decision which has already helped lift a weight off my shoulders. I have decided from this day on forward I will refuse to make my websites look and function right in IE 6 and IE 7. Dean Edwards has created a JavaScript that will attempt to fix IE 6 as much as humanly possible, forcing it to render everything correctly. It used to be known as IE 7, but he has recently released his latest version IE9.js which attempts to fix even some flaws that IE 8 has, while I am not yet ready to drop support for IE 8, I have enabled the latest and greatest version of this JavaScript so on any IE less than 9 the JavaScript will run.

To see everything that IE9.js supports visit the IE7.js Test Pages list and take your pick. The work that Dean has done is absolutely amazing and I am very happy that because of him I don't really have to worry about my websites in older versions of non-standards compliant browsers.

Even Microsoft sent flowers to the fake IE6 funeral with a note saying that we should stay tuned till this years upcoming MIX conference. I hope they say they are support HTML 5 and CSS 3 as that would be simply amazing. Maybe, just maybe they are switching from the old Trident based rendering engine to something more modern.

While I may dislike IE 6 and 7, I won't yet go so far as to put up a message just yet stating that people should get a better browser, I am removing a lot of stress and work in that I no longer have to support the old ageing browser.

Interesting bug

I was starting to see something interesting in the output from my Google AppEngine based project. I was automatically creating a link based on a config setting, named SETTINGS["contact"], and the code would work perfectly the first time the page was created and loaded, however multiple refreshes of the same page would show that the link was gaining slashes even when it shouldn't have.

The logic was as follows:

if contact is "mailto:" then do nothing
        if contact does not start with "/" or not with "http"
                contact = "/" + contact

This code would work perfectly the first time around, however if I had properly tested by setting contact = "/contact" as well, I may have caught this bug faster.

However since that piece of code was only being called once per page view, it worked perfectly as far as I was aware, the thing is I started seeing more and more slashes being prepended to contact each time I refreshed the page. I looked at the code above, and did not see that my logic should have contained an "and" instead of an "or". Even so if the code is being loaded once per page view the variable "contact" that started off containing the word "contactme" should only turn into "/contactme" and not "////contactme" on the fourth page load.

Each time I added in a logging or debugging statement and refreshed the page it would go back to "/contactme", I would change another thing, or add another debug statement and "/contactme" was there staring me in the face. It took me a little while before I hit refresh a couple of times and noticed that my debug output now contained what I had seen beforehand. That is when it hit me, Google AppEngine caches imports that included my global variables. As long as I did not modify any of the files in my project it would happily use the cached variable, which after the first reload would contain "/contactme", then because of my use of or instead of and, would become "//contactme" on the second reload.

Google AppEngine has some very aggressive caching, which may well be required to have it run at the scale Google wants it to run. This is just another warning for myself that I need to watch out when I modify global variables and that they will stay the same across different sessions.

This is the logic I ended up with:

if contact is "mailto:" or contact starts with "http" then do nothing
        if contact does not start with "/"
                contact = "/" + contact

Works exactly how I had expected it to work.

Project file structure

I'm currently working on a new website that will be hosted on Google AppEngine, however I am currently in the middle of revamping some older code and realised that maybe just maybe it belongs with the model rather than in a separate directory.

The setup currently is to have a models directory and a forms directory, they contain the models and the forms respectively, however I am starting to realise more and more that the form is a direct extension of the validation required in the model (which is not possible with the current database stuff that Google AppEngine offers), the form is taking user input and making sure that it is correct and then just passing it off to the model to check it into the datastore.

I'm thinking of merging the form into the model source code so that I can remove the forms folder entirely, since it just doesn't make sense to have the two in separate locations whereby one may be changed but the other may not. I'm afraid that they may get to be out of sync, and cause issues.

Will have to think about it for a little bit, no need to make rash decisions this late into the evening and blow away part of my source tree.


When I was 12 I started to learn how to program, I had just together with my dad, bought my first C++ book. I don't remember the name of the book, it might have been the C++ for Dummies book, either way it came with a CD and on that CD was the DJGPP. That day I spent some time learning the new environment the book had given me, I tried writing simple programs. Just a few days after I had bought the book I wrote a very simple C++ calculator. Nothing fancy, only 32 bit integers and what you wanted to do had to be entered in a very specific way, but I felt empowered. I had learned something, I was able to do this and master the machine.

From there my grand dad introduced me to BASIC, he had written software in BASIC before and figured that would be somewhere else to start and play with, my uncle helped me set up an environment and taught me the basics of BASIC.

20 GOTO 10

That was the first program I ran, and I remember it mainly because I was wondering why it was scrolling by on the screen so fast. I learned backwards if you will, I started with C++ and then learned BASIC, but I really did not get started until I was in High School, 9th grade I took a programming class taught in QBASIC. While the class was fun, and exciting I wanted to always push the envelope. For one of the programs we were required to draw a house using the QBASIC built in line drawing commands. What I ended up doing was reading the co-ordinates from a file, and drawing the required shapes in the correct places. During this class the teacher knew I was flying through the assignments and he let me play around with compilers and various other programming languages. C++ was once again the programming language of choice, this time I wrote a network based chat client so that I could communicate with my friend on the other side of the room without physically having to get up and talk to him. The teacher had separated us because of too much talking and this was my solution.

From there I also started experimenting with PHP as a web programming language, I wrote various pieces of software and scripts that never took off to accomplish various things, but mostly just to see if I was able to do it, if I could accomplish the goal I had in mind. This code I still have somewhere, on a CD with various other pieces of old code, recently I took the time to go through some of my old code and I have seen how much I have grown, how much I have learned in the various years that I have been programming now. It also reminded me how much time I spent just looking for resources and information, how long it took to get answers to various different questions.

10 years later the Internet has grown, answers are now as easy as using Google with the right keywords, however even then it can take too long to find the answer to something you know someone else has come across before. This is where StackOverflow comes in, all those years that I have been learning to program I wish a site like StackOverflow had existed, it would have allowed me to easily search for answers to questions as well as ask my own, arguably stupid, questions. It is a website by programmers for programmers and is entirely based around the idea that knowledge should be shared. If you start asking Google questions about C# you will most likely find something from StackOverflow on the list of pages it gives you.

StackOverflow has taken over my life, every day I check StackOverflow for new interesting questions, check the answers and if possible I answer the question myself. Finally there is a place where programmers are able to go with all different experience backgrounds and help each other accomplish one single goal, building better software.