Geekery


- March 25, 2006 9:47 am

Here you will find all of the programming projects and tutorials and such I’ve been working on. Since the conversion to WordPress and the new design I haven’t gotten around to reuploading and organizing the projects so just hold your damn horses.

ASP

ADO FileStreams - Time for creative ASP code! This is a more flexible and secure way of linking to your files. First of all, ADO streams are server-side memory-based filestreams. Since they are server side, the file you want the client to download doesn’t have to reside in a web-accessible location on the server (although the script needs access to the files). In fact, the file doesn’t even have to be the same name or extension. Therefore, it’s impossible for a 3rd party to directly link to the file. And it’s all done without file copies. (Src)

File Searching and Listing - In the archive linked below, I’ve posted some code using the filesystemobject (FSO). The FSO is the primary file manipulation object in VBScript. There are 2 functions that allow listing the file contents and folder contents of any folder on disk. There’s also a class (the neat part) that allows searching any folder and it’s subfolders for any file by name (or partial name). Great for searching local mp3 archives when used with the filestream code above. Sample scripts are included at the end of the source. (Src)

C/C++

LilMikey’s Tetris Clone - Yes, it’s a regular old Tetris clone. I wrote it for a small project in a college computer graphics course. Nothing too impressive but still a good time. Download the source or the binary. It is 100% cross-compilable with VC++ 6.0 and Codewarrior 5.x on Macintosh though. (all projects had to compile on macs… ack). GLUT is required to compile or run this program. (Bin, Src)

LM_CompressionEngine - This is a utility library that will be used in a good portion of the programs I write in the future. It utilizes zlib and a custom block file format that is easy to understand and manipulate. It’s well documented and quite flexible as far as data format. It supports memory and disk only methods for quick data access or smaller memory footprint as well as simple password protection. A sample program binary can be found below. The sample program is a fairly full-featured interactive command line program but keep in mind that it is just a sample of what the engine can do… not the intent (or extent) of the engine itself. Unfortunately, when the HDD my CVS repositories were on died I lost the latest source however I think this version is fairly recent. (Sample Bin, Src *may be dated*)

MP3 Arranger - I wrote this because of my DVD player. Unfortunately, it only shows files in 8.3 format and, as most mp3 files are named - I got a whole bunch of indistinguishable mp3s on a CD. This program will take a folder of mp3s and a destination folder, create a folder for each band, copy the mp3s for that band into their folder, and rename the mp3 to just the song name. Now they’re in good order and easy to see on my DVD player. (Bin, Src)

Process Management Software - This is some nifty code if you need to make absolutely sure a process is running 24/7. The first program, ‘watcher’ takes a program path as an argument. It will start the executable and query it every few seconds. It ensures the process is still running and sends a NULL message to it. If the program takes longer than 60 seconds to process the message, watcher determines that the process is hung, kills it and restarts it. The second program, ‘pwatch’, features a reusable class that performs all process starting/watching/restarting similarly to the watcher program. The pwatch program itself is simply a shell around that class’ functionality. The class is designed to be used in your own programs. There are examples of finding an running process by executable name, creating/opening/querying processes, and sending windows messages (Even though these are command line programs). Watcher: (Bin, Src) PWatch: (Bin, Src)

StarFighter - This was another quick little game I wrote for computer graphics. Unfortunately, control worked well on PCs but I had to dork it up to get it to work on the Macs. You’ll have to click and drag to turn the ship in this version. A speeds up, Z slows down, space fires, and q will rotate the camera (poorly). I’m still digging up the source but the binary is available below. GLUT is required to compile or run this program. (Bin)

Terminal Server Process Killer - Problem: Many users log on to Terminal Servers, start applications and disconnect without logging off leaving their processes running. This situation makes it impossible to distribute new binaries. Either you must kill off the session (see tool below) or you must kill off the processes. This tool can terminate a given process by executable name on an individual or all terminal servers. (Src, Bin)

Text Metrics Library - There is a whole slew of font related functions in the Win32 API. Most of them are awkward and difficult to use especially in the context of Powerbuilder or Visual Basic. I have written a DLL to wrap up some of these functions into easier to use counterparts. The one I’ve found most useful is the GetTextExtents. That function can be used to size a control with text on it’s surface to fit the text it contains. Just don’t forget to convert your units. (Src, Bin)

TrmUser - TrmUser is a command line program that sets terminal-server specific user profile information like Terminal Server profile path, Terminal Server Home Directory, and Terminal Server Home Directory drive from the command line. Back in the day, this little tool got passed around a bit in the Windows Terminal Server crowd because MS had yet to release a similar tool. Back in the day you had to use GUI tools to accomplish the same tasks which kills administrator automation. I think that in later versions of the Terminal Server Res. Kit they have a tool that does the same thing so this isn’t really useful anymore but if you’re interested in how you set TS info programmatically (and can’t or won’t use Active Directory to do it) this is still great.

As an aside, I rebuilt this program in VS 2003 just to make sure it still compiled. It appears MS did away with the old fashioned C iostream.h and now you must include and use the std namespace to access the stream functions. Out with the old and in with the new has its place but why would you break everything that uses iostream.h? Link with wtsapi32.lib and netapi32.lib. (Src, Bin)

UserLogoff - Getting sick of user management tools yet? Well, too damn bad. We had a need to logoff all users on our terminal servers except a selected set of users on a selected set of servers every night. What this program does is parse an XML file retriving a list of the servers to log people off of and a list of people to exclude from the logoff process. The XML structure is obvious and no arguments are necessary if the XML file is in the same path as the executable. Check it out: (Src, Bin)

J2ME

J2ME TODO List - It’s small, it’s simple, it’s just a TODO list. You can add, remove, mark done, and elevate priority of items. I wrote it just to toy around with J2ME. (Src, Bin: OTA provisioned; surf phone to http://www.lilmikey.com/cell)

PHP

iNoRDER - iNoRDER is a PHP personal time and business mangment system I wrote specifically for Mike Randle Photography. Through it I maintain contacts and correspondence, manage job flow, calendaring, etc. UserName:demo Password:demo will get you in for a sample although most of the sample items are probably old. It can be customized for many types of small business and not just photography. I don’t have a redistributable source package yet.

phpSimpleGallery - phpSimpleGal is gallery software engineered for website designers. The layout and behavior of the thumbnails is complete customizable and theme-able through css. Thumbnail prev/next, image prev/next, and mouseover thumbnail switching are options that can set without modifying the code. The mix of php and javascript automate the drawing of thumbnails and the switching of the main image. Due to the way the gallery is implemented you only need a single gallery page regardless of the number of thumbnail pages. The source is packaged up here

PowerBuilder

System Tray Object - These simple objects make it easy to use the system tray in your Powerbuilder programs. All you have to do is include the library in your programs, declare and create an instance of the uo_systray object, and call setup and pass in a window to recieve the events for the icon. Then, add icons to the object by calling the addicon() methods. Show an icon in the tray by calling the showicon methods. Set the tip text be calling SetTipText. You can even blink between 2 icons by calling the blink method (the interval time is in seconds btw.). Keep in mind that when showing or blinking icons it’s expecting the icon’s programmer defined name and not the filename. If you want to recieve events when a person clicks, right clicks, or double clicks the icon look at the instructions in the instance variable declarations to do so. (pbl)

Tutorial: Skinning Powerbuilder Windows - Learn how to make your powerbuilder windows more fluid and dynamic… pretty too.

VB6

Systray Module - This Systray module is very similar to the one I created for Powerbuilder although maybe somewhat behind as it’s not used in a production environment. Simply include it in your project, add icons using ‘AddIcon’, and show an icon using ‘ShowIcon.’ You can make them blink using the blink method. This object is different from it’s PB counterpart in one important way. PB used a timing object as an instance variable in the main object to handle the blinking. The VB version tosses a timer on a form. This is better, IMO, as the form with the timer can also handle the clicky-type events for the tray icon. Adding text to the bottom of the module is a lot more obvious than trapping ‘other’ events in a window. (Src)

--