January 30, 2008

Download files on iPod Touch

One of the big drawbacks with mobile safari is the fact that you can not download regular files to the ipod. However that has already been fixed by an interesting plugin for mobile safari. Interested? I know I was...

First off grab this file http://www.badongo.com/file/5544413 created by hachu. Then sftp into the iPod Touch, you will need to get a ftp client, I use Cyberduck. Then connect to the iPod Touch, and navigate to /System/Library/Internet Plug-Ins. This is the mobile safari plugins folder. Drop the plugin file you downloaded into this folder and then reboot the Touch by holding down the power button and sliding the red slider. After turing back on the Touch, try going and downloading something, you will see a new screen. This will give you the option to download the file, all downloaded files are placed in a download folder in the root user's media folder. One thing you will also want with this, is the finder for the iPod Touch, it will let you move/manage the downloaded files.

The author of this plugin states "No warranty or liability of any kind, of course. Don't blame me if it somehow messes up your data, though it isn't supposed to affect anything outside the Downloads folder it created." So you are on your own if it does not work, or breaks something. For more information check out the original post here... Enjoy

January 28, 2008

Remove iPod Touch App Space limit

As requested by a friend here are the steps to negate the space limit for apps on a jalbroken iPod Touch. The problem is that the iPod Touch has only a small space alloted for the root folder, where the root users folder does not have such limits. A un-jailbroken touch does not need a lot of space, however after installing even just a few third party apps you will quickly run out. Symptoms of such is installed apps do not work, even though they installed with out a problem, Or you will be prompted with a message saying you are out of space. Ether way you can follow the steps below on a jailbroken touch to get more space.

*UPDATED*
Although this still works under the 1.1.2 firmware, I have recently found the BigBoss Application which is a far safer and easier way to simply move your applications, and free up space on the /dev/disk0s1 partition where perl and other things are installed.


1. SSH into your iPod Touch
You should already know how to do this, if not, you should not be playing with the contents of your iPod!

2. cd /
This will get you to the root directory of the iPod.

3. cp -pr Applications /var/root
This makes a copy of the applications folder in the root and places in the root users folder in the iPod.

4. mv Applications Applications.old
Rename the applications folder in root to .old

5. ln -s private/var/root/Applications /Applications
This makes a symbolic link to the newly copied Applications folder. The iPod will think this is a folder.

6. Power down the Ipod Touch. Hold the black power button till a red slider appears and slide it. Then press it again to reboot. Check to see that everything is working before following the final steps!!!!

7. cd /
Return to the root directory of the iPod.

8. rm -rf Applications.old
This final step removes the old application folder.

Originally figured out with help from Here.

January 15, 2008

DDR Pad Revision 4





I like playing stepmania which is DDR for the computer, however playing with your hands is just not the same as feet. So I set off to build a pad for the computer, and several revisions followed after getting the first one working. Now I finally had a chance to update the DDR pad at home to rev 4.

To sum up everything before this,

Rev 0: was two tin foil covered squares of cardboard with some foam between, it worked but not well. More for the proof of concept and to get a USB IC controller working .

Rev 1: was 9 pieces of colored acrylic sheet held up by rubber and screws on a 3x3 foot piece of particle board. Between them where strips of metal tape which acted as the conductor and switch. This actually worked extremely well, and lasted a full year, with a little maintenance here and there. I later added black tab to hide the gaps between squares.

Rev 2: was a solid piece of acrylic and a piece of plywood. The top contacts rested on metal foil contacts in the center so no wires where used to actually connect the top. Much more sturdy, and was easer to maintain because the whole top lifted off instead of having to remove 9 squared with 4 screws each. This also lasted a year, but tended to break more easily.

Rev 3: Took the same design to the next level and placed solid copper wire in a grid on the bottom, epoxy was used to hold the wires in place. Now the bottom contacts would not need replacing like metal foil tape did. Sadly it tore through the weak top foil in a matter of minutes during testing. Rendering the pad useless.

Rev: 4 fixes this by having solid aluminum sheets on the top under the acrylic. Also wired clips now connect the aluminum contacts, thus always giving a good connection, yet letting access and maintenance continue to be easy. The metal was adhered by a special "for plastics" silicon. So far after a good amount of play by my self and others it looks like this might be the best revision so far. Unless the plastic cracks or the metal contacts fall off it should be nearly indestructible! I should have gone with solid metal conductors from the beginning, but it was a learning experience.

January 11, 2008

Making a code editor in a webpage

One of the big goals that I had over the winter break was to finish the upgrade of the Plymouth AMS website. Is started writing in in xml with a xsl style sheet. Although this is good for simper websites that I am going to be around to keep it up, because this is not the case I had to think of something else. After talking with a more experienced web programer in a workshop, I decided to re-write it in php as a web app. Thus after logging in you could edit the basic html on the site, yet this would leave the more advanced layout out of it. Perfect for what the AMS group will be doing. Ether way it is a huge advance from the front page created website they had before.

All that it will requite is a simple html/text editor written in php. This turned out to be a little more complex then I thought it would be. I started with a simple text area that filled the width of the page. Looks good. But after trying to edit 2 lines I got really annoyed. NO TABS, there was no way to tab, and a programer like me lives for code structure. So now I needed tabs... By default web pages use the tab key to go from one field to another not to add a tab character, luckily after some searching I found this very handy java script that would add tabs to text areas. It works very well, and now I have my beloved tabs again.

So first problem fixed, now another rears its head. This text area allows html code, which tends to have quotes here and there, the Mysql calls to the database I am storing the text in also has both double and single quotes. This does not mix well. Basically once it concatenates the strings together the quoted sections get completely screwed up by the new quotes added to my query. This must be a common occurrence so off I went searching for php functions that would take care of it.

As expected there was a function called htmlentities, basically it converts all applicable characters to HTML entities, aka the escaped form. This takes care of the quote problem, I just save this to the database and edit it when needed, as a bonus the text area field accepts these characters and shows them as they should be with out any problems. Thus there is no need to convert them back when editing the text, only when displaying them in html. See example below...


$query_string="UPDATE `***` SET `***` = '".htmlentities(stripslashes($_POST['***']),ENT_QUOTES)."' WHERE `***` = '***' LIMIT 1";


When displaying the html code from the database it is a little more complicated. First off I wanted this to be a hybrid text/html editor, this when you line return, it puts a <br /> just like a text editor would. To do this use the handy nl2br function, it converts the /n new line characters to <br />. Which looks really good, except that it does every line return, I only want non code style returns so then follow this by str_replace which replaces every "><br />" with just a ">" Thus removing all of the non needed breaks.

The last part is html_entity_decode which convert all HTML entities to their applicable characters. Thus the html is back to normal. You put this all together and it does the job very well.


$message = mysql_fetch_array($result, MYSQL_ASSOC);
$mconverted = nl2br( html_entity_decode($message['text']) ); // Convert back to html code
$removes = str_replace("><br />",">",$mconverted ); // Remove extra br due to code style
$xtpl->assign('message', $removes);

January 8, 2008

Remember to update xTemplate

I was having the hardest time yesterday getting xtemplate to work on the G4 web server. Every time I would open the php page a white screen would load. No errors, no problems, would not echo anything to the page!

I checked online and no one else seems to have this problem. So I though that maybe the Mac version PHP had something to do with it, but no luck there as well. Regular PHP would work fine, yet even pages I have done in the past and worked would not load. Finally I downloaded a fresh version of xtemplate and checked to see if the tutorial files worked. Low and behold they worked! Apparently a new version of xtemplate has come out and it works with the newer version of php I am running.

So a note for any one having problems with xtemplate running on a mac you might want to get the latest version!

[UPDATE: I had never turned on error reporting in my PHP install so that is why it never gave me any errors.]

January 7, 2008

Wood iPod Touch Case





My first iPod was a 500Mb shuffle, and after getting it I quickly went to work making a wood case, which was rather big but still worked out well. Now that I have a new iPod it was time to get to work on a new wood case.

I started off looking for two good pieces of wood that where about the right size. After selecting two pieces I had the dilemma of how I would carve them out to fit my touch inside. In a previous woodworking project I made a scabbard for a sword, the task was long and tedious in which I carved out an indent with a chisel. This was a little different because I was not working with hard woods and this had to be cut thin. I pondered this for a while until I remembered how my Dad had cut a grove out of plywood for me before. I could drill out the area I needed. Using a 25mm Forstner bit I very carefully remove from the two piece of wood the space that was required, and then drilled through the thinner of the two in a few places to make my window. Later I also removed the spaces for the charging cable and for some headphones.

Then all that was left was a lot of filing smoothing with sandpaper. The two pieces of wood where not the same size to start so I used a rasp and carefully brought the two pieces to the same dimensions. Then using a course sandpaper I smoothed out all of the differences in the edges. Finally finishing with a fine grit to smooth everything. Now that everything matched up I glued the two halves together and let it dry over night.

For finishing I used a rich early american stain. I wanted it to be dark to match the touch's black color. Then gave it three coats of finish to protect the wood from the handling it will be receiving. The last step was to glue to the insides a few thin strips of fabric. This is to protect the iPod Touch from ware when sliding in and out. The fabric also helps put a little pressure on everything so my iPod stays inside the case, even when pushing the headphone plug in.

The best part of this case is that it is thin, about the size of the touch itself not including the space in between. The big complaint that people had with my original wood case was that it was too thick. Now with this wood case that is not a problem, in fact the little extra width is better because it is easier to hold in my hand. All in all I am very happy with the outcome.


January 1, 2008

Happy New Year

Happy New Year

2007 was a good year over all, I hope 2008 will be just as good if not better!

I am not one to stay up late and watch the ball drop, but Gizmodo had a very interesting post on the history of the New Year's ball. Read it here.

Going from simple all the way to the LED lit giant of today. I found it funny how it started at around 500lb slowly became lighter and lighter till year 2000 where it becomes a half a ton.

Check it out, for it is shiny!