Archive forCoding

svn add command!

This is just a quick rant to say:

The svn add command exists for a reason.
Learn it, use it, love it!

I went into work for a few hours today as we have a rather pressing deadline for the current project and it would be nice to get stuff finished on time to allow for some testing. After making a bunch of changes to the code that I was working on I was ready to compile and give it a test. I decided to do the prudent thing and update my local copy so that I coud test what I had done with the latest version of the project.

Unfortunately someone(s) else had incompletely checked in some work since my last update. I say incomplete because they had obviuosly created new files and the VS.NET project file had references to where they should be, but they didn’t exist in the repository.

After some carefully thought out exclusions in the solution and a quick informative email later I was able to get my changes to compile. Even though I have not completed what I was working on, and hence not checked it back in I emailed the other developers to let them know what I had done (the exclusions) and why I had done it. Obviously excluding someone elses work from a project solution is not the best thing to do when there are tight deadlines. I didn’t want the things that I had excluded to become overlooked simply because the original developer(s) thought that they were now complete.

If we were running test driven development that would not be a problem as it would be caught in the next build and test phase, however we have not yet reached that point of restructure of our methodologies.

Comments (2)

PL/SQL the short way

At work we are all pretty busy with the project known as ‘Phase 2′. A project that the sales and marketing team had decided on a deadline before we even knew that it existed. This should be the last, or at the worst next to last time that something like this happens on such a massive project.

I have no illusions about it not happening again, however we can dream can we not?

Any way, the point of this post is simply to marvel at a lovely way to do some PL/SQL to build a bit of a data layer for the extensions that we are adding. I’ve not done a lot of PL/SQL in the past, and the stuff that I have done is fairly basic so I was quite impressed with the simplicity and functionality of this little block:

PROCEDURE getMenu
   (pDetails    OUT grcDetails,
    pMenuID   IN Menu.MENUID%TYPE DEFAULT NULL) IS
BEGIN
   OPEN pDetails FOR
   SELECT *
   FROM MENU
   WHERE MENUID = DECODE(pMenuID, 0, MENUID, NULL, MENUID, pMenuID);
END getMenu;

All the smarts of the statement are in the DECODE. For those that don’t recognise it, this is a small function written in PL/SQL for Oracle. Basically this function allows us to load all of the records in the MENU table, or the one specified by the pMenuID if it is supplied.

I was just impressed with it’s power and simplicity and had to share.

Comments

Sessions for sessions sake

I have a client who’s website I am now responsible for. This site suffers from “too many developers” syndrome, in that there are some very different coding styles througout. The unfortunate thing is that by reading through the code you can see that most of them have absolutely no idea what they were doing.

I’ve found instances of horribly inefficient JavaScript where 3 functions are defined for each record in a result set and the Primary Key field is appended to the function name to make it unique. None of these repeated functions did anything different. None of them used any of the information from the recordset other than the Primary Key field. It was effectively just a window.alert('Are you sure?'); type function.

I’ve found inefficient ASP where a query is performed, the record set is looped through and counted, the query is closed, and then it is redone. All just so that the number of returned records would be known before the record set was processed. Never mind that the record set can be interogated to find out how big it is. Never mind that even if that was not possible, you could have processed the record set, perform a MoveFirst and then start again without having to destroy the recordset and recreate it.

I think I’ve just found the piece de resistance - storing information in session variables just for the sake of it. A Page that I am currently reworking sections of has the following brilliant piece of coding

Session(”CustomMessageSmall”) = “error about credit card payment failure”
response.write Session(”CustomMessageSmall”) & “<br />”

I could understand putting the message into a session variable if it was being used on another page somewhere, but it’s being used on the very next line. I mean seriuosly guys, lets not make the server do any more than it has too.

Comments (2)

HTTPLook, the enemy within

I’ve recently had a problem with my computer that was quite annoying. About 30 seconds after loging in I was getting a “Generic Host Process for Win32 Services has encountered a problem” error. I had 2 options, send the error message or not. Whichever option I chose the machine would immediately stop working. I couldn’t even shutdown. I had to hit the reset button.

After working out that by ignoring the message all together I could keep working, I set about trying to find out what was going on. A bit of judicious googling lead me to look into the Event log. I found a slightly more helpful error message there regarding the file hlcap.dll and turned back to google. A little more googling got me to this page on the DevX.com Forums which pointed at HTTPLook as the culprit.

The problem that was described was not entirely the same, but the symptoms were very close. The suggested solution was uninstalling HTTPLook. I had only used it briefly while trying to debug a utility tool that I was writing and had not used it in months. I thought it was rather strange that it had suddenly started causing an error but I removed it and rebooted.

Thankfully removing HTTPLook fixed the problem and returned my computer to a fully functioning state.

Comments (4)

Action stations!

An interesting article about the Six Dumbest Ideas in Computer Security turned up on Slashdot this morning and it was an interesting read.

I had to laugh when I got to point #6 Action is Better Than Inaction. It so accurately describes the upper management where I work. In the case of us programmers, if management dont see us with our heads over the keyboard furiously tapping away they think we are not working.

I don’t know how common this is, but it is something that really frustrates me about my workplace. I work with some very smart people and we often spend a lot of time discussing things before just jumping in and tapping out some code. Unfortunatley it is difficult to impress upon management that this is us working and not just bludging.

Comments (2)

Next entries »