XFDL Viewer

The scope of the “Apps 4 the Army” competition that I am making my XFDL Viewer for is to use web apps.  So I did a quick change to PHP and read up and got a framework setup.  The idea is to be able to import the XFDL file and then parse the resulting XML to input values, either on a single form or by batch through an uploaded database.

The framework is complete and I’m pretty happy with the results as I’ve done much more application programming than web development, but PHP isn’t too bad.  After getting the frame work together, I started to work on parsing.  I mistakenly uploaded a XFDL file rather than the decompressed XML and I found something remarkable.  PHP’s SimpleXML apparently can decompress the XFDL file!! This takes out a very complicated step of my project!!!  I’m still working to figure out why the recompression does not produce the same output but that may not be a problem with the web interface.  Stay tuned for more updates.

Ubuntu 10.04 – Fixing Title Bar Buttons (Place on the right)

After downloading Ubuntu 10.04 Lucid Lynx, I noticed that the biggest user interface change is the title bar buttons.  Unlike Windows or Mac, the buttons are located on the left side.  This is not too bad if you can get used to it, but I found several complaints online.  So, for those who are not used to gconf-editor, here are instructions to fixing the title bar.

  1. Open a terminal or use Alt+F2 and type ‘gconf-editor’.
  2. In the tree menu on the left side go to: apps -> metacity -> general
  3. On the options menu (right side of the editor) find the option midway down for ‘button_layout’.
  4. Editing these options can let you customize the menu, here’s how:
    • The colon ‘ : ‘ sets the middle, so anything on the left of the colon is on the left of the title bar.
    • Settings are comma separated values of menu, minimize, maximize, close, separator
      • Duplicates and unknown values are silently ignored.
    • Example #1: menu:minimize,maximize,close
    • Example #2: close,minimize,maximize:
    • Example #3: minimize,maximize,close:

See, one of the great things with Linux is that these configurations are available.  If you take a moment to look around your gconf-editor, you’ll see how powerful this tool is to your user interface customization.  Feel free to contact me or comment here with questions regarding this process.

Ubuntu 10.04 Alpha 2 – Review

So I decided to update my laptop to Ubuntu 10.04.  This process got off to a rough start because a pesky dog ran into my laptop, shutting the lid and causing a sleep halfway through the upgrade.  The problem came in that the computer was not set to be able to resume and so I only had half the updates done.  So when I rebooted, there was no graphical display, and for awhile, not even the ability to use a terminal.  Thankful, grub had been updated and I was able to boot into the recovery counsel, compile a wireless driver, get an internet connection and download and install the rest of the updates manually rather than through ‘sudo upgrade-manager -d’.  Once that was done, I was amazed at the new Ubuntu.

Improvements that I noticed:

  1. Better Graphical Display (Finally away from the orange/brown theme!)
  2. Applets, as per the past four releases, are better in bothe appearance and use.
  3. Ubuntu is keeping with its integration of web based applications and social networking through the Desktop.

There are many more improvements but these are the ones that I’ve noticed first.  I’ve also seen through Launchpad that bugs are being addressed, which in this pre-review from last year, it would appear the the integration of fixes for the bugs in Linux has improved quite aways in the past year, and this release appears to be continuing the quality product of Ubuntu Linux!

XFDL in Linux :: Update

So, after talking with the Army’s G6 (essential the IT Department), the competition I’m entering (which because I’m not an active duty Reservist, I cannot receive prize money) is focused on web applications, not desktop applications.  The changes you can expect to see in my coding is that there will be quite a bit of php, perl and python that I’ll be using rather than the application side.  At the same time though, I’ll take what I do in this web application and use it for developing a desktop application and a Microsoft Office plugin that can be used to batch load files.  Just figured I’d acknowledge the reason for changes.  On the plus side of all of this, perl has a specific Mime module and php has a great and simple interface to xml parsing, so this may end up easier as a web application.

Python Curses – Custom Menu

Continuing on the same project as the previous post, I came to wanting to make a custom menu with curses in Python.  Realizing that there are functions to create menus in curses already, I wanted to build this fro m the bottom up.  The concept was to produce a menu that would highlight the selection change on the arrow keys or direct input, and then on a press of the Enter key the menu would return that selection.

Now, while writing this, you’ll see in my code that I took probable the least efficient way of building this menu, but it helps in making itself explanatory for the person learning curses.  As for the context of this coding, I built it as a function in my XFDL viewer, so there are 5 options in the menu.  I used win.keypad(0) to enable the use of the arrow keys but for some reason, the curses.KEY_UP was not being detected so the arrow key up and arrow key down are 259 and 258, respectively.  This does work though, I also have the menu catch numbers 1-5 and set the highlighted line accordingly.

def menu():
    curses.init_pair(1,curses.COLOR_RED, curses.COLOR_WHITE)
    screen.keypad(1)
    pos = 1
    x = None
    # I'm going to be lazy and save some typing here.
    h = curses.color_pair(1)
    n = curses.A_NORMAL
    while x != ord('\n'):
        # Gotta reset the screen from the root or lose the border, window, etc.
        screen.clear()
        screen.border(0)
        screen.addstr(2,2, "XFDL VIEWER", curses.A_STANDOUT)
        screen.addstr(4,2, "Please select an option...", curses.A_BOLD)
        # Detect what is highlighted by the 'pos' variable.
        if pos == 1:
            screen.addstr(5,4, "1 - XFDL -> XML",h)
        else:
            screen.addstr(5,4, "1 - XFDL -> XML",n)
        if pos == 2:
            screen.addstr(6,4, "2 - XML  -> XFDL",h)
        else:
            screen.addstr(6,4, "2 - XML  -> XFDL",n)
        if pos == 3:
            screen.addstr(7,4, "3 - Show XML",h)
        else:
            screen.addstr(7,4, "3 - Show XML",n)
        if pos == 4:
            screen.addstr(8,4, "4 - Exit",h)
        else:
            screen.addstr(8,4, "4 - Exit",n)
        if pos == 5:
            screen.addstr(9,4, "5 - DEBUG", h)
        else:
            screen.addstr(9,4, "5 - DEBUG", n)
        screen.refresh()
        x = screen.getch()
        # Is 'x' 1-5 or arrow up, arrow down?
        if x == ord('1'):
            pos = 1
        elif x == ord('2'):
            pos = 2
        elif x == ord('3'):
            pos = 3
        elif x == ord('4'):
            pos = 4
        elif x == ord('5'):
            pos = 5
        # It was a pain in the ass trying to get the arrows working.
        elif x == 258:
            if pos < 5:
                pos += 1
            else:
                pos = 1
        # Since the curses.KEY_* did not work, I used the raw return value.
        elif x == 259:
            if pos > 1:
                pos += -1
            else:
                pos = 5
        elif x != ord('\n'):
            curses.flash()
            # show_error() is my custom function for displaying a message:
            # show_error(str:message, int:line#, int:seconds_to_display)
            show_error('Invalid Key',11,1)

    return ord(str(pos))

I’ve highlighted the lines pertaining to my work around for the key pad.  This function will return the menu option and then that is processed for a reaction.  Reminder: the ‘screen’ object for my curses window is a global variable. I’m quite thrilled at the simplicity of this and the curses library, although I am disappointed in the lack of tutorials on the web deeper than typical ‘Hello World’ tutorials, but I hope these posts go to help others exploring this library!

Here’s a nice picture of the library in action:

Customize menu in action...
Be sure to comment on these tutorials and let me know if there is more detail needed or if they are helpful!!

Python Curses – Custom Progress Bar

Custom Progress BarIn making a visual editor for my XFDL project, I’ve decided to do the basic start in curses.  This is a module of python/library of C that I have not been able to utilize much at this point despite interest.  Unfortunately, there seems to be limiteexid documentation beyond the standard ‘Hello World’ type of program.  I’ll write this short tutorial with the assumption you can get through those tutorials and utilize this object.

The concept here is to create a progress bar in curses.  This example does not have any data but a basic understanding of python would allow you to create the refreshes on percentage of completion rather than time based as I have here.

def show_progress():
    #Create a window object.
    win = curses.newwin(3,32,14,10)
    # Add the Border
    win.border(0)
    # Current text: Progress
    win.addstr(1,1,"Progress ")
    # This is to move the progress bar per iteration.
    pos = 10
    # Random number I chose for demonstration.
    for i in range(15):
        # Add '.' for each iteration.
        win.addstr(1,pos,".")
        # Refresh or we'll never see it.
        win.refresh()
        # Here is where you can customize for data/percentage.
        time.sleep(0.05)
        # Need to move up or we'll just redraw the same cell!
        pos += 1
    # Current text: Progress ............... Done!
    win.addstr(1,26,"Done!")
    # Gotta show our changes.
    win.refresh()
    # Without this the bar fades too quickly for this example.
    time.sleep(0.5)

See, nothing to it.  The first line creates a new window object for and the next line adds its border.  I mapped out the relative positions for text, and you’ll want to customize this to what you need to use in your program, but for the sake of demonstration, it will show a period for each iteration.  As previously stated, you can customize this to be data or percentage driven in your program.  Don’t forget to call win.refresh() for each iteration you want to show on the screen!

XFDL in Linux :: Part 2

More for the ongoing series of producing an XFDL viewer in Linux.  In the previous tutorial, we decompressed an XFDL file, although I have had trouble recompressing the file.  It turns out that I need to do some experimentation and find the exact compression method used in gzip to be able to make the form readable.  That will be for the next update though.  I thought I would give a short preview of what’s next on this.

An XFDL file is an XML (xform) by IBM meant to run through their interpreter. IBM has some great documentation on this format.  PureEdge works much like a browser does to decompress the file by Mime-type and to then parse and read the file, including embedded binaries (for pictures, files, etc) and embedded coding (custom functions).  My interpreter will have a long ways to go so I’ll be happy to just be able to place my values in the correct fields.  I’m re-reading XML parsing within Python to make this an easy function, so be patient on that part.  But for those eager to see what I’m talking about, I’ve pasted a small section of XML from a decompressed XFDL.

      <field sid="NAME">
         <itemlocation>
            <ae>
               <ae>absolute</ae>
               <ae>9</ae>
               <ae>448</ae>
            </ae>
            <ae>
               <ae>extent</ae>
               <ae>461</ae>
               <ae>24</ae>
            </ae>
         </itemlocation>
         <value></value>
         <borderwidth>0</borderwidth>
         <scrollhoriz>wordwrap</scrollhoriz>
         <scrollvert>fixed</scrollvert>
         <fontinfo>
            <ae>Times New Roman</ae>
            <ae>10</ae>
            <ae>plain</ae>
         </fontinfo>
         <format>
            <ae>string</ae>
            <ae>optional</ae>
         </format>
         <previous>NAME</previous>
         <next>GRADE</next>
         <acclabel>d ay form 46 44-r, december 19 82.
ay p d. p e version 1.00.
edition of 1 august 19 77 is obsolete.
army reserve reenlistment data.
for use of this form, see ay r 1 40-1 11, the proponent agency is r c p ay c.
item 1. enter name using last name comma first name comma middle initial format.</acclabel>
      </field>
As you can see, there is a <value> tag for these nodes.  For my next post, I’ll write some python code to break this xml to an object that can print the label and insert a value into the xml.  There is a lot of work to interpret the embedded items, code and other tags, but this will be a start!

XFDL in Linux :: Part 1

Earlier, I wrote about using PureEdge Viewer, which is Windows software from IBM on Linux through Wine. This got me thinking, do we need to use Windows software. A quick look at the file and through Google and it’s easy to see that an *.xfdl file is a gzipped, base64 encoded xml file. So this is part one of what I hope to be a tutorial into designing software on Linux using python to open, read and write xfdl files in the same way as PureEdge Viewer. It gets annoying, to say the least, to need to open Windows in VirtualBox, or an actual install to read and edit *.xfdl files. The barriers I see at this preliminary point is to convert the xml to a readable image and then to make that editable where possible.

So, in this first part, we will do the very basic converting an *.xfdl file to an *.xml file. The code should be self explanatory but if there are questions, post them through comments and I’ll do my best at getting an answer to you.

#!/usr/bin/python
""" IMPORTS """
from base64 import *
import gzip, os, sys

""" DEATH!!! """
# Standard way to die...
def die(msg=None):
    if msg == None:
        msg = "Unknown error."
    print " [*] ERROR - %s" % msg
    sys.exit(1)

""" CHECK FOR FILE """
# No file name, then we have nothing to do!
if len(sys.argv) < 2:
    die("Did not specifiy a file name.")

""" GET FILE """
# In a more advanced version, this will check the magic value of the file as well to
# ensure it is an *.xfdl file.
filename = sys.argv[1]
print "Using %s" % filename

""" OPEN FILE AND SPLIT """
# Nothing tough, grab the magic number (1st line) and then store the rest as a variable.
f = open(filename,'r').read()
magic = f.splitlines()[0]
print "magic: %s" % magic
data = f.split(magic)[1]
print "Got Data."
del f

""" BASE64 DECODE """
# First we decode the base64.
f = open('temp.gz','wb')
f.write(b64decode(data))
f.close()
print "Base64 Decoded."

""" GUNZIP DATA """
# Yes, I know this writing to a file and then deleting it is ugly but I have not found
# a way to gunzip from a data stream.
f = gzip.open('temp.gz','rb')
gunzip_data = f.read()
f.close()
os.remove('temp.gz')
print "Gunzipped Data."

""" SAVE XML FILE """
# As this gets more advanced, it should be able to stay as a data stream for editing.
filename = filename.split(".")[0] + ".xml"
f = open(filename,'wb')
f.write(gunzip_data)
f.close()
print "Saved to temporary file '%s'" % filename

Nothing too involved here, simply open the file, strip out the first line and the decode the rest from base64 and gunzip that data to get the xml inside.  In the next tutorial, we’ll look at the structure of that xml, once I actually understand it or find decent documentation on it!

Custom Brush for SyntaxHighlighter Evolved

Okay, before I get started let me just say that I realize there are several already set-up plugins for the WordPress Plugin, SyntaxHighlighter Evolved to include a brush for the *.batch language.  Also, there is a great article by the Plugin’s author that will guide you through developing a brush.  The reason I am posting mine is to pass a long a few things that went unsaid for the less experienced WordPress Plugin developer, but let me just say that this was much easier both in the plugin development and brush development than I thought it would be.  The reason I made my own brush, it’s just more fun to make my own!

Now, that being said, here we go!   My post for “Violating IT Policy” included a batch script for Cygwin to be portable.  since there was no brush in SyntaxHighlighter Evolved To develop a brush, you will need to set-up a new plugin for word press.  The plugin will be adopted by SyntaxHighlighter Evolved as you will see in a moment.  The structure for this plugin will be:

<root folder>/wp-content/plugins/
                        /plugins/<javascript brush>.js
                        /plugins/<php plugin>.php

For the javascript brush, this does have some tricky elements. but I’ve commented what I’m doing below.

/** shBrushBatch.js **/
/* Declare a new brush with SyntaxHighlighter.brushes.<your name for the brush> */
SyntaxHighlighter.brushes.Batch = function()
{
	/* Declare words that you need highlighted */
	var variable = 'clear cls goto set';
	var constants = 'if or';

	/* This is the heart of your brush, you can use the *.
	/* SyntaxHighlighter.regexLib.* brushes when applicapble. */
	this.regexList = [
		/* You may notice that my comments are looking for a css that does not match. */
		/* I'll explain below the script. */
		// comments
		{ regex: /(^::|rem).*$/gmi,                             css: 'string'},
		// stings
		{ regex: SyntaxHighlighter.regexLib.doubleQuotedString, css: 'comments'},
		{ regex: SyntaxHighlighter.regexLib.singleQuotedString, css: 'comments'},
		{ regex: /echo.*$/gmi,                                  css: 'keyword'},
		// variables
		{ regex: /%w+\1/gmi,                                    css: 'keyword'},
		{ regex: /%\*|%%?~?[fdpnxsatz]*[0-9a-z]\b/gmi,          css: 'keyword'},
		// clear cls keywords
		{ regex: new RegExp(this.getKeywords(variable), 'gmi'), css: 'variable'},
		// if and key words
		{ regex: new RegExp(this.getKeywords(constants), 'gmi'),css: 'constants'},
		// labels
		{ regex: /^:.+$/gmi,                                    css: 'script'}
	];
};

/* Create the highlighter object. */
SyntaxHighlighter.brushes.Batch.prototype = new SyntaxHighlighter.Highlighter();
/* Set the Aliases */
SyntaxHighlighter.brushes.Batch.aliases = ['bat','batch'];

So the reason that my css does not match the actual of what it is would be because the theme does not match my preference.  I perfer comments to be green, so since the string for the RDark format is green, I had to assing my comments to the string.  This was pretty confusing but the way I figured out my color scheme was simple enough.  In <root>/wp-content/plugins/syntaxhighlighter/styles/ you will find all of the css files to coordinate with the theme.  Half way down, you will see “Actual Syntax Highlighter Colors” and it is at this point that you will want to see what all of your options are.  Rather than converting #5CE63B to green, I went and made a sample script once my plugin was complete, I then went and set up a color tester like this, in place of my normal brush file:

/** shBrushBatch.js  - color test version **/
SyntaxHighlighter.brushes.Batch = function()
{
	/* 	set your wordpress to:
			1
			string
			comments
			... continue until the last keyword ...
			color3
			1 I dropped the correct closing in the example for formatting. */
	var string = 'string';
	var comments = 'comments';
	// ... continue to the last keyword ...
	var keyword = 'color3';

	this.regexList = [
		{ regex: new RegExp(this.getKeywords(string), 'gmi'), 	 css: 'string'},
		{ regex: new RegExp(this.getKeywords(comments), 'gmi'),  css: 'comments'},
		// ... continue to the last keyword ...
		{ regex: new RegExp(this.getKeywords(color3), 'gmi'), 	 css: 'color3'}
	];
};

SyntaxHighlighter.brushes.Batch.prototype = new SyntaxHighlighter.Highlighter();
SyntaxHighlighter.brushes.Batch.aliases = ['bat','batch'];

After doing this and seeing the colors, I could then associate which color I wanted for which sets of syntax.

Now, onto making the plugin work.  Obviously, you’ll need both of these files to have any results.  What this does is when you activate this plugin (yes, it does show in your plugins) then SyntaxHighlighter adopts it.  This script is pretty standard from what I saw online and is almost exactly out of the author’s blog post.  The comments at the front are what will appear in your WordPress under Plugins.  I’ve kept the comments mostly the same as the author, as he is describing it better than I could.

<?php
/*
Plugin Name: Batch Brush - SyntaxHighlighter Evolved
Descriptionn:  Adds support for the Batch language to SyntaxHighlighter Evolved.
Author: Zachary D. Skelton
Version: 1.0.2
Author URI: http://www.skeltonnetworks.com/
*/

// SyntaxHighlighter doesn't do anything until early in the "init" hook.
add_action('init','syntaxhighlighter_batch_regscript');

// Tell SyntaxHighlighter about this new brush.
add_filter('syntaxhighlighter_brushes','syntaxhighlighter_batch_addlang');

// Register the brush with WordPress.
function syntaxhighlighter_batch_regscript() {
	wp_register_script('syntaxhighlighter-brush-batch',
		plugins_url('shBrushBatch.js',__FILE__),
		array('syntaxhighlighter-core'),'1.0.2');
	}
// Add alternative names for your brush.
function syntaxhighlighter_batch_addlang($brushes) {
	$brushes['batch'] = 'batch';
	$brushes['bat'] = 'batch';

	return $brushes;
	}
?>

At this point you should be able to load your page.  If it cannot find the brush (you’ll get a dialog to let you know), you could replace plugins_url() in line 19 with a string of a direct path to the file, but there should be no need for it.  The most common reason for this is an error in your javascript brush, so make sure to check that before going to insane.  After this is all done, you may have problems seeing the results.  It took me 5 loads of the correct format before I saw the change, in that case, deactivate the plugin, clear the cache, change the plugin version number in line 6 and re-activate the plugin.  Should not need all of that but some browsers are fussy, and that takes care of any problem with the cache. As I said before, this is well documented and relatively easy to make.  You can see that I made my plugin only apply to my script but it would be easy to add more things to it.  I used a lot of my regex directly from this plugin because that is a skill I’m still working on.  But this was surprisingly simple, and you can find lots of good information on making plugins of your own.  It is surprisingly not too tough!

Complaint

“I’m a PC and Windows 7 was my idea.”

This has been annoying me for the past several months, and since I have a blog, I’m going to complain.  First of all, Windows is proprietary and if it was your idea and they didn’t pay you for it, oh well, that’s business.  Secondly, the crap in Windows 7 isn’t that great; I bought my wife a Dell Mini-10 for her birthday and it came with Windows 7.  I immediately installed Ubuntu 9.10 Netbook Remix and the comparison without even numbers, just general usage, screen real estate and speed, Ubuntu is far superior.  And finally, Ubuntu and Linux itself are open source which means that I can truly say, as a contributer (bug triage):

“”I’m a PC and Ubuntu truly is partly my idea.”

64bit Flash for Linux

This has been a pain for a long time.  I went though and installed flash for Linux in this method but it only half worked for my 64bit distro in Ubuntu.  Too many problems coordinating with 32bit libraries and I would have flash applications that loaded fine but would not accept clicks, for example a video that I cannot pause or fast forward.  I set out to find a solution, as I realized this was a problem not with flash but with coordinating that flash with a 64bit distro.  For those interested, there is a 64 bit, Linux release and it’s installation is far more simple.  It is located on Adobe’s website, but hidden deep in some of the small text, definitely not a feature that stands out until you read through the page.  Here’s the solution:

#!/bin/bash
## installFlash64.sh

function die {
	if [ "$1" == "" ]; then
		echo "[*] ERROR -- Not Specified."
	else
		echo "[*] ERROR -- $1"
	fi
	exit 1
}

function check_root {
	if [ "`whoami`" != "root" ]; then
		die "You need root to install the 64bit Flash Player."
	fi
}

## Set root user
check_root
echo "You are root, the install will begin now."

## Download the package
echo
echo "Downloading..."
wget http://download.macromedia.com/pub/labs/flashplayer10/libflashplayer-10.0.45.2.linux-x86_64.so.tar.gz

## Untar the package
echo
echo "Unpacking..."
tar xzvf libflashplayer-10.0.45.2.linux-x86_64.so.tar.gz

## Move the file
echo
echo "Installing..."
cp -v libflashplayer.so /usr/lib/mozilla/plugins

## Clean Up
echo
echo "Cleaning..."
rm -rf libflashplayer.so libflashplayer-10.0.45.2.linux-x86_64.so.tar.gz

## Done!
echo "Done!"
exit 0


Violating IT Policy!

So, I work as a social worker and we are not expected to do much more than document with our computers. For job security reasons, I use my hobby programming in work to make the workplace more efficient and ensure that I have a job tomorrow! There are some problems with this, most notably, we are not setup to do programming. So I’m going to list my favorite tricks to get setup at work.

First of all, although we work through a company ethernet connection; we do have some flexibility. For one, I read the IT Policy and it specifically states I cannot install an executable onto the harddrive. Well, problem easily solved, I have a flash drive, so in comes a website for portable applications.  Here’s the applications I use the most.

*        GOOGLE CHROME

Google Chrome is a great browser.  It’s ability to interpret javascript leaves IE# in the dust!  As for it’s portability, just like most of these, just run the executable and install it to your flash drive (or if you want a little more speed and less portability, your harddrive).  Now, Google Chrome works great right out of the box, except one thing.  It’s flash needs to be updated.  Fortunately, this is easy to solve and there are only a few steps.

  1. Get FlashPlayer XPI for Windows.
  2. Rename the *.xpi to *.zip and copy flashplayer.xpt and NPSWF32.dll
  3. Paste those two files into <install directory>/App/Chrome-bin/<version>/ directory.  Replace install directory with where you installed the application and version with the folder that is your version number.

**            NOTEPAD++

This stuff is simple, but I thought I’d post a link for the plugins.  These are easy to install, plugins go in the \Plugins\ folder, configuration files go in the \Plugins\Config\ and documentation goes in \Plugins\Doc\. Here are my favorite plugins:

***   BOA CONSTRUCTOR

For this to work, you’ll need Portable Python which installs similar to most things but it altered file associations and so I just extracted it and then it runs fine.  You’ll also want to install wxPython which is a module for python located on the Portable Python Page.  For Boa Constructor, download the file and install it on a computer of your own.  From there it copies onto the flash drive just fine, just make sure to update the settings for your main python exectuable since it won’t be in the computer’s path.

****       CODEBLOCKS

CodeBlocks is another program that will copy straight from the computer to your flash drive to make it portable.  The real trick is getting paths set and configuring WX if you’re interested in rapid development of GUI’s in C.  So here’s the quick run through.  For paths, I struggled with this on my work computer but it will not read paths that have a space.  It sees that space as the end of your path, so when setting a path for a library, for example WX, make sure you store that in a location that does not have a space in the path.  As for configuring WX, here’s what I did.  I went to the WX Pack site and got the package, which is great.  No need to compile or anything, does it all on it’s own with a directory to link your CodeBlocks library to, just be aware, this will take a lot of space on your flash drive, but with all of these things, you can always store them locally if you are daring that much against your local IT Department!

*****          CYGWIN

The biggest pain and the best program to have for avid Linux users.  This site makes a great tutorial on how to do this.  And rather than reiterating this, I’ll add my own changes.  The biggest thing was I changed the startup script and then linked that script on my desktop.  The first thing to do is to install Cygwin on your flash drive, be aware it may not install all the programs you want.  I did it three times before it all worked.  Then you have to mount the drive as you cannot do this or it will write to the registry.  As for my script, here’s what I wrote:

;rem creating a startup script
@echo off
:: clear
cls

:: locate directory
echo Locating directory...
for /F %%A in ('cd') do set WD=%%A
:: create path
echo Setting Path...
set path=%WD%\bin;%path%
set SHELL=/bin/bash
set CYGWIN=codepage:437
set HOME=/home/zbert
:: mount fs
echo Mounting File System...
bin\mount -bfu %WD%/ /
bin\mount -bfu %WD%\bin /usr/bin
bin\mount -bfu %WD%\lib /usr/lib
:: login
echo Logging in...
echo.
echo.

if "%1" == "" GOTO noopt
	if "%1" == "c" goto cmd
	if "%1" == "-c" goto cmd
	if "%1" == "--cmd" goto cmd
	if "%1" == "h" goto help
	if "%1" == "-h" goto help
	if "%1" == "--help" goto help
	echo  [*] ERROR: Unrecognized option.
	goto usage

:usage
echo usage: cygwin [c^|h^|-c^|-h^|--cmd^|--help]
goto help

:help
echo.
echo          Portable Cygwin Loader v1.0
echo.
echo     Commands:            *Run normal with no options.
echo        c ^| -c ^| --cmd     Run in Command Prompt.
echo        h ^| -h ^| --help    Display Help Message
echo.
echo        Copyright Skelton Computers © 2009
echo.
goto end

:cmd
echo cls > bin\bash -l -i
GOTO end

:noopt
bin\bash -l -i
GOTO end

:end
set path=%WD%\bin;%path%
@echo on