Jakob's Blog

Programming is a world of constant learning. There's never a best way, only the best way found to date. As I continue to grow and learn, I find things worth writing about and sharing. I use this blog as a way to share, in hopes that others can learn from me as I have from them.

SnapTest 1.2.0 Released

August 30, 2008 @ 05:35 pm

Things have been quiet over here on the site, mostly because I've been focused on things at work and polishing up SnapTest for 1.2.0. And really, that's a good a reason as any to get the blogging going again. First and foremost, SnapTest 1.2.0 is out, and available for download. It comes with a slew of improvements and new things that should help make the testing process as painless as possible. Of all the things included, the most significant of these is the web testing interface.

I wrote recently on the topic of Isolation Testing in PHP as part of 1.2, and two methods are available right out of the gate. The more conventional of methods uses php's proc_open command. The web interface though takes advantage of the server to fan out processes to do work. Using the YUI Library, the newest version sports a web interface using the YUI Get Utility (with a callback) to ensure every PHP test runs independently. As an added bonus, on obscure windows installs where the multi-process model was pitching fits, WAMP (A and M not required) can now do full isolation testing.…

document.createElement and checkboxes

June 03, 2008 @ 12:03 pm

I ran into a problem in building the web interface for SnapTest today, where I couldn't seem to get a checkbox to show up as checked in IE. The original code looked something like

And no matter how many times I tried, IE (6 specifically) refused to check the checkbox. It turns out IE want your checkboxes made in a Mozilla-incompatible way. Specifically, IE lets you call document.createElement using an entire HTML tag, which will result in a node you can perform operations on.…

Isolation Testing in PHP

May 06, 2008 @ 06:50 pm

Since SnapTest 1.0, I've been wanting to improve upon the level of isolation occurring on a per-test level. Working with one PHP process per file reduced the chance of collision, but it still had problems. In cases where a tested object had to work with static classes, for example, it was difficult to ensure the class was reset properly during setUp() and tearDown(). To get there, each test would need to be ran in its standalone PHP process.

When doing research on how to spawn sub processes cross-platform, the options end up being very limited. Since forking is not available on window boxes, the only two available options seemed to be popen() with STDIN and system() with a socket connection. With inspiration from Ming's spinlock concept for JavaScript, it was possible to spawn the needed child processes, and check back on their output in a round robin fashion. Using /bin/nice (or the /low switch on windows) also keeps any one process from starving the parent.…

SnapTest 1.0.0alpha and SXSW Speaking

January 17, 2008 @ 11:53 pm

I've been quiet for quite some time, although for those who know my blogging habits that shouldn't be much of a surprise. I've been head down busy with a few things, specifically preparing for South By SouthWest (I'm speaking along side some very talented people, namely Alan Kasindorf of Six Apart, Blaine Cook of Twitter, and Sandy Jen of Meebo. The topic is on horizontal scalability, labeled "Scalability Boot Camp". Think of it like a firehose of really useful stuff, followed by some discussion about how this all works in practical startup (and larger company) environments. For the non-technical, there will be some grounding in business concepts from Kerry Miller of BusinessWeek as the moderator. For the technical, it'll be a feast of technologies and a yummy side of deployment and technical talk. If you're going to Austin, I'll see you there!

The second of the housekeeping stuff actually manages to eclipse my excitement about the SXSW thing, I can actually cross something off my life-to-do list. (Not that speaking at a conference isn't on there, I just haven't spoken yet.) Instead, I'm talking about the release of an open source project which I've been working on for some time out in the open. SnapTest, a unit testing framework for PHP, version 1.0.0 alpha is finally out. By "out" I mean there are wiki pages, documentation, and even a shiny .tar.gz waiting. While most projects I tend to do are for fun, personal benefit, this one has a certain tangibility (usefulness) to others.…

Just In Time Loader for JavaScript

November 27, 2007 @ 02:42 pm

The most recent version (1.0.0) can be downloaded here:…

Javascript’s Strange Threaded Nature

November 08, 2007 @ 02:38 pm

There's a lot of digging required to figure out if Javascript is single or multi-threaded, and for every article out there, at least three contradict it. Thanks to the work Dan Simard in June, a final answer on Javascript threads was reached. The only major problem in this was that the comments by a user to Simard's post indicated that alert() caused Firefox's execution chain to change. The result was while the prompt was on screen, setTimeout() and other assorted callback functions were free to resolve.

The problem is made worse with several setTimeout() calls. As a single thread, JavaScript maintains some sort of event stack, where all of the callbacks and timeouts pile up, waiting for their turn. Once the event stack is out of events, the timers start again to count down to execution. If you fire one call with a setTimeout() and a timeout value of 2 seconds, and one more second of code execution follows, there will still be 2 seconds on the timer since it has not had a chance to run.…

Git-Svn on OSX

August 06, 2007 @ 10:55 pm

Update Aug 08: It was pointed out that you need the OSX Developer Tools installed. They are on the OSX CD, and enable the ability to compile things. It's a must have for this to work.…

Defining Social Fun

March 04, 2007 @ 01:25 am

The concept of fun is so confusing, that the more a person tries to define it, the more confusing the concept becomes. Instead, fun is better described as a summation of things; interestingly, these things in and of themselves are not necessarily fun, but instead are foundations of an online emulation of life. In 1943, Maslow created a Hierarchy of Needs, which described the basic needs of human beings. Later, Nevis revised this theory slightly, adapting it based on his studies of East Asian values.…

Stylizing the Form Submit Button

October 28, 2006 @ 02:20 pm

"The buttons aren't styling" I remarked as I stared at the page in Camino and Safari. Testing on the Mac platform has been the absolute bane of my existence as of late, mostly because for some reason, these browsers in particular are very protective of their form widgets. Coming back to Cameron Adams' Entry on Styling Form Widgets, I found that none of the Macromedia examples were actually working for Camino/Safari, although they looked beautiful in Firefox. The submit button simply would not take the background settings. Interesting enough though, something of input type="button" styled perfectly.

However, the value attribute of the button wasn't getting passed in. For the legacy code around Gaia, we have forms with more than one possible "submit" for an action. The most common case of this is preview and submit buttons we traditionally use in the forums. This left us with two scenarios:…

PHP Transaction Manager Architecture

October 02, 2006 @ 11:59 pm

This is part two in the PHP Transaction Manager Series. You may also find the related entries in this series of interest:

Note: This article was written under the guise of PHP 4, which lacks a lot of object related functionality that would be beneficial to the development of the code used in these examples.