Can This Be Correct?

>A story on microsoft-watch.com says that Microsoft is expected to announce that the upcoming (when?) release of Microsoft’s new OS, Longhorn, will require the following hardware:

Microsoft is expected to recommend that the “average” Longhorn PC feature a dual-core CPU running at 4 to 6GHz; a minimum of 2 gigs of RAM; up to a terabyte of storage; a 1 Gbit, built-in, Ethernet-wired port and an 802.11g wireless link; and a graphics processor that runs three times faster than those on the market today.

Longhorn to Steal Limelight at WinHEC, by Mary Jo Foley

Wow. I’d love to have that type of hardware, but…huh?

Dual-core CPU? Minimum of 2G RAM? And so on…

Yozzers… imagine what a Linux server could do with those specs…zoom zoom…

Break All the Windows

For reasons that escape me, timed processes on my Windows box(es) just stop for no good reason. I’ve mentioned this before; the latest casualty was mySQL replication (Linux box => Windoze box).

I’ve been using the Windows box mySQL server just for backups, and to get my hand in how to run mySQL on Windows. Useful skill; one of the big pluses of mySQL is that there are native Windows binaries for it.

OK. And replication – which ran fine for over a month – just crapped out.

I couldn’t figure it out. Still can’t.

So I did what every Windows user does: Re-install the damn code.

Actually, I didn’t have the binaries for mySQL, so I got the latest v3 binaries (3.23.58) from a mirror. (I’m running v3.23 on Linux, so just trying to keep conflicts down.)

Installed, did all the set-up – which, since I just did it recently, was a breeze.

But the damn Windows mySQL server kept crashing every time I turned on replication.

After hours of poking and prodding, a Google (thank god for Google and their ilk) search gave me the knowledge that I needed: v3.23.58 on Windoze has, um, replication issues.

There’s a work around – don’t start as service, make it a stand-alone, set account with privileges for this yada yada yada.

That’s bullshit. That’s a huge bug (and I don’t really know if it’s a mySQL or Windows issue).

So I downloaded a v4 binary, installed, turned on replication and … damn! It works.

Sweet.

And aggravating – once I knew of this replication issue, the entire process – from downloading the 12M (or so) binary file, installing, setting up permissions, cutting data over etc – took about 15 minutes.

I spent hours trying to get something that couldn’t work to work.

Who do I bill those hours to???

mySQL/Perl Gripes

Last entry I whined about Perl’s appalling lack of a trim() function.

I forgot to add another Perl pet peeve: No comment blocks.

With most languages, you can place a “/*” before a code block and “*/” after the code block and have all lines – one to (no limit) commented out. (Note: Hopefully, it’s understood that the code comment open/close characters are sans quotation marks…).

Perl, in its infinite wisdom, does not allow this.

Each line must be commented with a pound sign: #

Example:


=======

PHP

=======

/*

// all five lines here are commented out

$myVar = ” Foo Bar “;

$myVar = trim($myVar); // now “Foo Bar”; full trim

$myVar = ltrim($myVar); // now “Foo Bar “; left trim

$myVar = rtrim($myVar); // now ” Foo Bar”; right trim

*/

======

Perl

======

# Note how I have to prepend EACH line with the pound sign,

# even multiple lines of comments, such as these two….

# $myVar = ” Foo Bar “;

# $myVar =~ s/^\s+|\s+$/; # returns “Foo Bar”

OK, no big dealie for these examples, but let’s take a real-world Perl example I was just working on.

I was doing a dataload, and – before I actually fired the SQL – I had several blocks of processing code and was printing out this or that line so I could see all was well.

Once we get to that point, then fire SQL.

I got to that point, but something barfed on the DB side. So I wanted to back out this or that block of processing code and print some additional debug statements.

But – to cut out any code block – I had to either:

  • Remove the code from the file (and paste it elsewhere so it’s not lost)
  • Put a pound sign before each line in the code block – up to 50 lines

Again – with most coding languages, you just wrap the code block in the “begin/end comment” characters. Done.

Ick. I think (not certain…) that Perl 6 is supposed to support multi-line comment tags, but … too late. Lots of pre-v6 code out there that doesn’t have this support. Lots.

MySQL Rant

While I’ve gotten over my initial reaction to mySQL (“It’s not a real database! Hell, Access has better ANSI support!”) and have grown quite fond of this DB, it still keeps biting me in the ass.

Note: I’m currently running v3.23x, simply because that’s what’s supported out on shared hosting sites (that I have to work with). Version 4 fixes – to a degree – the problem I’m going to bitch about right now.

I have square marks on my forehead from banging my head on the keyboard trying to make the following work in mySQL


UPDATE

table_1 (column_name)

SET

table_1.column_name = table_2.another_column_name

WHERE

table_l.id = table_2.id

Trivial, ja?

Nope.

Can’t do multi-table updates in pre v4.0.4 mySQL.

Ouch.

So, I had to write a script that pulled data from second table, stored (array) and then updated the first table.

Yes, this is solved now – in the v4 types, but subselects still are not (v4.1 will address this; won’t be a stable release until about November 2004).

In other words: MySQL is making great strides, but v3.23 – the current standard for most sites today – “offers” significant limitations.

But mySQL is moving in a good direction. Good. Because it does have some nice features.

Please just give me what I expect from any database!

End rants.

Perl Gripes

WATCHING:
Big Fish
Tim Burton

It took me awhile to warm to this movie, but I ended up enjoying it.

Not a great movie, not one I’ll watch again for some time, but with a sweet, funny and thoughtful story line. And great imagination.

Actually, this is a movie that works better as a preview – its got some great, three-second-long shots that would translate well to previews/commercials and so on.

All movies

There’s a lot of iffy areas that Perl catches flack for – loosely typed variables, overuse of hashes, the utter incomprehensibility of some excellent code (such as a great regex to extract data – looks like a punctuation-fest).

However, my biggest gripe – and maybe I’m missing something – is the lack of a built in trim() function.

Why not??

While I understand that you can use a regex like I have above, a trim function is something, to me, that should be part of every language.

Especially in these days of XML and Web-based apps, the spaces can matter.

So you want to trim stuff before it goes into the database.

Ditto when it comes out.

But that’s me.


=======

PHP

=======

$myVar = ” Foo Bar “;

$myVar = trim($myVar); // now “Foo Bar”; full trim

$myVar = ltrim($myVar); // now “Foo Bar “; left trim

$myVar = rtrim($myVar); // now ” Foo Bar”; right trim

=======

T-SQL (MS SQL Server)

=======

— No full trim (makes me nuts, also!);

— nest left and right trims

select ltrim(rtrim(‘ Foo Bar ‘)) as myVar;

— will return “Foo Bar” for myVar

======

Perl

======

$myVar = ” Foo Bar “;

$myVar =~ s/^\s+|\s+$/; # returns “Foo Bar”

There is an int() function in Perl – that returns a string as an integer. You could write a simple regex for this, as well, but there is the more useful – and expected – int function (parseInt() in JavaScript, I believe – in database languages you often have to CAST the string).

So why not a freakin’ trim function?!?

I still like Perl in spite of it.