Buk Life

ROBERT
REINHARD

CTO

If someone wrote the lore of BKWLD, the turning point chapter in our story would be the day Robert was hired. It's been Robert's technical direction and dedication to learning new technology that has kept BKWLD at the forefront of our industry.

31 December 2009

Photos from Sacramento summit

The SEA office flew down to Sacramento before the holidays to meet in person as a group, plan the next year, and have fun together over 4 days.  My shoulder was (and is) out of commission (bike accident) so I missed this years ski trip to Tahoe; it sounded like everyone got along fine without me though.  Going up to Tahoe is sort of a BKWLD tradition at this point, I think this was the 4th or 5th time.   Of all the photos I took, these came out the least blurry, which is pretty sad.  If someone with more skills and a better camera has some shots, please replace mine in this post!

Happy New Year everyone, looking forward to an amazing 2010!

Tags:

6 November 2009

Two requests per subdomain

I recently learned that  the http spec suggests browsers only open two simultaneous connections to a given subdomain at a time.  I haven’t tested to see how widely adopted this is.  Though I have noticed in Safari, looking at the activity viewer, that if the page requests many large assets (like a flash audio player where the user has advanced through tracks quickly), file requests start to queue up.  In a recent blog by Campaign Monitor, they mention that they server images from multiple subdomains at a time so the web browser opens up more connections at time.  You don’t even need multiple servers.  You could wildcard the subdomains on your webserver and serve up a unique subdomain.  As pointed out on Stack Overflow, you don’t want to choose a completely random subdomain on every request or the browser can’t cache the image.  It’s a pretty extreme optimization technique , though something to keep in your toolbox.

4 November 2009

Amazing Halloween costume

From here.
4067411423_8979d89588_o4067409759_1d194f2342_o

1 From here. Robert Reinhard,CTO

November 4th, 2009 at 08:02 PM
Posted By: Robert Reinhard in General

7 October 2009

VPN through PHP on (MT)

It’s been a two day quest, but I’ve finally gotten our web server to talk to a remote SQL server over VPN.  I wish I could document the steps as a how to (I’d like it for myself if I have have to do this again), but I’ve tried so many things I’m not sure which steps are true dependencies and which are extraneous.  First, the server in question is a LAMP server, running Plesk, hosted at Media Temple.  For the most part, it’s a vanilla configuration.  Here’s some of the things I learned in the process of getting this up:

  • The VPN is of the Cisco type, but using their linux software was a dead end.  I couldn’t get it to compile, it needed kernel headers and patches and on and on.  Eventually, I was directed to using VPNC.  There are scripts that convert pcf files to the format VPNC uses.  Also, you can store the VPN password within the config file, which is perfect for my situation.  If I feel like enduring further pain, it may be useful to get this working locally and stop using the Cisco Mac client altogether.
  • It turns out you need to be running as root to use VPNC.  Thus, for the users that would be running this, I had to add entries to the sudoers file.  I made it passwordless because I knew I’d be calling it from PHP.
  • I had to allow /usr/local/sbin as an open_basedir in php so that I could call VPNC.
  • From exec(), I needed to use the full path to VPNC.
  • Lastly, and this was particularly painful because I knew I was sooo close at this point, I had to comment out “Defaults requiretty” within sudoers.  When this is on, it prevents you from running sudo outside of the command line.

This was a very frustrating journey so hopefully this helps someone else.  Or me in the future.

17 September 2009

Alphabetize a mysql table

Say you have a table of names that you want to alphabetize.  Of course you could SELECT and ORDER BY name ASC.  Lets assume that’s not an option and you want to save their alphabetical order in a special column so then you can ORDER BY this column.  This might be useful if you have an application where users can manually order their items but you give them them option to reset to alphabetical.  Here’s what your table looks like:

people
- id (int)
- name (varchar)
- sort (int)

Here’s how you can populate that sort column with integers that, when ordered by, put the results in alphabetical order:

SET @i=0;
UPDATE people
INNER JOIN (
SELECT id, @i:=@i+1 AS i FROM people ORDER BY name ASC
) counter ON counter.id = people.id
SET people.sort = counter.i;

The SET command initializes a variable.  The subquery orders the list and adds a new column (i) that counts off each row effectively.  Then the outer query joins on this by the PRIMARY id so that we match the ordered row from the subquery with the outer query.  And lastly, we store the i value back in the table.

Tags: ,

16 September 2009

Batch change collation

Picture 1I’ve never understood (well, I’ve never looked into) why MySQL defaults to that swedish collation.  If your tables are a mix of collations, here is a nice php script that will convert all the tables to the collation of your choosing.  It even has a nice GUI you use in the web browser.  Download the script here (courtesy of phoca.cz).

Tags:

7 July 2009

Amazon S3 Tricks

We use Amazon S3 as an easy and cheap CDN on many projects. Here’s some interesting things I learned recently while researching how to stop direct downloading or linking to media files:

  1. Any file on S3 can be turned into a torrent by adding ?torrent to the filename.  As in http://bucket.s3.amazonaws.com/myfile.zip?torrent.  I read about this over here.
  2. S3Stat looks like a useful tool for viewing your S3 logs.  In particularly, checking for direct linking from other sites.
  3. You can make auto expiring links using S3 (documentation here).  This is the meat of what I wanted to find out.  Using the Query String Request Authentication (page 24 of the PDF) you can specify an expire time for a link.  As I take it (and we haven’t implemented this yet, so I’m not positive), you would set the read access of the file to “Authenticated Users.”  Then you would construct the URL to the file using your public AWS access key, the expire time, and then a signature that includes a hash of your request with the expire time and your private key.  So if you set the expire time to something only a few seconds after the current timestamp, that link should not be useable again.

6 July 2009

Copy paste between Fireworks and Flash

I don’t often batch import layered files (PSD, PNG) into Flash or even copy graphics into it.  But what I DO find really handy is copying text between the apps.  This worked in CS3 but it’s gotten better (more accurate) in CS4.  You can copy a whole group in and the font, size, and color are all maintained (or close enough, you usually have to nudge line height).  This saves tons of time when you’re populating a whole FLA from a text heavy design while keeping the text editable for the inevitable copy change.  Notice in this video how I can bring in multiple text boxes at a time.

16 June 2009

Calorie counter

Picture 3Doing research for a pitch I found the USDA National Nutrient Database.  I haven’t found an elegant API for it, but at the very least you could use curl and screen scrape what you need.  But wow, it’s deep.  A great resource for providing data for a health related site.  It looks like you can download the database whole and implement it locally.

Tags:

15 June 2009

Augmented reality mobile game

Jeff passed this around earlier this month, showing a practical use of augmented reality that was handled very elegantly by AKQA.  This isn’t flash, but shows another huge leap for this emerging technology:

0 Jeff passed this around earlier this month, showing a practical use of augmented reality that was handled very elegantly by AKQA.  This isn’t flash, but shows another huge leap for this emerging technology: Robert Reinhard,CTO

June 15th, 2009 at 10:59 AM
Posted By: Robert Reinhard in Distractions