Posts

Importing User Data Into Joomla

I had a need to import user data into Joomla with the Community Builder RC1 component installed. After a bit of discovery I found a method. First, I had to export my users from a proprietory Access database to something I could import using phpMyAdmin. I ultimately found that MySQL seems to like tab delimited files better, since phpMyAdmin likes to have a character set surrounding each cell for import purposes, and Excel doesn't export csv that way (at least not to my knowledge). Before any of these changes were attempted, I exported the tables marked for updating. Backups are good juju.... Once that was done, I had to form the data to prepare for import. The first table I imported was jos_users. I used a nice php script found somewhere on the net. Replace $TABLENAME, $FILENAME, $DATABASENAME, $PASSWORD, $USERNAME, and $HOSTNAME with appropriate values. # first get a mysql connection $dbh=mysql_connect ("$HOSTNAME", "$USERNAME", "$PASSWORD") or di...

Output MS Publisher to PRN files

I needed a method to programatically check a series of directories for .pub and save as .prn for later batch processing to .pdf through Distiller. There were hundreds, and I just couldn't make myself do it by hand... After a little Googling, I found some useful code snippets from MS, and Google groups. Comments and credits were left intact in the functions I borrowed, as well as my own. Hope someone finds this as useful as I did. Option Explicit Function GetFiles(strPath As String, _ dctDict As Scripting.Dictionary, _ Optional blnRecursive As Boolean) As Boolean ' This procedure returns all the files in a directory into ' a Dictionary object. If called recursively, it also returns ' all files in subfolders. Dim fsoSysObj As Scripting.FileSystemObject Dim fdrFolder As Scripting.Folder Dim fdrSubFolder As Scripting.Folder Dim filFile As Scripting.Fil...

Automated CD Burning using AutoMount

One recent project for my employer was to create a headless (pc with no keyboard, mouse, or monitor) CD burner that automagically detects an inserted flash card, renames the files, and burns them to a CD along with a Flash Projector application that plays the images on PC's or Mac's. My solution was to use the AutoFS automounter daemon, and shell scripts. Much of the scripting ideas borrowed heavily from the BashBurn project. The hardware used was commodity workstations, and a 9-in-one flashcard reader configured as a SCSI device. See the following articles for interesting info: http://www.grack.com/news/2003/Atech9-in-1CardReader.html http://www.cs.sfu.ca/~ggbaker/personal/cf-linux The file test.sh is run by cron every 20 seconds, piping the command through sleep: * * * * * root sleep 0; /usr/local/copydisk/test.sh && sleep 20; /usr/local/copydisk/test.sh && sleep 40; /usr/local/copydisk/test.sh Test.sh contents: #!/bin/bash if [ -f /usr/local/copydisk/...

Windows VBS Automated Maintenance Scripts

I had a need to automate a number of tasks for remote administration, and used Visual Basic Scripting and Windows Scripting Host Objects, since I am fairly comfortable with VB/VBA. This is an automated defragmentation script that uses dirms.exe, a defragmentation utility found here . Option Explicit Dim FSO, Drive, oShell, WshShell, BtnCode, rtn, hd, stComp Set WshShell = WScript.CreateObject("WScript.Shell") Set FSO = CreateObject("Scripting.FileSystemObject") Set oShell = WScript.CreateObject ("WScript.shell") '''' ''''''''''''''''''' DIRMS.EXE USAGE ' dirms c -q : Do free space evaluation, defragment, and quickly move files to the front of the drive ' dirms c DEFRAG -q : Defragment files only ' dirms c CoMpAcT -q : C ompact only ' dirms c COMFRAG -q : Perform partial compaction (quickly) on all fragmented files ' dirms c COMFRAG c:\filena...

Linux screensaver for Windows

WOW, this is cool. A Linux screensaver for Windows . Gotta try this out, and impress my co-workers... ;).

Database updates

I needed a method to update a database application across a WAN, and found that I could do this with my Linux firewalls, and Windows batch scripting. The topology is this: Win2k Svr -> Linux FW -> Internet Win2k Svr batch file: @ECHO OFF SET _LOGFILE=mydb.log Net Stop "SQL Anywhere - mydb" >> "%_LOGFILE%" ATTRIB -R "C:\Program Files\mydb Software\mydb\mydb.db" ATTRIB -R "C:\Program Files\mydb Software\mydb\mydb.log" NET USE Z: \\win2ksvr\home\backup\backup\mydb admpass /USER:domain\admin FOR /F "tokens=2,3,4 delims=/ " %%i in ('DATE /T') do set d=%%k%%i%%j FOR /F "tokens=1,2,3 delims=:. " %%i in ('TIME /T') do set t=%%i%%j%%k XCOPY "C:\Program Files\mydb Software\mydb\mydb.log" Z: CALL :REPORT %ERRORLEVEL% "C:\Program Files\mydb Software\mydb\mydb.log" XCOPY "C:\Program Files\mydb Software\mydb\mydb.db" Z: CALL :REPORT %ERRORLEVEL% "C:\Program Files\mydb Softwar...

Time to add to this blog

I can't believe it's been this long, and that I've neglected this blog for such a long time. Oh well, I'll just make it my scratch pad for tech notes.