Archive for December, 2008

My 2009 Predictions

  1. Britney gets remarried.
  2. Amy Winehouse goes back to rehap.
  3. Steven Colbert majorly retools his show.
  4. An amemdment is passed for poligamy but not gay marriage.
  5. Another Hulk movie w/ another actor, again
  6. Flying cars

Add comment December 31st, 2008

Johnny V now available on Adobe AIR Marketplace

Check it out, Adobe excepted my submission into the AIR Marketplace. I thought they’d give me crap about the uncleared picture of the actual Johnny Five from Short Circuit. Cool later.

Add comment December 29th, 2008

Merry Christmas I’m not completely Tone Deaf?…am I?

If you have every wondered how I’d sound if I tried recorded an EP Christmas album for Disney Records, here is your chance. I had fun singing like a goof.

All songs created w/ Abelton Live, an AutoTune and/or lots of reverb and chorus.
Jingle Bell Rock
MerryXmas (War is over)
Wonderful Christmas Time

Add comment December 25th, 2008

Roman Numeral/Arabic Convertion AIR App – Johnny V Now Available

Merry Christmas, I got you guys present.

I was looking for a need to make an AIR app, though this isn’t the best one, I turned my converter class into one. Introducing Johnny V.

Add comment December 25th, 2008

How to convert Roman Numerals and Arabic numbers in ActionScript 3

This past week I worked on a porting exercise. I have always wanted to find out how you convert Roman Numerals to Arabic numerals and vice versa. So I starting searching and found a bunch of bloated code for converting these numbers then I stumbled on this page.

So in a few hours of screwing around w/ the loops (typing this correctly took a bit) I got it ported. Porting is fun cause all you have to do is translate.

Here is the zip flie and Here is the class.

package com.joshspoon.etc.utils
{
	public class NumberUtils
	{
		public function NumberUtils(){}
 
		public static function romanize(num:int):String {
			var numerals:Array = ["M", "CM", "D", "CD", "C", "XC", "L", "XL", "X",
										"IX", "V", "IV", "I"];
 
			var numbers:Array  = [1000, 900, 500, 400, 100, 90, 50, 40, 10, 9, 5, 4, 1];
 
			var lookup:Object = {M:1000,CM:900,D:500,CD:400,C:100,XC:90,L:50,XL:40,X:10,IX:9,V:5,IV:4,I:1}
 
			var roman:String = "";
 
			var i:int;
 
			  for( i = 0; i < numbers.length - 1; i++)
			  {
				while(num >= numbers[i])
				{
					roman += numerals[i];
					num -= numbers[i];
				}
			  }
			  return roman;
			}
 
		public static function deromanize( roman:String ):int {
 
			var numerals:Array = ["I", "V", "X", "L", "C", "D", "M"];
 
			var numbers:Array  = [1, 5, 10, 50, 100, 500, 1000];
 
			var roman:String = roman.toUpperCase();
 
			var arabic:int = 0;
 
			var i:int = roman.length;
 
		    var compare1:int;
			var compare2:int;
 
			while (i--) {
 
		  	var letter:String;
	  		var listLetter:String;
 
		  	for (var j:int = 0; j < = numerals.length - 1; j++)
		  	{
		  		letter = roman.charAt(i);
		  		listLetter = numerals[j];
		  		if(listLetter == letter)
		  		{
		  			compare1 = numbers[j];
		  		}
		  	}
 
		  	for (j = 0; j <= numerals.length - 1; j++)
		  	{
		  		letter = roman.charAt(i + 1);
		  		listLetter = numerals[j];
		  		if(listLetter == letter)
		  		{
		  			compare2 = numbers[j];
		  		}
		  	}
 
		    if (compare1 < compare2 )
		      arabic -= compare1;
		    else
		      arabic += compare1;
		  }
		  return arabic;
		}
 
	}
}

2 comments December 17th, 2008


    Blog Calendar

    December 2008
    M T W T F S S
    « Sep   Jan »
    1234567
    891011121314
    15161718192021
    22232425262728
    293031  

    Posts by Month

    Posts by Category