Database Days (Daze?)

Over the last couple of days, I’ve turned my Inner Geek into DBA geek in a manner of speaking.

As a Web developer, I’ve of course been messing with databases for years in different capacities, but over the last couple of days I concentrated on two database-related tasks in an effort to better myself/my Web skills.

And it’s fun!

The items:

  • Replication (in this case, with MySQL)
  • Perl DBI

Without any further ado…

Replication (in this case, with MySQL)

Yes, I have long understood the whole concept of replication. I’ve worked with replicated, clustered, fault-tolerant DBs for years.

It’s just that I never really had a hand in actually setting up/maintaining any DB other than a single, stand-alone instance until now.

Yesterday, in a (for the most part) completely painless process, I configured replication from the MySQL instance on my main Linux box (master) to a MySQL instance on my main Windows box (I use SQL Server for my Windows apps, for the most part).

I was inspired when I read – on his blog – that Jeremy Zawodny’s MySQL book has been released.

Zawondy is a MySQL guru who works for Yahoo!, and he has much knowledge about the subject (and a good sense of humor – he’s worth reading for non-tech matters, as well).

One chapter of the book was available on the O’Reilly site (the publishers), the chapter on replication. (Note: Link to download page; chapter is a PDF file.)

So I downloaded it and thought, what the hell, let’s set up replication here!

And – as mentioned above – it was rather trivial to set up. For all I bitch and moan about MySQL (legitimately, I think), it still has a lot going for it. And I use it more every day.

One thing JZ’s tutorial left out was the issue of how to set up replication with Windows – the examples were all Linux-centric (which is fine, as MySQL is primarily a *NIX product).

However, since I rarely use the Windows MySQL, I had to dig around to find things. Such as the base configuration file.

On Linux: /ect/my.cnf

On Windows: c:/winnt/my.ini (may differ with different installations; but the file is “my.ini”)

Once I found that file, I made the changes, restarted servers and … damn… it just worked.

I’m sure I did some things stupidly, but that’s part of the learning curve – when something breaks, you figure out why and that’s how you get better.

But – so far – nothing’s broken. Excellent.

Perl DBI

I’ve just never gotten around to messing with this (I bought a book about it over two years ago…), simply because I’ve primarily done Web programming, and the scripting languages – ASP, ColdFusion, JSP, PHP – have been more than adequate for most tasks.

Now that I’m working more on learning back-end tools – CRON, parsing, data loads, shell scripts and so on – it seemed to make sense to (begin to) learn the Perl DBI so I could run simple Perl scripts to do a whole bunch of stuff that would be more convoluted with Web scripting languages.

So I wrote my first Perl script that uses the DBI – a CRON job that runs each night and updates a given database/table in my MySQL database server.

It’s a trivial example, but something that mimics a file I had written in PHP and does the same in less lines.

That’s good!

The Coin Toss on Privacy

In case you’ve been asleep for the last couple of weeks, there is small firestorm raging over Google’s introduction of it’s e-mail service, GMail.

Some links of note outlining the firestorm are via Dan Gillmor, news.com (see related stories there, as well) and CNN.

The question (I’m addressing here) is: Is this a valid firestorm or a tempest in a tea pot?

What Google is offering with GMail is intrinsically the same as the e-mail services offered by other large Internet players, such as Excite.com, Yahoo.com and Hotmail.com. However, since Google is a late-comer to the free e-mail party, it has to differentiate itself.

Some of the differentiations are what is what is raising the ruckus – in one case, a California (of course) legislator is attempting to block the official launch of GMail (now in Beta):

A California state senator on Monday said she was drafting legislation to block Google Inc.’s free e-mail service “Gmail” because it would place advertising in personal messages after searching them for key words.

“We think it’s an absolute invasion of privacy. It’s like having a massive billboard in the middle of your home,” Sen. Liz Figueroa, a Democrat from Fremont, California, said in a telephone interview.

“We are asking them to rethink the whole product,” she said.

– Reuters via CNN, Tuesday, April 13, 2004

Hmm…sounds serious…

Is it?

There is always the other side of the coin (obverse vs. reverse); let’s look at some of the issues GMail (may) introduce and draw some conclusions. I’m from Illinois – the Land of Lincoln – so let’s use the obverse (head) and reverse (tails) sides of a penny to set the Issue|Issue Deconstructed:

Heads: The service Google is offering is – essentially – the same as other site’s offerings: Free e-mail, X Meg storage, contact list, browser-based blah blah….

Tails:Yeah, everyone pretty much agrees that the basic concept does not significantly differ from others; it’s the other stuff. But that’s not the point of…this point.

Heads: GMail will scan your e-mail and place paid ads that correspond to the content of your message. (This is the one that gets everyone’s undies in a bunch)

Tails:This is the nasty part for most folks, and it’s not even touching the ad-clutter (making $$ off my messages??) nonsense.

To a degree, this is a valid issue. It comes down to privacy, but does this argument hold up?

Example: I have a wife and a mistress (example, dammit!!); I use GMail for the Mistress. When I’m getting a (hot and heavy) message from the Mistress, there are ads for “Is Your Spouse Cheating On You?” software, sex toy shops or whatever. Disquieting, to say the least, I would guess.

But is Google reading your e-mail? Sure, because I got an ad for the hotel I told the mistress I was going to take her to…

OK. Define “read” – yes, Google read your e-mail; so does anti-virus software (offered by other similar providers, such as Yahoo and Excite). In the latter case, plain-text RegEx matching toasts an entry based on keywords (supplied by user); in the former it toats an entry or displays it with keyword-based ads.

OK. The one (virus) you don’t see; the other (ads) you see. Both are based on ASCII-text keyword algorithms.

Heads: Google’s current privacy terms for GMail sound fairly draconian – they may or may not delete stuff and so on. Sounds fairly invasive, to put it nicely. (I’m not going to link, as I expect the terms to change dramatically in the short term)

Tails:I think Google is catching flack for its honesty. Honest. I have test accounts on Yahoo, Excite and Hotmail and – while I should – I have never read the goddam terms. Yes, I should. My guess is that these three (and others) don’t explicitly mention what happens to that “myMistress” folder when you delete it. Is it really gone? Can the FBI, John Ashcroft, my mistress’ husband get it recovered? Does “delete” mean “gone forever”? (Duh – of course not. Google just admits this.)

OK, here is my bottom lines on all of this fuss:

  • I think Google vastly underestimated the issue of privacy and – more importantly – the scrutity they get for any move they make.
  • GMail is free – at least as currently planned. Don’t like Google’s terms? Don’t use GMail. That part is very simple.
  • OK, your mistress has set up a perceived dangerous GMail account. Your incoming e-mail (to her) is scanned and ads displayed on the strength of your dirty talk. That’s not the issue: The issue is is the message somehow stored? Somehow accessible by humans, not just software scripts?

The last part is huge, and has two parts:

  • Is the info stored?
  • If stored, can this info be stored with associations to [me/you/mistress/Bin-Laden…]?

That’s the crux of the issue: This is “my” e-mail, is there the possibility that someone else (i.e. Google) can get their hands on “my” e-mail?

And the bigger – perhaps biggest question: Does this “someone else” have any plans to draw conclusions about me by reading my e-mail?

Good questions…

Random Musings

WATCHING:
21 Grams

I was expecting a drug movie – the 21 grams was the clue – but this movie, while having some drug use, is not about drugs.

It’s about the intersection of three people (and – peripherally – the people associated with those three) whose lives accidently intersect, told in a series of out-of-sequence vignettes (some brief, some extended).

Not a feel-good movie; not a great movie, but very, very good. Sean Penn again demonstrates that he’s one of the finest actors out there.

All movies

Some random musings on some non-related issues:

Microsoft Circles the Wagons

This issue is worthy of a full entry, but for now I’ll just make this point: With the spate of recent settling of scores (Sun Microsystems, InterTrust), MS appears to be circling the wagons by throwing money at companies with two objectives in mind: 1) Shut down expensive and distracting litigation, 2) Set the stage for the next version of Microsoft (the company), where it exercises it patent and DRM portfolio, and concentrates less on the actual software. It increasingly becomes a licensing company.

I’m sure I could be wrong about all this – and it wouldn’t be the first time – but MS has blown through a few billion recently to settle scores. That’s a lot of money, even for a company with ~$40 billion in the piggy bank. These are strategic moves.

The Constitution Terminator

There’s been a lot of ink (digital and otherwise) tossed at the issue of Supreme Court Justice Antonin Scalia’s erasure of recordings of a recent speech. (Note: A federal marshall did this; not Scalia.)

Lost in this issue is, to me, a discussion as to why Scalia doesn’t want his public speeches recorded.

First of all, if it is a public speech, doesn’t that pretty much grant anyone the right to record? Private talks or off-the-record talks with reporters I can see as his call to define, but speeches?

Second, if he’s so against recording his speeches, why give them?

And what’s lost if they are recorded? There were quotations of his speech given in stories about this who situation, so – apparently – quoting him is OK…as long as it’s by hand (is recording his speeches with shorthand allowed? Apparently.

Supreme Court spokesman Ed Turner said that Scalia was unavailable for comment. “The justice generally prefers not to have audio or video recordings of his remarks,” Turner said.

Washington Post, 4/9/2004

I don’t know, this is just a little bizarre to me.

Lily Day

Well, it’s Easter, and when I went into the grocerty store yesterday, the store was packed.

And it seemed like everyone was buying Easter lilies.

Madness!

The picture at right is actually an Easter lily from years ago – after Easter, it was going to be tossed. So I sav ed the plant and shot a few sheets with my 4×5 view camera. They turned out nicely; the full-sized image is a (scan of the) contact print from the negative.

Ah, I miss the darkroom some days…

I Parse, Therefore I Am

No matter what the shape/type/scope of a database driven application, at some point days of building parsers is involved.

These parsers can be final parsers, which will load (either one-time or CRON jobs) real data into the database, or they can be ad-hoc down-and-dirty scripts that load test data.

For either of these uses, Perl is your friend.

Can’t beat it…

The Economic Walden

READING:
Nickel and Dimed: On (Not) Getting By in America
Barbara Ehrenreich

Ehrenreich’s Thoreau-like adventure, with the world of manual, minimum-wage jobs as her Walden.

The basic conclusion of the book is simple: A job and hard work does not translate to a ticket out of poverty.

All books

In 1998, Ehrenreich, like Thoreau before her, set off to see if she could survive on her own; she reported her findings in Nickel and Dimed: On (Not) Getting By in America, which I started and finished today.

While Thoreau set off for this cabin in the woods surrounding Walden Pond, Ehrenreich set off for a more contemporary, yet just as isolated area: Leaving (to a degree) her safety net of family, Internet access, home and current occupation (writer), she sought full-time work for poverty-level wages.

Working as a waitress in family-style restaurants (think Denny’s), as a maid as part of a home-cleaning crew and as a menial associate at the world’s largest retailer – Wal-Mart – Ehrenreich came to the conclusion that having a full-time job was not the ticket out of poverty:

Something is wrong, very wrong, when a single person in good health, a person who in addition possesses a working car, can barely support herself by the sweat of her brow

  – Evaluation chapter

She worked in three different cities – sometimes working two jobs at once – and yet she still comes to the conclusion that she could not have endured much longer than the month she allotted for each city/job if she had had any sort of non-basic (food/clothing/shelter) costs: These non-basic costs would include any medical care, fixing her car and so on.

It’s a disquieting message that Ehrenreich went into this project expecting, yet her proof-by-experience is damning.

While I don’t necessarily agree with all her conclusions/accusations – she paints all management as Dilbetian pointy-haired bosses, and still wonders why the menial workers (of which she became one) don’t demand more for their labors – her book draws some interesting conclusions, many of which she never specifically states:

  • She is an educated, healthy, unencumbered woman. What of others with families or ailments. If she can barely get by, what does this mean for others who shoulder extra burdens? From what Ehrenreich writes, she was a rarity among those she worked with in many ways: Car, ability to put a deposit on an apartment, no children and associated costs/constraints. Again, if she can barely – just barely – make it, what of others?
  • She worked with a lot of co-workers – full-time workers – who were either homeless or depended on a second income (spouse, friend, roommate) to cut housing costs.
  • Affordable housing just is not keeping pace with the demand. If one considers geographically accessible housing (low income workers frequently have no car), and the number of affordable units dwindle to near-zero.
  • Food costs are higher for the less wealthy simply due to conditions – for example, Ehrenreich once received a box of food from a food pantry, and one item in the collection was a canned ham. Without a refrigerator – and in her case, living alone – the extra meals this large hunk of meat could provide were only marginally useful to her: Without a refrigerator, she’d have to eat it all in one sitting. (She ended up donating this box of food to another pantry). While I’ve read similar reports – the poor have to eat fast food/buy from convenience stores due to time constraints, but the costs are higher – it hits home with an example such as this.
  • I hadn’t realized that a lot of companies hold workers’ first weeks check as a security deposit of sorts, giving the money back at some future (termination, after X months) date. For someone living check to check, this is another incentive to not leave a job – one can’t afford to miss a check in this manner.

This book was written in 1998, when the economy was booming. Especially in Minnesota, where Ehrenreich’s last job was located, the boom fueled a demand for workers, yet conditions were still appalling and wages seemingly artificially low. Today, whatever leverage workers had due to a demand for manual/service-sector labor is obviously missing. It’ll be interesting to see if she revisited this issue recently to see – in a statistical manner, at least – how things have been changed by the job market forces.

Ehrenreich (almost) closes with the following message:

When someone works for less than than she can live on – when, for example, she goes hungry so that you can eat more cheaply and conveniently – then she has made a great sacrifice for you, she has made you a gift of some part of her abilities, her health, and her life. The “working poor,” as they are approvingly termed, are in fact the major philanthropists of our society. They neglect their own children so that the children of others will be cared for; they live in substandard housing so that other homes will be shiny and perfect; they endure privation so that inflation will be low and stock prices high. To be a member of the working poor is to be an anonymous donor, a nameless benefactor, to everyone else.

  – Evaluation chapter.

Ehrenreich then finishes up the book with a short paragraph saying she expects the workers like she worked with to someday tire of taking all the crap and demand a living wage.

Unfortunately, this is not a reality I see happening. For example, one of the points Ehrenreich makes in her book is that job listings don’t necessarily reflect need: Some companies keep a listing going forever, as turnover is fairly constant and the applications are frequently needed. It’s cost-effective to keep the ads running regardless of current needs.

In other words, the lowly workers don’t have any leverage. Yes, they may deserve more money/respect and so on, but – if you’re unhappy with your job – there is always someone else to fill it. It hurts the worker more than the company, or the company would not tolerate this consistent turnover.

Unite and Conquer?

When I first read about the agreement between Sun and Microsoft, I had two visceral responses:

  • Wow. Sun’s Scott McNeally has never had a nice thing to say about Bill Gates or Microsoft. So…wow.
  • Linux

The former is pretty obvious (as in, strange).

The latter explains away the former – it’s all business, and the business here is to unite and conquer against a common enemy: Linux.

Face it – Sun has been struggling for the last few years. Formerly the leader in Unix systems with it’s Sparc chip/Solaris OS, it’s margins have been hit the dot bomb, lower-cost alternatives (such as Intel/Linux) and miscues with Java (i.e., they still haven’t figured out how to really cash in on this language).

Microsoft – with $40B+ in its coffers, has been struggling lately, as well: No, they are not hurting per se, but they see the long-term writing on the wall: The release of Yukon, Whitby and Longhorn keep slipping, anti-trust issues dog them domestically and abroad, and security issues haunt them. In other words, it’s going to take some work to keep this company competitive long term.

Linux is a big enemy of MS, as well: Linux has a reputation of being more stable, less expensive and more extensible (no vendor lock-in) than MS server products.

So – in this respect alone, the MS/Sun truce makes sense.

Let the games begin…

Homer Wants More D’oh!

Word on the wires is that the voice-cast of The Simpsons animated television show have resorted to a work stoppage to get a pay raise.

The cast currently gets $125,000 per episode and are seeking a boost to $360,000 per episode.

This has happened a lot recently, with tough negotiations on the part of actors to get a bigger piece of the pie, especially for successful shows (such as Friends, Fraiser, Everyone Loves Raymond and so on).

To a certain degree, this has some validity: The shows are cash cows, and they – the cast – should get a substantial cut of said pie.

On the other hand, greed seems to drive a lot of these negotiations. Let’s look a little more closely at the Simpsons’ story:

  • Each season is 22 episodes
  • Voice actors currently get $125,000 per episode: $2.75M/season
  • Each voice actor is asking for $360,000 per episode: $7.92M/season
  • This doesn’t count any other benefits (such as syndication royalties). Base pay only.
  • They are voice actors; while – in some ways more difficult than other types of acting, they don’t have to do the following:
    • Dress up for shows
    • Have as many revisions due to other actor’s miscues and so on
    • Look good – the whole Hollywood obsession with youth, no wrinkles and so on. They are just voices

  • While I don’t know this for a fact, I don’t see each season’s taping as taking more than 22 weeks (overall). So this leaves approximately one-half of the year for them to pursue other paying tasks (yes, there may well be some contractual limitations on what they can do).

In addition, the taping for the shows probably takes place in either LA or NYC – two cities with high costs of livings.

But…come on…how tough is it to get by on $2.75M a year?

Let’s do some math: The median household income for the U.S. is approximately $43,000 – that’s per household, not per person.

So to match the salary a single Simpsons’ actor pulls in for one year, the median household would have to work for 64 years. That’s right – if they drop out of school at 16 and work for the years necessary to gain the base income from one year of Simpsons’ voice work (at current rates, not with the desired raise), they will have to work straight through until they are 80 years old.

Youch.

This is not really a ding at the Simpsons’ actors; it’s just that this is a nicer package to compare the lunacy of TV/sports/CEO salaries with those of average folks.

Yes, I know you can make arguments for the high salaries – such as athletes have short careers compared to, say, a CPA. Agreed. But why then does the athlete’s short career pay more – way more – than the longer career of the CPA? Where’s the parity? And what chance does a CPA have to get Nike endorsement contract?? (My accountant will sure never garner this, unless Nike changes its motto to “Just Eat It”…)

I guess it’s the disparity that’s troubling, and this also extends to studio honchos/team owners, as well. Part of the problem – as mentioned earlier – is that actors/athletes just want (at one level) their fair share.

Which is fair.

I think that, in many cases, the Suits (execs) are screwing the cast/athletes over.

But it’s still hard to feel sorry for someone whose fair share is 66 gazillion dollars, and they only got half that. Actors/athletes – by their very nature – are public, so they are vested with more criticism for greed than the Suits, but all should share the blame.

I just saw a short blurb – one of those bottom screen-crawlers – on CNN that looked at the average cost to take in a ballgame: Four tickets (Typical nuclear family: Mom, Dad, 2.2 kids and you leave the 0.2 kids in the car…), four hot dogs, four cokes, two hats, parking: $155

Let’s take that median family ($43,000/yr) and a current Simpsons’ voice actor ($2.75M/yr).

Leaving aside taxes – and my guess is that the tax rate will be approximately the same for both parties, as the actor has a financial analyst/planner – the Median Family will spend approximately 18% of their weekly income on this game. The Simpsons’ actor (singular – what if two incomes in this family?) will spent approximately 0.3% of a weekly income on this game.

Something is horribly wrong here….in oh so many ways….

CCTP

CCTP:
This is a newly established protocol, the Computer Component Transfer Protocol. It describes the interchange of non-digital information between two agents (client/vendor relationships, for example).

Formerly know by any number of sometimes synonymous definitions: UPS, DHL, FedEx, USPO (deprecated) and a handful of lesser-used mechanisms.

So, anyway, I ordered some info chips from Dell. Dell – along with Amazon – have invariably given me satisfaction with both their delivery time frames and tracking tools.

Dell had to backorder the chips – don’t ask; not germane – but followed up with message saying it was delayed, and finally shipped and all that.

Yesterday, I went back to the “shipment en route” e-mail to see where things were.

To my surprise, the shipment was in the Chicago (my) area. Great. Should be at my house (home delivery, for this order) by end of the next day tops.

A couple of hours later, I head a truck pull away from my house. I looked out the window to see a DHL truck pull away. Wow. The chips had arrived.

I happened to have that order page still open in a browser window; I refreshed the page and the status didn’t update. Whatever. I guessed that the order would be updated when the truck returned to the depot.

I grabbed the delivery, checked out that all was well, and then refreshed the page again: The order reflected the delivery.

So the trucks/units DHL uses has wireless that updates orders virtually instantaneously (the time gap was roughly 10 minutes and I don’t know of any depot that close to my house).

How cool. So, when I see an order updating (checked in to Memphis station, checked out of same…), it’s pretty damn close to real time. That’s impressive.

It also makes me wonder about the future – when/if RFID is accepted and inexpensive, can we expect to be able to track packages like a Mapquest search, where we can watch the package slowly move down the street so we know when to go to the front door/loading dock to pick up the package?

Hell, if there is geocoding in the order (of the customer’s location), an e-mail/page/SMS can be sent when the package X miles from its destination. In addition to the MapQuest concept.

Is this technologically possible? Absolutely.

Will people want this? Absolutely.

Will it be necessary to keep customers (i.e., if FedEx does it, will UPS have to offer same)? I don’t know.

The real $10,000 question is this: Will such capabilities become like a cell phone – expected nowadays, and not the toy/cool gadget it initially was – or will its allure be considered overkill and, frankly, annoying, like PointCast (remember Push [which, ironically, RSS is picking up on in a Pull manner])?