Wednesday, May 28, 2008

The High Road

This week has been a very political week. There has been quite a bit of distention through a few different channels in my life lately, but I think I've learned something of great value from them.

One of the situations involved someone else getting royally pissed at me for no apparent reason. There was nasty emails sent, etc, etc. Yet two days later, the same guy thanked me for my input on another project.

It was downright unnerving to have him take my input so readily 48 hours after cursing me out. It makes it sure hard to hold a grudge.

Taking the high road is becoming to appear to be a very valuable lesson that I'm going to need to learn for life. My old approach of getting pissed off at someone and just avoiding them indefinitely works fine when you're sitting in the sandbox (and boy did I take advantage of that property), but once you start touching reality, it seems the world gets orders of magnitude smaller and you're always dealing with the same people.

It looks like to get by in life, the high road turns out to be a much needed path out of a situation that can only get worse.

Tuesday, May 27, 2008

Atmel Free Samples

Lately I've been dreaming of getting an Arduino this summer. With 14 digital I/O pins and 6 analog pins. Aside from all of the flashing LED possibilities, one thing I've been dreaming about is using the I2C bus.

I2C is a two wire interface which allows me to connect multiple slave devices to a host, only using up two of the analog pins on the Arduino. The number of slave devices is limited, I2C only has a 7 bit (127) address space, and most devices only let you select 2 or 3 bits worth of its address. Thus you can only have 4 EEPROMs on one bus, and only 8 different temperature probes, but that obviously doesn't bother me very much, I'm still going to have fun.

I've requested a 256kb (32kB) and a 1Mb (125kB) EEPROM free sample from Atmel. We will finally see if what they say about getting free chips from manufactures is true. The Arduino does come with 512 bytes of ROM already, but adding another 125kB sure expands the possibilities.

One thing that has been bothering me is that I've looked around online, but I haven't found any projects using anything other than EEPROM over I2C. Are there any other chips other than 24Cx EEPROMs that are fun to use with a microcontroller over I2C?

Edit: I have found some DS1721 temperature probes, and requested two of them from Maxim. Obviously one of the first projects I'm going to attempt is going to be taking a temperature reading, logging it in my oodles of EEPROM (125kB + 32kB + 512B onboard), then plugging it into my computer and dumping it all.

Edit: Let me be very very clear. Atmel has completely ignored my sample requests, which is rather irritating. Oh well.

Monday, May 26, 2008

First Weekend in Portola

As far as I'm concerned, Memorial Day weekend is the official start of summer. It's the opening weekend for the Western Pacific Railroad Museum in Portola. I also brought my girlfriend along so she could come and see what really makes a mechanical engineer tick.

Bad weather on Memorial Day Weekend seems to be a tradition. Two years ago, I woke up Saturday morning to a nice 2 inches on snow on the ground. Luckily it had stopped snowing by the end of breakfast, and the snow melted by lunch, but it was still cold, wet, and miserable all weekend. This weekend wasn't nearly as bad; only rained off and on and was cold.

Dad showed up at Davis at 6am Saturday, and we loaded up the car and headed off. We arrived at Portola around 9. The museum typically runs a demonstration passenger train around the yard, which requires at least 4 crew members. We had two student brakemen and, since I happen to already be a qualified brakemen, I got my first chance to be an instructor brakemen.

My student brakeman was George, a striking image of my future plans. He got a mechanical engineering degree from UC Davis and went to Berkeley for graduate school, which is exactly what I'm planning on doing. He then worked in Nuclear power plants and security systems for 30 years. It was a very interesting day talking to him about mechanical engineering and some tricks he picked up in the industry. He was also one of the sharpest students I've seen. He picked stuff up quickly and I rarely needed to repeat anything, other than subtle technique tips.

This was really exciting because I've never gotten the chance to be an instructor brakeman before. I usually avoid working in the operating department at all. I'd rather suit up as a mechanic and dive into the first broken locomotive I find, but this weekend they needed me so that's how it was. To become a qualified brakeman you need 36 hours of experience, most of which I picked up switching to place equipment needed for the mechanical department. I now need to log a certain number of hours as an instructor before I can move on to be a student conductor. I like to think I did a good job teaching George how to be a safe and efficient brakeman.

On Sunday, two directors and the president of the museum showed up and enlisted me to help them reinstall bearings on some axles. This was a bigger job than it sounds. Each set of bearing weighs about 400 pounds. We listed them up with a forklift and had to line them up and slide onto the axle just right. I then wired them on so they wouldn't slide around while they're being moved.

Overall it was a good weekend and I enjoyed hanging out with the gang again. It looks like it's going to be a thin year as for guests and crew, so I'm probably going to be busier than usual.

Friday, May 23, 2008

Something to do about Twitter's Downtime

So the smart thing for Twitter clients to start doing is caching updates and just auto-retrying every x minutes until the service finally comes back up.

There's a few different possible approaches:
  1. After failing to update the first time, fork. Parent exits, child sleeps 5 minutes, tries to post, and loops until successful. Runs the risk of lost updates if computer is shutdown before successful.
  2. Have a system daemon that reads from a spooler file. The user client only appends updates to the Twitter spool and alerts the daemon of a new update.
  3. After failing, simply caches the update and exits. Next time, on startup, check the cache file for updates, and attempt to post them. Does mean that if the client isn't used for a prolonged time, the update won't be posted until then.
Of the three approaches, the second comes off as the most robust. It just means having another daemon running on your system. If not only for approach three, for any of them have an expiration time for updates. Then, if an update still fails after, say, 8 hours, the client just gives up.

Tuesday, May 20, 2008

C Tips Moves Forward

I haven't been working on any interesting projects lately. After being in college for a year, one thing I can tell you is that the quarter system kinda sucks. It's just not very enjoyable to have midterms every other week, until just over two months into the quarter, finals!

Whenever I do have any free time, I've been putting it into http://ctips.pbwiki.com/. Currently I'm working on adding an optimization section. Once thats finished, I'm considering more actively promoting the website online.

In the end, if I never do get above the current 0-2 hits per day, that will be alright. Collecting all of these code snippets in one place has already proved useful for myself. Just like del.icio.us, it's useful for me, but if someone else gets value out of my notes, so be it.

Sunday, May 18, 2008

Name Brand My Ass

So when I say name brand, what do you think of? 10% more? 20% more?

How about 350% more?

I was at Rite Aid shopping for some more laundry detergent. $16 for a bottle of Tide. That's a little pricey. So I look right next to it, and there is "Xtra" brand detergent for $3.50. Granted this bottle is rated for only 50 loads instead of 52, but seeing as how it's an order of magnitude cheaper, I could care less.

Another example of why shopping around can save you some serious cash.

Friday, May 16, 2008

Emergency Aquarium Aerator

One of the big fears of aquarium owners is an extended power failure. An aquarium is always stocked well above natural fish concentration, and depends heavily on the life support - the aquarium pump and heater. When you loose power, it's just a matter of time before the loss of aeration and heat will start stressing and killing your stock.

I was browsing the Harbor Freight website, after reordering their catalog after twice with no success, and stumbled upon a live bait aerator. This would be a perfect backup aquarium pump if the power cut out. Granted, buying anything from Harbor Freight is a hit, or miss, or miss proposition, but $5 seems acceptable for something that may or may not work, and that you may or may not ever use. Just make sure to have a D cell ready, or it'll do you no good unless you pull a MacGyver with a AA and a paper clip.

Wednesday, May 14, 2008

I Hate Echolink

So preparing to get my Ham license in a month, I've been listening to the local repeaters on the 2 meter band, and the one thing that just bugs me is Echolink.

Echolink is a network of radios connected over the internet, allowing a Ham operator to dial into a local radio, telling it to forward its signal to any other radio connected to Echolink. For example, this morning there was a guy from southern UK having a conversation with locals on one of the repeaters in the area.

This just bugs me. It's not that I have anything against people from other countries, or people wanting to talk to people in different countries, but I don't think VHF and UHF repeaters are the way to do it. It's just lame. If you want to talk to people on the other side of the world, go upgrade your license, get a good antenna, and talk on the 80/160 meter bands in the middle of the night.

Granted this is just my opinion, so others will still dial in through Echolink. I'll just keep my mouth shut until they hang up.

Solutions to Project Euler Problems

I've been collecting/ cleaning up/ posting my solutions to Project Euler problems as of late. I urge programmers out there to really try to solve these problems before downloading my solutions, but that is your choice.
http://ctips.pbwiki.com/PESolutions

The best example was problem 67, which required finding the maximum sum path down a 100 row triangle. Impossible to brute force since it has 299 different paths. Months I thought about that problem. Months! I was literally taking a shower when the strategy as to how to solve the problem in under a minute came to me. Excitedly I dried off, ran to my dorm room, and started sketching out the flowchart.

Monday, May 12, 2008

Replaced my Nalgene

Lately it's come to light that drinking from Nalgene water bottles may be a health hazard due to the #7 plastic containing bisphenol A, a chemical that *may* cause all kinds of problems.

Mainly due to girlfriends urging, last week I ordered a metal-based Sigg water bottle. Compared to most other e-commerce sites I deal with, they were a little slow to actually ship my order, but 9 days from order to delivery really isn't that bad. After all, it's a water bottle, not bottle oxygen or something.

Overall I like it. The cap with the loop in it is more convenient than the loop on Nalgene bottles. There are two things I don't like about it:
  1. The water does come out with a slight metallic twang. I'm going to attribute this to it being new and expect that after a few uses the taste will either abate or I'll get used to it. It isn't that bad.
  2. The thread on the cap is a little fine. It feels a little overkill to rotate the cap three times from closed to open. At the same time I can understand why the thread is so small, the cap does have a tendency to leak if the cap isn't tight, so a higher mechanical advantage is an advantage.

Hubble vs SMS Doesn't Make Sense

So I happened on an article on how SMS messages are significantly more expensive than downloading data from Hubble. This just really bothered me:

Why in the world are they comparing SMS messages with Hubble? Hubble broadcasts pictures of deep space, SMS messages are sent from teenager to teenager (Was that too coy? Sorry: person to person).

Hubble just doesn't make any sense. If they want to emphasize how ridiculously expensive SMS messages are per bit, compare it to OSCAR (Orbital Satellite Carrying Amateur Radio). OSCAR is a network of satellites launched since 1961 with repeaters in them. To use them, all you need is a Ham license and a hand held radio. I've been trying over the last few days and I think I might have picked up one of the beacons (Weak morse code vs noise is like 1% vs 2% milk). Getting a Ham license is very easy. There is study guides online, and the test is only 35 multiple choice questions and usually only $14.

Transmitting data through OCSAR satellites is not at all infeasible. There is a huge variety of data modes for radios ranging from computer-generated morse code to Phase-shift-keying to even more sophisticated means which are more noise-resistant. The idea of building a hand held radio with text input powerful enough to transmit on 2 meter for around $200 doesn't seem that far fetched.

Transmitting data through OSCAR is nothing more than the hardware (which they seem to ignore in their article) and the electricity. Remember that Ham radios are run off battery packs, so the power use is minimal.

Friday, May 9, 2008

Murphy's Law Applied to my Bike

I swear, I've almost replaced everything on this bike.

Brakes, front rim, back tire, both inner tubes multiple times, seat, drive train, and then today my pedal broke off. Luckily I had just left for Neuroscience, so I wasn't on the other side of Davis, yet. Half an inch of solid steel rod, sheered off.

So not looking forward to spending any more money on my bike this quarter, I picked the next closest carcase of a bike that someone had left behind, and stole a pedal off of it. Should get me till the end of the year.