Recent Project

I haven’t blogged about programming in quite a while, so I figured I may as well give it a shot. My current project that I am working on is a Haskell function to automatically conjugate French verbs based on the given pronoun. Currently the module only supports present infinitive tense, but I would like to one day expand it out to support many different tenses. The code takes advantage of the Data.Map data type for fast lookups, as I keep all of my irregular verbs in a map, and handle the regular ones using basic suffix rules.

Overall it’s a fun little project that is testing my Haskell programming ability. It is not overly complicated, but I have already found uses for the MonadPlus type class :-) I’ll post the code up when it’s further along, maybe I’ll make a package out of it or something, though I wonder who would find any use for it :D

Posted in Code | Leave a comment

Bee Stings! Oh No!

Today I was stung by a bee while playing Frisbee with some friends. Every once in a while a group of CS nerds (myself included) get together and play a nice fun game of Ultimate. Today we were playing a 4 on 3 game in the grassy area behind Chrysler Hall, one of the buildings on the UWindsor campus. Everything was going great until I noticed a sharp ache in my left foot. I assumed it was just a rock in my sandal again (dumb me was playing in sandals), but when the pain didn’t go away I looked down and I saw the jerk. There was a bee sitting right on the edge of my sandal! He must have flown down from above, landed on my sandal, and stung me!

Needless to say I’ll be staying off my foot for the next few days as the swelling has already begun to set in. If I’m not able to put a lot of pressure on it by Monday I’ll just work from my couch instead of going in to the lab. Chelsey, my awesome girlfriend who is a nursing student, told me that I should be good by next Friday, so hopefully my Ultimate career isn’t totally ruined ;-) I do give props to the bee though – pulling off that kind of landing is really tricky. Maybe he should enlist in the Air Force :-) put his stinger to good use.

Posted in Etc | Tagged , | Leave a comment

Camping Adventures at Arrowhead

I completed my first camping trip ever recently. I say it’s my first, but really it isn’t — I did camp once when I was very little, but aside from catching a dog-leash with a fishing pole, I don’t remember very much from it. Arrowhead Provincial Park is a beautiful campground just outside of Huntsville Ontario. Me being a city-boy, I was at first very nervous about leaving the comforts of civilization, but the sheer beauty of Arrowhead quickly made my worries melt away.

Chelsey and I drove together on the Thursday to meet with her family who had already been at the campground for a few days. The reason we had to go up later than everybody else was because Chelsey could not get the time off work. My current job is more flexible with hours — so long as I get about 20 hours of work done a week, I’m fine for making my own hours; I simply worked more hours from Monday to Wednesday to compensate for taking a vacation. The drive up was fairly uneventful: we took the highways all the way up, bypassing Toronto (thank goodness, Toronto is a very busy city). We split the driving job amongst ourselves, each driving approximately three hours; I took the first shift, and she took over afterward.

Chelsey and I arrived at the campground at around 1:00pm and we promptly settled in. Chelsey’s family brought up a trailer, while her uncle chose to sleep in a tent. The trailer was modest, but cozy. It had running water and electricity, and I was able to charge my phone (at the relief of my mom, hehe), and thus it didn’t really feel much different from a small house. The backyard of that small house, however, was nothing short of breathtaking. There were huge trees as far as you could see, in fact the entire campground seemed as though it were embedded in a cave of green. It was gorgeous.

On the first day we mostly relaxed and got ourselves settled into the trailer. We had an early night, which was good, since we decided to take a nice 4km hike on the second day. Arrowhead contains many trails, both walking and biking, of varying lengths. On our second day at the park Chelsey and I walked one of the larger trails: Beaver Meadow. It was amazing how quiet it was! The only sound we could hear was the calling of birds, and the skittering of the occasional chipmunk. We didn’t run into any black bears, thank goodness. The entire trail took us just over 1.5 hours to complete, and by the end we were very hot and sweaty. Luckily there was a beach for us to cool down! And when I say cool, I mean cool. The water was a bit chilly.

Later that evening (this being Friday) Chelsey took me canoing. This was my first time in a canoe, and some may have questioned my Canadian citizenship before that, but I can now proudly say that I am an expert canoer (canoeist, canoe-pilot, canoe-dude?). I was taught how to properly rudder a canoe for steering, as well as how to properly J-stroke (which, by the way, is really the only way to stroke on a canoe). I even saw a beaver! As we were heading back from the falls, I stated to Chelsey “That piece of land is floating away!”. It turns out that I was actually witnessing a beaver carrying away some wood to add to a dam further up. It was very neat!

On the third day, Chelsey and I went on another hike, this time down the Homesteader’s Trail, which is another one of the longer trails. The Homesteader was really hilly, our legs got quite a workout that day! The Homesteader gets its name from the fact that it winds past some very old stone structures that must have been made from early settlers. There is even a broken-down buggy along the side of the path. The evening of the third day was fairly calm. Chelsey’s dad cooked a roast over the fire pit, and it was delicious! Everyone was going to bed fairly early in order to get ready for the long drive home the next day, but we did wait up long enough to see the stars come out. It’s amazing what you can see in the night sky when you get away from the light pollution of the city. I was moved enough to purchase a book on amateur astronomy and some day I plan to build (or buy, maybe) a telescope for use on clear nights.

Sunday morning we packed up camp, and we began the homeward journey around noon. I, lacking in highway driving experience, opted to drive the whole 6 hours back home, just to prove to myself that I could. Aside from the occasional stops for gas and food, I drove non-stop.

And that describes my first trip to Arrowhead Provincial Park. Hopefully it will not be my last. I look forward to more camping trips with Chelsey in the future. Just as I got her hooked on reddit and her macbook, she got me hooked on nature.

Posted in Etc | Tagged , , | 1 Comment

Using rsync to remotely backup files

My laptop (a Macbook uni body that I picked up at the end of 2009) goes everywhere with me. Now that I am working on some serious stuff, it would be a damn shame if my laptop were to get damaged, stolen, or whatever. Thus recently I bought a cheap desktop computer from Futureshop, dumped Slackware on it, and set up rsync to run as a daemon. This setup allows me to remotely sync my laptop (certain directories, at least) with my desktop.

In case you don’t know about it, rsync is one of the coolest programs around. In a nutshell it syncs files and directories across networks. This blog post won’t go through the nitty gritty details involved with setting up rsync to run as a daemon (meaning it runs constantly, listening for connections), but I will briefly go over my personal setup that keeps my machines in sync.

I started out by picking a few directories on my laptop that I wanted to keep in sync: my documents, my pictures, and, of course, my code :-) . I then set up rsync modules corresponding to each directory. An rsync module is essentially a name that is attached to a directory on the server. So for example the module “bryan_code” corresponds to the directory /home/bryan/Code.

Next I wrote a shell script to automatically call rsync over a list of directories to sync. It responds to two commands: “push”, which pushes the laptop files onto the server; and “pull”, which yanks the server files down to the laptop. I have released the full script under the MIT License, and it can be found here. Hopefully it will be useful to you.

Next I started looking for a way in which I could tell my laptop to push its files up to my server daily, so that I don’t have to constantly run the script manually. I looked into using cron jobs, but when my laptop is asleep (which is often) it may miss its scheduled uploading. Luckily OSX has a program called “periodic“, which works just like cron, but if the machine for some reason misses its scheduled job, it runs the job as soon as it possibly can.

Therefore all I had to do was dump a small script into /etc/periodic/daily in order to have daily automatic backups! The script looks like this:


#!/bin/bash

script=/Users/bryan/bin/sync

log_file=/var/log/sync.log

if [ -e $log_file ]; then

    sizeof_file = `du -k $log_file | cut -f1`

    if [[ $sizeof_file -gt 1024 ]]; then

        rm -f $log_file

    fi

fi

date >> $log_file

$script push >> $log_file

This dumps all output to /var/log/sync.log, in case something goes wrong and you need to see what screwed up. And voila! Automatic backups!

Posted in Code | Tagged , , , | Leave a comment

SSH Executing Remote Commands

One nifty feature of ssh that I sometimes forget to take advantage of is that you can use it to execute commands on a remote server and then promptly log you back out. Say for example that I would like to log onto a remote machine just to check the tail output of some log file. Instead of running ssh to log in, executing the command manually, and the logging back out; the whole operation can be performed as:

ssh myname@myhost ‘tail /path/to/logfile’

Inside of the single quotes is the command to execute. For programs that are user-interactive, such as top, you can pass the -t flag to ssh. I didn’t know this before, I found out today while reading systemsboy’s blog :-)

ssh -t myname@myhost ‘top’

With this newfound ssh knowledge, I decided to put it to work by building some server control scripts. I now have scripts to shutdown, and restart my server which I can execute from my laptop :-)

Posted in Code, Etc, Stuff and Junk | Tagged , , | Leave a comment

Fireworks Night!

Chelsey enjoying the fireworks

Chelsey enjoying the fireworks

Every year Windsor and Detroit hold a joint fireworks display along the Detroit River to kick off the International Freedom Festival. It is the largest international display of its kind, or so I’m told. The fireworks were simply breathtaking! Chelsey (my super-fantistic girlfriend) and I watched them downtown by the river after she finished her shift at work, and I was able to get some really nice looking photos of the display, which you can see at my photo page. I don’t own a nice camera, so all of the photos were taken with my Blackberry (it takes decent photos, but the zoom is a little wacky).

Every year the displays get better and better. This year was fantastic, and next year will be even more grand.

Posted in Etc | Tagged | Leave a comment

Gay Walmart Employee Forced To Wear Special Uniform

A gay Walmart employee was forced to wear a special yellow vest and faced further harassment after word got out that he was a homosexual. Stay classy USA.

http://prideinutah.com/?p=2040

Posted in Etc | Tagged | Leave a comment

Fall Schedule

This upcoming fall semester (Fall 2010) will be my last semester as an undergraduate at the University of Windsor. All I have left to do are elective courses in order to finish off my Honors Computer Science degree! Yay! However, picking electives is hard, since most other subjects suck really hard (no offense). I’d simply fill in my elective credits with more Mathematics courses if I could, however in the spirit of making me a more rounded human being, I am forced to take courses outsode if CS and Math to graduate. I tried to fight it, I had people from my department get behind me, but in the end it didn’t matter. Oh well. I’ve come to accept it.

And now for my Fall 2010 schedule! My courses are (in order of fluffiness): Intro to Linguistics (first year languages); Cell Biology (first year biology, not required for a major in bio, for fluffy reasons); Physics and Society (second year physics elective, seems like it will be more like a history class, but physics is at least interesting); and lastly, as a final CS course (I had space for one more), Seleted Topics with Dr. Frost — I don’t really know what to expect yet, I believe it’s some sort of reading course — Neat!

So that’s it for my last semester. I hope to start graduate studies in the Winter Semester with Dr. Frost. It’s been a long time coming now, and I’m really itching to be done!

P.S. My face is still dry. I’ve got to have more bloodwork done tomorrow to monitor my progress. I’ll supply updates when I know the results :-)

Posted in School, Stuff and Junk | Tagged , , , , | Leave a comment

Nice Evening

Tonight Chelsey and I are sitting out on the screened in porch. I’m installing Windows 7 on her old laptop, and she’s browsing for information on thunderstorms. Tea will soon be had. I like these quiet nights :)

P.S. My face is really clearing up. The meda are doing the trick!

Posted with WordPress for BlackBerry.

Posted in Etc | Leave a comment

7 Days In

It’s been seven days now since I started my new acne medication, and I thought I’d write a little status update. So far things seem to be going okay. I’m noticing that my skin is much drier than usual (which is good, because that’s what the meds are supposed to do), especially around my lips, though my forehead is also dry. I’m also kind of itchy, but that could be attributed to some mosquito bites :-)

In order to combat the dryness, I’ve been using ample amounts of lip balm, as well as a moisturizer for my forehead. Hopefully I’ll be able to keep this under control so the medication can do it’s thing without making me too uncomfortable.

Posted in Etc | Leave a comment