Friday, August 22, 2008

The rest2web template of awesomeness

Now that classes are starting again, it's time to create course web pages. As I mentioned earlier, I'm using rest2web to generate most of the course web pages.

One really nice feature of rest2web is that the template page (used as a basis for all generated web pages) can contain arbitrary chunks of python code. One thing I noticed about my site design was that the sidebar (containing navigation links) was nice for index documents, but distracting for "leaf" documents such as assignment descriptions, lecture notes, etc.

So, I put in a few lines of code to check the page being generated (available from the pagename variable: see the rest2web template documentation) to see if it's an index page, and if so, suppress the sidebar. I needed to futz a tiny bit with the CSS styles, but overall it was an extremely easy change.

My CS 200 page shows how the generated sites look. Given how much easier it is to author reStructuredText documents than HTML, I think I'm getting awfully close to web content nirvana.

Feel free to use/modify/steal my rest2web template and CSS stylesheet files.

Tuesday, August 19, 2008

Thinkpad X61 Tablet

I'm now using a Lenovo Thinkpad X61 Tablet as my main computer at school. So far, I like it a lot. I'm dual booting Windows XP and Kubuntu 8.04. I was able to get the tablet functionality working, with automatic screen rotation (nifty!), using information on the following web page:
http://www.krizka.net/2008/02/13/thinkpad-x61-tablet-automatic-screen-rotation-under-linux/
If you look down at the comments section, there's some information on running on Kubuntu (KDE) instead of Ubuntu (Gnome).

You have to have the "hdaps_ec" module loaded. I put it in my /etc/modules file.

You also have to edit /etc/X11/xorg.conf. Here's a link to the one I'm using (caveat emptor):
http://faculty.ycp.edu/~dhovemey/thinkpadX61t/xorg.conf
Finally, the "autorotate.py" script has a regular expression bug (fix is in the comments). Here's the fixed version:
http://faculty.ycp.edu/~dhovemey/thinkpadX61t/autorotate.py
The stylus is not calibrated terribly well, and the Debian/Ubuntu folks somehow forgot to include the utility that calibrates it. However, it works acceptably. I used the Xournal program to jot some notes, and while it's not exactly like writing on paper, it's not bad at all. I may try to use this in class rather than writing on the whiteboard.

Thursday, August 7, 2008

gschem vs. kicad

I have officially given up trying to use gschem. I can place components (and even create new symbols), but I have had no success connecting pins with wires. It is possible that I am an idiot, but I don't think I have to go too far out on a limb to claim that gschem isn't the most user-friendly of programs.

Fortunately, there appears to be a nice alternative called kicad. The problem of parts I need (e.g., ATtiny2313, ICM7212) not being in the default symbol library is still an issue, although some web searching did eventually turn up symbols for the parts I needed.

Update: I was able to connect VCC on the ATtiny2313 to +5V! I'm going to tentatively say that kicad rocks.

Wednesday, August 6, 2008

rest2web

I've written a lot of HTML in the past few years, especially for course web pages. I've used two basic techniques:
  1. Hand-written HTML using a text editor. Blech.
  2. Editing HTML documents using Kompozer.
Technique #1 is just too much work. CSS has moved HTML quite a bit further towards true semantic markup, so you don't have to worry too much about presentation any more when creating content. However, there's no getting around the fact that HTML (and XML) is just ugly and painful to work with by hand.

Technique #2 is better than #1, but Kompozer (which was derived from the Mozilla editor) has its own share of quirks. It's buggy, and it generates ugly HTML (it wants to put <br> tags all over the #^!%#! place). I've been willing to live with its flaws, and it's saved me a lot of time. However, it doesn't help in automating the creation of navigational elements (e.g., breadcrumbs, sidebars).

Enter reStructuredText and rest2web. The former is a wiki-like lightweight markup language: a reST document looks more or less like plain text, but can easily be turned into HTML via a nifty python utility. The latter is a site-creation tool which uses reST and some additional lightweight metadata to create complete websites from reST files. It took a couple hours to learn my way around, but I was able to produce a very spiffy-looking site from (essentially) plain text files. Sweet!

Now I just need to create some content :-)

Saturday, August 2, 2008

djboxsym - a better way to create gschem symbols

OK, after my recent frustrations trying to use tragesym to make a gschem symbol for the ICM7212, I tried out djboxsym.

To make a long story short, it took about 15 minutes to do what I needed. Sweet. I used the web interface, which is very cool because you can immediately preview your work.

For posterity, my extremely modest efforts are available:

icm7212.sym
icm7212.symdef

Caveat emptor.

Friday, August 1, 2008

The sad and alarming state of circuit design tools in Linux

So, for fun I'm playing around with microcontrollers. I want to enter a schematic for the circuit I'm designing.

I tried out Eagle CAD, but there is no symbol for the microcontroller I'm using (the Atmel ATtiny2313). There are some user-contributed libraries for Atmel parts, but I don't see that part anywhere. Bleh.
[Aside: the ATtiny2313 is only an insanely popular and widely-used part, which has only been available for 3 years now. I can totally understand why it's not in any readily-available part library.]
So, I try out gschem from the gEDA package. Free software is always better, of course. The ATtiny2313 part isn't in the library, but I find it at gedasymbols.org. Yay.

Unhappily, I don't see the ICM7212 in either the built-in library, or at gedasymbols.org.

Blech. OK, how easy is it to add a new symbol? It's a plain, boring old 40 pin DIP. How hard could this be?

Well, it wasn't as easy as I had hoped. The state of the art is described in a tutorial. Here's a brief synopsis:
  1. Download a text file and an OpenOffice spreadsheet file. (The text file is not, as far as I can see, mentioned again in the tutorial.)
  2. Edit the spreadsheet to fill in hundreds of mysterious labels.
  3. Enter the function names,pin types, etc. for each pin.
  4. Save the spreadsheet as comma-separated text.
  5. Run the CSV through a python script, which creates a schematic file.
  6. Edit the schematic file using gschem. (Why? Wish I knew.)
  7. Save it as a symbol file.
Just trying to read the tutorial makes me want to vomit with rage.

The icing on the cake is this: the spreadsheet has pre-defined spaces for only 16 pins. I'm trying to create a 40-pin part. Being a programmer, I'm not going to sit there are fill in cells one at a time (17, 18, 19, etc...). I'll just define a spreadsheet formula that will generate these pin numbers for me, and copy them into as many cells as needed. The author of the spreadsheet, helpfully, disabled support for formulas in the entire spreadsheet. I honestly didn't even know this was possible!

Someone please just shoot me, or at least jab me with something sharp.

There seems to be a simpler approach, djboxsym, which looks like it dispenses with some of the unnecessary complexity.

Monday, July 28, 2008

Obligation analysis data

Here are the FindBugs analysis results files for my recent use of obligation analysis to look for unclosed stream bugs in Vuze and jEdit:

http://faculty.ycp.edu/~dhovemey/findbugs/vuze-obl.fba
http://faculty.ycp.edu/~dhovemey/findbugs/jedit-obl.fba

I classified the warnings as NEEDS_ANALYSIS if I considered the code apparently correct, and the warning could be avoided through the use of annotations (@WillClose, @WillCloseWhenClosed, etc.) These were cases where if a called method (or object) failed to close the stream, then there truly would be a bug.

I classified warnings as SHOULD_FIX if I considered that it was possible for the code to fail to close a stream.

I classified the warnings as ANALYSIS_ERROR if the warning was completely erroneous.