Hung Truong: The Blog!

  • July 19, 2008

    Bat Attack!

    Less than 4 hours after writing about The Dark Knight, revenge struck in the form of a bat flying around in my apartment. I’m not sure if this bat was sent as punishment for me not going to see Dark Knight again or what, but it freaked me out! It flew around the living room for a while, terrorizing me, then went to other parts of the apartment. Then it kinda crawled around on the ground for a while. I think it was trying to hide or look for high ground to start flying again.

    Then I hatched an ingenious plan to open a window and have the bat fly out of it! It worked!

    I really have no idea how the bat got in, since the only windows open were the ones with screens. Maybe the bat squeezed through one? Or maybe it was a lame assassination attempt? We may never know the truth!

  • July 18, 2008

    The Dark Knight: In IMAX!

    I went to see The Dark Knight in IMAX last night. It was pretty good. I mean, as far as movies go it was probably one of the best I’ve seen in years. But there was so much hype leading up to it that the movie was kind of wasted. My co-workers were really psyched about the movie. So listening to them continuously talk up the movie had its effect on me, I guess. If I had come in with no expectations, the movie would’ve been incredible. It still was, and it met the hype, but sometimes I feel the best way to go into a movie is with no expectations at all.

    When I went to see Wall-e a few weeks ago (or maybe it was just last week), I had no idea what the movie was about. Okay, so I knew it had a robot in it. And that was about it. I ended up enjoying it a lot! I think we, as viewers, should just let the damn story tell itself. No spoilers, no trailers, maybe just a title.

    Knowing as little as possible about a movie going into it probably gives the best chance for me to enjoy it.

  • July 15, 2008

    Hardcore Rails/Server Troubleshooting Session!

    So early last night, I noticed that one of my sites, Anime Nano, was flipping out and throwing 502 proxy errors. I tried to do some simple troubleshooting but it seems as though the problem came very suddenly, and I figured it might go away very suddenly as well. The thing about this particular problem was that I had made no changes to the server. So the problem should fix itself! Unfortunately, life is not so simple.

    When I woke up in the morning, not only was the site still throwing errors, it was also affecting my other websites as well. MapsKrieg, Notecentric, Basugasubakuhatsu, etc. So I figured I should find out what is going on. I sent a support request to MediaTemple, my host, in case it might’ve been something on their end. It took a while for them to reply, but they eventually just told me it was something taking up all the memory and that I should try to optimize the site. Not too helpful. But I don’t really expect MediaTemple to provide this kind of support anyway. And it turned out it wasn’t their fault.

    Upon closer inspection, the site was really behaving weird. I could tell by the logs that the site was actually rendering things, but it always took about 189 seconds. This was odd. I’ve had experiences before where the rendering took less than a second but the page still took more than 3 seconds to load. But 189 seconds! That was a bit too much.

    I had suspected it was something to do with the mongrel cluster that I had set the site up to run on. Basically, I followed the script that MediaTemple provided and I still don’t have a great understanding of how mongrel cluster works. That’s definitely bad.

    I tried stripping the view of everything but the content for layout. I got rid of before_filters and tried running the site on the mongrel clusters as well as the webrick server on port 3000. The same thing happened. It took way too long for the site to load. Thinking it might be easier to test on my local machine, I got the site and database from svn and mysql and, strangely, it worked fine on my PC.

    Now things were slowly fitting together. I was reminded of a post that someone made on Anime Nano about how their feed wasn’t being aggregated into the site. Apparently their feed was unreachable from my server. I had previously chalked this up to weirdness on their server, but I wondered if it wasn’t a problem on my server. The thing about each pageload taking almost exactly 189 seconds pointed to a timeout issue. Then I realized there was a piece of code in Anime Nano that I hadn’t written. It was a plugin for Text Link Ads that I used for some ads on the bottom of the site. That plugin was grabbing a feed of ads and parsing it to show links automatically on the site.

    If their site was unreachable, it’s possible that Anime Nano was just waiting on grabbing that snippet of code and timing out. And that’s exactly what happened. I commented out the text for the ads and the site immediately started working again. I’ll have to look into how I can prevent this from happening again before reinstating the ads.

    So what did I learn from this whole experience? You should probably understand how code works before randomly integrating it into your site (I added that code a long, long time ago and forgot about it). Also, relying on a third party to provide some information before loading your site is just plain stupid. I can’t believe how badly thought out I had made the organization of the site.

  • July 14, 2008

    Wii Fit: Fun With Linear Regression!

    So I’ve been playing Wii Fit for a while. One of the really neat things about the program (it’s not really a game, right?) is that it automagically graphs your progress as you lose weight. It’s pretty nice getting positive feedback when you put hard work into something. I think this is one of the very well thought-out features of Wii Fit.

    Anyway, I was looking at my weight going down and figured I’d do some rudimentary linear regression on it. I’m pretty much just eyeballing it because I don’t want to throw stuff into R or Matlab. It seems as though I’ll reach a threshold (away from Obesity) around the end of August. Though I’m basing this on a linear fit. It’s possible that the actual plot will end up looking more like a power law since it’s easier to lose weight when you’re way overweight. The point is, I’m losing weight and it’s nice to try and see when I might reach my goals.

    I also think it’s worth noting that Wii Fit seems to overestimate my weight. Because when I use my bathroom scale my weight is always lower than what Wii Fit says. I guess I could adjust the “weight of clothing” but since I always pick the same thing I don’t want to mess with the consistency.

    Now, if Nintendo had programmed some regression in automatically, I’d have to give it a 10/10 for science! But for now I’m pretty happy with just the graph functionality. It’s fun seeing large local fluctuations with a general downward trend. Now, if I can only keep this graph from turning into a parabola like with my DDR Diet…

  • July 11, 2008

    iPhone 3G GET!!!!

    So after a few false starts, I have an iPhone 3G that works.

    The journey was a long one; at the end I grew weary and lost faith. But finally, I have a neat iPhone 3G that does cool stuff.

    It started this morning at around 5:30. I woke up (though I only got like, 3 hours of sleep since I had taken a nap earlier and messed up my sleep cycle) and took a quick shower. No breakfast. Just took a vitamin water (these things are kinda good!) and a coffee granola bar for energy.

    Gaurav (from Troubadour Mobile) picked Adam (also from Troubadour Mobile) and I up. We drove to the mall and saw a bunch of peeps. We also saw some officemates from CampusRoost (yes, that’s a slick mention!). They told us that the AT&T store on Liberty had like, zero people and we should go there.

    When we actually got to the AT&T store, it was around 6:30ish. There were actually about 30 people in line. Apparently everyone showed up around 6:15 or so. There was a really cool line wrangler named Steve that kept everyone reasonably informed. We found out there were like, 40 phones. So we should be able to get one. Adam and Brent didn’t want to settle for white ones. Or 8GB ones. But I think eventually Adam got a black 8GB and I dunno what Brent did.

    At 8am, the line started moving, and it was moving well. But then disaster struck! It seems either Apple or AT&T didn’t have the resources to take a billion people in the US all wanting iPhones at the same time (and having to activate them in the store). The activations were apparently taking around 45-50 minutes each when they should’ve taken 15 or so.

    Eventually, the AT&T people let us just do most of the steps in store and then activate at home. By the time we were done, it was about 11am. I went home and tried to activate the thing for about 15 minutes. iTunes was just being bad. So I went to sleep. I woke up at around 2pm and tried to activate again. This time it worked after about 30 minutes of trying.

    I’ve been loading up apps and trying them out. It’s pretty cool. My favorite so far is the PhoneSaber.