Archive for the 'development' Category

MSSQL JDBC Drivers and getSchemas 2

At work, we’re in the process of trying out some new development projects in Java. And I guess we’re just masochistic, since we decided to write this new project against MSSQL instead of our usual MySQL. Anyways, everything’s coming together for the most part, except that few of the GUI database tools seem to be able to find our schema. Instead, it just seems to list the database users. We noticed this in Netbeans, Eclipse, and SquirrelSQL.

Yesterday, I started tracking it all down. Turns out, Microsoft introduced the concept of an actual schema in SQL Server 2005. Prior to that, tables were segmented by their owner. Consequently, the available JDBC drivers (both jTDS and Microsoft’s) implementations of DatabaseMetaData.getSchemas() actually return the list of database users.

Since I can’t do anything about Microsoft’s driver, I downloaded the source for jTDS and started poking around. In net.sourceforge.jtds.jdbc.JtdsDatabaseMetaData, around line 1589, you’ll find the following query:


After digging up a copy of the 1.5 JDK, I changed this to a query based on the information schema and recompiled. Then I fired up SquirrelSQL, and, bam. All my schemas were listed. Feeling quite proud of myself, I then discovered that someone had already filed a bug and the issue was fixed in jTDS’ CVS repository. Oh well.

Anyways, if you’re having issues browsing your MSSQL schemas with SquirrelSQL or other JDBC database tools, try building jTDS from source.

Every day 0

Here are two PHP functions (although one’s actually from an extension) that I didn’t know existed, but give you some good insight into your variables, especially when you’re mucking around with more complicated stuff: debug_zval_dump and xdebug_debug_zval.

Both give you more information about the underlying representation of your variables: in particular, what the refcount is for that particular value. Note, however, that while it’s literally called the “reference count”, a refcount greater than one doesn’t imply that the variable is actually a reference due to PHP’s “copy on write” semantics. XDebug’s version of the method wins here, because it also dumps is_ref, which does flag a reference.

(See Sara Golemon’s You’re being lied to or Derick Rethan’s References in PHP [PDF] for more.)

Instant Storage 1

Here’s one of my favorite PHP ‘hacks’: when I’m whipping up a quick script that needs a place to stash some persistent data, but don’t feel like coming up with a database structure, or doing anything remotely approaching a real solution, I instead stuff it into a “static” session. By static, I just mean that I set the session ID to a static value, so I’m always pulling the same session. Instant data store.

$_SESSION['stuff'] = $w00tz;

(Another quick and dirty approach would be serializing an array into a local file… oh, wait, I just recreated the default PHP session handler. ;))

PHPUnit + FAM + libnotify == fun 3

Last night I ‘tweeted’ (man, I hate that word!) on some hacking I was doing with PHPUnit, FAM (the File Alteration Monitor), and libnotify/notification-daemon to automatically run unit tests as you modify files.

Credit where credit is due: this was inspired by other people’s work with other unit testing frameworks.

Anyways, the short screencast in my update last night has already generated some interest, so I thought I’d get this out on the web for perhaps wider exposure.

Coming soon: continuous integration on your desktop for your PHPUnit projects.

Binning it 0

Most of you are probably familiar with pastebin, officially, it’s a “collaborative debugging tool,” unofficially, it’s a place to temporarily stick random blobs of text for other people to look at.

We’ve set up our own instance of pastebin in the office, and I often found myself wanting to paste files on my system, or the output of commands (like svn diff). After getting sick of literally (copying and) pasting stuff into the text box, I whipped up a command line script that takes its input from a file or STDIN. Sure, these probably already exist, but who cares.

Aptly, it’s hosted at pastebin.

Duck Typing 2

I’m in fairly creative mood tonight, as evidenced by one (now two) blog postings, the PHP coding I did earlier, and the upload of some 75 random pictures to Facebook. I guess that’s what happens when I avoid the work I really should be doing. (Blech, JavaScript.)

Anyways, a few days ago a coworker mentioned something to me about duck typing, and I again decided to shirk my responsibilities and experiment. The basic idea is to stand typing on its head and have an imperative system rather than declarative — as they say, “if it walks like a duck, and quacks like a duck, it must be a duck.”

Read more »

I’m in DC 2

So, as I mentioned a while ago, I’m presenting at DC PHP ’08. It’s this week.

The presenter I’m listening to right now just reminded me why I hate MVC on the web. But I’m not going to go into it.

The conference appears to have gotten the wireless correct, at the very least. The past two conferences I’ve been to have both had extremely flaky wireless connections, which presented problems for not only the attendees, but presenters who were depending upon an internet connection.

My talk is tomorrow, so for now I just listen.

Represent! 5

I just learned that I’ll be presenting at the 2008 installment of the DC PHP Conference (in Washington DC, oddly enough). I’m excited about the prospect.

Open up wide 2

When I signed into meebo this morning, I got a little pop-up with a blurb about a partnership with AOL. I was immediately intrigued. Unfortunately, muscle memory kicked in too fast, and I closed the box — the same one that opens every time I sign in — before I even realized I wanted to read it. So I signed out and back in.

Apparently, AOL is finally opening AIM up really wide. They’re talking about full protocol documentation (that’s the “oscar” protocol, not the crappy TOC one), letting people use their own AIM libraries, and full access to all the functionality (voice, video, filesharing, etc.) — as far as I know, this stuff has never been available before.

I also noticed that you can now convert any AIM screen name into a “bot”: the various rate limits are removed (or heightened, at the very least), you can’t be warned, and are allowed to be added to more people’s buddy lists. In return, you can’t initiate conversations.

You know what this means.

The screen name crabbychild has been successfully converted to an AIMĀ® Bot.

Across an Instance 0

Here’s the quick PHP tip of the day: class methods can access the protected (of any shared ancestors) and private (of the same type) members of any instance, not only their own instance. That may sound confusing, but it’s really not so much.

Read more »

Next Page »