Wednesday, March 28, 2012

Timing

Two of my favorite experiences happened in the same basketball game.

First, notice #4 on the red team--just behind me with the bald head.  He has the look of "we're down 15 points and I need to block that shot." He never stood a chance, so he tried to undercut me on my way back down.  No harm done, but that's just playing dirty.

"Don't undercut me, 4"

"What are you going to do about it, expletive?"  The game was getting heated.  Plenty of pushing, trash-talking, the works.

4 dribbles down the court, crosses his man over, and goes up for the shot.  And there I am, waiting patiently.  It was probably one of the sweetest blocks of my life--not necessarily because it looked good, but because the timing was so perfect! 

"That's why you don't undercut me!"


Oh.  And the second experience?

We won the game--and the coveted intramural t-shirt.


A- or BUST

In graduate school, sometimes we take hard classes.  Other times, we take classes outside our field of expertise.  Occasionally, we even get around to taking hard classes that are also outside our field of expertise.  Sometimes these classes help us gain valuable knowledge and skills that will forever benefit our skills.  Sometimes they teach us about the frustrations of life.  I think I've had enough of the latter.

The course was Wireless Networking.  The project?  Implementing full-duplex radios in a large industrial (read:  not entirely open-source) wireless simulator.  The problem?  Well, for starters, there needed to be serious changes to the infrastructure of the program including canceling timers at the right interval, sending packets through the correct protocol, etc, etc... But the second problem was just as significant:  I needed to understand the system forward-and-backward just to know what needed to be changed.  

Of course, I didn't start the project until later in the semester than I should have, but the professor made it seem like there would only be "a few small adjustments," and most of the work would be data analysis.  A week before the semester was over, I realized this was far from the truth:  I'd put in a good 20 hours on the project and still wasn't able to perform any "data analysis."  I figured I would just resort to using my powers of persuasion and emphasize some irregularities we'd observed to make a case, but in a class presentation a week before the semester was over, we were cut short by our professor who kindly informed us we were nowhere near finished and would need to complete the implementation by the week's end.

Guy smashing his head against a laptop keyboard
5 1/2 days, 40 hours more (including two near-all-nighters), and still nothing.  I don't think I'm an idiot, and I'm surely not incompetent when it comes to coding in C++ (just ask Smarterer--my score of 612 gives me a "proficient" rating), but I could not slay the beast.  Persuasive powers put to use again, I turned in what I thought was a fairly decent paper considering the circumstances.  When grades rolled around, I got a B in the class.  Not exactly what I wanted, and definitely not what my GPA was looking forward to, so I asked the professor if I could finish the project over the holiday in exchange for a regrade.  She was agreed.

It wasn't until 120 hours later (over my "break") that I finally had something working--and not just hobbling along, either.  I put together a stellar report complete with some of the aforementioned data analysis, and submitted for a regrade.  Within a few days, I got my professor's response:  an A- in the course.

I was thrilled, and so was my advisor (he'd expressed some concerns with my current GPA, but my promises for a higher grade in the class left him satisfied).  I put it all behind me.


Until about a week ago, when I got the following email from my professor (edited for brevity):
I submitted a request to change your course grade to A-. But it was not approved by the graduate office. To be fair to everyone, the graduate office enforced only considering the work done before the end of the semester.
In the past, students informed me in advance that they needed additional time to complete the project due to certain reasons and I assigned them an incomplete grade and was able to change them to a letter grade. Unfortunately, it didn't work in this case since you didn't inform me about the intention to continue the project and a letter grade had been submitted at the end of the semester. 
Sorry that I didn't know about the different treatment in the two cases earlier. If helpful, I'd be happy to write a letter to indicate you did a good job in the course and would be happy to give you A- if I had the option to do that based on the new project submission.
Seriously?  "only considering work done before the end of the semester" unless you have "certain reasons" to ask for "additional time"?  I've heard about this before.  You mess around the entire semester and realize you didn't do anything on your project, ask your professor for an extension, they give you an incomplete and a couple extra months to finish your project.  Apparently, if I would have simply asked for an incomplete and done the exact same work, I could have got an A- in the class.


I'm hoping this isn't the end of the story.  I'm hoping I'll go in and talk to the graduate advisor and he'll push through the red tape.  But I also hoped graduate school wouldn't be so full of drama.

Whatever the outcome, this is strike two against academia.  Why does an institution so "dedicated" to producing scholars have so many artificial barriers to keep you from getting there?


Maybe someday this will all make sense.


That's what I keep telling myself.



Thursday, March 8, 2012

Mission: Accomplishing


Every once in a while, Pandora gets it right.  Like right now.  For some reason, it chose to play this song.  I'm sitting here, putting together a rather complex piece of software, and it's going pretty well.  

Suddenly, I feel like I'm in the movies, theme music playing, conquering the world.  




I had to share that before the feeling slipped away.

Wednesday, February 29, 2012

IEEE Journal Publication

If you're like me, it's relatively late at night and you're trying to submit a camera-ready paper for a conference.  You've used LaTeX so it fits the formatting requirements exactly.  Or so you thought.  Upon trying to jump through the PDFExpress hoops, you get the dreaded:

Error   Font ZapfDingbats is not embedded (40x) 
Exasperated, you search the Internet and find a "brilliant" solution.  It's a couple of steps long, and it seems like it does the trick.  You plug along, resubmit the file, and sure enough, there are no embedded font issues.  But this time, it says some mumbo-jumbo about the file being too large.  Right about now, you start pulling your hair out (it took 90 minutes just to conform to IEEE standards, another 2 hours to find the "brilliant" solution, and it's now 15 minutes past the due date for the conference submission).  Another hour of searching, another step closer to the solution:  Look in Adobe under the "File Properties" menu, under "Fonts" to see if all the fonts are embedded.  Nope.  They aren't there.  There's an interesting article here about changing some of TeXShop's internal commands to try and rectify the situation.  But that doesn't do the trick in your case.

So here's the answer, and you can put your hair back in.

Sometimes, when including external figures/tables/whatever, the figure-producing program doesn't embed the fonts, which are then not embedded in the final PDF.  In my case, I use R to create figures, and the captions or something must be causing some severe issues.  Sure enough, looking at these PDF files individually with Adobe confirms my suspicion.  After a little more digging (thanks A Blog for your genius), I found that you can imbed the fonts using a dirty hack involving changing the file to an eps file and then back to pdf.  This doesn't change the picture quality, but does embeds the fonts.  Here's the code from the website, changed a little bit for Mac commands (I just changed pdftops to pdf2ps):
#!/bin/bash
export GS_OPTIONS='-dEmbedAllFonts=true -dPDFSETTINGS=/printer' cp $1 $1.old pdf2ps $1 tmp.ps ps2eps tmp.ps
epstopdf tmp.eps
mv tmp.pdf $1 rm tmp.ps tmp.eps
Run this program on all your external PDF files (it won't increase the file size significantly—in fact, in my case it decreased the file size), and then re-typeset with your favorite pdflatex editor.  And voila, you run the file through the PDFExpress PDF checker and you get:
Status*: PDF Passed PDF Check; PDF is IEEE Xplore-compatible
That's music to my ears.

Friday, January 27, 2012

Growing Up

It's 2012:  the year the world is supposed to end (okay, not really, but it makes for a powerful motivator).  As such, I've thought a lot about who I want to be when I "grow up."

When I was in high school, I envied those older than me because they had so much "free time."  Dad would always have time to read the newspaper, take volunteer coaching jobs for siblings, or spend lots of time working on fun projects around the house.  On the other hand, I struggled under the weight of marching band, basketball, and academics.  Dad would frequently tell me this was one of the easiest times of my life—which really bothered me.

Not long after my mission, I realized I had let my gospel scholarship degrade:  I struggled to stay awake as I read scriptures at night, and I wasn't quite as quick to remember specific verses when I was teaching.  But, thought I, this would all be made up at a future grown-up date when I had nothing better to do in the early morning hours.  I'm quickly realizing this isn't the case.  In a recent discussion with an older friend, he mentioned that you don't really change as you get older—you just get older.  I'm quickly realizing that this is the case.

But I've also realized something else.  While some of us are eagerly awaiting (even seeking out) changes that will signify our "grown-up period," there are an equal number who avoid change at all cost.  Still stuck in their [insert adjective for "opposite of adult"] years, they avoid (even rebel against) change.  Again on introspection, I've noticed the intersection of interests between myself and this latter pre-adult group of people is quickly shrinking in size.  Let's just hope this doesn't lead to disgust and more accusations of narcissism.

On another note, I stayed up until 2am trying to fix our leaking refrigerator hose.  And by fix, I mean I applied 6 easy-stick bike patches and a long piece of electrical tape to a hole in the hose before I finally gave up and turned the water off.  Maybe Dad wasn't using his "free time" to fix broken sprinkler pipes, either...


Monday, August 15, 2011

ACCOMPLISHMENT!!!

I haven't updated this blog for a while, but I thought I'd brag just a little bit.

I've been destroyed a couple times in Words With Friends by someone who has no qualms about cheating. So I pose a question to my readers: if I were to write a program that would find the best Words With Friends move on the board, it's still legal, right? It's all about pitting your abilities against those of your opponents. And if you can write a better program than mine, that's okay, right?

Well, here's one of my latest successes. While the program is still rudimentary, it scored more points than I've ever scored on my own.  So here's to NUBILOSE!!


Wednesday, November 3, 2010

...passing it along...

Every once in a while, you'll run across a serious problem (like downloading several thousand bacterial genomes from NCBI) and think to yourself, "There has got to be an easier way than doing this all by hand."  As you try and figure out a snippet of code to piece it together, you think to yourself, "This can't be that obscure of a problem.  I'm positive someone else has done this before."  And then, with a few clicks of the mouse, you find it.  Such was the case today.  Much thanks to Peter Cock (?) at http://www2.warwick.ac.uk/fac/sci/moac/students/peter_cock/python/ftp/ for publishing the code.

So, if any of you are trying to figure out how to download all 10k+ Bacterial genomes (or anything in batch) and are working on a remote UNIX system, here's how to do it:

Step 1:
Download ftputil from http://ftputil.sschwarzer.net/trac
If you're unfamiliar with Python (as I am), here's how to install it:
tar -xzf ftputil-*.tar.gz
cd ftputil-*
./setup.py install --root ~ # This will install it in ~/usr/lib if you don't have install permissions for /usr/lib)

Step 2:
Create a file called get_gens.py (or whatever you want), and put this in it (I've changed the original code to download all the .fna files. It's easy to change to download something different.)

#! /usr/bin/python

# append the library where ftputil is located
import sys
sys.path.append("~/usr/lib/python2.4/site-packages/")

import ftputil
import string
import os

#Where to put the genomes (script will create sub directories
#using the same names as the NCBI use).  This directory must
#exist already:
base_path="~/genomes/Bacteria/"

host = ftputil.FTPHost('ftp.ncbi.nlm.nih.gov', 'anonymous', 'password')
host.chdir('/genomes/Bacteria/')

dir_list = host.listdir(host.curdir)
for dir_name in dir_list :
    host.chdir('/genomes/Bacteria/')
    if host.path.isdir(dir_name):
        print dir_name
        host.chdir('/genomes/Bacteria/' + dir_name + '/')
        file_list = host.listdir(host.curdir)
        for file_name in file_list :
            #if file_name[-4:]==".gbk" :
            if file_name[-4:]==".fna" :
                print "File " + file_name
                if not os.path.isdir(os.path.join(base_path,dir_name)) :
                    print "Making directory " + os.path.join(base_path,dir_name)
                    os.chdir(base_path)
                    os.mkdir(os.path.join(base_path,dir_name))
                if os.path.isfile(os.path.join(base_path,dir_name,file_name)) :
                    print "Skiping file " \
                          + os.path.join(base_path,dir_name,file_name)
                elif host.path.isfile(file_name) :
                    print "Downloading file " \
                          + os.path.join(base_path,dir_name,file_name)
                    host.download(file_name, \
                          os.path.join(base_path,dir_name,file_name), 't')
                    #Download arguments: remote filename, local filename, mode
                else :
                    print "ERROR - Not a file " + dir_name + "/" + file_name