Antoun (Tony) Kanawati

Resume, contact: tk-software@comcast.net

Tony Kanawati is a software developer with over ten years of professional experience.

Skilled in: C/C++, Java, Perl, XML/XSL, Actuate, API design and implementation, written and oral communication.

Resume: Resume.html


Snippet from a performance evaluation:

One sided surfaces

One sided surfaces are interesting constructs. Two such famous surfaces are the Moebius Strip and the Klein Bottle.

The programs below provide OpenGL visualizations of these two surfaces. Also, as part of the this OpenGL experiment, there is a Towers of Hanoi animated solution, which has nothing to do with one sided surfaces, but is mathematically interesting.

(Win32), (Linuxsource).

Win32 binaries are included in the zip file.

To compile from source, you need: OpenGL (or Mesa), GLUT, libjpeg, and GLUI.


img/moebius_grid_00000.jpg

Last update: 2004-04-09

Backtracking class template

Backtracking encapsulation for C++ (courseware for a C++ course I teach occasionally): .

This is a literate program providing a simple C++ class template for general purpose recursive backtracking algorithms. Demonstrations include the Cannibals and Missionaries problem (two variations), and the Eight Queens problem.

To use the class template, the programmer defines their problem as a class describing the basic properties of the problem: what moves are available, a test for completion, and a test for move validity. The solver works with different evaluators: two standard evaluators are provided:

  • Pick the first solution.
  • Accumulate all solution, by pretending to fail when a solution is found.
Custom evaluators can be used to locate solutions with particular properties; e.g.: the first solution with a queen in cell (2,3), the first ten solutions, etc...

Read document (PDF).

Developed while teaching a C++ course.

Last update: 2004-04-09

Sqlite wrapper for java

A Java wrapper built around a small SWIG generated interface for SQLite.

There are two parts to the package: a small direct interface to a small set of C functions to access Sqlite, and a class abstraction (SqliteDB, Query, and Row) for more conventional java-style use.

The Javadoc documentation is at: java_sqlite_docs.

.

Tested on Linux and Win32, with Java 1.4.x, SWIG 1.3.21, and Sqlite 2.8.13. Requires Perl during the build.

Last update: 2004-04-14

Sqlite wrapper for Perl

A Perl wrapper built around a small SWIG generated interface for SQLite.

There are two parts to the package: a small direct interface to a small set of C functions to access Sqlite, and a class abstraction (SqliteDB, Query, and Row) for more conventional Perl-style use.

The documentation is at SqliteDB.html.

requires SWIG 1.3.21, SQLite 2.8.x, and Perl 5.8.x (tested with perl 5.8.3, sqlite 2.8.13).

Current bundle is linux-based; Win32 coming soon.

Last update: 2004-04-14

Test program for the Sqlite wrappers; loads a whole bunch of fortune cookies files into a sqlite database, using Perl. A Java program can then be used to browse the database.

; you need both the Perl and Java wrapper from above.

Last update: 2004-04-13

A simple introduction to binary search trees (in C++)

A literate program that builds a binary search tree with an interface similar to the standard library containers. CWEB sources, dvi, and PDF included.

The bundle includes a copy of texitree from GNU libavl. The progam is used to generate the tree images in the document.

Read document (PDF).

Download:

Developed while teaching an algorithms/data structures course.

Last update: 2004-04-09

Miscellaneous Doodles

Updating Active Perl docs after installing/updating a package: The following tiny script does the trick.

use strict;
use ActivePerl::DocTools;
ActivePerl::DocTools::UpdateHTML();
ActivePerl::DocTools::WriteTOC();

Or, as a one-liner:

perl -e 'use ActivePerl::DocTools; ActivePerl::DocTools::UpdateHTML(); ActivePerl::DocTools::WriteTOC();'

Cleaning up a path string to avoid repeated listings of the same directory.

Path strings (PATH, MANPATH, LD_LIBRARY_PATH, ...) have a tendency to grow in an active environment (you change something, and source .profile), nested shells appending to inherited variables, and other factors. This little perl script removes duplicates a path string, while keeping the order.

# fixpath.pl
use strict;
my $p = <STDIN>;
chomp $p;
my @items = split(/:/, $p);
if ($p =~ /:\Z/) { push @items, ""; }
my %seen = ();
my @newitems = ();
foreach (@items) {
    if (!exists($seen{$_})) {
        push @newitems, $_;
        $seen{$_} = 1;
    }
}
print join(':', @newitems), "\n";

Example use: export PATH=$(echo "$PATH" | perl ./fixpath.pl)

If you don't care about directory order, this one-liner does the trick:

echo "$PATH" | tr ':' '\n'|sort -u|tr '\n' ':'
$Revision: 1.24 $
$Date: 2004/04/27 12:48:51 $