Conversely, the 20 month old just beat a level of Xmas Angry Birds on his own.
Fun puzzle – Christmas Conundrum
Saw this puzzle on Chris Shiflett’s blog and was able to figure it out. Don’t read further if you want to try yourself…
First, I wrote down the numbers, and immediately noticed the first numbers “1024” and “512” were suspiciously binary… though, that seems somewhat coincidental now. However, I plotted all the numbers into a spreadsheet, then did a conversion to binary. I began thinking that maybe the 1s and 0s were like the beat of a Christmas song, so I tapped them out, and it didn’t seem to be anything. Though bits seemed to be like “Jingle Bells” or “God Rest Ye Merry Gentlemen”, they never played out for the entire song. I got a bit sidetracked, thinking this was a designer, that maybe the numbers should be converted to HEX values, and use those colors for something. Again, it didn’t pan out. Here’s where I was at that point:
Then, as I looked at the column of binary numbers, I noticed there was a pattern… not in the numbers, but in the shape of the groups of numbers. I converted the column to monospace type and started connecting the 1s. It really didn’t make sense at first… but I saw the last group of numbers made a Greek Sigma “Σ” and an “X”. So I thought “Sigma Chi”, a fraternity. The numbers above it made a “W” and a Sigma, and I thought maybe the “W” was supposed to be a Psi, but I couldn’t find anything relevant for “Psi Sigma”. At that point, I hadn’t connected all the 1s correctly, so I went back and connected all the 1s, even diagonally. The patterns became a lot clearer… but it still didn’t make sense. At that point, I had my table turned just a bit to the side, and noticed the Sigma could actually be a sideways “M” and the “W” a sideways “E”… so I had “E M M X”. With that, I saw I already had the “A” and a “Y”. Once I made one more missed connection of 1s, I had the two “R”s and figured the extra bit in the first group was an “!”. From there, it was a simple matter of re-ordering the letters to make: MERRY XMAS!
Thanks to Chris Shiflett for the fun diversion. Though, it looks like I missed submitting the correct answer by only a few minutes (congrats Cogocogo) … it was still an enjoyable brain exercise.
Breakin
Rammstein Steamroller
Mashup based on this.
Found an Old Song I Co-wrote
I used to have a site full of my old bands’ music, but that site went down and all those songs got trashed. I have them all backed-up on disc somewhere, but haven’t had a chance to go through all the stuff we have in boxes. Anyway, I found this mp3 in one of my archives and I’m posting it here for the time-being. Wow, it’s almost 10 years old:
NewIceEnemy – GirlTalk inspired mash
After seeing SO many tweets about how great and awesome and wonderful the new GirlTalk “album” is, I decided to do a quick mashup on my own. It seems the formula is: 1) find an instrumental hook from an 80s pop song, 2)get some rap acapellas, 3) grab a vocal hook from some other ironically cheesy song, 4) mix them together. In that vein, here’s my New Kids on the Block, Vanilla Ice, Public Enemy mashup:
keyboard
Things I Learned from Codeworks Austin 2010
I went to Codeworks Austin on Saturday, and it was kind of eye-opening. Lots of good info about how to better approach PHP development. Here’s what I learned:
- First and foremost, even after developing for over 10 years, I have a LOT to learn. In fact, there’s an alarming amount of stuff I DON’T know.My biggest issue, is that I originally learned PHP4 10 years ago, and it was very procedural. You wrote code from top to bottom, and it ran from top to bottom. After I started getting into it, I got my first programming job doing mostly Flash, ActionScript 2, and classic ASP using VBscript. I basically set aside learning PHP, since there wasn’t really a need in my day-to-day life. I picked it back up a couple of years ago, mostly for personal sites, but PHP5 had many new features, and I never had need to learn them all.
- I really need to master OOP. Again, my previous programming experience was ActionScript 2, classic ASP, and PHP4… which are all mostly procedural or functional. I’ve jumped ahead quite a bit in my OOP experience with getting into some of PHP Frameworks like CodeIgniter and CakePHP… but I need to get more comfortable writing my own classes outside of the frameworks.
- Speaking of frameworks, I might need to check out Zend. It seems a lot of people there were using Zend Framework, and the speakers seemed pretty happy with it. Also, I think I was the ONLY person there that isn’t using PEAR. So I should probably get on that as well. Though, working on a Windows machine, it doesn’t look all that straight forward.
- Speaking of Windows not being easy… it seems most people there were on Macs, and many seemed to be Terminal/Command Prompt ninjas. Since current Macs have Unix at their base, there is a lot of built in functionality that makes setting up a PHP dev environment a lot easier. However, I think I may go the Linux route, because… why not just go as hardcore as possible?
- Subversion/ Version Control. I’ve submitted one bit of code to Github, and that’s the ONLY time I’ve ever checked anything in or out, ever. In a multiple dev environment having version control is a necessity, but since I’ve been a “lone ranger” for all of programming career, I’ve never bothered to learn or implement it. Moving forward, with both my personal advancement and expanding my current job, I really need to get this up and running.
While the actual talks themselves were okay, they were mostly “overview” type stuff. Very little detail. But just seeing how other devs worked was the most education thing I took away. Lastly, I really want to get more involved with other events like that… and take my coding to the next level.
odometer
My Sacrilegious Twitter App: Jesus the Zombie
I like to play around with PHP and APIs and create silly, stupid things every now and then. After recently watching a number of zombie-themed shows, namely The Walking Dead and Dead Set, I thought it would be funny to have an app that would “eat” the brains of people’s Twitter avatars. And for whatever reason, I thought having a Zombie Jesus doing the eating would be even funnier.
I worked out the steps that needed to happen: 1) get a submitted user’s avatar from Twitter, 2) process the image so it looks like Jesus is eating the “brains”, 3) display/save the image, 4) send out a Tweet with a link to the picture.
Getting the avatar from Twitter is a fairly simple function:
function getAvatar($screen_name){
$url = "http://api.twitter.com/1/users/show.json?screen_name=".$screen_name;
$ch = curl_init();
curl_setopt($ch,CURLOPT_URL,$url);
curl_setopt($ch,CURLOPT_RETURNTRANSFER,1);
$return = curl_exec($ch);
curl_close($ch);
$return = json_decode($return);
return $return->profile_image_url;
}
Since you don’t need authentication, you just “curl” to get the user’s info, parse the json, and return the avatar’s url. Processing the image isn’t so easy. I’ve used the GD2 library in the past… for another simple app that put a custom message on Charlie from “Lost”‘s hand, in the episode where he wrote “Not Pennys Boat” on his hand, which I can’t seem to find now. GD2 is powerful, but not user-friendly at all. So I searched for a better solution, and found the amazing WideImage library. It does everything I needed, and I was able to map out the process I needed in a few minutes.
I grabbed the image from Twitter, resize it to 60px by 60px, then rotate it -45 degrees. Then I have a Jesus png that I use as a mask, with the section where the avatar goes being cut out… and some blood coming down for effect. To do the masking effectively, I had to then resize the avatar’s canvas to the size of the main Jesus pic, and position the avatar on the canvas to the area where the open area of the Jesus pic is. Then you merge the two pictures to make the final image.
After that, I just used “writeText” to put the caption on. I had do a second “writeText” in black for the bottom part, to give it a shadow, since just the white was being washed out. Once all that is done, I save the file. For the filename, I was originally using the timecode… but if by chance multiple people hit the site simultaneously, it might be hosed. So instead, I took the two submitted usernames and the timecode… and ran md5 on it. I’m assuming that will give totally unique names.
I didn’t want to be serving up the images solely on my machine, so I decided to use the TwitPic API to save the images. This also allowed me to skip using the Twitter API and do the actual post from TwitPic as well. Since this is a simple, fun project, I decided to use the legacy v1 of the API, because I didn’t want to mess with oAuth. Here’s that function:
function sendPic($file,$to,$from) {
$key = ""; // TwitPic API key
$consumer_token = ""; // Twitter application consumer key
$consumer_secret = ""; // Twitter application consumer secret
$oauth_token = ""; // the user's OAuth token
$oauth_secret = ""; // the user's OAuth secret
$ar = array (
"consumer_token" => $consumer_token,
"consumer_secret" => $consumer_secret,
"oauth_token" => $oauth_token,
"oauth_secret" => $oauth_secret,
"key" => $key,
"message" => "I just ate @" . $to . "'s brains at the request of @". $from ,
"media" => "@$file"
);
$url = "http://api.twitpic.com/1/uploadAndPost.json";
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $ar);
curl_setopt($ch, CURLOPT_RETURNTRANSFER,1);
curl_exec($ch);
curl_close($ch);
return true;
}
And that’s basically it. The only other bit of code-fu I used was to check the Twitter names people might put in… since sometimes people will use the “@” in front of the name, and other times they won’t. So I just ran a “strpos” checking for “@”, and if it’s at the 0 position, I “substr” to position 1.
As far as security, there really isn’t any. Since there’s no mySQL, I wasn’t too worried about it… as there’s not much to exploit with the simple code I used. I did set a session with the timecode, and if you try to submit the form more than once a minute, it sends an error… though that would be trivial to overcome.
Other than toying with it some more, I’m pretty much finished. Being wide open as it is, it’s very very VERY susceptible to spam… so I may implement a bit of oAuth eventually. Other than that, it’s really only amusing for a few times… after that, it’s just a bit annoying. So we’ll see if anyone else finds it humorous.


