Recently in Coding Category

Frustrations

| | Comments (0)

So you do some DBA work and one day realised that the worst has come true - the replication is just so broken you have to start all over. Usually there is always some kind of ground level when working with computers. If a program is badly broken try reinstalling it. If that does not work try reinstalling the OS maybe. If that does not work buy a new computer etc.

I had this situation on a system I am playing DBA on. Slony-I was badly broken so I had to restart from scratch. My ground zero was to drop the database and start over... But... what if you can't???

[postgres@A05L005 postgres]$ dropdb oasis
dropdb: database removal failed: ERROR: tuple already updated by self

Negative measure of productivity

| | Comments (0)

This is happening even today, but still so true...


-2000 Lines Of Code

I recently ran into a weird issue with ASP.NET. In my Global.asax file I have a handler for Application_Error to display a standard error page. However, in the Master Page (the handler transfers to an error page that inherits from a custom master page), I read the session state to show a global status.

This works fine, until an unhandled exception is thrown. Then I suddenly get an exception stating that Session is null. This made no sense, and I even discovered a response from someone on the internet that once an unhandled exception was thrown, the session state is reset (which is preposterous). Eventually I found the reason - the Application_Error event is raised *before* the AcquireRequestState event is raised - which sets up the Session state.

Simple conclusion - Session state is not available in Application_error.

If you run a Swing application under Parallels for Mac v3.0, and are using Java 1.6 and your direct draw extension is enabled you will find the application never draws (render) it's canvas.

It is not a bug in your code - just turn off all graphics acceleration in XP.

A classic

| | Comments (0)

(From CodeSOD: The Pyramid of Error)

if (error)
  if (fprintf(stderr,"An error occured while writing to the file")<0){
    if (fprintf(stderr,"An error occured while writing to stderr")<0){
      if (fprintf(stderr,"An error occured while writing to stderr")<0){
        if (fprintf(stderr,"An error occured while writing to stderr")<0){
          if (fprintf(stderr,"An error occured while writing to stderr")<0){
            return fprintf(stderr, "An error occured while writing to stderr");
            /* lets stop here, its enough */
          }
        }
      }
    }
  }

.NET never ceases to amaze

| | Comments (0)

http://support.microsoft.com/kb/810218

In essence - when you do a Server.Redirect("SomePage.aspx?SomeParam=SomeValue") .NET conveniently will make that SomeParam persisted over the subsequent requests - i.e. if SomePage.aspx contains a form to be submitted, that form's action will be rewritten to include this param. Neat? No! How do you clear a querystring parameter no longer used? You can't. At least not elegantly.

This is why I prefer J2EE - you have to work harder, but you almost *never* have to implement workarounds to work around unneeded high level features.

In HTML development...

| | Comments (1)

less is always more.

Why #region is evil in C#

| | Comments (0)

C# has a nice preprocessor directive called #region. In principle it is very cool, but it is like so many cool ideas - HORRIBLY broken.

Micro Optimisations

| | Comments (0)

I was recently involved in a project where I was reminded of a typical scenario in today's IT environments that still baffles me...

When are you growing?

| | Comments (0)

I think most developers assume that the more years they write code, the better they become. I have a very different measure for whether you are really bettering yourself.

Ask yourself this, and answer honestly:

With every new project you successfully complete, do you feel that the previous project was not done as good as the one just finished? Do you have an urge to open that previous project and bring it to the same standards as the latest project? Or do you feel that both projects have been created equally?

If your answer is the latter, I am sorry but you are not growing. No matter how good you are.

About this Archive

This page is a archive of recent entries in the Coding category.

Cats is the previous category.

Computers is the next category.

Find recent content on the main index or look in the archives to find all content.

Pages

Powered by Movable Type 4.12