follow me on Twitter

Blogs

This page serves as an aggregator for a couple of my blogs. Featured blogs are:

Ecuador and Peru - Day 1

This summer I took a trip to South America and visited Ecuador and Peru. I've decided to publish the journal that I kept in Ecuador and Peru, and hopefully add some additional comments retrospectively. This should give you a taste of the adventures of South America, and hopefully inspire some trips! So, let's begin...

Our first day of travel began with a last-minute run to the bank, some packing, and some breakfast. For the life of me, I could not find my tennis shoes, so I wound up wearing my hiking boots. Mom sent us off in a cab ride with a young adventurous driver. We made small talk all the way to the airport where we checked in without a fuss. In the terminal. I befriended a lady from Monterey, who offered to get us into the aquarium for free. During the plane rides, Madelin and I practiced Spanish and got more and more excited for our upcoming adventure! One lady could feel our energy and asked us all about our planned adventure. By the time we were over South America, the stars were shining high above the clouds. We saw the mountainous terrain unfold before us in waves of street lights and buildings. It didn't take long to realize that we were in a whole new world. In the airport, they had infrared cameras and were screening out anyone with a fever for fear that they may have the Swine Flu. Luckily we passed without any problems. Felipe, Wladimir, and Amelie happily met us at the terminal and gave us all their insights regarding our plans. It was great to be greeted with some friendly faces. We checked into our hostel: a clean, quaint little room with an amazing view. Free internet and breakfast are a bonus! I realized that despite being in a different time zone, Ecuador does not do Daylight Savings Time (DST), so it is the same time here as it was in Chicago. Our evening ended in plans for tomorrow.

CWM Recovery Loop

I've recently been playing with some android tablets and phones, and was looking for the best OS for my TF201, Transformer Prime (IMO, it's Virtuous Prime). In the process, I installed a number of Cyanogen Mod versions, but each one had some weird quirks: auto-rotate never worked, GPS didn't work, WiFi was flakey... all in all, a terrible tablet experience.

On my way back to Virtuous Prime, I asked Cyanogen Mod to reboot into recovery mode. This was a huge mistake.

I don't know if it's a bug in Cyanogen Mod, or a bug in Clockwork Recovery, but from that point on, any reboot, cold boot, hard boot, you name it, would bring me into the CWM recovery prompt. I tried installing numerous other images, but I was still stuck with this very basic issue.

A couple websites suggested holding the power + volume down buttons to do a cold boot, and boot the OS from there. On my setup, CWM seems to have bypassed this extremely useful functionality, and instead would always take me to CWM Recovery.

I found the correct workaround on this blog: http://hmastuff.com/blog/?p=65, however I couldn't do that first cold boot step.

To workaround, I plugged in my TF201 to my computer via USB, booted into CWM Recover (like I had any choice...), and started up adb. I had this lying around from my initial rooting efforts. If you don't know how to get it, try installing the Android SDK, and looking for it in platform-tools. Anyways, I confirmed that my devices was connected with 'adb devices' and used 'adb shell' to implement the workaround I had found, and unstick my boot loop.

To summarize here's the steps:


adb shell
echo boot | dd of=/dev/block/mmcblk0p3 bs=1 seek=0
reboot

Hope that helps someone!

Feet and Relationships

I found myself thinking (surprise!) about relationships today.  Specifically, I was thinking about new relationships, friendships, or what have you.  Certainly, I try to put my "best foot forward," so to speak, when I am meeting someone for the first time.  I mean, let's face it: nobody is going to present all their flaws up front.  Flaws are simply not attractive, which is why I find myself filtering these out in a new relationship.  I put my best foot forward.

Naturally, I began thinking about my feet, and moreover, about my other foot.  If I always put my best foot forward, what happens to my worst foot?  I certainly can't walk with my best foot forward all the time.  Well, I guess I could try, but it would be some kind of awkward lock-step.  On the whole, I would not get anywhere and be very late for meetings (of which I never seem to run out).  Of course I can't walk with my best foot forward all the time, this is simply not how we walk.  We use one foot and then the other, alternating naturally between the good foot and the bad foot.  I'll admit that sometimes I skip or pretend that I'm dancing and actually lock-step, but I can't NOT alternate feet if I'm traveling by... foot.

Good foot.  Bad foot.  What does this, then, mean for my new relationship?  Well, I think it means that the natural walk is going to have to settle in at some point.  In addition, it would seem that the sooner this happens, the better.  While the good foot is certainly good (hence the name), it's only half of our wonderful walking apparatus, and only half of ourselves as a person.  If the new relationship is going to last, and if I am to be on time for YAM, I need to alternate using both the good foot and the bad foot.  If I keep using only one foot, I feel like I'm going to miss out on a lot, and ultimately not get to where I'm going, both in the physical world, and in the emotional one.

My apologies to those reading this who do not have the use of their feet.

MySQL on OS X via PHP

I don't know why, but I always have trouble when I'm setting up PHP and MySQL on OS X. Actually, I do know why, and it's for two reasons:
  1. I usually forget that you have to uncomment the line 'Load module php5..." in /etc/apache2/httpd.conf
  2. Whenever I try to connect to mysql in php using localhost from a website I'm sandboxing on my machine, I get an error.
The error will read something like "Could not connect to socket via /var/mysql/mysl.sock..." I poked around and, indeed, there is no such path on my machine. Instead my mysql.sock goes to /temp/mysql.sock. If instead I try to change the host from 'localhost' to '/tmp/mysql.sock' then I get the same message, but after the server does a lot of thinking. I suspect that it may be something related to the file permissions on my system, but the only thing that works for me is to symlink to /tmp/mysql.sock in /var/mysql/mysql.sock. Bingo, problem solved. I'd be curious to know if there is a better workaround...

Emotions are Stirred

Well, it's the first day of the new year, that's 2008 for those of you keeping track, and I guess its no surprise that I find myself in a retrospective mood.  As if I needed a reason to stop and think, right?  It's a time of emotions and feelings, and don't be too confused, this is not a Lifetime original movie.  More so, it's just my thoughts.  In fact, today it is a time of thinking about my thoughts: metacognition.  Let's get right down to business.  The topic: emotions (and if there's time, a short discussion on the proper uses for a colon (:) as punctuation).

I've been kind of tired today: sort of lethargic, and hungry but not really wanting to eat.  I started thinking I was getting a cold, but then I realized that I never get sick (true story).  Instead, I came to the realization that my emotions were stirring.  I wasn't sick, I was just feeling.  A couple questions popped into my mind.  First and foremost, "why," and coming in a close second, "how?"  Why is an interesting question (those are the only kind I have).  

Boomhauer on The King of The Hill once made an interesting observation about money, "Money is like the dang-old wind, man, you only feel it when it's moving."  I really like that analogy, and I like to think of emotions in the same way.  That is, my emotions are all present in me at all times: anger, love, joy, and video games.  Most of the time they just kind of sit there in a good-enough equilibrium.  They sit until something comes along to jostle them.  My anger emotion makes its move when I slip on some ice, and just as if there were some force hitting that emotion, at first it's really noticeable, but emotional friction kicks in right away, and eventually the anger resides into my pool of emotional good-enough-ness.  Once it stops moving, much like the wind, I don't feel it anymore.  Joy gets a kick (or gets kicked, I should say), when I return to the ice to see it a soggy, salty, and sticky mess.  Another fleeting emotion falls victim to Boomhauer's analogy.

Love is my favorite one to apply this analogy to.  I think it works pretty well, at least from what I've experienced.  Just like any emotion, you only feel it when it changes.  Love changes in many different ways, but think just about starting a relationship, and ending one.  At the beginning of a relationship there are all these exciting forces messing with that love emotion.  There's some excitement kicking it around, there's anxiety taking swings at it with a baseball bat, and all in all that love emotion is all over the place.  Fast forward a few months, maybe a year if it is a good enough relationship (or the two parties are just that uninteresting), and the love emotion has probably settled down from its initial thrashing.  Sure, some things come along now and again to mess it up a bit, a fight or an anniversary, but on the whole it's pretty much just there.  I think there are times in any relationship where it's easy to forget why the other person is special, or to take him/her for granted.  Maybe it's in the middle of its lifespan or maybe somewhere else, but it ties in nicely with that initial analogy.  Your love isn't changing, so it's easy to not feel it.  Should this relationship have an end, the results are consistent with the previous wind and money exhibits.  Maybe it's a messy end and you feel it a lot: the love emotion is bouncing like a pinball in the pool of emotions.  Maybe it's a mutual thing and the net result is just a little movement.

The more I think about it, the more I realize that I'm a huge nerd.  I've basically just applied Newton's Laws of motion to emotions (is it a coincidence that the laws apply to two words with such similar spellings?  I think not...).  Nerdiness aside, it does a good job of summing up the "why" my emotions were stirring and making me lethargic/sickly.  But what about "how?"

I like this question because it's one that I can't really answer.  To me, it's a question of immaterial things (emotions, thoughts) manifesting themselves as physical changes, annoying changes at that.  I think it's safe to say that one of the emotions stirring within me is anxiety: I've made a new friend, and I'm not sure where it will lead.  Now, this is certainly "real" enough, right?  It's a thought or a "feeling," but it's not something I can touch or see.  As far as I know (which is not a lot, bear in mind (no, there are no animals in my brain)), these are just electrical impulses in my brain.  For some reason, these anxiety thoughts are a signal for my stomach feel like it has just a little bit too much acid than base, and manage to make me hungry yet full at the same time.

I think I may be making some headway here.  Thinking about emotions as thoughts and thoughts as impulses from my brain, makes me wonder if emotions are only emotions because we think about them, and we react the way we do.  Maybe this anxiety emotion is exactly that impulse that makes my stomach all gurgly.  Maybe love is just that impulse that makes your heart feel like it's on fire (or maybe that's acid reflux)...

Conclusion: I think my emotions were really just gas.  Some gas just escaped me and I feel much better.  I'll let you decide what did the trick.

Recovering From Apple Coma

I recently had the pleasure of reviving my macbook's broken hard drive from the dead. A quick word of advise for anyone with Apple products: get Applecare! You'll wish you did when things start breaking after the year-long factory warranty has expired (aint it always the way...). Warnings aside, I did some funny gymnastics to get up and running again:

My problem was a bum hard drive. I'm not sure what caused it, but at some point my system stopped responding and after a cold restart, I could not progress past the gray apple logo and nice wheel loading screen. I could hear my hard drive sputtering as if it were trying to get fired up and failing. I never received an error, I just hung at this screen indefinitely (8+ hours while I was sleeping didn't make any progress).

I had backups of most things, save for some music I was working on earlier in the day. Luckily my sister's iMac was close by, and my Macbook is old enough to have a firewire port. I happened to have a firewire cable, so I booted up in Target mode (hold 't' after the apple sound during startup), and was actually able to mount my drive on sis's computer. It took me a long time to navigate my folder structure, but everything was visible after enough time. I took this to mean that my hard drive was merely crippled, and not gone.

I got the few files I needed and ran to Fry's to get a new hard drive. Replacing the HD on my macbook was nice and easy -- it sits kiddy corner to the ram -- however, finding the screw driver to mount the new hard drive in the easily removable case that my old one was in was not. It turns out that you need a Torx T8 screwdriver if you ever want to get the drive out again. Luckily Ace Hardware had it, and all I had to do from there was reinstall with the system discs.

Of course, to make things interesting, my CD drive has been broken for almost two years now, so I had to go back into target mode and do it from sis's computer. Luckily it all worked out and I'm back in the blogosphere, the twitterverse, and every other electronic habitat.

A New Book

It has become something of a tradition that every year, at Christmas, my dad will give each of us a book to read.  It sounds kind of nerdy, but he always picks these best-seller books that are really great and fun to read.  It sort of makes me feel guilty that I'm reading something fun and not something of monstrous literary significance.  After starting this new book, I was so struck by it that I just had to write down my impressions.  This is what I get for reading right before bed!  The book is called An Arsonist's Guide to Writers' Homes in New England by Brock Clarke.

This writer writes as if he were speaking the way some people I've met do: like a writer who writes the way he speaks.  I guess that's not saying a whole lot.  His sentences are at least six lines long, and punctuated with commas and hyphens.  It's easy to get lost in a cycle of appositives.  He's the kind of writer that will digress every other paragraph, and take an entire chapter to make a single point.  Coupled with this almost annoying style, is the ridiculously fast pace of the book.  The author has no problem simply stating major events in just a few words, and with the amount of alluding he does from chapter to chapter, reading thirty pages of this book is entirely exhausting.

That said, I'm really enjoying this book.  The premise is so simple, yet so unique and specific.  A man goes to jail for an accidental crime.  His life is basically ruined and the story seems to be about the affects this has on his life.  It's a tried and true premise for a story, but the author gives so many details, that it's easy to see past what would otherwise be a bit of a cliche story.  I mean, honestly,  how often do you hear a story about a man who accidentally burned down the Emily Dickenson house and killed two people in the process?  Sounds kinda interesting to me.

All in all, the book would be pretty bleak if it weren't for the author's extravagantly trivial observations.  It doesn't seem like the story teller can take anything seriously, which makes for a pretty funny read.  At the same time, however, I feel the main character's pain.  There's something so agonizingly real about being accused of something you didn't do, or didn't mean to do.  There's a kind of haunting feeling that lives in all of us when we know that someone could blackmail us, and there's nothing we could do about it.  Just hinting that the character might go through these things, instantly brings up these built-in emotions that the author somehow knows I have.

So far: great book.

Binutils and objdump on Mac OS 10.4

For some reason OS X (10.4) does not contain objdump.  Seems like quite a useful tool to leave out.  Some searching revealed that objdump is part of binutils.  After much failure trying to install binutils 2.19 for OS X (10.4), I finally came across the supported version on the Apple website (binutils 2.16).  This version of binutils successfully compiled, but much to my chagrin, did not produce any binaries (weird).

To make a long story short, otools, does come with at least the developer tools for OS 10.4, and provides the same functionality as objdump.  Sample usage:

otools -tv a.out

The above will print out the disassembled assembly code of a.out.  You can do other nifty things like print out the shared libraries used.  I hope this saves someone some trouble.

Ice and Exams

Welcome to my home away from home.  I've been spending so much time in this ominous beacon of steel and cement, that I saw it fit to give it a blog entry (lucky building...).  This past week has been one of non-stop work and studying.  It seems that all my classes conspired to stress me out.  My friend from Italy was telling me about how their final exams are stretched out over four weeks.  Even with that, he said, he still has lots of things due all at once.  Still, it has to be better than having everything due within one week.  The culmination of every class, every project coming together in a single week is simply too much.  It seems that all my time is spent in this nifty building, whether it's early in the morning, late at night, raining, snowing, hailing, or raining fire like the apocalypse.


But, this is just the change the winter brings.  Out goes the warm weather, in comes the cold.  No more rain (well, some rain... Ms. Nature can't make up her mind at the moment), just lots of snow and ice.  It's not all bad, however.  Occasionally the snow falls just right, the night sky turns an inky black, and icicles reflect the light from the street lamps in a thousand different directions.  It's a welcome break from the various stress associated with this time of the year.  It may sound cliche, but there's something to be said for stopping and smelling the roses... or in this case, the ice covered branches of the trees on the Engineering Quad.  There's a funny kind of tranquility that the ice has.  It reminds me that sometimes I just have to sit still for a while and reassess my priorities, just like that frozen water is doing (should I be ice?  Should I melt and drip?  I think I will chill here for a little bit...).

In any case, all the badness that is final exams will pass in a matter of days.  The ice will melt, vacations will begin, and building lolcats will consume all of my free time.

Cross-Browser AJAX

I am celebrating right now because I found a work-around for a very strange problem I've been having regarding AJAX and Internet Explorer's general noncompliance with the world. This has literally been on the critical path in my senior design project for months, and seemed to have cropped up out of nowhere. Let me explain...

The Problem

I have a call to a function which initializes an XMLHttp request object based on the browser, of course, grabs some form inputs, and sends those values in the request header of a call to my nifty php function, which manipulates these inputs and gives me some XML in return. Pretty standard stuff. After using this for a while, I noted that it seemed to fail in IE, but not in Firefox (surprise). After some debugging I had determined that IE was indeed making the request, and was indeed getting back data, but the data was all invalid. I tried calling my php file directly from IE, with the same parameters that my javascript pulls, and got legitimate results. What was going on!?

Clearly, the php file seemed to not be getting the right parameters, even though the javascript was computing them correctly. Here is the code:


function customTime() {

// Get form element values
param1 = document.getElementById('param1').value;
...

// Initialize the XMLHttpRequest object
var xmlHttp = ajaxInit();

if (xmlHttp) {

// Define what to do when data is ready
xmlHttp.onreadystatechange=function() {
if(xmlHttp.readyState == 4) {

// Note that even though I get bogus data,
// I still get data... confusing!
var xmlDoc = xmlHttp.responseXML.documentElement;
var nmarkers = xmlDoc.getElementsByTagName("marker");

alert('Number of results: ' + nmarkers.length +
'\nSome data: ' + nmarkers[0].getAttribute("number"));

}
};

// Send the request...
try {
xmlHttp.open("POST", 'custom_data.php', true);
xmlHttp.setRequestHeader('Content-Type', "text/xml");
xmlHttp.setRequestHeader("Content-Type",
"application/x-www-form-urlencoded; charset=UTF-8");

xmlHttp.send('param1=' + param1 + ...);

} catch (e) {
alert("Unable to make request, please try later... Error:"
+ e.message);
}
}
}


The 'Solution'

The problem, in fact, was that, for some reason, using the parameter of XMLHttp.send() to add my form inputs to the request header of my http request failed in IE. The reason for this still has me scratching my head, but the fix was simple enough:


// Send the request...
try {
xmlHttp.open("POST", 'custom_data.php?param1='
+param1+ ..., true);
xmlHttp.setRequestHeader('Content-Type', "text/xml");
xmlHttp.setRequestHeader("Content-Type",
"application/x-www-form-urlencoded; charset=UTF-8");

xmlHttp.send(null);

} catch (e) {
alert("Unable to make request, please try later... Error:"
+ e.message);
}


All I did was move the parameters as part of the URL for the XMLHttp.open() function. Tada! I'll try to do some research into the open and send functions and post the method behind the madness when I get a chance.