Friday, December 19, 2008

Lua Deep Equals

I was surprised when I couldn't easily google for a Lua deep compare function. It's main purpose is to compare tables and check if they have the same values, but of course it's recursive so it just uses ~= to check for difference in non-tables.

Anyway, so I wrote my own and figured I'd post it here for posterity. Maybe you can come up with a shorter version?

-- Deep Equals
local function equals(t1, t2)
   if t1 == t2 then
       return true
   if type(t1) ~= "table" or type(t2) ~= "table" then
       return false
   local v2
   for k,v1 in pairs(t1) do
       v2 = t2[k]
       if v1 ~= v2 and not equals(v1, t2[k]) then
           return false
   for k in pairs(t2) do
       if t1[k] == nil then
           return false
   return true

Monday, November 17, 2008

Godiva Float

I just died... and went to heaven... and I've come back to give you the recipe...

-Godiva Chocolate Liqueur
-Bailey's Irish Cream
-Ben & Jerry's Chocolate Fudge Brownie Ice Cream

1) Put them all together in a mug.
2) ...
3) Profit!

Oh man, you have no idea. You NEED to try this if you consider yourself a chocoholic. Otherwise.... no... there is no otherwise! You NEED to try this!

Wednesday, November 5, 2008

Favorite tsch Aliases

So I spend a lot of my time at work tooling around on a remote server through ssh. Here are a few of the aliases I use everyday that make my life a little simpler. Put them in your login script and save yourself some headaches!

#setup color ls
alias ls ls-F ; set color=ls-F

#ls shortcuts (cause 2 chars is better than 4!)
alias la 'ls -a'
alias ll 'ls -lg'

#vim color shortcut
alias vi 'vim -X'

#make grep ignore svn files
alias grep 'grep \!* | grep -v /\.svn/'

#remove those pesky Permission denied lines when using find
alias find 'find \!* |& grep -v /Permission denied/'

#change dir and list contents
alias cdls 'cd \!*; ls'

Friday, August 29, 2008

Lunch Places Near UC Irvine

Ok, so this isn't a technical post nor applicable to the web at large, but last time I checked there were 30+ places to eat within 5 miles of UC Irvine (my place of work). So, I'll try and enumerate some of them here if I can; obviously I wont get all of them. I'll probably stick to <$10 ($) and <25 ($$) per person places that you might eat at lunch.

On Campus @ UCI

  • Quiznos ($)
  • Wendy's ($)
  • Rice Garden ($)
  • Tortilla Express ($)
  • Bene's Pizza & Pasta ($)
  • Greens-to-Go ($)
  • Brandywine($)
  • Pipin Commons ($)
  • Mesa Commons ($)
  • Phoenix Grill ($)
  • BC's Cavern on the Green ($)
  • Anthill Pub & Grille ($$)
  • University Club ($$)

University Center

  • Z-Pizza ($)
  • Kochee Kabob House ($)
  • Arriba Baja Grill ($)
  • In & Out ($)
  • Jack In the Box ($)
  • Le Diplomat ($)
  • Lee's Sandwiche ($)
  • KFC Taco Bell($)
  • Ray's Pizza ($)
  • Asia Noodle Cafe ($-$$)
  • Gen Grill ($-$$)
  • Britta's Cafe ($$)
  • Veggie Grill ($$)
  • Steelhead Micro Brewery ($$)
  • Chakra Indian Cuisine ($$$)

Albertsons Place

  • Del Taco ($)
  • Gina's Pizza & Pastaria ($-$$)
  • Aomatsu Sushi Restaurant ($$)

Culver Center

  • Tacos & Co ($)
  • Charo Chicken ($)
  • Subway ($)
  • Tenko Teriyaki House ($)

The Bluffs

  • Panera Bread ($)
  • Daphne's Greek Cafe ($)
  • Baja Fresh Mexican Grill ($)
  • Quiznos ($)
  • Carl's Jr ($)
  • Pasta Bravo ($)
  • Islands Restaurant ($-$$)
  • Pei Wei Asian Diner ($$)
  • Wasa Sushi On the Bluffs ($$)
  • Wild Fish Sea Food Grill ($$)
  • Champagne's Market ($$)
  • Marco Polo Italian Eatery ($$)

Michelson CPK Place

  • Mother's Market & Kitchen ($)
  • Wahoo's Fish Tacos ($)
  • Fatburger ($)
  • Baguette Time ($)
  • Narano Sushi ($$)
  • California Pizza Kitchen ($$)
  • Houston's Restaurant ($$)


  • Mc Donald's ($)
  • Taleo Mexican Grill ($)
  • Gyro King ($)
  • Joe's Pizza & Pasta Cafe ($)
  • Michelson Cafe (?)
  • Souplantation ($$)
  • Daily Grill ($$)
  • The Melting Pot ($$$)
  • Bistango ($$$)

Ralphs Place (Harvard and Main) - Corner Bakery,
Jamboree places by Google - Wienerschnitzel,
Crossroads Shopping Center (Barranca and Culver) - Target,
The District (Barranca and Jamboree) - Chick-fil-a

If you've got any more let me know!
If you don't know where something is... Google it!

Monday, August 4, 2008

iPhone 3G 2.0.1 Update Undoes Jailbreaking

Of course, I didn't find a similar report until after I had started installing the update.

But let me confirm:
The 2.0.1 update for the iPhone released today does in fact overwrite firmware and undoes what the PwnageTool allowed.

I haven't yet tried to use the 2.0.1 .ipsw with the PwnageTool, but I doubt it will work.
In fact when installing 2.0.1 after the pineapple log popped up it was followed by a cartoon of Steve Jobs with his hands in the air and a 'say' bubble over his head, which I didn't look at fast enough to read. Then it went to an apple logo like the un-jailbroken boot screen.

It seems the update is actually a re-image of the iPhone operating system. I'm going to try using the PwnageTool on the 2.0.1 ipsw and see if that works.

Edit: PwnageTool does not yet work with the 2.0.1 firmware.

Edit #2: PwnageTool Has now been updated to work with the latest firmware.

Friday, July 25, 2008

Changing iPhone 3G Root Password

1) Jailbreak your iPhone

I'm gonna assume you did this already, if you're actually trying to change your root password. There's no reason to change your password unless you jailbreak your iPhone, because no one will be able to access its command line in the first place.

2) Enable and use Terminal on your iPhone

  • Open the new Cydia app that PwnageTool installed and install MobileTerminal
  • Launch the new MobileTerminal app (Skip to step 3)

2.1) (Alternate) Enable and use ssh on your iPhone

  • Open the new Cydia app that PwnageTool installed and install OpenSSH

2.2) (Alternate) SSH into your iPhone from a computer on the same network

  • Get the iPhone's IP from Settings > Wi-Fi > Blue arrow next to your network > IP Address
  • At the command prompt (In Terminal on Mac or an ssh client on a PC):


  • Enter the default root password: alpine

3) Change your iPhone's root password

  • At the command prompt:


  • Enter your new password twice as asked.
  • You may also want to change the password for the 'mobile' user:

    /usr/bin/passwd mobile

You Win! Now random people wont be logging into your iPhone.

Saturday, July 12, 2008

iPhone 3G (Remote App Crash)

So I got my iPhone 3G today. I stood in line 2 hours before the AT&T store opened and then got my ne 16Gb black an hour later. There were only 25 people in front of me, which is way betetr than the 500+ I saw at fashion island yesterday.

Anyway, it's a pretty awesome phone and I'll probably review a few features and apps, but I just wanted to document a problem I had that I couldn't find written up.

I had been using the Apple Remote App to play music on my computer and start tv shows. And then one time when I opened Remote my iPhone went to a black screen and then showed a white apple logo. The slide to unlock globe eventually came up, but it scared me for a bit. It turns out my iPhone had crashed and rebooted.

So I thought everything was fine until I noticed on the top left it said No SIM and wouldn't let me connect to the computer when I plugged it in. I was really hoping it hadn't somehow wiped my SIM card, which would suck. Thankfully I was able to get it back to normal by just rebooting the iPhone:
  • Hold down the home and power buttons and slide to shut off
  • then push the power button to turn on.

Wednesday, July 2, 2008

Mac OS 10.5.3/10.5.4 nvidia 256 Colors Driver Fix

I can't take credit for the idea, I found a poorly translated blog post that explains it. He found the fix on the MacRumors forum. Anyway, lets start from the facts.


Mac OS 10.5.3 nvidia video card drivers no longer support 256 colors mode, and 10.5.4 didn't fix it. This means that all your old favorites no longer work, namely Diablo 2 and Starcraft (Both games by Blizzard).


Revert to 10.5.2 Drivers. Seems simple, eh?
Unfortunately most people don't have a second computer sitting around that they haven't upgraded yet. So the key is to find a legal free download. Thankfully Apple still has the Leopard Graphics Update 1.0 available. And to get into those compressed files without actually installing it (since it probably wont install on a 10.5.3+ OS anyway) you have to run a piece of shareware called Pacifist that lets you view the files to be installed by a package.

WARNING: If you have 10.5.5 already DO NOT USE THIS PATCH. It will cause your computer to fail to boot.
10.5.5 Fixes 256 color mode for Mac Pros and MacBook Pros with nVidia cards, but not MacBooks or MacBook Airs with intel cards.
If you have a MacBook or MacBook Air, in order to get 256 color mode you must be using these 10.5.2 drivers on 10.5.4 or lower.
NOTE: Starcraft now works in thousands of colors.

My Contribution:

I didn't want to re-explain the process for non power users. So I've extracted the nvidia drivers and created a double click package that backs up your current drivers and reverts to the 10.5.2 ones.
Download (Version #4 - 22.4mb compressed dmg): mirror
(1000+ downloads of the latest version as of 7/13/08)
(6100+ downloads of the latest version as of 10/1/08)

Yay! Have fun re-living your Diablo 2 days waiting for Diablo 3 to come out!

To Restore:

To revert to your backed up drivers just run the installer again! It should say uninstall on the customize page.

Manual Restore:

If the above doesn't work you can try the following in Terminal:
sudo chown -R 0:0 "/System/Library/Extensions Backup"
sudo cp -r "/System/Library/Extensions Backup"/* /System/Library/Extensions/

Drivers in this Package:


Update Version #1 (7/3/08):

- If you get a prescript error then you probably didn't have all the drivers that it tried to backup. Either that or you were running it a second time and the drivers were already moved.
- If you get a postscript error then it failed to set the permissions after installing the files. I'm not sure what would cause this yet.

Update Version #2 (7/3/08):

-The prescript is a bit more robust now and checks for the existence of files before trying to move them.
-The postscript has been removed. The installer should now handle the permissions itself.
-If the backup files exist on your hard drive the installer will only allow you to uninstall, at which point it will restore them and remove the backups.

Update (7/3/08):

-My server couldn't handle all the downloads so I've mirrored the file on

Update Version #3 (7/4/08):

-I added the drivers for the Apple Intel integrated cards, 950 and X1300 series.
-I also contained the pkg in an apple dmg, which compresses a bit better than zip.
-I'm not sure why so many people aren't getting the files installed. The installer is supposed to handle that part, and I have reports that it does work on more than just my machine. Worse comes to worse you can at least run the uninstaller, since the scripts seem to work for everyone.

Update Version #4 (7/4/08):

-I was finally able to duplicate the problem of the scripts running the files not being installed. I believe it is a limitation of PackageMaker that it doesn't want to let it install into system folders.
-So I've made a new package (version 4) that backs up your files (prescript), installs the new files into the /tmp/Extensions directory, moves the files to the correct location and then deletes the temp files (postscript).
-Hopefully this solves the problem. I was able to fully revert to my 10.5.4 files and then run the package backwards and forwards without problems. Hopefully you all will have the same results this time.

Sunday, June 29, 2008


Short Version:
I graduated from college, got a car, got a job, got my own apartment and can now start my real life.

Long Version:

I now have my Information & Computer Science bachelors degree from UC Irvine. It took me 5 long years, but I had some fun doing it. Only in the last year did it really start to drag on; I had done most of the classes I wanted to take and was just taking ones left required for the major. But now that's behind me. I passed all my math classes, had fun programming, learned a lot of Java, took some cool Human Computer Interaction classes, made a cell phone game, wrote a web app collaboration center from scratch, sang in the choir, went to some parties, made a couple friends and met my girl friend Niki (dating nearly 2 years now). I'd say it was definitely worth it.

A lot of people wish they'd majored in something else or still don't know what they enjoy doing after they get out, but I think I've got a pretty good idea. I enjoy programming and I enjoy designing user interfaces that are intuitive and make user manuals unnecessary. To that end I've done a lot of web design and web application development, but I'm hoping at some point in the future I'll get a chance to do some strait application development. On the other hand I love that the web is cross platform and can be used on a multitude of platforms. Plus there's a lot of cool new developments that make web coding more versatile and standardized.

So I've been working for Administrative Computing Services, one of the computer departments at UCI, part time since Sept 2007. They had originally told me they could probably find a place for me after I graduated. I also applied to my three favorite companies as mentioned before, but no one else seemed interested in me. I had interviews but no offers. Then as I was nearing graduation I was told that UCI had a highering freeze on new positions until the next budget was made and that they weren't going to be able to hire me. So I sent out a bunch of new apps with nothing comign of it.

Finally, the week of my graduation, my friend Alex told me his friend was CEO of CenterCode, a small company that did web apps and beta testing. They were looking for a web tools programmer. So I applied with them and had a great interview. It looked like he was gonna hire me and then I got an offer from AdComm! I was pretty surprised that they had gotten me a spot. Apparently they got the VP of UCI to sign off on it to push it through the hiring freeze! So I told CenterCode and they said they would have probably made an offer, but it would have been for about $10k less than AdComm was offering. He recommended I take the one at AdComm. So I did! I 'start' July first.


I've got a great apartment in Alisa Viejo, but you'll have to wait for more on that. Hopefully I'll have pictures soon!

Tuesday, June 10, 2008

You have a 'Go' for graduation.

Finally, another chapter of my life comes to a close. After five years at UCI I'm finally graduating (provided I pass my last math class). No one will know what the 'I' in ICS means in my degree, but at least I will know that it meant 5 years instead of 3.

Now I (try to) enter the work force, mostly mental exertion I'm betting. Everyone say's I've been limitting my job search too much, and that's probably true. I applied to Apple and Google and Blizzard. I would love to work at any one of them. I also applied at the two computer agencies at UCI, which would be both familiar and convenient.

The few phone interviews with Apple didn't go quite as planned. One didn't call me back and the other I blanked out on the 2nd technical interview and sounded like a unix nub.
Google never called.
Blizzard finally got back to me less than a month before graduation (many months after applying) for a web app dev position. I'd love to take that one, still waiting for a call back after the phone interview.
I went through the whole interview process at UCI, but it's been almost 2 weeks and I haven't heard back.

So I'm still looking, hoping for a 'real' career. Web apps or user interface design would be right up my ally. Lease is up June 30th. I'll be continuing work at Administrative Computing Services at UCI until then (working on the staff web portal, SNAP).

So between now and the 30th I need to have confirmation of a job and find a new apartment or else I'll be moving back home for a while. As much as I love my parents, it kind of feels like failure to have to go home after they put so much into my education.

Apple's just releasing a myriad of web apps and a ton of new iPhone upgrades, and the rest of the world is web app crazy. I didn't think I'd have trouble finding a place to do that. I'm really hoping to avoid startups. The failure rate is just too high. I need some consistent cash flow and some real experience before I would want to throw my fate in with a new company. I'd really like to be somewhere recognizable. For some reason I feel it's important to be able to tell people what I do, where, without getting blank stares.

My dreams for the future:
- Job
- My own apartment (my own room for the first time ever!)
- iPhone3G
- Nissan 350z (or 2009 370z)
- Niki

Friday, May 2, 2008

Math = Programming - Computer

So I made a realization this week about why I hate math so much.

I was sitting in my Topology class and the teacher was going over the latest uber theorem that we have to memorize the proof of. Then it struck me: he was writing a function up on the board. And in the process of writing his function he had to define a couple new types of objects. Then he used those new classes of objects to define a relationship between them and the equivalence classes of the theorem.

But then it dawned on me: I'm gonna have to memorize this source code and not only regurgitate it later but be able to apply these classes and functions to some new object set... It's like writing a couple java classes and then having to do all the execution manually, without the computer to do the actual grunt work.

What sadistic person enjoys this?

Please for the love of god, let me just write the source code once, run it on a couple tests, get the results and refine the procedure. Don't torture me by making me memorize every line of code and make me do all the computation on my fingers!

Who does that!?

There has GOT to be a better way to teach this math. Please.... Anyone?

Wednesday, February 6, 2008

Mac OS 10.5

So, my girlfriend got me 10.5 for xmas (yes, she's awesome).

I was initially hesitant to pay for the upgrade myself, partially due to the pain I went through to set it up as a server in 10.4, but I'm happy to say that it was WAY easier on 10.5. First of all Apache 2 and PHP5 come pre-installed, and after doing the in-place upgrade (of 10.5) my mysql and svn installs still worked! So all I had to do was configure the default Apache2 to be similar to my old setup, mainly for svn and using port 82 (my isp wont allow me to serve from port 80).