These are two simple programs I did for a college professor friend who needed to put class outlines and notes on her web site. The programs accept text files and output them as HTML bulleted lists, or indented, numbered lists. Nothing terribly slick or incredible going on here -- only text filtering.
These two programs are used to maintain HTML pages. Both programs search for a "fake" HTML tag and replace the tag with other text. The Tag2FStat program replaces tags with the current system date and time or the date and time obtained by using stat() on a file. This is how notices on the web pages give the date and time that a file or page was changed on the web site.
This program splits fixed column data into comma-separated values. This could be done with an awk script, or the cut command or other things, but scripts have a way of behaving oddly if everything isn't just as they expect, and this was written partly for the entertainment value. Also, executables are faster and I need to parse fixed column data dumps of hundreds of millions of records and don't want to wait.
This program reads a comma-separated value file containing data representing checking account activity and an HTML file that contains a "fake" HTML tag, and then the program outputs the HTML file with a pretty HTML table of account activity in place of the fake HTML tag. This is how the Account Activity page for the DavieGOP is created.
(This program is obsolete due to web site changes at the Supervisor of Elections and differences in the precinct numbering scheme. It is still a useful example of posting requests to web sites, and mining data from the HTML results. This program contacts the Broward County Supervisor of Elections web site, requests the voter demographics web page for a precinct, extracts the data from the page, and outputs it as comma-separated values. This program is dependent on libcurl. The version here has a feature removed that gets all precincts' data in one pass of the program to prevent people from DOS'ing the SOE web site.
This program reads several comma-separated value files containing data representing precinct voter demographics, lists of precincts within a location (town or village), and lists of Republican Executive Committee members. The program outputs nicely formatted HTML tables listing the demographics and committee people for a given location. This is how the Davie and Cooper City demographics web pages are created for the DavieGOP web site. This program is obsolete due to Supervisor of Elections precinct numbering changes caused by redistricting.
Solution to Colin Carter's Xt Menu Bar Widget Dilema - Updated May 20th, 2005
This is a short, simple tutorial or example X program using Xt/Xaw widgets to produce a window split by a horizontal pane with a number of menu buttons in the top pane and some "main" program content in the bottom. The purpose is to use just the Xt/Xaw toolkit widgets to produce something similar in appearance to the "menu bar" that is a standard widget in most larger X-based widget toolkits.
This was done in response to Colin Carter's request for assistance on the Suse-Programming-E mailing list. It had been about 13 years since I did any real X coding, but they say you never forget how to ride a bicycle -- or maybe they meant fall off a bicycle.
There are many versions of the code in the RCS archive starting with the code from the first, original request to the last one that appears to work as intended. In between there are many examples of lameness and severe Stupid Programmer Tricks as I tried to remember how to make this work based on the limited information that could be gleaned from the web. It seems not many people do basic Xt/Xaw level coding for user interfaces anymore.
Solution to Colin Carter's Xt Menu Bar Widget Dilema: Part II - Updated August 28th, 2005|
This is a not so short, not entirely simple, example X program using Xt/Xaw widgets to produce a window split by a horizontal pane with a menu bar in the top pane and some "main" program content in the bottom.
This revised Xt/Xaw menu example includes an app-defaults Xrm database file MyProg that can be copied to your home directory. This code example also includes dignostic messgaes reporting the application's Xrm database resource names using borrowed appres v1.9 code. Additionally, the miles of explicit XtCreateManagedBlahBlah() code to create the menus have been replaced with a few code layers that build the menu buttons, pop-up menus, and menu items on the fly using data in a few arrays to drive it. The data for the entire menu structure is declared in mymenus.c and can be changed without recoding anything else.
The tar file contains the RCS tree for this Xt/Xaw menu tutorial. It also includes the entire history for the original Xt/Xaw example program, testxt, above. (The original TestXt is the myprog.c file prior to version 1.10).
One Known Bug To Fix: It works fine with the standard Xaw widget set. But, when the 3D widget set is used resizing the window causes the interior panel to progressively resize smaller than the window. After a few resizes the window contents are reduced to a little blob of pixels and will not resize larger. Perhaps if the top most widget used a resize callback which would try to force the widget tree to resize larger than the window size, then it would get the correct geometry... ramble... ramble...? Just a theory.
Simple Embedded SQL/C example for PostgresQL - Added Dec 2nd, 2006
This is a short, simple example of writing embedded SQl/C code using the PostgreSQL libraries. This was done on my system using PostgresQL 8.1.5 built directly from source. Many distros like to change the default locations for apps like PostgreSQL, but this makefile should work for everyone. It uses pg_config to determine the location of client libraries and include files. So, if the pg_config utility is in $PATH it should work without changes.
The program performs the following activities:
The code is short and simple, and was surprisingly easy to slap together. SQLSTATE value checking is done and reported after each SQL operation, so it should be obvious where errors occur. The command line parameters are the dbname and the user name. Run it without parameters or with the -v option and it will tell you how it works.
Something even more lame will go here.|
This spot reserved for lameness exceeding the FDA maximum limit for lameness exposure. Parental supervision recommended.
CSV - Updated November 22nd, 2009|
Why are there so many programs here that deal in comma-separated values? Because I have a C library of functions for manipulating CSV files. The CSV program is a front end for that library permitting generic processing of any kind of CSV File.
This C program is an implementation of something somewhere between a spreadsheet and a database for working on CSV files. But, its primary value is as a toy for my entertainment to keep my pointer gymnastic skills from getting rusty.
Originally, there was just CsvData that parsed a single line of text, validated the contents, and split the data into fields. To do useful work for campaigns CsvFile was built around CsvData to read entire files into memory. Then sort and field manipulation features were added.
Any other programs listed on this page discussing comma-separated data are built using at least a subset of CsvData if not the entire CsvData/CsvFile objects. Sometimes, the other programs aren't always using what is current, so one of the other enhancements I want to add is to split out all CSV data manipulation into a shared library, and keep all the exotic processing features and terminal display in a separate project.
(2006-10-16) A major overhaul has occurred. A partial infrastructure was invented as a stepping stone to implementing the csv processing features as shared library plug-ins. All the command options now have standard code for parsing command line executables, generating help, validating arguments, and executing the function. The wrapper level functions now use a standard method of execution that accepts a unified structure containing the function arguments. Lots of code has been consolidated -- where the argument parsing and help information resided in separate files, now most of the code supporting a specific command appears in just one interface/control file for the command. It is still far from complete, but the code has once again reached a happy place where it is safe to compile.
(2009-11-22) Another "major" change. The license for CSV has changed from GPL to LGPL as of version 1.27. The original GPL version is baselined at version 1.26 and is still included in its own, obviously-named RCS directory. And, by the way, a quicksort implementation has been added in version 1.28. If you're sure your data is comfortably disordered, so the stack will not blow out due to recursion, then have fun with the much faster quicksort.
And now that we're talking about goals: