Culmination of Senior Project

May 3rd, 2009

So, for the few people that have read my musings thusfar, there may (or may not) have been note that I’ve had a rather prolonged lull, particularly given the Mid-Atlantic CCDC round that intended to write about, but probably can’t now because my memory’s fading.

In any case, the reason for this lull has been, aside from my laziness and Team Fortress 2, my schoolwork. In particular, my Senior Design project, Shallow Frost, has finally been “finished.” It’s finished in the sense that I’ve turned in everything and I’m done presenting on it, but I’d say it’s far from finished as a software project.

In any case, in lieu of describing it here, I’ve posted my final, public presentation on YouTube (in two parts):

Part 1
Part 2

If any of you actually watch to the end of part 2, you’ll notice my demo… well… it didn’t exactly work. How embarrassing! And I had done a final test on that very podium 10 minutes prior. *sigh* Well, in any case, it’s over now. I swear, that was the first time it just up and broke (without me prodding it) in months. Oh well, what’s done is done, and no one seemed all that upset other than me.

If I actually decide to do anything more with this (unlikely, because of how it’s built, it won’t ever really go into the kernel), I’ll surely post updates and such. Thanks for reading/watching!

Share and Enjoy: These icons link to social bookmarking sites where readers can share and discover new web pages.
  • Digg
  • del.icio.us
  • StumbleUpon
  • Reddit
  • Technorati

linux

Merging files with pr

April 1st, 2009

Tonight, I’ve been poring over a rather large data set that I want to get some useful information out of. All the data was originally stored in a .html file, but after some (very) crude extraction techniques, I managed to pull out just the data I wanted, and shove it into a comma-separated file. Earlier, I had given up on my tools at hand and typed up an entire list of row headings for my newly-gotten data. So I had two files like so:

headings.txt
Alpha
Bravo
Charlie

values.csv
1,2,3,4
5,6,7,8
9,10,11,12

I spent quite a bit of time trying to figure out how to combine the two columns into one file with what I knew, but none of my tools could quite do it without nasty shell scripting. It took me a while, but I eventually found this post that cracked the case for me. The pr command, ostensibly for paging documents, has enough horsepower to solve my problem in short order, like so:

$ pr -tm -s, headings.txt values.csv

The -t tells the program to omit headers and footers, and -m tells it to merge each line. The -s, tells it to use commas as field-separators. My desired result, like so:

headings.txt
Alpha,1,2,3,4
Bravo,5,6,7,8
Charlie,9,10,11,12

There are numerous other options to pr, and depending on your potential line lengths, one may have to experiment. But for me, this got the job done.

External Links

Share and Enjoy: These icons link to social bookmarking sites where readers can share and discover new web pages.
  • Digg
  • del.icio.us
  • StumbleUpon
  • Reddit
  • Technorati

linux ,

Follow-up on mplayer’s tab-completion

March 23rd, 2009

So after a big of Googling and finding this bug (after several others), I was made aware of three things (in response to my previous post):

  1. mplayer’s tab-completion support does in fact come from bashcomp
  2. this support is covered in the “base” module
  3. the appropriate file uses strange regular expressions

At the time this bug was filed, the appropriate file to edit was (or was in) /etc/bash_completion. Since bash-completion-20081218, the bug was fixed, but the package also underwent some changes that seemingly caused locations of config files to change. (Apologies if this is incorrect, but I never went diving into the configs of bashcomp before now!)

In any case, the bashcomp configuration files are now in /usr/share/bash-completion. Since mplayer’s support is in base, the file that handles mplayer is “base” in that directory.

Now as for the “strange” regular expressions, that deserves some qualification. I’ve already seen lots of regular expressions on my (albeit rather short) day, but the reason I consider these ones strange is because they seem both unnecessary and redundant. The line in question is currently 5983 on my version 20081219-r1:

_filedir '@(mp?(e)g|MP?(E)G|wm[av]|WM[AV]|avi|AVI|asf|ASF|...|fl[iv]|FL[IV]...'

The two ellipses are my own adding, since the actual expression is one humongous line that ends up looking rather horrible here. My problems with this are both the explicit writing out of upper and lower case alternatives and the the bothering to do things like fl[iv]. Actually, I don’t have a problem with the latter except in the presence of the former. And to be fair, I probably wouldn’t have ever cared or noticed if I hadn’t been able to find “flv” when grepping numerous files. Not that “greppability” is necessarily a goal for configuration files, but it’s certainly annoying when it’s specifically hindered by regular expressions that save negligible space like the ones in this file.

As a final note, I’m going to disclaim that I’m no expert on bash scripting and the various intricacies of handling regular expressions therein, so I’d be happy to hear from anyone who knows better about why I should lay off the poor bash-completion folks. :-P

External Links

Share and Enjoy: These icons link to social bookmarking sites where readers can share and discover new web pages.
  • Digg
  • del.icio.us
  • StumbleUpon
  • Reddit
  • Technorati

linux ,