Aneal Khimani

Life doesn’t stop coming at you

by Aneal on Feb.25, 2012, under Slacking off

In case you haven’t noticed, I haven’t posted a new blog entry here in several months. Please believe that it isn’t because I haven’t had anything interesting happen to me since my last post. Quite the contrary.
I’ve written several interesting applications that I’m pretty proud of. I’ve been killing it at the office and have finally organized my life enough that I appear to outsiders to be an adult.

I’ve written a few times before about the PHP jukebox I was working on. Well that is a reality now. It’s a fairly slick little application. It works pretty similarly to how some of those digital jukeboxes you see at the bar work. There’s a screen that displays several album covers. You click an album cover, you are presented with the tracks on that album. You choose a track and blamo, it adds the track to the current playlist. My version has a few extra bells and whistles too. It tracks all the plays across every album. So you can see which songs/albums/artists are most popular. Also, it constantly tracks what song is currently playing and offers suggestions at what other songs on the jukebox are similar to it (if Metallica is playing it displays “You might also like Guns-N’-Roses). Snazzy.

But of course, I’m never satisfied. I’m already in the planning stages for version 5. Gonna be a complete new build from the ground up. Since HTML 5 has that snazzy new <audio> API, I’m gonna leverage that power and make the browser play the music natively. No longer will I have to piggyback on Winamp for my audio playing capabilities. This iteration of the jukebox will have the ability to access the Youtube API to pull the official music videos of some of the songs in the list and will offer the option of showing the video of the song (letting Youtube control the audio as well).
I’m gonna try to find a good online Lyric database to populate that data for each track in the jukebox as well. So, you could theoretically end all those arguments about exactly what Jimi Hendrix meant when he sang “Excuse me while I kiss this guy”.

I’m also going to split out my albums into their own table in the database this time around. This was a pretty big limitation in my previous version. Also, I’ve added an ‘active’ field to all songs and albums too. That way I can control exactly what songs/albums or combinations of the two are accessible (just in case I throw an “all ages” cookout or something; I can turn off all the 2 Live Crew). I also plan on including some interesting configurations options to control the whole beast. Limiting albums according to genre, adding an ‘attract mode’ which will play random songs at a specified interval if nobody is interacting with it, color schemes, layout schemes, turning on/off features. Should be pretty rich when it’s done. Heck, I might even make a version available online for folks to download when I’m done… We’ll see how much flexibility I decide to add in.

At any rate, it would seem that I’ve contacted a Real Estate agent who has put me in touch with a Mortgage Broker, and the wheels are spinning towards me purchasing a house later on this year. The broker says it’s just a matter of finding a place, making a down payment and signing papers. I’m currently working pretty hard on saving dough to make that down-payment part happen. Should have my goal around the end of the year. I intend on moving downtown (or close to it) so I can be closer to the office. My daily commute is pretty life-sucking.

I’m also going to seriously ramp up looking for freelance IT work. I have skills. People have IT needs. There’s no reason we can’t get those people and me together so they get solutions and I get money. Seems simple enough right?

That’s it for now.

Leave a Comment :, , more...

QR Code and PHP – Quick project

by Aneal on May.13, 2011, under PHP, iPhone

Hello all,
I know I haven’t written anything useful here in a few months, but tonight as I was working on one of my big projects (PHP jukebox) I got a flash of inspiration and threw together a really quick and dirty little trick that many of you can duplicate in just a couple minutes.

Every day the line between what your TV does and your PC does is blurring. TV’s today are shipping with Netflix apps embedded, and your PC is no doubt packed with movies, music and other such media. Many of us however still have a pretty expansive DVD collection. I was thinking that I wanted a quick and easy way to watch any of my DVDs on my PC without having to take the disc outta the case, march it over to my PC, open the disc tray, launch etc. Even better, I wanted a way for ANYONE who comes over to my place to be able to do this. The answer? QR codes!

If you’ve been living under a rock for the last few years, you haven’t seen anything like this:

QR Code

This is a QR Code. It’s basically a fancy bar-code that can holds lots more interesting data than just a UPC code. If you’ve got a smartphone, odds are you have some sort of QR reader already installed, or can grab one from the app store your phone is tied to. These codes are easy to generate too. There are several places on the web that will do it for you (even Google Charts will).

Basically, you can dump a phone number into the QR Code Generator, it’ll spit out a little QR code for you to use. When you scan that code w/ your iPhone, blamo it’ll dial the phone number. You can send a vCard to the QR generator, scan the output, blamo, you’ve added a contact to your phone’s address book.

The bit I used was to encode a URL into the QR Code.

Sooooo…

I grabbed one of the DVDs from my collection (Episode I, Star Wars of course), stuck it in my PC and ripped it to AVI. Then I wrote a small PHP file that lets me launch the file. It looks something like this:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
<?php
if (isset($_GET['itemID'])){
    launchItem($_GET['itemID']);
}

function launchItem($item){
    switch($item) {
        case 0:
            exec("F:\Movies\Star Wars\Star Wars Episode I - The Phantom Menace.avi");
            break;
    }
}

?>

Let’s go over this:
First I check with an if statement if the Super Global $_GET is set. If it is, then I analyze the data that gets passed in (‘itemID’) with a switch statement. There’s only one case to check against in this demo, but you could theoretically write as many as you want. Heck, I’d even go a step further and create a small database to grab the files from there… But I digress…

Keep in mind that you’ll need to have this php file on your web server somewhere for any of this to work. I’ve got a Windows machine and use a WAMP stack for this. If you’ve read any of my other posts, you should already know what this is.

Next step, create a QR code! So I jumped out to Google Charts and generated a URL that points to that PHP file above on my WAMP server on my local network. In my case the URL was:

192.168.1.64/xampp/sandbox/phonelaunch?itemID=0

See the ?itemID=0 bit? That’s where the itemID comes into play with the GET super global in PHP. Anyhoo, PHP tutorials isn’t what this post is about.

Then I printed the code out, taped it to the back of my DVD case and done. Now all I have to do is make sure my phone is connected to the network, scan the code w/ my iPhone and my PC starts the movie, Jar Jar Binks and all.

One could theoretically rip every DVD, CD etc they owned, create a QR code for each and attach it to the case, tweak the PHP above and have your whole media library launchable from your phone. The cool part is when my girlfriend comes over, she can decide what we watch and launch the move from her phone too. No phone side code needed at all! Heck, if you knew my outside IP, you could launch a movie on my machine! Is this slick or what?!

1 Comment :, more...

Blogroll

A few highly recommended websites...