May 23, 2013
The Problem I often want to fiddle with the bash prompt, but don’t want to deal with bash prompt escape sequences. I wish for a utility which simplify setting a bash prompt. I finally wrote that utility myself: mkprompt Install Copy mkprompt to a directory in the path. Using mkprompt The best way to show […]
February 20, 2013
When scripting in Tcl, I often need to process CSV files, including printing it out. Since I often found myself in need of printing, I wrote two helper procedures: load_matrix, which loads a matrix (a table) from CSV file; and print_matrix, which prints a text presentation of the matrix. The end result is the ability […]
October 13, 2011
The Problem When coding in Python, we need a way to store configurations and settings in a file, then be able to access them in the code. Our requirements for accessing these settings are: Simple to learn and use — We would like to target novice coders Easy to understand Hierarchical of settings References ConfigParserShootout […]
September 8, 2011
I have added to the Tcl Wiki a section on how to print out a keyed list. If you want to print out the contents of a keyed list, give it a visit, search for keylprint.
July 17, 2011
Many Tcl scripters know how to catch an exception, but not many know how to throw it. This wiki page shows how.
July 2, 2011
The Problem In Linux Mint, the default font and background color for tkcon is terrible. I want to change that to something easier to read. The Solution Here is my ~/.tkconrc, which fixes it by choosing a better font and background color: Discussion The default font in Linux Mint is terrible: it is hard to […]
July 2, 2011
I often need to determine if a file belongs to me while my script is running in a shared environment. For that, I created a function called fileIsMine, read all about it here. Update: I did not know that Tcl has a command called file owned, which does exactly what I want. Duh!
April 26, 2011
The Problem After the cd command, the next command is almost always ls so we want to combine the two to automatically issuing the ls command right after the cd command. The Solution In bash, add the following line in either ~/.bash_profile or ~/.bashrc: If you are using csh or tcsh, add the following line […]
April 26, 2011
The Problem We want to organize tests in a hierarchy of directories and execute them in all at once. The Solution We can organize tests in sub directories of arbitrary depths, but in order for tcltest to include a directory, that directory must contain a file named all.tcl. In this example, we only create two […]
April 19, 2011
The Problem We want to test the result of a function, but don’t know the exact values The Solution In case where we only have a vague idea of what the result or output should look like, we can use the test command’s -match option. For example: Explanations: Lines 6-10: this is the same test […]