February 29, 2008

How to fix an iBook





Well I got another iBook from surplus for another dollar, which also was showing the same symptoms of the GPU having solder connection issues. Also once again by putting pressure on the chip and the board the LCD would turn on. However unlike the last iBook I tried this fix on, this one required less pressure to get the screen going, and would stay on at certain angles, so what ever was wrong with the solder was quite a bit less than the last iBook, which makes my life easier.

So, I grabbed the propane torch and set up the board by removing anything that would melt. This time, after doing some research of others attempts at this process, and found that a slow heating and cooling process is much more effective. So I heated for a minute at a low setting from a little distance, then heated at full for about another minute while watching the screen. At the start, the screen was a garbled mess, however soon the chip overheated and the screen did a weird blurring effect. This was normal and happened last time, so I backed off with the heat and allowed it to cool a bit, after a few seconds the chip started again, but was still not quite right, so I repeated the process. This time after backing off with the heat, the screen went to the blinking question folder that I was looking for. After getting this far, I let the chip cool on its own, which took around ten minutes. After it cooled correctly, I made sure the board turned on, and shook and slightly bent the board to make sure it was securely connected. My last attempt had several failed successes, which by bending the board showed it had not correctly reflowed the solder. However this time it was fully connected.

Ha, it may have taken two attempts to get right, but now I have a working iBook for my digital picture frame project, and as requested I have pictures of torch in action, which where missing from my other post, enjoy.

February 28, 2008

Space Invaders for your wall


I randomly stumbled upon Blik Surface Graphics who carry a set of wall decals that look like Space Invader sprites. Space invaders for the video game challenged is a simple game where you shoot aliens, using a little mobile cannon, before they get too low and invade the earth, or shoot you. There have been many renditions, but Space Invaders still remains one of the first arcade shooters.

I thought the decals where very cool, but I am a poor student and did not feel like paying the $12.50+ so I set out to make my own. Firing up AppleWorks I went to town with a bunch of black squares. They ended up looking like the real thing, so I was happy, and printed out the same number as the decal set would have. If you are feeling lazy and do not want to make your own, I have uploaded my set here for anyone to use.

The end result turned out rather nice, but now Matt says we need a Mario wall too, sounds good to me!

February 27, 2008

Tesla Coils are awesome

After building a vandergraph generator, which worked rather well, I have looked at making one of the many other high voltage static generators out there. I really want to build a wimhurst, and eventually will, however I really want a Tesla Coil, because they are amazing. They are so powerful the intense electric field around them can light up fluorescent bulbs from a few inches to a few feet away depending on the size. The one big drawback to Tesla coil is they need an outside power-source, usually a high-voltage transformer of some kind, as well as other electronic components, so in reality it is not quite a static generator, but still amazing machines! If I ever find plans for a simple low power one I will definitely start building it.

I love the video above because it demonstrates a simple Tesla coil very well, plus I can not stop laughing every time it starts up, creates a static buz, and then BOOM (At 00:24). This is the first one I have heard do this.

Other people have done amazing things with Tesla coils, such as adjusting the frequency to play music on them!

February 19, 2008

Coolest NERF gun yet




Many guys my age had a hoard of NERF guns as a kid, heck I still have a hoard, although I do not use them quite as much. Still after seeing the new NERF Vulcan EBF-25 on Gizmodo, I know this might be worth looking into. It looks like some kind of advanced weapon, except for the orange coloring. However that is to make it not look real enough to get a kid shot for carrying this around, which is understandable. Still any moder could do a great paint job and make this look beyond awesome. Oh course the biggest question raised by this NERF gun is if you can modify the chain to be longer then 25 darts. A chain of 200 or more would be very impressive indeed.

After looking at the picture for a while another thing came to mind. The Vulcan EBF-25 looks very much like the portable turrets in Halo 3. They both grab on the top, and fire from the trigger on the back. The tripod is very similar as well. The front of the gun is the only major diffrence. So was this inspired from the NERF team playing halo? Who knows, but what I do know is any one I show the Vulcan EBF-25 to wants it. Way to go NERF!

February 15, 2008

How to break an iBook


Well I am usually pretty good about not breaking things worse when I am trying to fix them, but today was not my day...

I had got an iBook off of surplus for a buck, however it did not have any video, after taking it apart and pressing on the graphics chip on the board I could tell its connections had come loose. Similar to the story here. So I set off on an adventure to try to fix it. After making a cup out of aluminum, I got a propane torch and started heating it. It worked well enough and came very close to working, but shifting the board still caused video problems, so I had the bright idea to put some pressure on it while heating.... BAD IDEA! The solder balls underneath got squished and fused together, rendering the logic board useless.... Sigh. There are times when you wish life had an undo, this was one of the times I wanted to use it. Well I will remove the solder and chip from the board and see if it at least starts, right now it turns on shorts and shuts off. However it would take inhuman skill to solder it back on correctly. Ah such a waste, well maybe I can sell the working parts online.

Note: The clamp was not tightened any further then to simply hold the cup and a small metal piece on the bottom together, plus give me a grip to hold on to, but that was still to much pressure.

Luckily there are more iBooks on surplus with the same problem, and because I am probably the only one crazy/stupid enough to attempt this again to try to fix them, I at least have a couple more tries at making a digital picture frame. Yes that was the original goal.

Oh well, now excuse me while I go beat my head against a wall.

February 12, 2008

Simple Flat File Database

I had recently been refused access to a sql database for a project, this I started looking for other options. After a little searching I stumbled across txtSQL, which is a very powerful but easy to use flat file database.

To start off download the latest release (2.2 final at the time of writing this). Then read the read me in the doc folder it will walk you through setting up the include files you will need as well as the database folder, by default called data. One you have these placed correctly just like with mysql you will need to connect to the database.


include('includes/txtSQL.class.php');
$sql = new txtSQL('includes/data'); // Location of the database files
$sql->connect('root', ''); // This is the default name and password
$sql->selectdb('XXX'); // XXX is the database name


This will let you connect to the database you want to use, I do recommend changing the password from its default. However there is no database or tables right now so you should add these.


// txtSQL created a new database named testDatabase
$sql->createdb(array('db' => 'XXX')) or die('Error creating txtSQL DB, txtSQL said: '.$sql->get_last_error());

// Create Table in new database
$columns = array(
'id' => array('type' => 'int', 'auto_increment' => 1, 'permanent' => 1
'name' => array('type' => 'string', 'max' => 50),
'email' => array('type' => 'string', 'max' => 50) );

$sql->createtable(
'db' => 'testDb',
'table' => 'testTable',
'columns' => $columns);


Now you have tables set up, unlike sql databases, this is all commands with arrays, so it takes a little getting used to, but is not to horrible to learn. Finally, you just need to manipulate the data.


// Select
$where = 'somthing = '.$_POST['something'];
$results = $sql->execute('select', array('table' => 'XXX', 'where' => array('0' => $where), 'limit' => array(1)));

// Grab first result
$result = $results[0]; // Just want the first result

//or use them all
foreach($results as $result) // Grab each row from the result
{
//... Do something
}

// Insert
$insertvalues = array( 'name' => 'matt', 'date' => '9/8/06' );
$sql->execute('insert', array('table' => 'XXX', 'values' => $insertvalues));


The rest delete and update are also similar, and you can find example in the documentation included.
Although txtSQL is not a perfect replacement for a real sql database it does work rather well. However it is suggested that is only be used with smaller database needs, otherwise stick to a real real database management system. Still for what I needed it to do I am quite happy.

February 7, 2008

Setting up web shares in Apache

One thing I wanted is the ability to share directories online other then having to make folders in my WebServ folder. So off I went to look up how to configure Apache to do this. As I expected this was not all that hard to do, you just have to add a few lines to the apache config file.

Just type " sudo vi /etc/httpd/httpd.conf " or use what ever editor you like, I like VI. then look for the section below...


#
# Aliases: Add here as many aliases as you need (with no limit). The format is
# Alias fakename realname
#
<IfModule mod_alias.c>


Find place you like to put the info for your new shared directory, and add the lines below. The #"stuff" lines are optional, but it is a good idea to comment about what you are adding.


#Share via online
Alias /NAME OF SHARE "/PATH TO DIRECTORY/"

<Directory "/PATH TO DIRECTORY/">
Options Indexes FolowSymLinks MultViews ExecCGI
Order allow,deny
Allow from all
</Directory>


This will set up a new directory that you can access with http:/serveraddress/name of share. This worked quite well, however I still wanted to take it a step further. I could make a php index page that prevented access, however that would not give me quite the level of security that I wanted. Instead I looked for a way to secure a directory with Apache. First of you need to change the directory set up by setting it to...


<Directory "/PATH TO DIRECTORY/">
Options Indexes MultiViews (+ other things you want)
AllowOverride All
</Directory>


This make it look for a .htaccess file that specifies the access rules for the directory. You will now need to add this file to the directory you are sharing. In that file you need to add these lines.


AuthName "Name of Stuff Share"
AuthType Basic
AuthUserFile /PATH TO PASSWORD DIRECTORY/.htpasswd
AuthGroupFile /dev/null
require user ADD USERNAME


This sets up the directory, the last thing you need to to add a password file for it to reference to.
To do this, cd to the password directory you used above. Then type htpasswd -c .htpasswd "USER NAME" this will add a password file to the directory for the use name.

There you have it a new directory in Apache which requires a password to access.

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.]