Three Liquid Galaxy Projects Accepted for Google Summer of Code 2011
Yesterday the student proposals accepted for the Google Summer of Code program were announced. The Liquid Galaxy Project, participating in the program for the first time, accepted three proposals. These projects will dramatically extend the functionality of the Liquid Galaxy system:
New Control Input Devices and Distributed GL Rendering — Paul Hunkin, mentored by Andrew Leahy
Paul is a PhD student and has been running Liquid Galaxy on his university display wall for some time now. This project will initially target Microsoft’s Kinect as an input device for Liquid Galaxy, and may also leverage ClusterGL for distributed GL Rendering of Google Earth and other OpenGL applications.
Network Sync in Irrlicht — Ben Wright, mentored by Ben Goldstein
Google Earth is certainly a “killer app” for the Liquid Galaxy platform, but there are many other applications that could be easily enhanced, coordinating multiple instances rendering portions of a panoramic view. This project will modify the 3D Open-Source graphics engine Irrlicht, enabling many 3D applications using this platform.
Android Phone Accelerometer as Liquid Galaxy Input Device — Reese Butler, mentored by Adam Vollrath
Currently, the …
visionport
Postgres query caching with DBIx::Cache
A few years back, I started working on a module named DBIx::Cache which would add a caching layer at the database driver level. The project that was driving it got put on hold indefinitely, so it’s been on my long-term todo list to release what I did have to the public in the hope that someone else may find it useful. Hence, I’ve just released version 1.0.1 of DBIx::Cache. Consider it the closest thing Postgres has at the moment for query caching. :) The canonical webpage:
http://bucardo.org/wiki/DBIx-CacheYou can also grab it via git, either directly:
git clone git://bucardo.org/dbixcache.git/or through the indispensable github:
https://github.com/bucardo/dbixcacheSo, what does it do exactly? Well, the idea is that certain queries that are either repeated often and/or are very expensive to run should be cached somewhere, such that the database does not have to redo all the same work, just to return the same results over and over to the client application. Currently, the best you can hope for with Postgres is that things are in RAM from being run recently. DBIx::Cache changes this by caching the results somewhere else. The default destination is memcached.
DBIx::Cache acts as …
database performance perl postgres
RHEL 5 SELinux initscripts problem
I ran into a strange problem updating Red Hat Enterprise Linux 5 a few months ago, and just ran into it again and this time better understood what went wrong.
The problem was serious: After a yum upgrade of a RHEL 5 x86_64 server with SELinux enforcing, it never came back after a reboot. Logging into the console I could see that it was stuck in single user mode because there were no init scripts! Investigation showed that indeed the initscripts package was completely missing.
I searched on bugzilla.redhat.com looking for any reported problems and didn’t find any. I reinstalled initscripts, rebooted, and the server was fine, but it was not happytimes to have that unexpected downtime.
Tonight I ran into the problem again, this time on a build server where downtime didn’t matter so I could investigate more leisurely.
The error from yum looked like this (the same problem affected the screen package as affected initscripts):
Downloading Packages:
screen-4.0.3-4.el5.i386.rpm | 559 kB 00:00
Running rpm_check_debug
Running Transaction Test
Finished Transaction Test
Transaction Test Succeeded
Running Transaction
groupadd: unable to open group file
error: …hosting linux redhat security selinux
Determining dominant image color
This grew out of a misunderstanding of a client’s request, so it never saw the light of day, but I thought it was an interesting problem.
The request was to provide a “color search” of products, i.e., “show me all the orange products”. Finding the specific products was not a challenge since it was just a database query. Instead I was interested in how to choose a “representative image” from among the available images for that product. (And as it turns out, the image filename gave me that information, but let’s assume you don’t have that luxury: how do you tell, from a group of images, which one is “more orange” than the others?)
Of course, this depends on the composition of the image. In this case, I knew that the majority were of solid-color (or two- or three-color at most) products on a white background. The approach that was settled on was to severely pixellate the image into something like 20x20 (arbitrary; this could be very dependent on the images under study, or the graphics library in use). If you also supply a color palette restricted to the colors you are interested in matching (e.g., primary, and secondary colors, plus perhaps black, white, and gray), you would have a …
graphics
Use ZIP+4, except when you shouldn’t
The USPS provides a handy API for looking up postal rates on the fly. Recently it started failing for code that had been working for a while, so I investigated. I found a couple of different problems with it:
- First, the “service description” field had been “augmented” by including copyright symbols via HTML mark-up. That meant internal comparisons started to fail, so I “canonicalized” all the responses by stripping out various things from both sides of my comparison.
$string =~ s{&(?:[a-z/;&])+}{}gis;
$string =~ s/[^a-z]//gis;
$string =~ s/^\s+//;
$string =~ s/\s+$//;
$string =~ s/\s+/ /gis;- Second, I found that the API inexplicably rejects 9-digit ZIP codes, the “ZIP+4” format. That’s right, you can’t look up a domestic shipping rate for a 9-digit ZIP. The documentation linked above specifically calls for 5-digit ZIPs. If you pass a 9-digit ZIP to the API, it doesn’t smartly recognize that you’ve given it too much info and just use what it needs. Instead, it throws an error.
So the API got too clever in one regard, and not clever enough where it counts.
perl
Virtual Page Tracking and Goals with Google Analytics
Sometimes I come across websites that don’t use RESTful URLs or have too unique (with an order number) URLs during checkout and I need to implement Goal Tracking in Google Analytics on these user interactions. I’ve also had to implement Goal Tracking in a non-ecommerce web application where tabbed on-page browsing guides users through a 3-step process. Examples of situations that pose challenges to traditional page tracking in Google Analytics include:
- Throughout Interchange’s checkout, URLs are posts to “/process”, which makes the user interactions difficult to distinguish.
- Throughout Spree’s checkout, URLs are posts to “/order/:id/edit”, which are distinct and can be difficult to aggregate.
- In a Sinatra application we developed recently, the single page URL is “/locate.html”, but tabbed browsing occurs through three unique steps.
Google Analytics Tagging
To add Goal Tracking by URL, pages must first be tagged as “virtual pages”. To implement virtual page tracking in Google, it’s as simple as including a new virtual page URL in the _trackPageview action:
<script type="text/javascript">
var _gaq = _gaq || [];
_gaq.push(['_setAccount', …analytics ecommerce javascript
DBD::Pg query cancelling in Postgres
A new version of DBD::Pg, the Perl driver for PostgreSQL, has just been released. In addition to fixing some memory leaks and other minor bugs, this release (version 2.18.0) introduces support for the DBI method known as cancel(). A giant thanks to Eric Simon, who wrote this new feature. The new method is similar to the existing pg_cancel() method, except it works on synchronous rather than asynchronous queries. I’ll show an example of both below.
DBD::Pg has been able to handle asynchronous queries for a while now. Basically, that means you don’t have to wait around for the database to finish a query. Your application can do other things while the query runs, then check back later to see if it has completed and grab the results. The way to cancel an already kicked-off asynchronous query is with the pg_cancel() method (the other asynchronous methods are pg_ready and pg_result, which have no synchronous equivalents).
The prefix “pg_” is used because there is no corresponding built-in DBI method to override, and the convention is to prefix everything custom to a driver with the driver’s prefix, in our case ‘pg’. Here’s an example showing one possible use of asynchronous …
database dbdpg perl postgres
Ruby, Rails, and Ecommerce
I’m a big fan of Ruby. And I like Rails too. Lately, I’ve been investigating several Ruby, Rails, and Rails ecommerce framework options (follow-up to discussing general ecommerce options). I’ve also recently written about developing ecommerce on Sinatra (one, two, and three). Most of End Point’s clients are ecommerce clients, so we’ve seen it all in terms of feature requests (third party integration like QuickBooks, search, PayPal, product features like best sellers, recommended items, related items, checkout features like one-page checkout, guest checkout, backend features like advanced reporting, sales management, inventory management). Our services also include hosting and database consulting for many of our ecommerce clients, so we have a great understanding of what it takes to run an ecommerce solution.
When it comes to ecommerce development, someone who likes coding in Ruby (like me) has a few options:
- Ruby DSL (e.g. Sinatra)
- Pure Rails
- Open Source Ecommerce on Rails: Spree, ROR-Ecommerce, Substruct. End Point admittedly has the most experience with Spree.
Here’s a run down of some pros and cons of each option:
| Pros | Cons | |
Ruby DSL |
|
ecommerce ruby rails