Monday, November 8, 2010

Open source tools from AT&T

I recently started playing around with Graphviz to generate some images of directed acyclic graphs (DAGs). I came across the following site regarding other open source tools from AT&T.

http://www.research.att.com/software_tools

Friday, March 5, 2010

Nice perl samples

I was looking for a way to find the character width of the terminal in perl. I came across this page and thought it was well organized.

http://pleac.sourceforge.net/pleac_perl/userinterfaces.html

Monday, January 18, 2010

Switching profiles for Terminal.app on the command line

I switched from using iTerm.app to Terminal.app a while ago. One of the things I loved about iTerm was the ability to turn on/off transparency via a keyboard shortcut. Terminal.app doesn't provide a shortcut, but you can provide some alias' to change the current profile from the command line. The following link provides the instructions on how to do this:

http://www.swombat.com/setting-up-terminalapp-with-tr-0

Tuesday, December 29, 2009

Inferring XSD from XML documents

It seems that every place I've worked at has used XML documents to organize information. At my current place of employment, we use XML documents for various things. Lately, I've been working in the world of XML without any predefined XSD or DTD to verify the XML against. This isn't necessarily a problem in our case because we are the only consumers of the documents.

Recently, I've been tasked with using some of the files. I remember previously running into a tool for inferring schema documents from XML. I had to jog my memory a little to find it, but I found it. The tool is called Trang. It's a great way to see a description of what the XML generalizes to. After you download the jar, you can run it like so:

java -jar trang.jar *.xml testing.xsd

This will examine all the XML files in the current directory and create a file named 'testing.xsd'.

This is also a great for coming up with the schema by creating example XML files. After the schema is generated you can go in a tweak it if you need to.

Saturday, December 5, 2009

sailfish 50 miles northeast of Isla Mujeres

I can across this great article on sailfish today. I didn't realize that sailfish hunt in packs. The article's pretty short and the pictures are amazing. Thank you National Geographic.

http://ngm.nationalgeographic.com/2008/09/sailfish/holland-text

Saturday, November 28, 2009

Teach Yourself Programming in Ten Years

With regard to my current side projects at home, I've started to ponder graduate school. Grad school is something I'm always thinking about because I'd love to teach computer science at the college level at some point. Neural networks and genetic algorithms have always been interesting, but lately I've been thinking more about programming languages.

I've been doing a lot of Perl for the past several months and I think I've validated my preconceived notions about the language. Perl is one of those languages that fills programmers with a variety of emotions. It seems to be heavy at the opposite ends of the spectrum. People tend to either hate it or love it. Even within the Perl community, there seems to be strife about certain topics.

My opinion about Perl is an ambivalent one. I often feel like I'm the child in the middle of a divorce. The language has some great features and I have a lot of fun programming in it. On the other hand, it's a bastard language and I despise it. Either way, it's a great language to talk about in an academic manner.

Perl has dynamic and lexical scoping. You can program in an object oriented, imperative, or functional style. It also has mappings to Prolog, so you can program in a logical style if you like. For subroutines that are referentially transparent, you can use a memoization module. You can use closures, which means you can do currying. Virtually every programming languages concept is manifested in the language.

To bring the story to an end. This prompted me to Google for "programming languages graduate school". The first result from the search shows a list of the top ten graduate schools. UT is number 8 (woot!). The second result is the one I found most interesting:

http://norvig.com/21-days.html

I thought the page was an interesting read. Enjoy :)

Wednesday, November 18, 2009

dsh - distributed shell on Mac OSX

We have several hundred computers at work. One of the tools we use to interact with these machines is dsh, also known as dancer's shell or distributed shell. You can use dsh to run a command on a group of machines. For example, you could run the following command to find out what operating systems are running on a group of machines:
dsh "uname -a"
I'm going to give a short tutorial on how to set this up on the Mac for a group of machines with ssh available. First of all, I'm using MacPorts, so you'll need to have that installed before proceeding. With MacPorts installed, you can run the following command:
sudo port install dsh
After ports has done it's thing, you will need to create the proper directories:
mkdir -p ~/.dsh/group
The '-p' tells mkdir to create both .dsh and group directories. Neither of these directories existed for me. Now we need to create a 'group' file with the names of the machines we want to access:
vim ~/.dsh/group/testMachines
Add machine names to the file with one machine per line. For example:
pluto
mars
saturn
earth
You can create as many files in the ~/.dsh/group directory with this format. We will use these files to organize what machines we're sending commands to.

Now we need to create a config file:
vim ~/.dsh/dsh.conf
with the following contents:
verbose=0
remoteshell=ssh

waitshell=1 # whether to wait for execution
# 1 = run commands serially
# 0 = run commands in parallel

remoteshellopt=-lmmasters # mmasters is the login id for the machines
verbose=0
showmachinenames=1

The last thing we need to do is set up passwordless ssh for all the machines in our group file. Once that's done, we can start using dsh. Go ahead and give it a test drive:
dsh -g testMachines 'uname -a'
The -g argument tells dsh which group file we want to use.