Code snips, and programming examples.

Control Winamp 2.X in VB6

Attached in a simple VB6 module that will help you control an running Winamp instance. I lost this awhile back, and could not find a module that came close to the features that this one offers. Digging around I found it on an old backup drive and decided to post it here.

Winamp VB6 Module
You will need to change the extension from .txt to .bas and then add it into your project.

Currently I am using this code in my project to control Winamp, along with the Winamp LCD Display Plugin to display information on my 2×16 serial LCD above the DIC. Working great so far, but I need to find some option or other way of telling the plugin to clear the LCD screen when it loads up, since the LCD remembers data sent and does not clear old data, leaving characters where there should be nothing but blank spots.

By |April 24th, 2010|Categories: Code|Tags: , , |0 Comments

Document Processing Source Code

This is the PHP console program service that Anthony and I programmed at work. We got the owner of the company to sign off a release form finally making the code available under the GPL.

Please note that this code will probably not work for you as a drop in place system, it will require tweaking, and lots of setup on your part. Please do not ask me for assistance.

Use this code at your own risk. You will need knowledge of Linux, PHP, Shell Scripts, and some common computer programming knowledge.

Folder structure for this program is as follows:
/tmp – Used for temporary storage of files for FDF merge into interactive PDF.
/usr/local/bin – Storage for all scripts this program uses. (dps.php, forge_fdf.php, file2pdf, pollerctl, dps_poller, hud-process.php)
/usr/local/dpsdocs – Root storage for following folders:
dpsdocs/merged – If save mode is on, saves raw ODT and PDF files in named folders.
dpsdocs/failed – Saves documents that failed to merge for some reason.
dpsdocs/monitor – If user chooses fake printer, will save the PDF here, instead of really printing it. Good for NFS/SMB share.
dpsdocs/templates – Live templates that the system pulls.
dpsdocs/test_templates – Test templates that you can SMB/NFS share for users to add tempaltes and you can sync to live later.
dpsdocs/xml_request – Where all the XML files get dumped to from which ever system you have generating them. Good to NFS/SMB share.

Files used and purpose:
dps.php – Main PHP program, does the merging and OOO operations. Takes in the XML as the first parameter and some others. Open file and view for yourself.
dps_poller – The program that loops continuously looking for newly dumped XML files. XML files that have specific printers are SCP’ed over the network to other servers running program so they build and print locally at that location.
file2pdf – This shell script gets called by dps.php and finishes the job, runs pdftk operations, and reads the sorting.txt file to decide where to print.
hud-process.php – Example PHP file that takes in FDF data and merges with specific PDF files. Called from dps.php.
pollerctl – Service script that makes sure the dps_poller is always running and never died for some reason.
tbs_class.php – TinyButStrong PHP class file, called from tbsooo_class.php.
tbsooo_class.php – TinyButStrong OpenOfficeOrg class file, called from dps.php.
zint – Console program that takes in data and creates a barcode. dps.php calls this, and creates a PDF417 barcode.

Document Processing PHP System

By |April 2nd, 2010|Categories: Code|Tags: , |0 Comments

Looking through scripts

Every now and then at work I have to dig through a few scripts to find some off the wall command that is run at a specific time, and to run it manually. Today I had to find a few commands so I opened a script that controls the shutdown of all databases, and found a nice block of comment code that was left from a friend, best damn UNIX guy I know. I’ll post an excerpt of it here, taking out the stuff that I should really not make public for obvious reasons.


#### DO NOT try to fix this! ###
# The following loop is absolutely painful, and I know you THINK you
# know a better way to do this, but trust me, it won't work. It will
# LOOK like it worked, and you won't know the difference until you have
# to restore from the backup you created and it fails.
#
# The ----- command used to shut down the databases completes
# successfully (return code 0) BEFORE the database is actually shut
# down (if you don't believe me, call -------- --------- Corporation
# and ask them 000-000-0000. Therefore we cannot start truncating
# the ----- just because ----- completed successfully. The ------
# command used in this loop returns an exit code of 0 if the database
# is shut down, and some positive value otherwise. In this loop we
# go through all of the databases, add up the exit codes for each one,
# and repeat until the sum is 0 (meaning all databases are shut down).
# It would be easier to grep 'ps -ef' output for the '-------' database
# server process, but so far we can't get ------- Tech Support to
# confirm that no other process could be modifying database files,
# so this is the only method that has the -------- stamp of
# approval.
#
# -- BEGIN brain dead loop --

Sorry, I just love finding odd bits of code from others during normal day operation.

By |March 23rd, 2010|Categories: Code|Tags: |0 Comments