Tuesday, 16 September 2008, 19:11:53 MDT comments(1)
Categories:
Sometime in late 2005, or early 2006, I learned of a forthcoming book entitled Learn Objective-C on the Macintosh. Since I had desire to learn about this very topic I signed up to receive an email notification when the book was published. On July 26, 2006 I received that notification, and it has been sitting in my email inbox ever since. I never had the time to devote to the book while I was in school. Last Tuesday I purchased the eBook (just a PDF), and finished reading it this afternoon. This post is my review of the book.
First, the overall presentation of the book is well done. The eBook is colorful and has large, easy to read, text. Important points and side notes are broken out of the main text with in-lined blue boxes. The chapter openings are single column pages, and the chapter pages are two column. Each chapter is broken up into subtopics that make it easy to digest in small chunks. So the presentation gets a 5 out of 5 from me.
Second, the content. I think the book is well laid out, and does a good job covering the basics of the language. The book assumes a prior knowledge of C, but not any prior knowledge of Object Oriented Programming (OOP). Having taken two classes in C++ (an OOP language), I was already familiar with the concepts, but I found the discussion to be a welcome refresher and easy to understand. There are more in-depth discussions of OOP available, and the goal of the book is not to teach OOP. So I was pleased that the authors decided to give an overview of OOP instead of a full-blown discussion.
I feel like the book does a thorough job of covering the Objective-C language. Since Objective-C is a superset of C, and the authors assume the reader is already familiar with C, there really isn't that much to cover. Each chapter covers a single feature of Objective-C. Actually, there are a couple of chapters that cover the Macintosh development environment Xcode and common source code management. One important thing to note: this book is about Objective-C on Macintosh OS X. Therefore, the discussion of Objective-C, and the example code, revolves around the Cocoa API; specifically, it relies on the most basic parts of the FoundationKit. Altogether, I think the authors do an excellent job of teaching the Objective-C language while introducing the reader to development on OS X. I give the content of the book another 5 out of 5.
Third, I want to talk about some issues I have with the book. Namely the editing and lack of exercises. Most books such as this one give the reader some exercises to work on at the end of each chapter. These exercises let the reader think about what he has just read, and try to apply his new knowledge without just copying and pasting (i.e. retyping what is in the book and running it through the compiler). A perfect example is the K&R book. It isn't a textbook, but it could be used as one. Each section has a set of exercises to which there are no printed solutions. The reader has to understand the material to get it right. The compiler is his grader. Learn Objective-C on the Macintosh, on the other hand, has zero independent exercises. Granted, it is possible to come up with your own, but if you are just learning the language it's nicer to have some suggestions.
As for the editing, it could use a little work. There are several places where sentences don't quite make sense. It is clear that the author was typing one thing, and then changed his mind and typed another. But the worst error lies in the code snippets. There is a least one running example that has the same error every time it is printed. If the reader is not following along with the provided project files, or doesn't recognize the error, he could be very confused. For the most part the editing is fine, but the editing problems that are present are glaring.
One final note. This book was published in 2006, as I mentioned earlier, so it is a bit outdated in some parts. For one, Objective-C has been bumped up to version 2.0 which introduces garbage collection. This affects the boilerplate code generated by Xcode, and is not addressed in the book. There has also been some major changes to Xcode, specifically Interface Builder, which can be confusing when trying to follow along in the book.
Overall, I was pleased with the book and look forward to using the lessons learned in my next endeavor — learning to write GUI Cocoa applications. Accounting for my issues with the book, which would be easily fixed with a new edition, I give Learn Objective-C on the Macintosh an 8 out of 10 (totaling the previous two high scores and subtracting two for my gripes).
Monday, 15 September 2008, 16:20:22 MDT comments(2)
Speaking of problems with my MythTV machine, I recently lost sound on the machine. I built my HTPC (Home Theatre Personal Computer) to be a High-Definition machine. As such, I intended to have one cable connecting the HTPC to my television — an HDMI cable. I specifically bought a nVidia GeForce 8500GT because it uses passive cooling (no fan noise) and has an SPDIF audio input so that it can pass audio out over an HDMI cable. After putting the machine together, and getting it all setup, I discovered that the nVidia drivers for Linux did not support passing audio over the HDMI cable. So I sighed, maybe said a few choice words in nVidia's direction, and connected an eighth inch DIN to RCA cable between the HTPC and my television. All was dandy!
Fast forward to last Thursday, when I decided to work on my HTPC. The first thing I did was update the operating system and software. That meant I got new video card drivers; version 173 instead of the old version 169. Suddenly I had no sound! Actually, I had much weirder problem. I could play sound at the console, before starting the X session, but got only silence after X had started. It took me a while to discover this, but once I did, it was clear that the video card driver was doing something very strange. After a bit of searching, I came across a single forum post that gave me the answer. In the 173 version of the driver, nVidia had silently enabled audio over HDMI (oh the irony!).
I spent hours trying to get sound to play via the HDMI cable. But for some reason my machine just will not do it (I'm beginning to think the patch cable from the sound card to the video card is bad). So I switched over to a regular VGA connection. I quickly got tired of that. The picture was blurry and I had to restart X multiple times whenever I turned on the television, because the display wasn't syncing properly.
In an effort to get this resolved, I wrote a lengthy post to the nvnews.net forum asking for help. I had not received any replies by lunch this afternoon, so I bought a DVI to HDMI cable to try when I got home. After lunch, however, I found a thread on the forum detailing my same problem along with a fix. So now, thanks to that thread, an older post, and Hex Fiend, I have working sound again.
I'm writing this post just in case someone else is having the same problem, and they are not having any luck finding the resources that took me four days to find.
Sunday, 14 September 2008, 17:23:47 MDT comments(0)
Several months ago I built a MythTV computer. Since I built it during spring semester I didn't really have the time to fully configure the machine. So it's been in a usable but needs work state ever since. One of the biggest problems was getting the machine to boot into the MythTV frontend application without requiring a login every time. The GNOME Display Manager would allow me to specify an automatic login, but that only works for the first login. So if I had to quit the MythTV frontend for some reason, GDM would automatically come back up, but then ask for a username and password. SLiM recently (as in 9/7/2008) added support for an automatic login, but it also only works for the first login. This seems to be the way of things for this type of application. They will automatically login a user the first time, but not subsequent times, and there is no way to make the programs quit after one execution.
This situation was unacceptable to me. I needed a login manager that would do three simple things:
- Automatically login a chosen user.
- Grant the user privileges as defined by PAM.
- Quit execution when the X session was quit.
Since I could not find such a simple program, I wrote my own. In my code section you can find the source code to a program "mythlogin".
Why not just execute xinit directly from inittab? As of Linux kernel 2.6.24 it is necessary to establish privileges through PAM in order to be able to run processes at realtime priority. Prior to 2.6.24 you merely had to set the user id bit on a binary to zero and the application could escalate itself to realtime priority. Now, though, you must explicitly give the user the authority to set processes as realtime. So you can't just directly init X from inittab and expect an application like mythfrontend to be able to enter realtime priority mode. By using a login application that authenticates, or at least starts an "authenticated" session, via PAM you are able to get these privileges for your user.
Friday, 22 August 2008, 10:32:36 MDT comments(1)
Categories:
The last time I went to get my haircut I was sitting in the waiting area when I noticed a magazine with an odd title — Garden and Gun. I just had to find out what this magazine contained, so I started reading the table of contents. That's when I found the article entitled Sweet Tea. Being the southerner that I am, I immediately flipped to this article and read it. I really enjoyed the article. The author does an excellent job of capturing the southern obsession in print:
No matter the source, our affection for sweet tea characteristically reaches religious fervor. Ask any Southerner where the best sweet tea is served, and he or she will have an opinion. I once knew a man who would drive forty-five minutes to a south Georgia Chick-fil-A because it had what he deemed the tea of the gods. This is not the sort of devotion one finds with other beverages, even coffee. Coffee is an addiction. Sweet tea is an obsession.
If you love sweet tea, or just want to try and understand why people drink the stuff, give the article a read. I'm sure you will enjoy it.
Monday, 28 July 2008, 21:21:12 MDT comments(2)
Categories:
It has been over two months since I last posted anything here. I have been so busy with school I just didn't feel like writing about anything. But now... I have finished! Earlier this afternoon I turned in the final draft of my senior paper. Unless I get an e-mail from my advisor in the morning, with some last minute suggestions, it is done. Once that grade is committed to the record I will officially be a graduate.
The mathematics program at CSU has a capstone course MATH 4990, or Senior Seminar. In this course, you are required to do independent research on some area of mathematics that has not been covered in the degree courses. Each student is paired with an advisor who will work with them on their research. At the end of the semester the student has to present their work in a thirty minute presentation. The student also has to write a thorough paper on their topic.
I chose to research the Discrete Wavelet Transform (DWT), specifically the Haar wavelet. The typical research application is image compression. Instead of doing the same thing that has been done numerous times, my advisor suggested I compare wavelet image compression with some other image compression. So in my paper I compare using the Haar wavelet to compress images with using the Discrete Cosine Transform (DCT). The DCT is the basis of JPEG image compression.
I started my research back in January. When the spring semester was coming to a close my advisor and I agreed that there wasn't enough time for me to finish the paper. So I took an incomplete in the course to finish the paper over the summer semester. That means I have been working on this paper for the past seven months. This is why there have not been many updates here. I didn't want to write about my work until it was finished, but there was little else about which I could write.
But now it is finished. So I present you with the finished result (local copy). If you actually read the paper, I hope you enjoy it. There is plenty of room for improvement, but I think it is quite good as it is. Hopefully you will feel the same.





