Web App #1 - A Facebook App

Posted in Facebook, php on November 23rd, 2009 by helloworlder – Be the first to comment

This was my first Facebook app and can be found at http://apps.facebook.com/try-to-pronounce-it

What the app does it let you upload pronunciations of phrases in a foreign language and share it with others. I think the fatal flaw of this app would have to be that users have to upload WAV files instead of any format they want. This opens up a lot of issues with usability. For example, the windows sound recorder does not by default save the recorded sounds as WAVs, and since WAVs are uncompressed they are large. In addition, streaming WAVs in the browser is awkward - whereas with MP3 files I could just use a SWF player to stream the files in a nice way.

In fact, at once point I had successfully implemented the FFmpeg library to allow the user to upload almost any file type they want, and the app would automatically convert that file to MP3. Also, since the files were all in MP3 format, I could stream it in a nice SWF player. Unfortunately I discovered that the MP3 (and other codecs) were patented and the usage of them wasn’t actually legal. Pesky software patents …

A Web App a Week Challenge

Posted in php on November 4th, 2009 by helloworlder – Be the first to comment

Now I’m back from Europe and starting to look for a job. While the job seeking is going on, I’m going to try to give myself a challenge that is to try and create one web app each week until I get a job!

The first web app should be up in a few days (err, hopefully).

EDIT: Well this is taking more than a week, but I should have my first Facebook App up within a day or two. It’s written in PHP. At first I wanted to use the Codeigniter framework but it was virtually impossible getting it to gel with Facebook so I went with straight PHP, unfortunately.

In Europe

Posted in Misc on October 16th, 2009 by helloworlder – Be the first to comment

I m in Europe at the moment. Have been for the past 2 weeks and will be for another 2 so thats the reason for the lqck of updates. Actually in Paris right now. Cant type much because dont know how to use the french keyboard thus the dodgy punctuation, and Im real tired. So goodnight and ill write somthing in 2 weeks.

The Landing Game

Posted in Misc on September 28th, 2009 by helloworlder – 2 Comments

The Landing Game was originally an experiment I was doing to simulate the forces that act on a plane with “real physics”. Then I couldn’t do that so it kind of turned into a game. Because it wasn’t planned I did a bit of the famous spaghetti coding :-)

Though The Landing Game only has 1 level (lol), I learned a bit about game design. One of the most difficult aspects is getting the difficulty right. Too difficult is frustrating and too easy is just boring. I got some friends to test it and the general feedback was - toooo hard. Furthermore, the instructions were not that clear. I ‘m a huge flight sim fan so it was ok for me. That’s why it’s important to do testing.

Anyway you can play the game here. I haven’t fixed up the difficulty yet because I’m pretty busy preparing to go overseas - so I guess you better be up for the challenge!

hehe

Just showing you that it is actually possible to land the plane even at this difficulty!If you’ve played flight sim before then you might find it easier.
TIP: Remember to flare the plane and keep your eye of the Vert Speed indicator. For more info on flaring, see the wikipedia page on Landing.

EDIT: The game has now been made a lot easier after overwhelming feedback that the game was far too difficult and even “impossible”. Now it might be a bit too easy. The main problem is that it only has 1 level! With multiple levels I can gradually make it harder each level. But, I don’t really have time to work on this anymore so I’m leaving the game in its current form indefinitely.

Unobtrusive AJAX Pagination With Rails

Posted in Ruby on Rails on September 27th, 2009 by helloworlder – 1 Comment

I’ve searched around for unobtrusive AJAX pagination with Ruby on Rails tutorials but the best I’ve found are the ones by Ryan Bates at Railscasts. Pagination with AJAX , followed directly by AJAX History and Bookmarks teaches you how to create unobtrusive AJAX pagination.

Also I was at http://wiki.github.com/mislav/will_paginate/ajax-pagination. I didn’t follow those instructions but took note of the advice NOT to use link_to_remote to try and create unobtrusive pagination because they are actually obtrusive and make life difficult for search engines.

Test your AJAX pagination with the Javascript turned off and it should still work fine. Remember that search engines don’t read Javascript so they just ignore it, so if your AJAX app works with JS turned off then chances are that search engines will do alright on your site.

Life’s Like a Depth-first-search

Posted in Misc on September 22nd, 2009 by helloworlder – Be the first to comment

life_dfs

BadProgramming.com

Posted in Misc on September 22nd, 2009 by helloworlder – Be the first to comment

Just found a site called Bad Programming and unfortunately it looks pretty dead.

However I do like the idea of studying bad coding practices. In programming we talk a lot about code smell which is based on our intuition. But intuition is not magically drawn from the ether. Instead, it comes from our own experiences of past mistakes, right? Some mistakes we learn from, and others we don’t. And there are many mistakes we haven’t made yet. So studying bad practices or anti-patterns helps us to avoid making old mistakes and prevent new ones from being made.

The “Re-inventing The Wheel” anti-pattern is one of my favorites. Whether based on pride or ignorance the result is the same - you waste time solving a problem that has already been solved before. If you use Ruby then you know that RubyGems helps you to address this problem.

Flash 0.05 Twip “Issue”

Posted in Actionscript 3.0 on September 13th, 2009 by helloworlder – Be the first to comment

If you ever try to add any number smaller than 0.05 to the x or y properties of any graphic, then you’ll will notice nothing will happen. It will not add anything smaller than 0.05.

Actually, this issue is due to the way Flash deals with pixels. In the wonderful world of typography, 1/20 of a pixel is called a twip, and 1/20 in decimals is not surprisingly 0.05. Graphics in Flash are positioned using twips, so Flash just ignores you if you try to move an object less than a twip.

Well, the solution is simple:

Instead of something like:

graphic.y += velocity.y; // velocity.y may be smaller than 0.05

you do something like:

yPositionTemp += velocity.y;
graphic.y = yPositionTemp;

Capistrano with Windows - Solution to “No such file or directory”

Posted in Misc on September 11th, 2009 by helloworlder – 2 Comments

If you’re trying to deploy a Rails app from Windows* and you get a No such file or directory warning during cap:deploy, then it’s very likely that you don’t have a command line svn client installed. Google CollabNet Subversion and grab the command line client tool from their website. You’ll need to sign up but it’s quick and painless compared to the pain you just went through searching through the Internet for this information in the last hour :-)

Just remember that after installing the client you need to close down and re-open the command prompt window. Do not forget that because I did. Also you really should type svn at the command prompt to see if svn is actually in the PATH. If it is, then you should get a nice “Type ’svn help’ for usage. If not then you’ll get some error.

Good luck with the rest of the deployment.

*I’m assuming you’re not trying to deploy TO a Windows machine. It’s possible but you’re a minority if you’re trying to do that, which means it’ll probably be harder to find info pertaining to your needs :-)

Automatically Tweet Your SVN Commits

Posted in Misc on September 7th, 2009 by helloworlder – Be the first to comment

There’s a very cool Ruby script called ruby_scm_twitter written by the guys at www.thewebfellas.com, that will automatically tweet your SVN commits. Download it here.

However I had to make some changes to the ruby_scm_twitter.rb script to make it work. You’ll need to do the same. Before you go any further you might want to read the readme file that comes with the script so you know what I’m going on about. Ok, the changes:

You need to replace the contents of the run method on line 120 with the following code:

httpauth = Twitter::HTTPAuth.new(@options.username, @options.password)
Twitter::Base.new(httpauth).update(message)

That is because the Twitter gem that the script depends on has been updated since the script was written, and Twitter::Base.new(…) expects only 1 parameter now, namely a Twitter::HTTPAuth object. Also, make sure that you do NOT have @options.user, but instead you should have @options.username. That was a typo in the original script.

This was mentioned in the readme file, but I want to remind you: You must make sure that this script - ruby_scm_twitter.rb - is executable.

Alright, that’s all we’re doing with that script. I had to also make some changes to the post-commit file in the hooks folder. If this is your first time working with the post-commit file be aware that under hooks there is a file called post-commit.tmpl. You have to get rid of the .tmpl - just rename it to post-commit. If you don’t do this then SVN will not execute the post-commit script.

The actual contents will need changing too. The readme file says:

REPOS="$1"
REV="$2"
/opt/svn/hooks/ruby_scm_twitter.rb -u twitter username -p twitter password -f "${REPOS}" -r "${REV}"

You should change it to

REPOS="$1"
REV="$2"
/usr/bin/ruby1.8 /opt/svn/hooks/ruby_scm_twitter.rb -u twitter username -p twitter password -f "$REPOS" -r "$REV"

/opt/svn may not be the path to your repository. For me it was /home/helloworlder/repository/hooks.

Finally, you must make the post-commit file executable.

And that should do it.


Easy AdSense by Unreal