Monthly Archives: March 2010

Using Cursors with PHP MySQLi and Multiple Prepared Statements

After my post on using PHP MySQLi and multiple prepared statements at the same time someone commented that using cursors could do the same thing. With that comment I dug some more and found that modifying the cursor type that is used under the covers will indeed let you execute multiple prepared statements concurrently on the same connection.

First off you may ask yourself why you would want to use this. The best answer I have for that is that the solution in the other post loads the entire result set into memory from the very start while with this solution you can control just how many rows you load. To get started you will want to take a look at the MySQLi statement set attribute call. This call is will let you modify the underlying cursor type that is used with the prepared statement in two ways that are useful for this issue.

Continue reading

Parsing the SXSW Twitter Stream for Fun

Over the weekend I decided to toss together a simple twitter stream monitoring app that would capture SXSW tweets. I wanted to build on some of what I learned while hacking together the stuff for code2009 and it was also an excuse to play with node.js and a few other things. I figured I would put together a quick post with all the different parts and as I have time I'll pull together some of the more important sections into larger posts. Be warned that the site may stop functioning since it was only a few hours work and mostly put together with bailing wire and gum.

Server side:

  • node.js – Used to process the long polling requests
  • ngnix – Front for multiple nodejs instances and serving some static files
  • underscore.js
  • rabbitmq – Used to monitor the realtime feed
  • Redis – Used as a datastore for everything
  • ruby – Used to glue a bunch of things together, tons of gems used
  • Resque – Used to handle the screen captures

Browser side:


Using Daemon-Kit and RobustThread to Build Ruby Daemons

On a number of occasions I have found myself needing to assemble a daemon process for some type or processing done using Ruby. Each time I roll things a little different and I finally started to wonder if someone had already put together tools for doing the daemon parts. After some quick digging I ran into Daemon-Kit and after adding it together with a couple other tools it seems like what I've needed. I've put together a few recipes here to help guide others who might be looking for something similar.

Continue reading