TraceyText – A Source Code Visualization Tool to Teach Programming

March 4th, 2009

TraceyText’s home page is http://traceytext.sourceforge.net

TraceyText is an HTML-based teaching tool for visualizing single-stepping through source code. TraceyText can also double as a text/HTML slideshow library implemented in JavaScript. With TraceyText’s features, you can create web pages with a text or HTML slideshow and TraceyText will minimize the file size. TraceyText can also combine multiple “views” in the same slideshow to adjust in sync with each other.

The best way to see it in action are the source stepping demo and the picture slideshow demo. The demo runs through the Dragon Realm game from my book that teaches Python programming. You can either create these web pages with TraceyText by hand, or use the included TraceyText Python script to create a source file that generates the web page.

TraceyText is a useful tool for visualizing source code debugging or any presentation with HTML content. TraceyText has an API which opens itself to user-created JavaScript as well. TraceyText’s name comes from its original purpose as a way to demonstrate debugging traces through source code.

I created this tool as a way to demonstrate how programs run line by line, and what it outputs and the state of the varaibles. Simple text was way too verbose, and video would have taken too much bandwidth. In addition, TraceyText makes for a very nice and simple HTML slideshow.

On the downside, this is a tool mostly for programmers who know JavaScript. I’ll put together a user-friendly authoring tool later if there is interest.

ccwd.exe – Copy Current Working Directory command

July 25th, 2008

I’ve written a small program that can be run from the command line. The ccwd program will copy the current working directory to the clipboard. I wrote it so that I wouldn’t have to right-click, Mark, highlight text in the console window, and press Enter to copy the text of the current working directory.

Now I can just run ccwd.exe and have it done automatically.

The source code is released under a BSD-style open source license, and the Windows binary is 7kb. I made this program intentionally simplistic (it is fashionable to call it light-weight), for people looking for very simple functionality. Place ccwd.exe somewhere in your system path (such as C:\Windows)

ccwd.exe does not produce any output, and returns 0 on success and a nonzero value on failure.

Source code

Binary executable

Similar programs can be found here:

PyBat: A Python Module to Replace Batch File Usage (or, “Batch Files Aren’t Dead, They Just Deserve to Die”)

March 10th, 2008

Download PyBat 0.1.2

More details at: http://pybat.sourceforge.net

UPDATE: Hi, Reddit! I just wanted to clear this up: PyBat is about solving a somewhat specific problem: allowing Python scripts and batch files to communicate environment variable changes. This is in the case where you have a ton of legacy batch files that you cannot (for whatever reason) outright replace (which may or may not be the best thing to do in your case). I understand that everyone has their favorite scripting language (and for nontrivial tasks, they all sound better than batch files), but this is for situations where you want new Python scripts to work with the old stuff. The rest of the article is simply my rant that using batch files for nontrivial tasks is like working on a fusion reactor with a stone ax. Thanks for reading! Check out the rest of the site!

I’ve seen build systems that have accumulated the cruft of undocumented, half-forgotten, it-was-written-by-a-guy-who-no-longer-works-here software that was added piecemeal over time. It wasn’t until I had to do maintenance work on it that I discovered the horrifying truth of batch files.

Batch files are great for small tasks. But no bit of software remains small for very long, and after a while it balloons into an almost (but not quite) unbearable size. Most batch files rely on goto logic. Batch files use environment variables (which is essentially a single namespace of global variables). Batch files have no consistent syntax. Batch files require several twists and hoops for basic programming tasks, if they can do them at all. Batch files rely on obscure command line switches (I can never remember if copy’s /Y suppresses the confirmation prompt and /-Y enforces the confirmation prompt, or the other way around.)

(UPDATE: I know you can use “call” to jump to a label in the batch file, though I don’t see it in use often. The parameters use the %1 %2 etc. convention, instead of more descriptive labels. And although you can always /? a command, most command line switches are also not very descriptive.)

I tried googling for a batch file debugger, but only found pages that give handy “techniques” like printf-style debugging. Yech.

Of course I then realized the reason no one would make such a useless, baroque thing is because we already have real scripting languages with real debuggers. Although throwing out a large system of batch files and rewriting them in Python or Perl is tempting, it’s something you should almost never do unless you have a week or two to kill.

No problem. Let’s just make all our new code or do piecemeal replacements in Python, and leave the old but still usable batch files around.

But you can’t. Because of environment variables. Many of the batch files I’ve seen do nothing but configure settings by changing environment variables (Visual Studio’s vcvars32.bat is an example of this). But any changes made to a child process’s environment will not be seen by the parent process. Batch files calling other batch files get around this with the “call” command. But batch files calling Python scripts (or vice versa) will not be able to see any changes made by the called file.

It’s not a flaw at all, it’s a basic, well-designed operating system principle. But it does make adding Python scripts that are backwards compatible with a batch file system impossible.

So I wrote a script to get around this impossibility. PyBat is a Python module that lets a Python script call a batch file (or vice versa), and will see the changes made by the called file. Because batch files can share environment variables with each other (with the call command), and Python scripts can share environment variables with each other (with the execfile() function), I’ve written pybat.py and pybat.bat that can bridge the two worlds by writing to a commonly known file. (A hack approach, but also the simplest that works.) (more…)

DiscEx: Discover, Explore – Virtual tour web software

January 7th, 2007

UPDATE 9/14/2011: UT has removed this code from their website. The software was basically a poor-man’s Google Streetview, with individual photos taken around the sculpture, rather than a panoramic in a QTVR-style viewer. Unfortunately, I don’t have the code or the images anymore. No big loss, since it was implemented as a Java Applet when these days it would be much more appropriate as a web app. One day I’ll revive (or perhaps it’s better to say, resurrect) this project. -Al

This is an applet I did in my junior year at UT for my software engineering course. It’s implemented as a Java applet, and looking back that was precisely the wrong technology to use. I plan on doing an updated, web-based Javascript version soon. In the meantime, here it is.

The virtual tour site is of the Umlauf Sculpture Garden in Austin, TX. We took several hundred photos of the garden (which came to about a gigabyte of images), but had to size them down for bandwidth considerations. The originals were lost in a disk crash.

Ideally, I’d like to recreate this software to be easy to use and allow people to visit other places in a more natural manner. I’m still working out the feature list and applications of this software.
http://www.cs.utexas.edu/users/s2s/latest/sculpture1/src/DiscEx/applet.html – DiscEx: Discover, Explore (LINK NO LONGER WORKS)

Al’s Alerts

December 31st, 2006

Al’s Alerts, a web application (http://alsalerts.com).

Al’s Alerts is a service that will email you posts from craigslist whenever a post appears with the keywords you provide. This frees you from having to check craigslist every day if you are on the lookout for something specific. This is an improvement on craigslist’s subscriptions, which will simply send you every post in the category.

The site is operable, but I’d like to do a front-end rewrite using the Python web application framework Django. The back-end also needs to be rewritten to scale better. The user interface needs to be improved and streamlined, and I also need to include the additional cities that craigslist now serves.

This is currently a work in progress.

« Previous Page

Powered by WordPress