The code for the genome analyzer was actually finished a little while ago and delivered to the “customer” (my friend that works in a microbiology lab down in Atlanta). It’s technically still in beta; once he has a chance to use it, he’ll get back to me with any bug reports and requested upgrades. All I have had to do recently is add documentation into the code and attempt to make a makefile (project currently builds and runs within Eclipse). Unfortunately it seems Java and makefiles don’t play well together; all the documentation I found online suggested using Ant or Maven instead. This might be confusing for anyone in class attempting to compile and review my project, so instead I am going to export the project file from Eclipse and add instructions on how to install Eclipse and build the project from within. Anyone that wants to run the program via command line can easily export the program as a runnable jar. Not ideal, but it’s the best I can do for now. I have one more upload to make later this morning to github, then everything is wrapped up for this class.
I’ve run into an interesting problem with Ubuntu when running in a VM (using Parallels). When I am on my home network, the Network Device setting in the VM needs to be set to ‘Bridged (Airport)’. This however does not work on VT’s wireless network, and I need to set it to ‘Shared’. In reverse, Shared does not work on my home network and only Bridged works. Both networks are wireless, with only the encryption type being different. I am not sure what exactly the difference is or why I am seeing this behavior. Because of the way I set up Ubuntu in Parallels, I cannot actually “boot into” Ubuntu to run it as the main OS to test other configurations. It’s easy to switch, it’s just an interesting behavior that I do not understand why it is happening.
Just finished and submitted the Process Object assignment. It wasn’t too difficult, though I had to think about how things were copied in respect to classes after the fork() call. I ran into one error that had me stumped for a little while. When trying to read from the pipe, I was getting garbage even though the child process was running. It turned out I made a common c++ mistake, and passed &string instead of string.c_str() when writing to the pipe.
I noticed there appears to be one conceptual error in the process-test and consumer interaction. Process-test is set to write a line to the consumer process, which writes a confirmation back to the pipes, and is read by process-test, all in a loop. However, when Ctrl+D signal is sent to the process-test process, it exits the loop and does not read again. The consumer process however writes one more line to the pipe, the number of lines, which is never read out of the pipe.
Pipes have a limited amount of space, the size of the buffer is determined by the OS. When a process writes to a pipe, if that buffer is full, the process blocks. In theory, if the consumer process had written a long enough string to the pipe, with nothing there to read it out, it could have blocked and hung forever. There should be one more getline call in the process-test file, after it exits the loop.
When writing the futures paper, I needed to install Latex so that pandoc could correctly do the document conversions. It took some time to track down the package name, which was not ‘Latex’ but part of ‘texlive’. Searches on ‘latex’ returned no results and ‘tex’ returned too many. I think this can be a problem with some of the package naming conventions in Linux in general. I was fairly surprised that this functionality wasn’t included as part of the default Ubuntu install. Hopefully future Linux distributions work on improving package naming and maybe the way users can search for package names.
Ubuntu has been releasing new versions with what feels like an aggressive release schedule, so I decided to look into upgrading. Before doing so, I always like to read up first on new features and changes. I ran across a story about how Ubuntu 12.10 has Amazon ads pre-installed. While most reviews say it is unobtrusive, the fundamental idea of including ads like this gives me pause.
I don’t know how ‘deep’ this ad code is embedded in the OS, but it does not seem like something that should be the responsibility of an OS. It does not appear to simply be an application that can be uninstalled. It can be turned off in the system preferences, which makes me think it has hooks deeper than just the application layer. With OSes getting larger (and thus more bug-prone), this just feels like an unnecessary addition that can cause more potential problems than it is worth.
It’s been awhile since I updated this (site outages didn’t help either). Luckily there is still plenty of time before the end of class to get all the required posts in.
Finished the pipes homework exercises. It wasn’t very difficult, it has been awhile since I worked with pipes though. The hardest part was getting the consumer process to correctly read from the pipe. I was able to make the dispatcher, have the generator write to the pipe, and the dispatcher kill/wait correctly. The problem was the consumer process seemed to be hanging. It turns out I needed to correctly close the pipes in both child processes and the parent process, or else something was hanging waiting for that data to be cleared out. Once that was handled, the program worked correctly.
I upgraded my OS to 10.8 (Mountain Lion) from 10.6 (Snow Leopard) today. This also required updating to a new version of Parallels, because Parallels 6 is not compatible with 10.8. The upgrade was fairly simple, and it then converted all my VMs, including Ubuntu. The Ubuntu VM actually runs better now, I think because of the new version of Parallel tools. The resolution is fixed, and the mouse response is a lot better. I was pretty surprised and was worried I’d have to reinstall all my guest OSes.
I’ve come to find too that a lot of the stuff I try to do on Ubuntu also works on Mac OS X. I guess it shouldn’t be that surprising since OS X is derived from Unix. I seem to remember though that a lot of the shell commands were non-standard or had different options from the Posix standard, but either I was wrong or I’m remembering an old version.
I’ve mostly got everything working in the Python assignment for class. The major commands all work, including the extra credit portions. Now, I just need to put in error checking for robustness and correct feedback messages.
Python definitely has some neat things in it. The ability to easily create and manipulate lists and dictionaries reminds me of Groovy and Grails. That kind of syntax built into the language is much preferable to the Java or C++ template method of lists and collections. I’m not a fan though of the Python insistence on using try/exception blocks for a lot of flow control. That’s one of those design things considered an “anti-pattern” and I’ve seen a lot of developers get into trouble with it before. My opinion is, if complex return types are needed such that you’re throwing exceptions to communicate logic information rather than true fatal errors, your function needs to be redesigned.
Eventually I need to look into how to split a logical program up into multiple python files. The homework solution I’ve come up with uses a lot of small function handlers, and I’d much prefer to group them in their own files rather than having everything above main in one file.
Worked on the Python exercises for homework 3. I was finally able to get past the ‘ctrl-d’ issues where ctrl-d (eof) has to be sent twice to the script, and all stdin input was buffered until this double-signal was sent.
The trick was to change my loop from:
for val in sys.stdin.readlines()
for val in iter(sys.stdin.readline, ”)
Also finally fixed the issue with detecting a newline vs eof when determining whether to exit the script on illegal input vs printing the product and resetting on an empty line. In my exception catch block, I check the value to see if it is just a newline character and if so, act appropriately and do not exit. Otherwise, I print to stderr and exit.
On to the second part of homework 3….
This blog will be used to fulfill the assignment requirements of ECE2524, and will contain posts about Ubuntu Linux.
Over the weekend, I installed Ubuntu on my Macbook Pro. I already had Win7 on the boot camp partition, and triple-booting on an Apple machine can be a bit tricky, so I decided to use a VM. I created a new VM in Parallels, downloaded the 64-bit iso of 12.04 Ubuntu. The install was pretty straight-forward, and runs fine in a separate window. The only drawback is that running a VM taxes the laptop’s resources and causes the fans to run high.
I also installed the aptitude updates as we went through in class, and also installed the QT SDK for my 3574 class. I have some experience working with and developing on Ubuntu, so there were no real problems during any of the installs.
The next step was to go through the commands assigned to me for the Command School assignment: diff, echo, exit, hostname, less, ls, and head.