Random thoughts

In the course of my web-surfing about, I found this interesting post by Joel Spolsky.

“The Perils of JavaSchools”

I’ve never been formally educated on a computing thing in my life :. Having seen code by someone that was, whom I’d like to strangle… Some times I wonder if I should keep it that way >_>. I would still very much like to one day pursue a masters, an excuse to (hopefully) learn more then I can solo. But honestly, the odds of ever being free to do so are quite slim.

I still remember starting out in C++ for the first time, and having a problem handling the syntax for simple statements:

if (foo < bar)
do_bar();

if (bar < foo) {
do_foo();
do_bar();
}

At the time, it was actually the most complex thing I’d ever had to learn. After figuring out that the curly brace was only required if there was more then one line, the rest was easy as pie. Once the simple logic was sorted out, I never had a problem like that learning another language.

But, that’s why I’ve come to look on learning a language differently then learning to write programs. A language has a syntax, how do you express something in written form? Through the languages syntax. One of the things that I love about C, is that for better or worse. You can cram the entire language syntax into your head. It’s really that small and light, that leaves a lot more room for working on a problem and not feeling: “Oh, I didn’t know I could write it like that” later on.

Actually creating a workable program is a bit different, it’s not a question of how you may write it (e.g. if (expr) { do; } or if expr: do), but how do you write it? One of the big joys of programming for me, is to sit back and try to figure out how to solve the problem. That’s the fun thing (y).

Writer’s Block: Lunch Break

Do you bring or buy your lunch during the work week? How much money do you spend on food consumed during working hours?

Sponsored by Microsoft Small Business

Live Journals Writer’s Block

Used to bring lunch, but it was a waste of time lol.

Get up, get dressed, get ready, go to work, work straight through, come home and either eat lunch or wait for supper time, depending on the time of day.

I’m generally used to eating twice a day plus an occasional snack. My living habits have conditioned me against eating a breakfast, to the point that if I do, I won’t be hungry for lunch until hours later then normal. Some times when work is heavy, I skip eating until dinner, just to much bother: especially if work is early the next day, and eating dinner late wouldn’t be that much good. Then again, until recently I almost broke my inhale dinner, take nap routine :.

Lunch however, is generally my favorite meal of the day hehe.

Plan of Attack — tongiht through the weekend+monday

In no specific order:

0/ Train Ez, Spawn, possibly Ghost/Medic as well — operation marshal

1/ Write new interface for the ‘custom’ library on sas <---- implemented, remaining code is 'features', need to test it and place under revision control, along with other changes to the lib. 2/ Build mock-ups for GCHQ of the new docs

3/ Implement the install code for ‘that project’ I’m doing with a few guys from forums.pcbsd.org

4/ Test pythonic bindings to libxml2 (I may need this __soon__) <---- lxml interface to libxml2 accepted 5/ Evaluate gtkmm and py-gtk (I don’t think I like the wxWidgets api after spending so much time with Qt3/Qt4) — run tests under Winsucks, because linking against gtkmm and friends will be the big pain.

6/ look up the api docs for interfacing C/C++ code with Python 🙂

7/ eventually get around to placing my .vimrc, .exrc, .Terry_shrc, and various .site_shrc files under CVS (or other scm) on Vectra. <---- vimrc and Terry_shrc imported, other files being less portable, some name convention needs to be worked out. 9/ try to complete social studies homework before [SAS] SOP Prototype Due Date.

10/ eventually catch up with posting more on my LJ then todo snippets

11/ download Wiz’s latest mix and let’er blast <--- it rocks 12/ Implement my admin scripts 13/ Update cougars settings

14/ Implement my ‘lister’ PHP script <--- done, just need to write the password locker. You know, life would really be sweet…. If I could get paid to use my brain, instead of saving it all for my off-work hours lol. No if I new any companies in this burg that hire and train self-educating-geeks :

Japanese beaver or Blackwidow spider?

Well I’ve taken care of most of the stuff in need of doing, realising that I couldn’t take care of the paper work until I hear from Valroe, saved time lol.

Since I’ve been unable to find anything suitable, I’ll probably end up creating a new library of code for the website…. One that obey’s a policy of not shooting the next coder in the foot, like the bastard taking pot shots at me through years old code >_>. The sad thing? I thought about the ideal implementation for hours at work (my job leaves me with my brain free 90% of the time). Yet, between various business…. It is approx 15 hours later……. I’ve still not had the freedom to work on it!!!

Yet implementing it,a nd making code on the website would improve a heck of a lot. Especially debug times, and probably save me more time in the long run. Which reminds me, looking at the code I’m charged with maintaining/fixing:

Judging code by WTF/Min

But what do you do, if the WTF’s are rapid enough to be measured in seconds?

0/ fill out paper work
1/ complete assigned work form hq
2/ test code

rest, I can’t think, I’m to busy thinking about food >_>

Muttering about my task list

I managed to fix the issue quite easy, I still can’t believe it was that simple… I wonder though, if this is what will hit me in the next fix-it task to come up:. I’d also love to punch people that don’t check errorous return codes in the face!

I remember the 6th commandment of C Programmers,

If a function be advertised to return an error code in the event of difficulties, thou shalt check for that code, yea, even though the checks triple the size of thy code and produce aches in thy typing fingers, for if thou thinkest “it cannot happen to me”, the gods shall surely punish thee for thy arrogance.

Especially since I’m the one being punished for anothers dickheadedness!

I really wish PHP had exception handling, WAIT !!! (a quick google of the reference manual later), PHP 5 added them, YKYMF! I smell a few additions to my utility library… unless what I need has already been universally implemented by someone hehe.

And in likewise reflection upon The 10 Commandments of C Programmers:

Thou shalt check the array bounds of all strings (indeed, all arrays), for surely where thou typest “foo” someone someday shall type “supercalifragilisticexpialidocious”.

Some people just don’t know how true that is!

Thumbing through the annotated edition, I can’t help but chuckle at this… And hope such a thing befalls the bastard that did this to me lol.

verily there be many, many ancient systems in the world, and it is the decree of the dreaded god Murphy that thy next employment just might be on one. While thou sleepest, he plotteth against thee. Awake and take care.

Ok, so maybe I am a jerk sometimes ^_^

Anyway, I got a little bit of time before bed. I’ll use that to take care of a few odds and ends, and I’ll finish the other work I need to do tomorrow night.

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;
}