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.

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

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.

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.

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.

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.

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.

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.

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.

Wosaic

So, the hectic pace of school and life has left this blog seriously lacking.  That's ok though, because this shameless plug comes with a reminder that (for me) that this blog exists, and some ideas for new posts.  The plug: Wosaic.


Yea, I think I've plugged this already, but today (Sunday) marks the first official "beta" release for our project.  It's pretty exciting, as it represents a couple months of hard work and problem solving, not only in the domain of programming problems, but also project management and software design.  Maybe in the course of this plug, we can get some insight from the project's ups and downs, and how to manage a project.


Lesson 1: Version Control

This is a must.  Anyone who's done any kind of serious coding within a group, knows this as common sense.  Luckily for me, this has become my intuition as well as the intuition of my project partner, Scott.  However, living in the world of undergraduates, it's easy to come across people who have not been exposed to such situations.  So, for anyone not aware: verison control is crucial.  It allows you to organize your code such that it is available to all your project members, is up to date and synchronized with your latest changes, and serves as an archive of your code, should something go terribly wrong.  Typically the flow is something like, check out some source code, make your changes, and commit them.  For instance, if you wanted to toy with Wosaic (say, add a new source plugin, which is nice and easy to do), you could check it out with the following svn command:


svn checkout http://wosaic.googlecode.com/svn/trunk/ wosaic


Subversion (SVN), for example, keeps track of the files that you change and will recognize this when you are ready to commit your changes.  Committing simply adds your changes to the 'trunk,' or the rest of the source code.  Now when other people checkout, or update their code, they will get your changes.  Neat, huh?  Not only is it neat, but it is an excellent way to stay synchronized with your project members.  


Lesson Two: Bug Tracking

No project is perfect, but good projects can track their imperfections and schedule fixes.  This is where having a database of bugs is useful.  The idea is that someone can file an issue, or bug, document it, and assign it to someone.  This gives the developers a clear list of the things they have to fix and how to reproduce issues.  Not only is it good documentation, but having a glaring list of bugs helps remind project members about what needs to be done, and ends up making people more productive.  I mean, let's face it, nobody wants to admit that their project has bugs.  One resource people rave about, though I haven't used it myself, is Bugzilla.  This has the advantage of being free, fully featured, and developed by the open source demi-gods of Mozilla.  On Wosaic, we used a simple Issue Tracker that came with our Google Code site.


Lesson Three: Project Website

Another useful thing to have is a website for the project.  It's useful to aggregate releases, documentation, and discussion in one spot.  For this, we used Google Code.  This was an invaluable resource, as it sets up a nice SVN repository.  Additionally, it provides a wiki, and issue tracking.  The wiki is perfect for documenting features and project design.  Having the ability to get feedback from users is also a valuable tool... assuming, of course, that you have users.


Lesson Four: Distribution

This was probably the most interesting part of developing the Wosaic project.  Being an open source project, Scott and I wanted to make it accessible to all platforms.  Naturally, we chose to implement our idea in Java, since Java prides itself on striving for platform independence.  This is all well and good, but you still need to sort through the small nightmare of different JRE versions, IDEs, building jars, automating the build process, and producing 'native' applications for multiple platforms.  One tip for Java developers: decide what JRE to use right up front.  Say, "Hey, let's be compatible with Java 1.5 and up" and stick to it.  This is important, regardless of the language, as there are and will continue to be revisions to languages and their compilers.  Java is interesting because it requires a virtual machine to run, which gives it the platform independence, but lacks the feel of, say a native OS X (or Windos, or *nix) application.  The ability to create executable jars makes the experience close, but not quite there.  We resorted to some other tools to help us out, such as Launch4j for windows, and Apple's Jar Bundler for OS X.


Such tools are nice for releases, but for day to day development, there's nothing that beats a good Ant script.  This is very similar to a Makefile, for those lucky enough to be acquainted with Makefiles.  For others less (or more?) fortunate, this means that with a simple command, 'ant' you can build the source of your project, run it, generate documentation, and brew a cup of coffee.  Well, maybe you can't get coffee out of the deal, but just about anything else you might want to automate with regard to the build process can be automated with Apache's Ant.  It's pretty sweet, because an ant script just boils down to an XML file that specifies various targets and tasks.  One cool thing about this is, if you are a documentation freak like me, you can whip up a little XSL stylesheet and transform this xml into a website that details your build targets for anyone to view at their leisure.  You can even use ant to perform the transform ().  Sweet.


... And Back to the Plug

Phew.  Well, that turned out to be more substantial than I anticipated.  There are plenty more lessons to be learned, but I think we've hit on some important point here.  Remember to check out Wosaic's project site, and grab yourself a copy of our source (or one of our sweet binaries... Mac users note the handy disk image).  Until next time, peace!