This one is just to much

Ok, now this one has me putting my hands up an shoutin’ “this one’s to much!”

I’m working on rewriting an old pile of sludge that hurts my eyes, properly porting it to the new interface that works better… So far, so good, except for the fact that the actual bi-language mingle used for both logic and display, is about as undocumented and about as helpful, as a bullet in the toe.

All was going well in trying to understand it, until I saw this kind of thing:

/* NB: I probably added most of this indentation myself */
$query4 = *_query("look up a user", $dbh);
$name=*_fetch_array($query4, $dbh);
echo "<font color='#6699ff'><b".$name['the users name']."</b></font><BR><BR>";
echo "<table border='1' cellspacing='0' cellpadding='3'><tr border='0'><td align='left' border='0'><font color='#6699ff'><b>some header</b></font>";

$query = *_query("look up first section from database", $dbh);
if ($query) {
$nr = *_num_rows($query, $dbh);
for ($k=0;$k<$nr;$k++) {
$topic = *_fetch_array($query, $dbh);
echo "&nbsp;".$topic['the topics name']."&nbsp;";
// ... do other crap

Where ‘the topics name’ is looking up a row in the database, which contains a non breaing space: &nbsp; ALL THAT FOR WRITING A FREAKING BLANK SPACE !? I have no idea if that was a quick and dirty way of cutting an item out of the list or what (before I took over), but for crying out loud… If I ever did something so moronic, I would shoot myself before leaving it for someone to find.

THANK GOD THAT I DID NOT CREATE THIS MODULE …. Even if I’m the sap whose got to keep it running like a swiss clock :

Todo: Toolkit and Library madness

Examine for portability the following toolkits under these OSes: Windows NT, Mac OSX*, Unix-like.

*I sadly don’t have a Mac, although I would really love one. So a OSX binary of some form will have to pass.

GTK+ — C, C++, Perl, Python, Ruby, PHP, C#.NET (Java bindings also avail but seem to be gnome-centric)

Qt4 — C++, Perl, Python, Ruby, Java (C#.NET and PHP bindings seem to be questionable and only C++/Python and possibly Java bindings can be depended on).

WxWidgets — C++, Perl, Python, Ruby, Java, C#.NET

Swing and SWT would be considered if they were available under more languages !!!

Evaluate portable standard/add-on libraries to each language for the following capabilities:

String handling (they all do well in the language standard)
Regular Expressions (Only Perl and Ruby get this great imho)
XML Processing
Network programming — both sockets based API and protocol support (IMAP, POP, HTTP/S, FTP)
Database handling — must support MySQL, SQLite, and some form of flat file.
Basic compression and archive format support (e.g. tar; zip; gz; bz2; lzma)
Inter-Process Communication (IPC) methods and related process control (e.g. fork(), exec(), signal(), kill() type routine-families).
Ease of use and deployment

Goals:

Build up a standard frame work of toolkits/libraries/etc that are portable across both my general operating environment and the various languages I use

Attempt to standardize myself on few languages rather then rubber banding between various programming languages + sh/awk/sed/friends

Ensure full development environments are available to me under FreeBSD 7 and Windows NT 5.1 (e.g. I can code from either machine and not change tools)

At least one language for scripting/prototyping and one for more efficient execution when implemented in that language (e.g. 1 interpreted + 1 compiled)

and try to stay sane along the way without writing a few libraries in the process >_>

Something that has been on my mind of late

DRAFT POST

I very much need to start standardizing myself on a smaller set of tools. Maybe tools is not the best choice of ord, o much as it is a question of languages and libraries. It’s actually kind of ironic, I really would like to learn several more languages (Ada, Fortran, C#, Erlang, and I never did wrap my head around Scheme).

C++

Pro’s:

can do low level stuff

can interface well with C code and libraries

Qt is natively C++ and supports everything I need it to run on (in Qt4 OSE hehe)

Fairly portable and standardized (at least much of the 1998 standard…) with several compilers available.

Mainly toolkits and frame works available, both native and from C.

Widely used and my first language

Con’s:

having to dig into lower level interfaces is very error prone when doing it with a headache the size of California.

Often not my first choice for building a prototype *quickly* but good for final implementation.

Java

Pro’s:

Inheritable portable between JVMs of the same implementation (e.g. Sun JVM for Win and Sun VM for Mac can run same code).

Simpler OOP syntax then C++, imho

The Swing GUI toolkit is fairly portable and SWT sufficiently supports the platforms I want to avoid skipping.

I like the way it handles exceptions, and usually like checked exceptions — when a class is designed appropriately.

It’s well defined if not perfectly standardized and compliant implementations are fairly common enough (Sun’s)

Wildly used and my third language.

Well documented (if a bit boring)

Con’s:

Everything is OOP….

I prefer native code to waiting on java to load

Requires a suitable runtime

Conventions expected by some tools can occasionally be irksome (to me)

C# (C Sharp)

Pro’s:

It’s not Java

It’s similar to Java/C++

Core elements are standardized

Less resistance to shooting oneself in the foot / doing stupid things then Java but not as much as C++.

Gtk#, the binding of GTK+ to C# is available on the platforms I care about.

Con’s:

Most C# applications are probably tied to Microsoft Windows implementation via .NET or through Gnome related interfaces

Requires a runtime (e.g. .NET, Mono, or Dot GNU)

Requires just enough learning of it’s differences from Java, for me to use it.

PHP5

Pro’s:

Portable and interpreted

Widely used across the WWW for server side scripting.

GTK+ bindings to PHP available and portable’ish

Simple language and member of the CBF.

The OOP increasingly resembles Java syntax and is just “enough” syntax to be useful without cramming.

Well documented

Con’s:

Local php.ini files can cause problems (how much can you assume?)

Needs a run time (php) of the right version (5)

php4/php5 is less common off web servers or developers systems

Python

Pro’s:

Great for writing prototypes

Several toolkits available that are fairly portable

Easy to work with and quit portable (and issues of portability well noted in the docs)

Large standard library

Implementations for the Java Virtual Machine and Microsoft .NET framework are available (if not as current as CPython) as well as the standard (C)Python implementation.

Con’s:

Requires a run time

I *hate* it’s handling of regular expressions after being so used to Perl…

It’s slower then native code

Interfacing with C /or C++ code can, uhh… Get interesting, from a portability perspective.

The program is the source

Ruby

Pro’s:

Handy pure OOP language

Great handling of regular expressions within the language itself, as opposed through importing an object oriented interface (i.e. as in Python/Java/C++)

Usually very “comfortable” to write.

Large standard library

Con’s:

It requires a run time and alternative compilers (e.g. xruby, ironpython) may be lacking in reliability or cause some features to be unavailable

The program is the source

Wishing Ruby 2 would come sooner….

Documentation can be irksome at times

It’s slower then native code and even slower then Python (Ruby 1.8.x)

Oy vey

Well now I’ve bloody well seen it all.

test script locally — works perfectly fine

test script on web server — dies with syntax error.

One that everyone who checks the script seems to agree along with the interpreters syntax checking as well, that the script is perfectly valid.

Well, at least I know the bloody thing _works_ when it works lol.

The scripts a major improvement over the existing one but far from important… Just one of those leave it better for the next generation kinda rewrites (y).