Archive for August, 2010

Why so curious?

By Skeleton-Boy on deviantArt,

why so curious?


hotspotdot is my entry into Microsoft’s My App is Better Challenge. In a nutshell, hotspotdot allows you to locate and tag “hot spots” that are important to you, allowing you to create a personal database of hot spots.

It’s a very simple app, utilizing PHP, SQL Server 2008, jQuery, jQuery UI, and the Google Maps API. I wrapped thing up in under 2 weeks, but in order to make the August 25th deadline there were a few features I didn’t get a chance to put in, such as preloaders, icons on the map, and searching by tag. I’ll probably devote some time to these in the coming weeks.

hotspotdot login

The goal of the contest was to create something showing off the power of SQL Server and Microsoft’s new PHP for SQL Server 2.0 drivers. I used the new PDO driver which was pretty sweet – very simple, elegant API. Two things in particular that impressed me were transactions (very nice for doing multiple inserts or deletions) and a consistent and well designed exception model (makes error handling much easier and especially powerful when combined with transactions as failed queries don’t effect the database [code jumps to exception handler before commit() is called], so no chance of junk being inserted). Error messages, in general, were also much more descriptive than those I’ve encountered with MySQL.

Finding a server proved difficult. I got a shared hosting solution, but the host was unable (though I suspect unwilling) to install the PHP for SQL drivers. So I ended up getting a virtual private server, but this only came with SQL Server Express and I used some features (see below) that prevented a migration. In order to avoid purchasing an SQL Server 2008 license (way out of my budget), my final solution was use the shared hosting server for the DB and the VPS for everything else. Hence the reason for the site being located at the my. subdomain, which maps to the IP of the VPS.

SQL Server 2008 is a fine system (despite some annoyances with the management studio)… though it’s really just a solid database system, which isn’t bad, but there’s nothing really impressive or creative about that. It’s not really leaps and bounds above a cheap solution like MySQL. The contest was about SQL Server, so I tried to do something that utilized a fairly unique aspect of the system: the geography data type. I wasn’t too impressed. It simply holds a (longitude, latitude) pair in a certain format, nothing more. The one big advantage of having a vector type like this would be doing comparisons based on distance but, as far as I could tell, this isn’t supported (my queries failed). Worse yet, in SQL Server Management Studio the display of the geography type is in hexadecimal, making things very cryptic… I couldn’t help but wonder why this is any better than using 2 columns and storing the longitude and latitude values independently. That said, the idea of richer/more-complex data types within a relational database is a pretty cool idea and it would interesting to see it taken further and beyond its current, primitive state.

hotspotdot map

hotspotdot map

Leave a comment if you find a bug or have any questions, comments, etc.

Flushing the local DNS cache

If your messing around with DNS records and finding that names are are not resolving to their new locations (this happened to me today), flushing the local DNS resolver cache may help (if not, you probably have to wait for DNS propagation or you configured something incorrectly). I only needed to do this on a Windows server, but I decided to dig a bit deeper to find out how to do this on other systems as well.

On Windows:

ipconfig /flushdns

On Linux it’s a bit more difficult and not as simple as ifconfig /flushdns. You can try to restart the nscd daemon (note the path may be different depending on the distro):

/etc/rc.d/init.d/nscd restart

However, nscd may not be installed on some distros (e.g. Ubuntu) and applications (e.g. Firefox) may keep their own cache. So you’ll need to restart the application in such cases. If your desperate, you can also restart the entire networking subsystem:

/etc/rc.d/init.d/networking restart

On OS X, Leopard and higher

dscacheutil -flushcache

On OS X, Tiger and lower

lookupd -flushcache

“Saving changes is not permitted…” in SQL Server 2008 Management Studio

The issue occurs when saving changes that would require dropping and recreating a table (e.g. messing around with columns). I would think a warning would be sufficient instead of a restriction that requires digging through the app options window (which is not even hinted at in the popup). I also can’t imagine how effective this would be; unless you design your schema perfectly the first time around you’d always encounter this issue and need to disable this “feature” as you made changes.

sql server 2008 management studio error

The fix is to go to Tools » Options » Designers and uncheck “Prevent saving changes that require table re-creation”

h/t to Deems’ Weblog for the solution.

Website thumbnails

Generating website thumbnails was a pretty hot topic a few years ago with the rise of services like websnapr, thumbalizr, and, perhaps the most well-known, snap shots. The popularity of doing this has faded somewhat, most likely due to the realizations that services like snap shots are not all that helpful and more of an annoyance than anything else.

I did my own thumbnail generator app a few years ago for a CentOS system. It was painful. I believe I was using gtkmozembed and just going through hell to resolve all the dependencies to get things running on a command line system.

With the WebKit stuff I recently put up, I decided to revisit the idea under .NET, and things were surprisingly easy. This is due to the fact that WinForms 2.0 has the Control.DrawToBitmap() method which makes capturing an image of the client area of a control relatively easy. I should mention, .NET 2.0 has the WebBrowser control, but I could never get the Control.DrawToBitmap() method to work; I always got a blank (white) image. The WebBrowser control is also undesirable because it’s based on IE6, so its certainly far from up-to-date or accurate rendering, even more-so than the outdated version of WebKit I’m using.

So let’s say we’re running a WebKit instance in a Panel (panel1), we can capture what’s displayed as follows,

Bitmap bmpOut = new Bitmap(panel1.Width, panel1.Height);
panel1.DrawToBitmap(bmpOut, panel1.ClientRectangle);

Here’s an example of a capture:

website thumbnail

There is one critical limitation; only the visible portion of the web page is captured. However, if a component to scroll and capture different portions of the page were implemented, and the final image was pieced together from these portions, a full page would be captured.

Another limitation is there there is no way to tell when the page is finished loading. Figuring this out requires digging into the depths of the WebKit codebase, I’m certainly not up for it, and it’s not for the faint of heart.

Goodbye to Google Wave

Google has announced it will be shutting it down.

I saw the demo of it in the Google I/O webcast last year, it seemed interesting, like Facebook comments but more professional and more generic (not limited to a closed social network); however, the idea of it as a service to replace email left me uneasy. I liked email. Sure it could be better, and Wave was in some ways better, but it didn’t seem substantially better. On a more ideological level, I also liked that email was vendor-free, I wasn’t chained to Google for my most important communication tool.

google wave logo

I was somewhat alone in this opinion. Most outlets were already predicting Wave as the next big thing and the end of email was fast approaching (nice summary from SAI).

Using Wave was disappointing. It was like being in an empty chatroom as no one in my social network was there. Lonely, but I figured that could change, this was, after all, just an early beta. Most striking to me was the 3-column design, which seemed like overkill and placed, IMO, an overload of information on the screen (I don’t think I’ve ever seen a successful app with a 3-column layout). More importantly the actual user interaction seemed quirky. You had your list of waves in the center column, but you replied to and created new waves in the right-most column. The information in the 2 columns were intimately linked, but the layout made the thread and its associated waves seem disconnected. A 2-column layout with a Facebook-comment-esque system in the right-hand column would seem to have been a better design and allowed for user content to claim the majority of screen real estate. One early lesson I learn working on apps: let the user’s content come through.

Beyond my first impressions, nothing brought me back to Wave. It wasn’t significantly better than email and having yet another messaging or social networking tool was a burden for me. It may have been an okay project collaboration tool, but the feature set never blew me away and my misgiving about the UI didn’t compel me to go in that direction.

QR Codes

QR Codes are basically just another type of bar code, but they’re cooler for a few reasons,

  • There’s no license to use them. From Wikipedia: “The use of the QR Code is free of any license. The QR Code is clearly defined and published as ISO standard. Denso Wave owns the patent rights on QR Code, but has chosen not to exercise them.”
  • Most smartphone have an app to decode them, and if the text is a url, the app can usually get you to the site quickly.
  • You can easily make them from a number of web apps, such as the one @
  • The codes themselves look pretty cool and iconic.

qr code for

I first noticed them on, where authors used QR codes to link to their articles page. The practice has since stopped and was pretty stupid to begin with, as the codes are really only valuable in physical setting; it’s still much easier to click a link when your in a web browser (yea, I do realize that’s exactly what I did above, but that’s more for demo purposes rather than accessibility). More recently, I’ve noticed them on Freelancers Union posters in the subway.

There many be a number of other potential uses. I met someone a while back who was, for whatever reason, focused on eliminating business cards and providing a digital means by which people could swap info. Not unheard of, but I really don’t think you can simplify a business card transaction with any great success – it’s already pretty damn simple. However, attaching a QR Code could be a good way of allowing someone to quickly get a digital copy of what’s printed on the card.

On a side note, it would also be awesome to see QR Code graffiti popping up one day.

Firefly 3

I noticed I never wrote anything about Firefly, but if you’ve looked at my portfolio, you may have seen it under the Game Tool section. Firefly is simply a tool to create 2d particle systems, for special effects in 2d games. I’ve been working on cleaning up the UI and adding support for more advanced features and fx, and here’s a new screenshots of how things look.

firefly particle fx editor

A few major points of interest:

  • A nicer, custom, iconified tree view showing particles and emitters.
  • 2 views vs. the 3 views in previous versions. The untextured preview was dropped, as it was largely unnecessary.
  • A custom listbox control editable properties replacing the standard property grid control (the property grid look terrible unless it’s heavily customized and it’s also fairly difficult to work with)
  • Paths for particles exhibiting non-linear motion are now shown correctly (previously, only straight lines were shown). I was looking into rendering Bézier splines, but this is difficult to do using just the fixed-function pipeline and just rendering a set of line segments was much simpler and worked quite well.

The rendering is still done using Managed DirectX, which still works great, but, unfortunately, is not supported for 64-bit systems, so the app has to be compiled as a 32-bit application and run atop the WoW64 subsystem.