Friday, July 23, 2010

An Intelligent Game

Every now and again as a programmer you come across some bit of code that excites you. In this case it's a simple 20 questions game. Now, I'm sure the code is fairly simple. People are characterized with qualities and it asks questions to optimally limit the remaining possibilities. But I tried playing the game about 10 times and it was dead on each time, even when trying to think of people it would likely fail on. I thought it was impressive to have such an extensive list of people that it's been trained for. And every time it's asked something it becomes smarter and better able to determine your person.

Try it out at

Tuesday, July 13, 2010


Next up on the list of projects is a Droid App. I'll throw something very simple together first, maybe something similar to the black jack I made a few posts ago. After a starter App I'll try and make something more complex. I hate Eclipse, but it seems I'll be using it once again for these google droid apps. If nothing else, it will keep me learning new things which is very important as a programmer. Over the course of my career I'm sure i'll need to re-learn everything I do in order to stay competative and challenged.

Saturday, July 10, 2010

Retirement Calculator

So how soon will you be able to retire? This little post calculates and graphs the amount of money you'll be able to save towards retirement. This gadget maps out the growth of your wealth based on monthly contributions from your salary, which increases every year with raises.

For example, Average Joe makes 50,000 a year. He expects an average yearly raise of 10% for the next 30 years. He currently has 5000 in saving, 6500 in his 401K and 6500 in a taxable stock account.

Each pay check he pays 8% into a 401k retirment which yeilds an average of 7.5% annually. He pays 2% into savings at 3.5% interest, and 5% into a taxable stock fund that yields roughly 11%.

I assert that in order to retire at a very young age, you'll have to have enough retirement money to earn as much as you withdraw from it. That can be calculated with the formulate: amount_required = desired_salary / (interest - inflation). In order to retire now with a before tax income of $30,000 you'll need to have $1,200,000 saved.

The Red graph represents the amount required to retire. It adjusts with inflation each year. The green represents what you've saved up to that ponit.

Of Coures, if you're only planning on needing that money for a period of time, and not replenish your money as quickly as you're taking from it, then you won't need quite so much. I made this to try and see what it would take to retire by the age of 35, and thus didn't want a time period. I'll probably add a period of time to the retirment section down the road.

Basic Salary Information:
Salary with Bonuses:
Yearly Raise %:%

Initial Money Saved:
Initial Savings:
Initial 401K:
Initial Taxable Stocks:

Investment Contributions:
Savings Account:%
Savings Rate:%
401K Rate:%
Taxable Stock:%
Taxable Stock Rate:%

Retirement Info
Desired yearly retirement salary:
Expected interest rate on all retirement funds:%
Expected inflation rate:%
Amount Required to sustain salary:

Tuesday, July 6, 2010

Google Wave, Part 2

Roughly 2 months after first looking at the Google wave API, I finished my first Google wave gadget.  I included it in the wave embedded in the original post: check it out here.

It's a simple app that graphs numbers as they're entered, intended to track weight.  I discovered that the wave API has a couple tricky bits to it.  Using a variable as a key when storing or getting a value does not work, while using a string literal does.  For example:

works perfectly, but:

 var mapId='count';
will not work at all.

Hopefully I have some more time going forward to play around with the wave API.

Saturday, July 3, 2010

Gaming and Programming

I've had a lot of fun playing a game that seems to teach the basics of programming. It illustrates functions, recursion, conditional statements, and all in a thought provoking and challenging manner. The recursion and expert levels were a blast. So if you're interested in programming, or a guru wanting a quick critical thinking challenge, check out:

A professor from mine at college, probably inspired by the amount of World of Warcraft I played at the time, was frequently looking into the possibilities of teaching via games. I think making learning fun and teaching critical thinking skills through video games will be the wave of the future.

How about you? Did you find the game enjoyable and challenging?

Saturday, June 26, 2010

Top 5 Pranks

We're going to take a step away from the serious topics, and dive into some fun experiences I've had with very simple code. Here are the top 5 most memorable computer pranks I've played on friends, family, coworkers, and other students.  All of these are for Windows computers.

1) Fake Desktop.

Take a screenshot of their desktop, set the image as their background, and hide the the start bar and remove all the icons on their desktop. The result is a desktop that looks exactly the same as before, but nothing can be clicked on.

2) Swap the mouse buttons.

This can be done either through the mouse option in the control pannel or through the registry.

For the registry, you can save the following as a .reg file and run it:
Windows Registry Editor Version 5.00
[HKEY_CURRENT_USER\Control Panel\Mouse]

3) Fun with VB Script

Save the following as c:\prank.vbs:
while( true)
If MsgBox(" is Awesome",vbYesNo) = vbYes Then
WScript.sleep 90000
End If

Then, save the following as prank.reg:
Windows Registry Editor Version 5.00

and run prank.reg (double click on it).
Should be good fun... every 90 seconds it'll prompt them to confirm you are awesome, and will start up when they restart.

4) The browser trainer.

Ocassionally you have the friend that still uses internet explorer. This little script will help train him to use a better browser.

save the following as a .vbs file and run it.
dim obj
set obj = WScript.CreateObject("WScript.Shell")
if obj.AppActivate("Internet Explorer") then
MsgBox("Access denied, please use a better browser!")
end if 


This can be set to start on boot the same as #3.

5) Remote Control

While I wrote my own application to do this which was a little more undetectable when finding an excuse to learn socket programing(but only allowed me to send button and mouse events and didn't display what they were doing), this can be easily done through free tools like VNC. Simpley install VNC, connect to it from a remote computer and you'll be able to interrupt what they're doing. Maybe slightly move the mouse so they miss click, or type a random key from time to time. Regardless, it's enough to make anyone go insane who doesn't catch on to VNC running in the background.

Lastly, a quick tip for executing some of these pranks. Often, computers in computer labs have pretty strict security settings and won't allow you to easily execute some of these pranks. In many cases, you can open Internet Explorer > File > Open > Browse > Right click > new file > make a new file of the type you need > right click the new file you made> edit > enter the code > save and close > right click the file from the open dialog box > open/run

Many times the windows dialog box still has full access to do everything you need, to save and execute files.

Thursday, June 24, 2010

Evolution, Part 3

As you can tell from the screenshots in “Evolution, part 2”, the program spawns a lot of pop up windows informing me of a multitude of errors. I can’t seem to prevent them, so I made a script to keep an eye out for them and close them as they pop up.

Show VB Script

Not terribly pretty, but effective. Now, I realize there are some serious setbacks to evolution in programs. This is more an experiment of my imagination than it is a serious attempt to make synthetic life. I like to experiment, to find new uses for my code and to push the boundaries of what it was meant to do. What are your thoughts? Is the development of AI through random chaos even a possibility?

Revision three of the code has a lifetime of 300 executions before it quits. From my previous experiments, the code tends to create a functioning copy in a ratio of 1:260 executions.

Once more than 3 instances of the code get going, they start overwriting the file at the same time causing problems. Going forward, I'm going to put together an older computer to let this program run freely, and try to output their executions in a safer manner.

Friday, June 18, 2010

Evolution, Part 2

I ran a few small simulations testing my code from the post below, and quickly added a few changes. It seems a way to stop the spread of programs is essential.

The program mutated several times while maintaining the ability to copy itself. With each byte set to have a 3 in 10,000 chance of changing, roughly 1 in 260 programs could run and reproduce.

I added a 5 second sleep, a file that they update every time they finish running, and a file they read from at the beginning and immediately terminate if it contains the word "stop". These setbacks will provide some basic room for improvement, the first steps of artificial fitness.

Going forward, I think I will require the programs to perform tasks before they can copy themselves. I think I might have them interact with another program that provides challenges, and if they pass, will copy and execute them. They will not have access to directly copy themselves. I look forward to sharing the results and seeing your input!

Thursday, June 17, 2010


I always dreamed AI would start from some massive body of code, a huge project worked on by thousands of people. But what if a program needs to develop consciousness much the same way we (most probably) did? That it is simply too complicated to develop without evolving to that point itself. What if a single tiny program, set only to copy itself with a small degree of error, is the start of synthetic life?

I threw together a little concept program last night: show code

The very basics required for evolution seem to be present in our virtual environment: bad mutations will not run, or will crash, and will not be capable of reproducing. The different programs would compete over processor time and storage as they populate our virtual world.

Unfortunately, the virtual world isn’t as harsh as ours. It would be very difficult for random mutations to be beneficial in any way. In fact, it’s likely to start at an optimal solution, and any mutation would simply slow down its ability to reproduce.

In the mean time, I’ll unleash these frequently crashing synthetic progeny to do their bidding as I look to introduce hazards and predators to force a better fitness test that yields beneficial mutations.

Sunday, May 9, 2010

Google Wave

Over the next week I will be exploring the Google Wave API. This post starts with embedding a wave in a webpage which will be used to make gadgets and robots throughout the week. For those that may not have seen Google Wave, it allows many people to collaborate on the same piece of work. I currently use wave pretty heavily to plan trips with friends, document the adventures of the D&D game I'm in, and to vote for a place to eat lunch with the other developers at work.

I have high hopes for wave. It may even provide a means for webpages to communicate and save data without using php/asp/etc and a database(other than the php and database that drives google wave). Simply send what you want to communicate to others viewing the site or what you want to save to Google Wave. We'll see how it goes.

I'm having a little trouble getting the wave to appear for people logged in without google wave accounts.

This is the Wave Frame

Monday, May 3, 2010

Irrational Number Storage

Once upon a time, I really thought that programs could one day be represented with the starting position in an irrational number. Since Irrational numbers don't repeat, given enough time we could calculate pi or any irrational number far out enough to get anyone's SSN, or phone number, or the binary code that makes up Adobe Creative Suite 3.

Of course I later realized that it would take more data to store the starting position than it would to actually store the program. In the spirit of the idea, I decided to make a little example.

Binary Pattern to Find:

When I originally thought of this method as a child I imagined finding the pattern for a program in PI, but for the sake of speed, this example uses Fibonacci sequences to generate a string of binary data that doesn't repeat. It's way faster since all you need to do is a simple addition to find the next number, and as you can tell from the pattern finding below, speed is quite important.

I turn each digit of the Fibonacci numbers generated into binary with the following conversion:


For example, the begining of the sequence 1,2,3 gives us the binary string 001010011 so searching for: "100" would give us starint position 5. The idea to is have the same possibilities for "0" as I do for "1", hence 8 and 9. My theory is already off since Fibonacci number sequences have more odds than evens.

After 1400 and some fibonacci numbers, the next Fibonacci number becomes too large to be stored as a double(3.something times e raised to the 308th power is the last in javascript), so I restart the equation with the next seeds. For example, if the first series was 1,1,2,3,5... then I start the next series with 1,3,4,7,11... and then after that gets too large, 1,4,5,9...

Graphing project

Yet another Javascript project. I wrote this a while back, and recently added the canvas element to test out some basic graphing I'm hoping to include in a project for work.

Amortization Schedule Calculator


Interest Rate:

Term of loan:

Monthly Paymnet:


Additional Yearly Payment:

Additional Montly Payment:

Tuesday, April 20, 2010


Ever wonder how Keanu would say a given phrase?

Keanu Translator