Archive for the 'Web Development' Category

The Mona Lisa in PHP

Recently on Hacker News it has become common place to bash PHP. There was an article posted to the site with a title of “At 14, is PHP Finally Growing Up?” which started a slew of flame bait. I took it upon myself to post this morsel of a comment:

I would like to argue the C language argument here. If I want to shoot myself in the foot, the language should let me. If I want to paint the Mona Lisa, the language should let me. PHP does that.

That prompted a few snarky remarks about which resolutions and to what extent PHP could paint the Mona Lisa.

So I did it.

Full size: http://williamriggins.com/mona.php?x=400&y=571

Favicon Size: http://williamriggins.com/mona.php?x=10&y=10

Code (minus base64′d image constant): http://pastie.org/506643

Rails, OAuth and GameTweet

Yesterday I launched a little tool for twitter using Ruby on Rails, Capistrano (with Deprec), and OAuth called GameTweet. This is the first Rails application I’ve deployed since I started playing with the stack a few weeks ago. The idea for GameTweet came one night when I was thinking about the old TD clan website before the site went down. There used to be a feature for anyone who wanted to be text messaged when a game was about to start where a user could put in their phone number and carrier and any member of the site could send out a mass text to those on the list notifying them when they were going to play. Fast forward a few years into the future and we have Twitter, which works with most phones and can notify users when a message is posted.

The idea was simple: Use Twitter to notify my friends when and where I was playing a game, specifically a PC game.

I remembered that Twitter was implementing a new authentication method which might just work for something like this, as basic authentication always seemed dirty to me. Why would anyone in their right mind hand out their username and password? A quick Google for “Twitter OAuth in Ruby on Rails” and I hit the Twitter OAuth examples. It didn’t take much to fashion the quick and dirty example into a working system. Actually, I’d estimate I was in the single digit hour range as for work involved. It was simple, which seriously scared me. Capistrano and Deprec really made the process extremely painless. More on that later.

OAuth came easy. All I had to do was follow along in the step by step example from Twitter’s wiki and then register my application with Twitter’s OAuth Client page. Perhaps the hardest part was debugging and testing, as the current Twitter system doesn’t appear to have a test sandbox.

So GameTweet was born. Just login to Twitter via OAuth and then type the IP:Port combination of the server you’re playing on, then the name of the game, and hit “Tweet!”. GameTweet then uses OAuth to update your status with all that information as well as a tinyurl to the GameTracker server status page using the tinify_urls plugin.

Capistrano, the Ruby based task automator, is perhaps the single most amazing piece of scripting I’ve seen in awhile. Coupled with the deployment recipes from Deprec, I was able to manage everything from code checkout, releases, deployment and even the Apache configuration all from one “cap deploy”. I managed to get an installation of SMF2 (a php based forum) deploying with Capistrano as well. Really, it is a joy to work with. After making a quick change to GameTweet I just had to run an “svn commit” and “cap deploy” and everything is up on the server with the latest code, database schema, and Passenger restarted the application.

That said, GameTweet has absolutely no test harness. I’m still learning the ropes with Ruby and Rails, but I do plan on eventually implementing a full test bed. OAuth is perhaps not the best thing to start with, but GameTweet was a tool I wanted to use for myself so I built it. Fast.

If you have an idea for GameTweet, want to talk shop, criticize my horrible Ruby on Rails code, or just talk pop me an email using the contact form or send me a tweet.

ASP.NET Pandora, iTunes Mashup

What is it?

Last week I had some down time and manage to crank out a relatively basic mashup of the iTunes Libary XML file and Pandora’s favourites feed. Essentially my code reads in the iTunes XML file and converts it into a readable form using XSLT then grabs the Pandora feed and compares the two using XPath.

The application is written in VB.NET on the ASP.NET platform. Yes, I know, VB is the poor ugly stepchild language but we use it at work and it was far easier to pick up and go. C# is on the docket for the next project, I promise. That said, I’m hoping to get some Ruby and Python up here too. I just need to get a ticket in with my Linux hosting provider.

Why did you write it?

I wanted to write this application for awhile but I never had the time or the motivation. Thankfully boredom breeds innovation for me. I had started the code months ago and abandoned it after getting stuck on the WebRequest to Pandora. I managed to dig up the code last week and had a few eureka moments which lead to release worthy code.

The reason behind the construction of this application is that I use Pandora every single day. I practically need their radio service to work. One thing that I do when I’m listening is bookmark the songs I like, and mod them up with the thumbs up button. It’s intuitive and quick to do which is great. However, when you’re ready to plop down a bunch of money on new music how do you know which songs to buy? I always forget to update my favourites list to remove the songs I’ve bought, and I’m too lazy to search my iTunes every time I want to buy a song. Sure, iTunes sometimes prevents you from buying the same song twice, but having been bitten by that bug before I’d rather have a third part verify that for me.

Improvements, Ideas, Concerns

The application is very rudimentary and will be sitting on a very restricted shared hosting environment. The code is definitely not rocket science, but it works for the most basic use case. That said, it doesn’t handle advanced searches or merge results for remixes and the like. It isn’t using a special algorithm for matching. It just does a direct XPath contains on the artist and song title. If it doesn’t match, the application will falsely mark it as if it doesn’t exist in your library. Likewise, single quotes are currently not handled correctly because I was lazy and XPath parameterization looked like a pain. This is just a proof of concept.

iTunes XML files can get pretty big. I think my library file was almost 6mb, which is rather large for a web upload. I might look into letting users upload a zip file and decompress it on the fly. Not sure how you’d go about that though. My guess is this application will thrash the server with IO under load.

One of my coworkers/friends suggested implementing affiliate IDs for the various music stores and injecting those into the application in order to generate revenue. If I ever wanted to turn this into a real product that might be a way to monetize, but rest assured that isn’t implemented at the moment. If anyone wants to see this as an actual product, feel free to drop me a line.

Where is it?

It will be hosted on my new domain at once the kinks are worked out. GoDaddy’s Windows hosting is far from perfect, but it gets the job done. Unfortunately, it appears they are trying to proxy my WebRequest and XSLT discovery outgoing sockets which is throwing an error. I have a ticket in to find out what I can do to fix that.

If you are interested in seeing the code I’ll gladly post it. Right now it isn’t up to much and still needs some cleaning up so I’ll leave it off for now.

Where have I been?

An excellent question. Where have I been?

In the past 12 months I have gotten married, switched jobs, adopted a kitten and moved back to the big city. You could say I’ve been in quite a few places doing any number of things. To explain though, I left WeatherFlow to return to Orlando to be closer to friends and family. Working there was perhaps the best decision I had made as I was able to learn quite a few technologies in a short amount of time, meet some very bright and driven people, as well as work on some amazing projects. If it wasn’t for WeatherFlow I wouldn’t be where I am today.

Where is that, you ask?

Well, I’m currently working for one of the largest defense contractors in the world. I work for the division which creates internal HR Applications for the company. Definitely a change from my usual 6-12 developers in a room and rapid application development. I picked up some legacy ColdFusion code and helped the team hit a couple releases before I was reassigned. From there I joined a small VB.NET/ASP.NET development team working on some internal applications which were eventually shelved, or made it into Phase II.

During the colder months I took on a stretch assignment to help another team which had been working with a 3rd party software vendor. Essentially, I have been testing and deploying the application for our internal team and managing the correspondence with the vendor. I’ve been learning our software engineering process, IIS configuration, account provisioning, writing SOI’s, hosting meetings and trying my hand at application deployment and environment configuration. Really, it has been a great learning experience thus far and I am looking forward to this new fiscal year.

Where do I go from here?

I am hoping to post more code on this blog, as well as start a few new projects on the side. I have a small Pandora/iTunes mashup written in VB.NET/ASP.NET 3.5 which needs a home. Hopefully I can find some hosting shortly and get that one up and running.

This year my goals are lofty:

  • Learn ASP.NET MVC with C# & jQuery
  • Learn Python & Django
  • Learn Ruby on Rails
  • Get Certified, whether its an MCPD or MCTS just do it.
  • Write something useful.
  • Become a better technologist and developer.

As always, I want to keep current and stay on top of the industry changes, and filter out the hype from the reality. Agile this, rails that are great things to investigate but what is the business case? What is the need? Hopefully this year I can find the time to publish some articles recounting those very things from my own point of view.

I hope that brings everyone up to date. I am still here, and hopefully I’ll be posting more in the weeks to come.

Mike Potter, Adobe – Thanks Guys!

So, I was checking my mail today and a mysterious package arrived from Amazon. Now, it could have been anything but to my complete shock and awe, it was from Mike Potter at Adobe. Here are some blurry photos from my phone:

WrappedCardBook

I had added the cookbook to my Amazon wish list shortly after Flex 3 was released, as I wanted to dive in and learn everything I could about the newest version of Flex. I really appreciate the gift, and to all of the Adobe team, thank you. You guys have delivered a great product, and you really know how to reach out and touch the community.

Flex Web Cam Effects Demo

Just updated the blog to WordPress 2.3.3 and figured it was time for another post. Today on InsideRIA.com they posted a rather interesting post about Flex graphical filters. Now, I’ve wanted to do this sort of thing for a very long time, but only today had the down time to give it a try. Basically, the application I’ve attached shows your regular web cam feed on the left, as well as a filtered feed on the right. I’ve only scratched the surface with what you can do with filters, combining filters, and the like but the demo serves a very useful purpose.

When my boss saw my little demo running his first comment was, “Wow, that’s fast.” and he was right. Flash was rendering the filtered stream in real-time; side-by-side with the regular output. Granted, blurring and practically inverting the colors isn’t rocket science, but the applications are limitless. Personally, I’d love to see a background subtraction library for Flex with other real-time video processing effects. My guess is that someone over at Adobe already has something to this end for working with YouTube Remixer and similarly powered applications.

Code and source after the break…

Continue reading ‘Flex Web Cam Effects Demo’

OnAir Bus Tour – Atlanta

This post is kind of a stub, I’m sitting in the Fox Theatre ready to live-blog. ;)

The event started awhile ago, and I’ve been blogging it as it happens. As always, you can always hit the live video feed instead of reading my transcripts & witty commentary as well.

A special thanks to WeatherFlow Inc. for flying me out to the tour.

Information: http://onair.adobe.com/schedule/cities/atlanta.php

Live Feed: http://onair.adobe.com/live/

Live blogging after the jump…

Continue reading ‘OnAir Bus Tour – Atlanta’

MyBlogLog Plugin Update – In demand?

Well, it’s been over a year since I released my WordPress MyBlogLog plugin, and I’m still getting emails about it. Honestly, I’m very surprised that this thing still works. If you’re using the plugin now, or want to, let me know! I think it is time for a big code overhaul, and perhaps some new features but there is no sense in developing this plugin if there’s no demand. If you’ve got an idea, post it up and I’ll do my best to get it out there in the wild with the next release. I did notice the guys over at MyBlogLog have been hard at work improving the JavaScript and their own feature set as well which means I should probably update the plugin pretty soon. Also, I am aware of the missing readme file! Please, I know about it, and I’ve posted about it. I promise, next release, you all will get an extensive readme!

Anyways, it amazes me how far MyBlogLog has come since the day I registered and alpha tested it. Really, you have no idea how simple the idea was at the time. Todd, Eric, Steve, John and the rest of the crew over there at Cloudspace and Yahoo, my hats off to you guys.

Chumby – First 50

The chumby is a compact device that displays useful and entertaining information from the web: news, photos, music, celebrity gossip, weather, box scores, blogs — using your wireless internet connection. Always on, it shows — nonstop — what’s online that matters to you.

I just got an email from the guys over at Chumby.com and they’re about to run a 50 person beta run of sorts. I’ve applied to get on the team, and I’m looking forward to it. The work I’ve been doing recently really would look amazing on one of these, as I’ve been working on a flash version of our companies’ wind graph. Basically, it’s a real-time, on site wind graph of our weather stations. So, the Chumby is really the perfect vessel for this thing, albeit a strange one.

Chumby

Subversion: Working With HotCopy

Well, I am almost finished moving all my data onto my brand new MacBook Pro 15″ when I realized I needed to move my Subversion repositories. I’m not an expert on Subversion, nor will I ever claim to be but this might just help a few people out. When I made the backups of my repository I went with the trusty ‘svnadmin hotcopy old_repos new_repos’ option and had a plug and play backup to restore when the time came. Now, I couldn’t find a single reference on how to restore from a hotcopy, and it certainly wasn’t obvious to me so… Here’s what I did:

  1. Download the OS X SVN Installer from Martin Ott’s Site
  2. Install the package.
  3. Make a .profile file in your home directory and paste the following into it: export PATH=$PATH:/usr/local/bin
  4. Issue a ‘svnadmin recover repo_hotcopy’ to start the BDB again.
  5. Ta da, it’s done!

Strangely, that seemed to have fixed everything! Now, that might’ve been the most obvious thing in the entire world to a SVN guru, but it wasn’t to me. I did issue a ‘killall svnserve’ and then a ‘svnserve -d -r repo_hotcopy’ before testing it, but it checked out with SVNx and everything looks good.