Recent Articles

Oct 2004

The Hotel (reservation system) From Hell, Continued

by in Feature Articles on

Today we'll get a second look at the H3000, the application from yesterday's post that actually made Jesus weep. The fiercely brave Nikolay Simeonov provides us with even more insight into this abomination.

You've seen what the forms look like, so here are the demonic instructions powering “z bel 64001.”


The Hotel (reservation system) From Hell

by in Feature Articles on

If you haven't yet gotten your fill of vampires, jack-o-lanterns, and haunted houses in this Halloween season, then you are in for a treat. Over the past few months, we've all seen some some rather ... unique ... ways of doing various things, programming and otherwise. But today is different. Today, we will see what only Nikolay Simeonov and a few other brave souls have seen. We will see the abomination whose mere thought would send many programmers into the accounting profession. Yes, today's post will contain a glimpse of the reservation system from the Styx (the river, not everyone's favorite 80's band) Motel itself ...

Appropriately, this is written in Access. But even the Dark Lord has his limits ... the Fox Pro versions exist only on the fifth level of Hell and lower.


#include "pascal.h"

by in Feature Articles on

Ludwig Von Anon sent in some code from the UI component of a large, multi-platform system he has the pleasure of working on. At first glance, the code didn't seem all too bad ...

procedure SelectFontIntoDC(Integer a) begin
 declare fonthandle fh;
 if (gRedraw is not false) then begin
   fh = CreateFontIndirect(gDC);
   SelectObject(gDC, fh);
   DeleteObject(fh);
 end;
end;


From the "It worked when I tested it" Department

by in Feature Articles on

Ade sends some code that he discovered as the culprit behind some searches taking, literally, forever to complete. Written by a senior developer at his company, I believe we can officially nominate this as the “Regular Expre-What?” Function of the Year. It's quite impressive to see nine potential endless loops in such a small function, although this still remains proof positive that (9*INFINITY) is still infinity.

private static string StripAllSearchCharacters(string Criteria)
{
 int iPos = -1;

 iPos = Criteria.IndexOf("*");      
 while (iPos != -1)
 {
  //ED: String.Remove() returns a string; it does not change the string itself
  Criteria.Remove(iPos, 1);
  iPos = Criteria.IndexOf("*");    
 }

 iPos = Criteria.IndexOf("<");      
 while (iPos != -1)
 {
   Criteria.Remove(iPos, 1);
  iPos = Criteria.IndexOf("<");    
 }

 iPos = Criteria.IndexOf(">");      
 while (iPos != -1)
 {
  Criteria.Remove(iPos, 1);
  iPos = Criteria.IndexOf(">");    
 }

 iPos = Criteria.IndexOf("!");      
 while (iPos != -1)
 {
  Criteria.Remove(iPos, 1);
  iPos = Criteria.IndexOf("!");    
 }


 iPos = Criteria.IndexOf("&");      
 while (iPos != -1)
 {
  Criteria.Remove(iPos, 1);
  iPos = Criteria.IndexOf("&");    
 }  

 iPos = Criteria.IndexOf("|");      
 while (iPos != -1)
 {
  Criteria.Remove(iPos, 1);
  iPos = Criteria.IndexOf("|");    
 }

 iPos = Criteria.IndexOf("?");      
 while (iPos != -1)
 {
  Criteria.Remove(iPos, 1);
  iPos = Criteria.IndexOf("?");    
 }

 iPos = Criteria.IndexOf("!=");      
 while (iPos != -1)
 {
  Criteria.Remove(iPos, 1);
  iPos = Criteria.IndexOf("!=");    
 }

 iPos = Criteria.IndexOf("=");      
 while (iPos != -1)
 {
  Criteria.Remove(iPos, 1);
  iPos = Criteria.IndexOf("=");    
 }

 return Criteria;
}

Round() we go again

by in Feature Articles on

I didn't think it was possible. I honestly believed that there is no possible way that anyone could come up with a worse way to round numbers than that roundoff function. But leave it to Greg Fulton to stumble upon this method that makes the aforementioned post look like pure genius. Poor, poor Greg.


RealXML ... really!

by in Feature Articles on

If somebody asked me to identify this document, I'd probably say that it's a poor excuse for an XML-defined structure representing some sort of case/order. That is ... if I didn't see the root element. Have a look for yourself! It may be deceiving, but this is real XML. Not fake, pretend, bogus, simulated, imitation, or disingenuous. Root elements don't lie!


It's not how big it is ...

by in Feature Articles on

... it's the context in which you use it. And depending on how you use this C constant that Henrik A stumbled across, it can get pretty interesting ...

#define MAX_PID  2^sizeof(SpaceId)-1 //SpaceId is typedef int, sizeof(int) is 4


I'll use my own, thank you very much

by in Feature Articles on

I couldn't think of anything to add to this story from Mohammad Abdulfatah, so here goes ...

I was tasked with writing a report against the backend database of a widely-used and highly-respected library automation system. I needed to display a field aptly named “creation_date”. I initially assumed that the field in question would be of type “datetime”, but I was wrong. It was of an integer type, and a nullable one at that.


The spec? Plus more comments!

by in Feature Articles on

It's a two-for-one day today. Well, more like two-half-posts-hoping-to-make-up-for-one, but you get the idea. First, Nikola Tepper shares with us what happened when he finally was able to figure out what the spec was:

Me: I think I understand, you want me to display this comment everytime this value is negative?


A Preemptive Defense

by in Feature Articles on

There are those who embrace criticism, believing it will help them become a better at whatever they are trying to do. Then there are those who shy away from criticism, feeling that it is a personal attack. And then there are people like cybreid's colleague, who are so confident in what they do and embed their work with justification of every action. I wonder what the footnotes on this fella's Composition essays looked like ...


MULTI/SQL

by in Feature Articles on

Dave Brookes sent me some T-SQL from a system he inherited. It got me thinking ... why didn't I think of this before? Thinking back, all of the systems I developed have had lots and lots of subroutines and functions, each one doing it's own discrete task. What a mess! Looks like Dave's colleague is way ahead of me ... 


Unglobalization

by in Feature Articles on

Don't ya'll hate when ya get all them funny French-lookin' letters muckin' up the datas on yer Internets? Well now ya'll can thank Jean-Philippe Daigle for inventin' this handy dandy function here. Yeeeeeeeee Haw!


Random Randomization

by in Feature Articles on

Thanks to Darren Sargent, we have what appears to be the first PL/SQL post. And that comes as quite a shock to me, considering all of the absurdly stupid things you can do with Oracle.

Q: How do you generate an 8-digit random number in PL/SQL?


HowBigIsMyCallStackSort()

by in Feature Articles on

Those of us lucky enough to have to develop our own sorting functions, either academically or professionally, have probably at least though about the efficiency the various algorithms. In fact, there's a whole science to this. But how many of us have taken a Bubble Sort (the least efficient of inefficient O(n2) sorts), brought it down a notch, like Andrew Reid colleague, and made it recursive?


$_PHP["admin"]

by in Feature Articles on

In yesterday's post, someone wondered why I keep picking on PHP's Variable Variables. Well, to be brief, it's a maintenance nightmare and is akin to taking a shortcut through the minefield: you're pretty certain where all the mines are, but anyone following your path can get into a lot of trouble. I wonder if the defenders of this are the descendants of folks who complained about removing COBOL's ALTER verb. But I digress, here's yet another reason why empowering developers with things like variable variables is as safe as letting kids play with scalpels:


IHBLRIA

by in Feature Articles on

I'm pretty sure we've all heard of NIH ("Not Invented Here") before. But I'll be willing to bet that you haven't heard of IHBLRIA ("Invented Here, But Let's Reinvent It Anyway"). And it you have, that's quite impressive; I just made it up right now.

Today's post is a perfect example of IHBLRIA. From the creators of the Replace() function, here is the solution for Knowledge Base Article 190742, as discovered by Kris:


Error Nonhandling

by in Feature Articles on

After accidentally breaking a glass in your kitchen, have you ever frozen up completely, unable to do anything but think “oh crap. uhhh ... uhh ... crap ...“? Well, me neither. I usually shrug my shoulders, grab the broom, and clean up the mess. Apparently, that's not how Craig's predecessor deals with errors ...


When (n<0) won't do.

by in Feature Articles on

This isn't the first time we've seen programmers having a difficult time gasping the intricacies of negative numbers. Heck, I'm sure we all had a little difficulty understanding at first, in the fifth grade. But you'd really think that someone able to program (am I giving too much credit here?), would have a little more sophistication than to distinguish positive and negative numbers with the “little line thing“ in prefixing the number.


Thankfully, there's only twelve months

by in Feature Articles on

Andy came across some rather inefficient logic from an earnings calculator he inherited. I'll spare you function where they test the DayUnderContract ...


And I think I'll call it .... "Referential Integrity" !

by in Feature Articles on

One thing I absolutely hate about working with databases is when you have to use more than one table. Don't get me wrong, I'm usually able to shove all of my data in one table, but some times you just have no choice. Thanks to Jason Strate, I'm going to be prepared next time I use multiple tables. His colleague was able to figure out a way to ensure that no one goes adding rows willy-nilly. It's sheer brilliance!


$_PHP["encryption"]

by in Feature Articles on

So what do you do when you need to pass secure data to another system over the web? Web services? Secure-Socket-Layer POST? Well, if you're using PHP, you don't need to worry about any of that fancy stuff. You can use this handy encryption method (as one nameless PHP-driven application does) to send your important data to your vendor or client ...


White Screen of Death!

by in Feature Articles on

We haven't had a tech support story in quite a while now, and that's too bad if you ask me. I think many of us programmers enjoyed beginnings as young technicians, eagerly waiting to get enough education or experience (or at least graduate highschool) to land that programming job. SethNess shares an entertaining story that reminds me of these days ...

About 10 years ago, I was working as the only IT-proficient person in a big office, with 35 networked PCs and a custom UI.


When once just isn't enough ...

by in Feature Articles on

... then call a function from an external library that does exactly the same thing. That's what Mark Pitman's colleague does. If you think about it, doing this wille ensure that your GUID is doubly-random. And if you're really lucky, it'll be randomly-random. Even better!