Evaluate Tcl scripts as a UDF in MySQL

In the previous blog entry, I mentioned evaluating Tcl scripts from within MySQL using the User-Defined Function (UDF) capability already in MySQL. For example, it would allow you to do this:

CREATE FUNCTION TCL RETURNS STRING SONAME 'libtcl-mysql-udf.so';

SELECT TCL('expr {2 + 2}');

Well, after a few hours of productive coding and hacking, I want to share tcl-mysql-udf-0.1.tar.gz with you.

I’ve done very limited testing on this and on very little sleep, so I wholly expect there to be really stupid mistakes in there–but, it does “work” on my personal Debian 4.0 Linux and MySQL 5.1.20 setup with Tcl 8.4.12. If you want to play around with this, I strongly urge you to read over the README included in the tarball, as it should have all the relevant bits of information necessary to get you started.

A quick demonstration of what’s currently possible with this version:

mysql> SELECT TCL('info patchlevel') AS script;
+--------+
| script |
+--------+
| 8.4.12 |
+--------+
1 row in set (0.00 sec)

mysql> SELECT TCL('info commands') AS script \G
*************************** 1. row ***************************
script: tell socket subst open eof pwd glob list exec pid time eval lrange fblocked lsearch gets case lappend proc break variable llength return linsert error catch clock info split array if fconfigure concat join lreplace source fcopy global switch update close
1 row in set (0.00 sec)

Currently, Tcl errors result in the function returning NULL–I haven’t figured out how to propagate the error string back up, yet.

mysql> SELECT TCL('error foo') AS script;
+--------+
| script |
+--------+
| NULL   |
+--------+
1 row in set (0.01 sec)

Also, the maximum length string that the function can return is currently hard-coded to 255 characters.

mysql> SELECT LENGTH(TCL('string repeat x 1024')) AS script;
+--------+
| script |
+--------+
|    255 |
+--------+
1 row in set (0.07 sec)

I implemented the function as accepting a variable number of arguments, the first being the Tcl script, followed by values that get appended to the $args Tcl variable–as though it were a Tcl proc call, in a sense.

mysql> SELECT TCL('concat [llength $args] $args', 'abc', 123, NOW()) AS script;
+---------------------------------+
| script                          |
+---------------------------------+
| 3 abc 123 {2007-08-25 08:50:35} |
+---------------------------------+
1 row in set (0.05 sec)

If you’re familiar with Tcl and MySQL and aren’t afraid of compiling something and fooling around with it in your dev playground, I’d love to hear what you think of this code. Can you see any use for it? What else would it need to be able to do before it would be useful to you?

Tags: , , ,

Is Vertica’s product just Sybase IQ?

Emmanuelle Skala (Sr. Director, Commercial Sales at Vertica) emailed me a heads-up this morning that Vertica Systems, Inc. earned an honorable mention for this year’s Computerworld Horizon Award.

I first heard and blogged about Vertica back in January 2005 and was very excited to see what Michael Stonebraker was going to introduce to the world this time. He’s pretty much the father of the modern relational database, having been a part of many companies in the industry throughout the years.

His latest work has been on C-Store, a “column-oriented DBMS” developed amongst the Massachusetts tech. universities. It is being released as open source software under one of my favorite licenses, the BSD license.

It’s exciting to finally see a column-oriented DBMS released as open source. The concept is nothing new.  Sybase IQ was doing this commercially over 10 years ago, before 1995 when it acquired Expressway:

Sybase IQ is based on technology that Sybase acquired when it purchased Expressway in 1995. However, it was not until the release of version 12.0 in 1999 that the product really came to its present level of maturity.

It’s clearly in the Sybase IQ documentation, “When you load data into a table, Sybase IQ stores data by column rather than by row, for each column in the table.” I’m guessing, without having looked at their implementation, that C-Store does things differently than IQ, but the underlying premise sounds the same.

Perhaps C-Store can be hooked up to MySQL as a pluggable storage engine. That could be very cool and possibly even useful! Maybe I’ll work on that this week at MySQL Camp II.

Tags: , , , , ,

Jason sees value in Mahalo for the long tail of users

I love that Jason comes out and says “Mahalo is not for you” to the geeks:

“The fact is, if folks who are in the .001% of the internet population are in love with our service that’s probably a BAD SIGN.”

He goes on to say:

“[…] what the vast majority of people want from search is to type a word into a box and get an organized list of high quality links. That’s it. It’s that simple, and that’s what we’re doing.”

There’s a reason why Jason was a good fit for AOL–and a tremendous loss for AOL when he left–because Jason naturally “gets” the ideas that the AOL founders have known for almost 20 years now.

AOL Keyword dialog screenshot

It goes back to something I’ve argued with user interface designers on and off for years: users don’t want to browse the web, they want to find information. Getting more than one result back means having to make a decision and most people aren’t educated or informed enough to make the decision as to which path will result in finding what they’re looking for. They don’t have time to navigate down until they reach a dead-end and back-button their way to the decision point and try again.

Sometimes, I wonder if Mahalo’s going to miss the mark because they still give users too much to choose from. This is why Google’s “I’m Feeling Lucky” button is such brilliant genius–if only Google’s search result quality were much, much higher. Once Mahalo’s data set grows sufficiently large, it might be useful to just redirect people to the top link instead of serving them a results page. Yes, this means you can’t monetize on eyeballs with paid display ads, but perhaps you could revenue share with the destination that you send users to.

This is why I kept wanting to launch a little skunk-works project inside AOL to build out keyword.aol.com … which would just reuse their existing keyword database and redirect users, so if you went to keyword.aol.com/sports it would redirect you to the page that is already programmed as the destination for KW: Sports.  No real additional “work” would be done by the editorial team–just repurposing the existing data.

Oh well, AOL may have missed the boat on this one but maybe Mahalo has a chance to win here. I can’t wait to see how things turn out.

Tags: , ,

August 13th Hackfest was teh awesome

As an off-shoot of the monthly MySQL meetup that I co-organize with Steve, we started a weekly Hackfest meetup that meets on Monday nights. Last night’s Hackfest had a good turnout–7 of us at the start, 6 at the end–and there was lots of activity, even some coding!  Here’s some pictures I took half-way through:

August 13th Hackfest August 13th Hackfest

After Mary came and presented Rayt at the August MySQL meetup, I suggested she come to our Hackfest and I’d work on it with her. She was working up the design comp for the user interface and I started working on the bookmarklet and portal and soon we’ll have enough done to take some reasonably interesting screenshots.

I hope we can keep the momentum up and get more folks coming to work on their projects at the Hackfest. It would be nice to get someone to provide us a better venue–we currently meet at the Panera Bread in Paramus, NJ, which offers free wi-fi and is very accomodating of us, but it can be quite noisy and we usually can’t get the private room you see in the picture behind us. If you know of any organizations that would be willing to give us space with tables and chairs, a few electrical outlets, and some form of Internet connectivity for an evening every Monday night, let me know!

Tags: , ,

What is GIMP’s equivalent of Photoshop’s Median filter?

In my attempts to wean myself off as many commercial applications as possible, I decided to give The GIMP another try. I grabbed the Win32 installer for GIMP 2.2.17, which made installation a breeze. It certainly starts up much faster than Photoshop CS2, which is another big plus. It is amazing how featureful it is for a free software application.

But … there’s still a functionality gap between it and Photoshop and that’ll make it hard to switch completely. Specifically, where is GIMP’s equivalent of Photoshop’s “Median” filter? Not sure what I’m talking about? I’m referring to this:

Photoshop's Noise-Median filter

It’s a really useful filter and I can’t seem to find the equivalent in GIMP. It’s good for smoothing sharp edges into curves, like this:

Jagged area After applying median filter
(Before and after)

Getting this effect is as easy as this in Photoshop:

Apply median filter

But, how do you do it in GIMP? I’ve searched and the best I’ve found is people suggesting that GIMP’s “Filters > Enhance > Despeckle” has a “Median” filter, but it’s not even close to the same effect.

So, if there’s a GIMP wizard out there who knows GIMP inside and out, what’s the magic incantation to reproduce this effect that’s easily done in Photoshop, in GIMP?

Update: I found

Sent in my registration for MySQL Camp II

I just found out that MySQL Camp II is being held in Brooklyn, NY, later this month, on August 23-24, at Polytechnic University. Hopefully there are still slots available and I’ll be there.

Husky 8-in-1 Torx screwdriver including T5 tip

The other day while I was grocery shopping, I dropped my Treo 650 and bricked it. It would power up and the touch-screen was responsive, but the keyboard wasn’t. Sad, but not defeated, I decided to try and fix it myself since it was bricked anyway. But, it’s secured with Torx T5 screws and I haven’t found a good source for smaller Torx bits. I already have drivers as small as T6, but where could I get a T5 bit?

Husky 8-in-1 precision screwdriver with Torx bitsOf course there’s bound to be plenty of online shopping sites where I could order one, but I wanted immediate gratification–plus, I needed to see if my phone was truly unusable, in which case I’d need to go and get a replacement right away. Luckily, I discovered that Home Depot carries the Husky 8-in-1 Precision Screwdriver, which has 4 double-sided bits ranging of sizes T4, T5, T6, T7, T8, T9, T10 and T15, all for $5.97! I drove down to my local Home Depot and picked one up, got home and took my Treo apart.

It turns out that the lower-right pad under the right-hand shift button on the keyboard PCB was permanently depressed. I’d carefully lifted it with a pair of precision tweezers and popped it back up, exercised it a few times and closed the Treo back up. The keyboard was working once again and I had a usable phone! However, if I weren’t so lucky, apparently Cellular Nationwide Network, a company based out of Hong Kong, is selling a Treo 650 replacement keyboard PCB for $9.99. I have no idea what the shipping costs from HK to the US are, though.

If you’re going to take a stab at fixing your own Treo, this video walkthrough shows you how to take it apart:

I’m just glad I was able to get my Treo working again! I really didn’t want to have to spend money to replace it right now.

If this helped you out with your own Treo repair, I’m glad. Feel free to let me know in the comments below–or, ask any questions you have and I might be able to answer and help you out.

Tags: , , , , ,

Not the “Baby on Board” sign you were expecting

I’m sure you’re sick of seeing those 45-degree rotated square “Baby On Board” signs by now. You know the one’s I’m talking about:

Baby On Board

Yeah, that’s the kind. All of the stupid variants that have sprung forth from this incredible farce of a “safety device” … it’s a meme that should never have taken off, but did. Every time you glance at a car with a little yellow and black square in the window, it doesn’t even matter what it says, the “baby on board” pops into my head.

Oh, but thanks to AtlantaHoopla, I no longer grimace at the stupid things. No, instead, I smile and recall this image:

Baby On Board

Oh yes, someone went there. To whoever it was, I salute you.

Update: Just found another great version of this classic sign:

Baby on Board, hanging in the window

That is just made of win–I need to get one for my car. Anyone know where they can be bought?

Tags: , , , , ,

Dethcat can has a gift

On the Intertubes, news travels fast. It didn’t take long for news of a cat living in a nursing home to get mashed up with the recent LOLcat meme. I mean, who could resist Oscar, the dethcat, the kittah of deth? But, what surprises me is the fact that the connection to the old “all your base” meme hasn’t been made, yet–that I could find, anyway. So, Interwebs, I give you this:

All your base are belong to Oscar, the dethcat

For great justice!

Tags: , , ,

On vacation at the Hilton Suites Ocean City Oceanfront in Maryland

I’m on vacation with the family this week and we’re back in Ocean City, MD. We were here in September 2005 at the Club Ocean Villas II, at which time the Hilton Suites Ocean City Oceanfront was still being built. We all really liked Ocean City, so we wanted to check it out. I’m a bit wary of trying out a brand new resort so I said we should try to get in for 2007, this way you avoid all the early growing pains.

Like last time, we came down the Garden State Parkway to the end and took the Cape May/Lewes Ferry across. The traffic was very kind to us and we made the drive in great time. The Hilton is situated between 32nd and 33rd Street. Checking in at the hotel was pleasant and uneventful, and our room was ready and waiting for us.

Ocean City, MD, July-August 2007

Here’s the view from our suite, #614. The view is fantastic, looking out over the ocean and the two outdoor pools.

Of course, while this is a vacation for the family, in the evenings I’m busy getting work done. Fortunately, there’s fully wired Ethernet in the suite and wireless networks set up in the lobby area. Out of curiousity, I decided to try a quick speed test to see what kind of bandwidth they’re offering:

My outbound connections are coming from 74-95-78-21-delmarva.hfc.comcastbusiness.net (74.95.78.21). It appears that I’m getting 512 Kbps down, 128 Kbps up–not amazing bandwidth, but totally adequate for teleworking.

It’s still early in the vacation, but unless something goes radically wrong, this is definitely a place I hope to be able to come back to again. It’s definitely a plush, five-star resort and a great way to enjoy the Ocean City beach.

Tags: , , ,