GIGO, How to debug and fix code the hard way

THAT SON OF A BISCUIT BAKING PIECE OF HOG CRAP OF A MODULE !!!!!

I’ve finally found the problem that, i spent 3 hours trying to prove was broken. Only to find out, the ‘contract’ behavior it expected from it’s environment at fault. And the rest of the module, is such a hopeless pile of shit, that I didn’t realize it, until I found the simple fact.

Garbage In, Garbage Out, but no Error message.

I never checked the data stream output, because the interface test failed. But it actually did do exactly what it was supposed to do, just with garbage values, which through off the rest of the code… That ignores errors rather then handling them.

If I h ave got to kick the bitch in the teeth twice a day to do it, this website will furfil the [SAS]’s needs.Or it will get ripped apart bit by bit and rebuilt as something that will serve them well!

Song of the day: 2008-09-08 / Highwayman



[Willie Nelson]
I was a highwayman. Along the coach roads I did ride.
With sword and pistol by my side.
Many a young maid lost her baubles to my trade.
Many a soldier shed his lifeblood on my blade.
The bastards hung me in the spring of twenty-five.
But I am still alive.

[Kris Kristofferson]
I was a sailor. I was born upon the tide.
And with the sea I did abide.
I sailed a schooner round the Horn to Mexico.
I went aloft and furled the mainsail in a blow.
And when the yards broke off they said that I got killed.
But I am living still.

[Waylon Jennings]
I was a dam builder across the river deep and wide.
Where steel and water did collide.
A place called Boulder on the wild Colorado.
I slipped and fell into the wet concrete below.
They buried me in that great tomb that knows no sound.
But I am still around.

[in unison]
I’ll always be around, and around, and around, and around, and around.

[Johnny Cash]
I fly a starship across the Universe divide.
And when I reach the other side,
I’ll find a place to rest my spirit if I can.
Perhaps I may become a highwayman again.
Or I may simply be a single drop of rain.
But I will remain.
And I’ll be back

[in unison]
again, and again, and again, and again, and again.

— title: Highwayman; written by: Jimmy Webb; performed by: Willie Nelson, Waylon Jennings, Johnny Cash & Kris Kristofferson, “The Highwaymen”

And this appears to be the old music video, mmmm:


Of languages, libraries, and tools

I have been contemplating my standard language/library issue with care, although I’ve yet to finish most of the tests…. Courtesy of work, laziness, and to much work on the website lol.

So far, it seems to me that language wise my best thoughts:

Python, I don’t really ‘like’ python but I can do a tremendous amount of work in it compared to other languages, time wise. And it’s fairly easy to implement and test stuff — worst thing I can say about it is it’s interpreted and the regular expression support is done via a standard library module. Although jython (compile to byte code, but compares to a smaller version of an old CPython release) and ironpython (python for .net clr) should help the former, and the api for regex ain’t that bad, but sucks compared to Perl lol (like most languages seem to, that don’t steal Perls syntax or likewise make it a core element of the language syntax). Python also can handle interfacing with other languages well enough between the CPython, Jython, and IronPyhon implementations.

Java, great syntax and fairly logical. The byte code is portable enough between Sun JVMs and it even has the portable Swing GUI toolkit, although I’d probably end up using SWT or the WxWidgets bindings. The bad things about Java, although you can compile to native machine code, ya need to get the GNU Compiler for Java (GCJ) working first. Regular expressions are done via it’s libraries rather then syntax, and. Well the only _nice_ way of saying it, most of the tools with the JDK eventually piss me off, but I like the language aside from that. The only major con is it is as OOP-centric as I’ve ever seen, and it’s that way by design.

C++, lower level then any of the others and offering the best level of interface to C code of any of them around ;-). I personally prefer Java’s syntax over that of C++ but it still gets the job done. It’s just a question of how often you want to press Shift while typing… One of the best things, the STL is quite nice and well enough supported now to be worth using. Although, in my experience when working around C interfaces, the STLs value can go out the window, but maybe that’s just how long I went before using the STL. One plus, unlike Java or Python, you get a more traditional pointer, not to mention a few interesting things in the std::namespace and boost libraries. Not sure what shape exceptions support is like under various system compilers, but I don’t think that I’ve ever seen C++ code using exceptions outside of examples or perhaps the FAQ :.

Useful points of interest:

WxWidgets for the GUI — portable to target platforms of most interest and in all three of the above languages (and a few more too).

libxml2 for XML — portable to target platforms, but seems to only have C++ and Pyhon bindings easily available, libxmlj (for java) I think would need compiling and I haven’t tried that under FreeBSD or Windows yet.

Semi-Native Regular Expressions — Boost libraries for C++, Pythons own regular expression module, and ditto for Java (not that I like them).

std::string, str, and String classes — basic string handling in C++, Python, and Java. Boost and WxWidges also provides wxString.

MySQL bindings — database operations; quickly available for C++, Python, and Java (JDBC based). Using SQLite in C++/Python is also easy enough but I’m a bit leerly of Java-related connections for SQLite3.

As to the other stuff that was on my list:

C++ and Python provide suitable IPC systems, never have looked at Java in that light. Most of the stuff I need, is basically provided by the C libraries under POSIX systems and Windos, Python has a suitable interface to it, so I’m happy hehe.

Python has good enough built in support for common compression and archive formats. Whatever can’t be done via java.util.zip hopefully could be done via JZlib, I’m not familiar with anyhing ZLib under C++, but there is always the traditional interface ^_^.

I haven’t considered the network side that much. Although I sometimes find it a bit lengthly, I don’t really mind working with the C-style sockets library I’ve used here, using the windows sockets library shouldn’t be to far off from the ones used on *BSD and GNU for my needs (aside from headers/linking). Python has support for a number of protocols (and pwns Ruby on documenting the classes for most protocols IMHO), Java well enough out of the box, and both Python and Java provide usable interface to TCP/UDP. WxWidgets also has a few things as well but more limited, that might be worth looking at, since I’d rather like to use a similar interface in each language, while still leaving code that can be read.

As to the ease of use and deployment, that is always a tough question. Under FreeBSD and Debian at least, they are all ‘easy enough’. Windows of course, always has to be the pain in the ass. But for total portability this is an AoR where Python excels. When it comes to deploying stuff, it gets tricker. Windows lacks a package manager and you eventually have to draw a line between what you’re stuck bundling and what your stuck making a dependency. One of these days I need to look at py2exe and see how it would work out for what I’ve a mind to setup.

Big pluses:

Qt4 for C++ and (generally) Python is great and works on all my systems, QtJambi I’ve never tried on FreeBSD yet, but would be interesting if it works. The only thing I hate about Qt, the commercial license costs an arm and a leg :-(, but most of my needs fit within the (free) Open Source Editions license terms with a smile.

WxWidgets seems to be less painful then GTK+ under Windows while still supporting many languages, although GTK+ would probably be more fun to learn in my case. It also has nifty things, including string/regex classes.

MySQL and SQLite are generally portable and have bindings to other languages quick & easy enough. I’ve never used SQLite on a project, since I run MySQL on one of my own systems to service all my SQL-related needs πŸ˜‰

When it is all said and done, I really think Pyhon is the best choice… I dunno why or how, but it seems that way! Hmm, to re-dive into using Python for most tasks, or to get C++ crazy… Or live with using both side by side? For my own sake, I think I should sake fuck Java! But it is a great language in it’s own right.

Oh well, maybe in a few months I’ll have figured out which path to take. I can always make use of other languages and tools, but I very much need to find a “primary” set to work with!

think:
switch(choice) {
case PYTHON_ONLY:
// Python becomes my primary language
break;
case CPP_ONLY:
// C++ becomes my primary language
break;
case PYTHON_AND_CPP:
// use both side by side
break;
default:
goto think;
}

My laugh of the day, 2008-09-08

β€œTo bring a MicroVAX to its knees, try twenty users running vi β€” or four running EMACS.”

I just couldn’t help but smile, nod, and laugh lol. Vi is a fairly light weight program in todays world, and was designed in a time when just moving your text editors cursor was probably slow as watching paint drying. Emacs on the other hand, tends to be rather hefty in most good implementations, I think it was once a cottage indrusty to make light-weight emacsen.

And to this day in the form of GNU and X Emacs is, one small operating system, but a huge text editor compared to the nimble Vi. I don’t go much in for the Vi Vs. Emacs stuff and vice versa, because I use the Vim which is the only thing better then Vi πŸ˜‰

The days woes

I think if I have to look upon another line of code on the website tonight, I’ll go mental! Maybe it’s lucky for me, that tomorrow is such of a hell of a long job, that I’ve got to go to bed early to survive it lol.

Even a spider needs sleep eventually

The best way to describe old code on the site, is a scripting language with many globals, almost no regard for scope, rarely any indentation, extremely long lines, and compounded with (often shitty)HTML embedded in multiple layers, and designed in such a way. That if you so much as add a comment somewhere you’ll probably break something lol*. It’s an exaggeration of course, but it is essentially _that_ bad to work with. Much worse when you consider that system upgrades can often make subtle changes that only an asshole would’ve assumed never would change. I’m tired of having to think up band aids around shit that shouldn’t have been written in the first place. I’m no brilliant programmer, but for the love of HAL, at least try to do a decent job!

[SAS] has had one very negative impact on my life, I can’t stand assholes that do things half-assed, whether it’s running around like a headless chicken, or making toxic waste look pretty.

In a lot of ways, I wish I could just rip the website part… Build it anew, as Operation Excalibur was meant to experiment with locally. But people would likely not like that idea, because all they get to see is the ‘outside’ of the site, not the innards. *SIGH*, I don’t like rewriting stuff from scratch, but I don’t like being forced into bubble-gum solutions with bubble gum on the bubble gum either. I know Wiz isn’t a code monkey, tbh he would have a good excuse to write putrid code, but the sad thing? The jackasses who wrote the code we’re working on, were supposed to be an educated man. I really hope, if that person ever gets a job that involves computers and programming or webwork, they stick a cattle prod up their ass at the sight of the work being done. At least Wiz makes an effort, that’s more then I can say of the person that hashed out most of the websites less-nice modules.

I still need to fix one module used in the selection course, and after having spent more then 3 hours reading, thinking, and testing. I still can’t find the reason why it stopped working lol. The S.O.B. in question doesn’t even have anything to do with our recent changes, but no… It’s gotta be a prick and break, without reason, without word. To be honest, I never knew how much I would miss exception handling before I had to live without it, even if I never really used exceptions in most of my code lol.

Tis the nature of my sort, I think, to be pissed off and frustrated with such crocks. Including the kind that I wouldn’t even wish on a machine let along a programmer. One thing I do know, it’ll have to wait until at least Wednesday to get fixed, because I’m going to be working like a dog tomorrow and Tuesday. Oh man, what I would do if I had a week or two of nothing else to do but wage code-warfare upon building a more robust website.

* For those that don’t know, a comment is a section of code that is totally ignored when running it, e.g. int foo = /* comment */ 1; is treated as if /* comment */ was never there.

Applying CSS to this theme

Well, hopefully it is an improvement. I’ve tried to take the default font sizes in px, and tune them in using pt’s, I also enlarged a few things. All of which are improvements, except for the entry text with I enlarged a bit higher then I wanted, in the hopes that a change from 1280×800 on a 15.4″ widescreen running FreeBSD + X.Org to a 1600×1200 on a 19″ conventional running Windows XP at 144dpi over normal, will hopefully still be legible in Google Chrome >_>.

Ok, so I’m getty cooky, but I like that little web browser loool. If the font size isn’t to hard to read on my desktop, I’ll probably lower it to ~11pt or so. I know, courtesy of the Windows / Mac OS / X11 differences, that working in points isn’t very good, but I prefer it, and it’s my LJ to post on after all. I think though, it’s a bit nicer then using pixels all over.

At the time of this LJ post, my theme is ‘Under Fire Smooth Sailing by Michael Raffoul’, being allowed to add some of my own Cascading Style Sheets (CSS) code in the customize theme menu, I’ve effected these changes with the following:

/* the header title, basically my user name */
div.header-title {
font-size: 23pt;
}

/* the sub title, what reads 'captains log' at this time of writing */
div.header-subtitle {
font-size: 18pt;
}

/* the nav menu above the header */
div.header-menu {
font-size: 9pt;
}

/* the thing that currently says 'recent entries' above the first entry */
div.body-title {
font-size: 14pt;
}

/* all of the sidebox titles use this class */
div.sideboxTitle {
font-size: 9pt;
}

/* posts summery list links and calendar numerals */
div.summeryList a, div.latestmonth-inactive, div.latestmonth-active {
font-size: 7.5pt;
}

/* my links list on the side bar,
*
* XXX I wanted this a little larger
*/
div.sideboxContent#systemlinks > div.listitem a {
font-size: 9pt;
}

/* entry header, e.g. date/time - subject */
div.entryHeader {
font-size: 11pt; /* XXX slightly larger */
}

/* the text of the actual entry -- larger text !*/
div.entryText, div.entryText a {
font-size: 12pt;
}

div.entryLinkbar ul > li > a {
font-size: 10pt;
}

Ahh, I love CSS at times.

Microsoft Kicthen — I’ve never been so scared of the future

Food Networks programming for tonight was examining the kitchen of tomorrow concept, from a time when blenders, ice makers, and dish washers were new gizmo’s… all the way to work in the present day. Ranging from some ideas that folks at MIT are ‘cooking up’, all the way down to a spoon that can taste :

But the one that really got me, was the Microsoft Kitchen. A quick look at the lock, and the person was let in — always wanted one of those retinal scanners, just like on TV! (or as my Mom put it, just like in Back To The Future II). A cook top that displays cooking advice… Recipes, even a flibbing stencil to help you cook, and a voice to give you instructions.

If you don’t know how to cook and the computer tells you to chop your fingers off, will you do it?

There was a Networked Microwave, you just scan a can of soup, and it fetches the instructions off the internet and warms it up for you. Oh, for crying out loud… Why the heck would I want a network attached Microwave? Unless I could program it in Java ? I can just imagine it, go scan a can of soup, some prankster has broken into your microwave, and it fetches instructions that makes it blow up in your face >_>

In the memory of Dr. Ian Malcom, These people must be so preoccupied with whether or they they could, that they don’t stop tot think if they _should_.

It also showed that every thing in the cabinets had a little radio tag that a computer tracked, letting you know how much Chili you had and stuff, great idea! Although I reckon any one with sufficient DIY skills could cook that up during a spell of unemployment lol. I wonder if the system is encrypted, or you neighborers can know how many bags of cookies you gnosh on before going to Weight Watchers haha. Another thing that Microsofts Kitchen had, was a computer telling you advice, put an appliance on the counter top, and it started giving you ideas to go with it.

Well hell, they can’t even create a decent search engine, so I can only hope it uses some kind of most recently used algorithm.

Not to mention a computer to provide medical advice on how much and what to take. Oy vey, I can just see that one going sour…. I dunno what is worse, having Clippy in your medicine cabinet or the probability that it will either Blue Screen of Death or suffer from a (lethal to stupid you) malware infection when someone asks a question +S

I know, having used Microsoft software for almost my entire computing life… The idea of just Microsoft reaching a cars multimedia system was scary, but this kitchen of the future, is just fucking

__S_C_A_R_Y__

.

Ya know, I generally consider myself borderline on technophilia at times… But in all honesty. I think if you just ditched the stupid sales jingles and stuff, I would much rather have the far from digital “kitchen of tomorrow” from the 1950s, or better yet fast forward to the Jetsons, with a automated food preparation system and a robot maid lol.

But then again, if the ultimate invention ever occurred inmy life time, I’d probably worry about the dang thing trying to poison me for a few decades before they became common place enough to trust <_<. But by then, they would probably be network attached without any security devices lmao. Why do I feel old? Probably because I still have need of the ol’microwave more then Microsofts networked one hehe.

Font sizes

Now this is pissing me off…. Almost every website I use, seems to set the font size in Pixels.

sasclan.org — 10px (for crying out loud)
pcbsd.org — 12px
daemonforums.org — 13px
sas-spidey01.livejournal.com — The Under Fire theme I’m used has a selectable but sets it in ‘px’ πŸ™

At least though, It’s not a total wash out. Live Journal itself does decent by fonts in it’s main theme. Wikipedia respects the browser, and my LJ’s theme is very configurable hehe. I think, if I ever had tons of cash to spare, a paid account + working on themes here would be a fun time killer lol.

I managed to fix it fairly quick, wlel have way. I fixed it for [SAS] but broke it for non [SAS] lol. I’ve still got to wrap my head around that bowl of soup before I can be sure it’ll work right along side the new code.

I would’ve had it done much faster, if it wasn’t for the stupidest of typo’s… I really wish the difference between

$foobar = some value;
if ($foo_bar) {
... do something;
}

Was an error (or at least a warning) about an undefined variable on our setup, rather then creating a new one called $foo_bar. Maybe, I’ve just been using statically typed languages to much lately :.

More work to do today, but I did managed to install SWAT 4 and TSS without problem. It’s very good to return to the Proving Grounds, but I still miss some of the old gang… Alas, that’s the way things are and there still is work that remains to be done in the department.

Oy what a week…

I can’t wait for next weekend!!! By then, I’ll be off work.. bu at least, this weekend I’ m only working lightly.

Tonights primary objective is to work on the website, for me at least. It is a very tiring subject, I like the languages involved of course, but I’d rather be hit by a truck then write code like what we’ve inherited lol.

I’m no brilliant programmer, but hell, at least I try to write robust code. Not stuff that’ll make the next poor sap to maintain it, want to fly over and kick ya ass. Hmm, oh man, what I would do if I could >_>