Friday, February 22, 2013

The best of Carnegie Mellon

It is now more than three and a half years since I moved to Pittsburgh. I do not believe I have senioritis quite yet, but graduation is approaching at an ever-increasing rate, and I have already been considering my future for a couple of months. And while it certainly is the time to think about the future and the many great opportunities it holds, it is also the time to evaluate the past and appreciate the best of Pittsburgh and CMU while I am still here. So, here is my attempt to compile my best memories from four years at CMU.

Orientation
As an incoming freshman, you are required to attend one week of orientation before classes start. This week is packed with exciting activities, all aimed at getting to know each other better. I got a lot of great friends in that first week, and we had tremendous fun. We went bowling, went on a boat trip with big speakers and dance music, and we played "I gotta feeling" by The Black Eyed Peas over and over again. We even had a giant "rock, paper, scissors" tournament among all the (over 1500!) incoming freshmen at Playfair.


The atmosphere was simply amazing, and everybody felt comfortable randomly talking to everybody else. All without a single drop of alcohol.

The housing communities
From my first year in Henderson House, through my sophomore year at the Neville Co-op, junior year in West Wing and senior year in Morewood Gardens, an excellent community and great friends have always surrounded me. I have had some truly excellent roommates, which I hope to keep in touch with as I leave Carnegie Mellon and leap into the future. Who would have thought I'd be a best friend with one from the Bronx?

Yuva India Restaurant
This restaurant simply serves the best meal that a man could ever wish for. Located at Craig Street, this is where I end up whenever it is too cold or too wet to walk to Oakland. Frankly, I might end up here even it is warm and bright as well, because the Lamb Karahi is just amazingly good; at least when they get it right, which they do most of the time. At least 50% of the time. Oh, and the woman in charge who wears sunglasses indoors? Priceless!

The academic community
I have no other word than outstanding to describe the academic community I have found here at Carnegie Mellon. It was the rumour of great work ethics and friendly geeks that attracted med to this school in the first place, and the CMU community has exceeded my every expectation. This is a school were everybody takes deep pride in their work, and I have always been encouraged by my peers and teachers to give my very best in everything I do.

While we certainly had a superb community in my TAF class at Knarvik Vidaregåande Skule (high school), our focus on quality and work ethics was not quite at the level of CMU. The support that this community has given me in pursuing excellence is something for which I will be ever grateful. I now have an appreciation for hard work that I did not have before. It has grown on me this that Andrew Carnegie once said: "My heart is in the work."

The weather
Growing up in the Bergen Area on the west coast of Norway, I am acquainted to rain; thus, the rumour I found on the Internet about terrible Pittsburgh weather did not at all scare me. And when I got here, it turned out that the weather is excellent! Maybe a little too hot the first two weeks of fall, and a little too cold the first two months of spring, but generally: the weather is excellent. The sun shines regularly, the temperature is great and the rain comes in sudden thunderstorms rather than being spread thin across several days. It is great! It was particularly funny my freshman year, when 30 cm of snow fell on one night. The streets were closed for three days! It gave me time to make this video about Pjeff.


Volunteering at an old monastery.
We restored the building so it could
be used for after-school programs
The clubs and organisations
The variety of organisations on campus is tremendous, and I have been blessed to participate in several of them. My freshman year I went to the Dominican Republic with Alternative Break, and started my very own Floorball Club with a friend from Singapore. The university supported us by providing us with a place to play, and helped fund some of our equipment costs. I have also been a part of one of the many great Christian fellowships on campus, an ad-hoc soccer group, the table tennis club, and the pool club, as well as academic honour societies.

The educational flexibility
At Carnegie Mellon, we are allowed to pursue depth and breath sequences of our own choice, by putting together our own schedule every semester. As a student in Electrical and Computer Engineering, I have been able to take classes from the Departments of Civil Engineering, History, Philosophy, Computer Science and Music that I find interesting. I have for instance taken several interesting courses in religion, and the music courses I am allowed to take counts towards my general education requirements. I believe it is an excellent quality of the education model that the students gain deep insights in more than a single field.

The ice cream
Pittsburgh, and in particular the Oakland and Squirrel Hill areas, are the Mecca and Medina of great ice cream. Carnegie Mellon, being strategically located between the two, is thus a great starting point when hunting for the sugar shot of the day: Go east to Squirrel Hill, and you will experience the deepest, darkest, most fulfilling chocolate milkshake that man has ever made at the Cold Stone Creamery; Go west to Oakland, and your taste buds will praise you in utter astonishment for the chocolate with hot fudge you got at Dave & Andy's Homemade Ice Cream.

The professors and teaching assistants
Getting to know the teachers and professors have been one of my great experiences at Carnegie Mellon. The vast majority of them do their upmost to provide plenty of time where the students may ask clarifying questions, and the professor or his assistants will answer general or specific questions to the best of their ability. While I was ignorantly unaware of how great this offer really was my freshman year, I really started appreciating this form of learning when I became a teaching assistant myself, first semester of sophomore year. Talking about course material (or even material that only is only vaguely related to the course) with course staff is simply one of the best ways I could possibly learn, and also a good way to find fellow students to work with.

One of my many favourite professors, Helmut Vogel
Having the opportunity to teach as a course assistant for three semesters myself was also a rewarding experience, both because of how well I got to know the professor, and also because of the rewarding interactions with students in the course. I sincerely hope I will have the chance to do more (that resembles) teaching in my future career.

Research opportunities
The research opportunities at Carnegie Mellon are wide and diverse. As an undergraduate in Electrical and Computer Engineering, I have been encouraged to participate in research projects with world-renowned professors, and one of the research projects I have participated in have already shown some quite remarkable results. Applying what we learn to a real research projects is immensely rewarding, and is an excellent supplement to the required Capstone project classes that I think everybody ought to take advantage of.

The game room
How often do you get to play as much pool as you want, on good tables and with excellent opponents? Answer: All the years that you spend on Carnegie Mellon. The game room community is diverse, and covers table tennis players, DDR –dancers, foosball players and pool players, as well as the many occasional flirters who attempt to teach their targets how to hold a pool stick, and those who just play randomly with a bunch of friends. Yup, there is an air hockey table and a curling –table as well.


In sum, I am very happy that I studied at Carnegie Mellon, and I would have chosen to study here again. I hope to maintain the best friendships I have made here, and I hope to come back to visit during spring carnival some time. It has been an honour staying here, and I am confident that Carnegie Mellon University will continue to excel in teaching and research in years to come. I pray that its students, staff and faculty will continue to see the fruits of their hard labour, experience personal fulfilment and live in happiness. As they would put it here in America:

May God bless Carnegie Mellon.

Tuesday, February 19, 2013

Serial Communication with RXTX in Java 1.6 for Mac OS X 10.7 (Lion) with Intel 64 bit processors

After spending way too many hours installing the RXTX library for Java on my Mac, I though it might be worthwhile to save others the trouble by sharing what I did to make it work. (Version 2.2) (2/18/2013)

None of the binaries I found that were available worked for me, and getting the configuration and build instructions right was neither completely trivial; some of my attempts plainly did not import at all (even though my code seemed to compile nicely), while in other attempts the code crashed and gave a non-sensical PortInUseException. (What I gathered from reading the online discussions, is that there are some issues regarding 32-bit vs 64-bit architectures, some issues regarding different parts of RXTX not working well together, some issues with the use of lock-files in Mac, and some issues with regards to RXTX not always working well with Java 1.6)

In any case, these are the steps I found to work:

(Most of which are based on this far more insightful walkthrough by Chris Bartley)

0. Remove all files from previous attempts to make RXTX work.

1. Install XCode Command Line tools, if you haven't already (I used XCode 4.6). (You can get XCode from the App Store. After XCode is installed, open XCode, and go to XCode -> Preferences -> Downloads -> Components -> Command Line Tools to install)

2. Download the source in order to build RXTX yourself. (None of the binaries that I found online worked for me, but you are welcome to jump to step 8 using my binaries if you want). You can get the source by telling this to the Terminal:

$ export CVSROOT=:pserver:anonymous@qbang.org:/var/cvs/cvsroot
$ cvs login
Logging in to :pserver:anonymous@qbang.org:2401/var/cvs/cvsroot
CVS password:
$ cvs checkout -r commapi-0-0-1 rxtx-devel

For the password you may have to type something random (e.g. a space character), if the Terminal goes off looking for a password in a file; but you should not need a password per se.

3. Check that, in your ~/.profile, the PATH environment variable has /usr/bin and /bin first (if needed, modify .profile so that the places where you set the PATH (e.g. "export PATH=$PATH:/opt/local/bin:/opt/local/sbin") have the additions at the end)

4. Set the variable JAVA_HOME:
$ export JAVA_HOME=`/usr/libexec/java_home`

(This step may not be necessary, but if Chris Bartley includes it, so do I)

5. Make sure there are no spaces in the absolute path to the rxtx-devel folder

6. Run the configuration script in the rxtx-devel folder
$ sh ./configure

7. In the rxtx-devel folder, manually edit the Makefile such that the JAVAINCLUDEDIR variable gives the correct path for the file jni_md.h (you will have to search for the file jni_md.h on your hard drive).
JAVAINCLUDEDIR = /System/Library/Frameworks/JavaVM.framework/Versions/Current/Headers

Of course, your path will be different than this; it will be the path to where you found jni_md.h. (This variable was found somewhere around line 107 in the Makefile when I did this.)

8. Build
$ make

Two files are produced with which we are concerned. They are:
    * rxtx-devel/RXTXcomm.jar
    * rxtx-devel/i386-apple-darwin11.4.2/librxtxSerial.jnilib
    
Note that the name of the folder I call "i386-apple-darwin11.4.2" may change depending on your system. This is simply the folder name I got, running OS X 10.7.5 (Lion) on a 2.4 GHz Intel Core 2 Duo (64-bit architecture).

(The files that I produced in this step are available here, in case you want to try those, rather than making your own.)

9. Move the two files acquired in step 8 to /Library/Java/Extensions
Updated! See below

10. Add execution permissions to RXTXcomm.jar
$ chmod +x RXTXcomm.jar

At this point, RXTX works for me. In your Java source file, you should only need to
import gnu.io.*


UPDATE (2/20/2013)
It turns out that step 9 above will break some other Java applications (e. g. the Arduino IDE). A better version of step 9 is the following (these steps are specific to Netbeans, but I am sure you can do something similar using other development environments):

9.1  Move the file RXTXcomm.jar to a location where you can access it from the project where the library is needed, e.g. in a folder "libraries" inside your project folder.

9.2  Move the file librxtxSerial.jnilib to the base directory of your project

9.3  Open your project in Netbeans, then right click on the "Libraries" folder and choose "Add JAR/Folder." Find and select the file RXTXcomm.jar in the dialog that shows up. Since librxtxSerial.jnilib is in the base directory for your project, it will be automatically recognised.