Flex Shortcut Cheatsheet (on one page)
January 12th, 2010
Annoyed that the Flex Keyboard shortcut reference was multiple pages, I recreated this so I could print it out and hang it on the wall.
Textmate Bundle - Go to File and ColdFusion Help Docs
July 23rd, 2009
Coldfusion Help ⌥⌘L
This command is bound to option-command-L (lookup). Simply click on a coldfusion method (function) ie: StructAppend or a tag
There are support files required for this command which includes all of the html help for Coldfusion (the same html files that are part of the Homesite Help files for CF 8 Download). You can download just the part that is needed and extract them to the html folder in your Downloads folder as it is looking for the files in ”~/Downloads/html”
Go to File ⌥⌘G
This command is bound to option-command-G (goto) Simply click on a line that has a cfinclude, a javascript script src tag or a css link rel tag and whether it is a relative link ”../somefile.css” or if it is a link off of the root of your project (a project must be defined for this to work) the file will open after you execute the command.
Files
You can grab the files here Steven Ross Bundle and The Help documents for ColdFusion 8
Learning git? This might help.
February 24th, 2009
I stumbled upon this after browsing some podcasts on rails the other day. The learning rails podcast has an episode on git (a distributed version control system). If you have heard the buzz (git is basically the new SVN, at least in hype). Go check it out
Now running on passenger (and ruby EE)
February 6th, 2009
If you use rails, or are considering it, it just got a whole lot easier to deploy using apache and mod_rails a.k.a Phusion Passenger
I think the best part of the experience was the installer, if you have ever compiled anything on linux you know it can be a pain when you don’t know if you have the required libraries. So the Phusion Passenger folks wrote their installer in ruby and it tells you what is missing (if there is anything). Sweet stuff.
Its much easier than running on mongrel, especially dealing with restarts and reboots (if you ever have to reboot, typically apache is already configured to start on startup). So how to restart an app? no shutdown you just navigate to the rails directory and issue a “touch tmp/restart.txt” next request the app will restart. Slick, wish everything was that simple.
So all in all (with out ruby enterprise) it took me 15 mins to install it and switch all my apps over from Mongrel to Phusion Passenger.
Linux / OS X - shell scripting with sudo
January 29th, 2009
Ever need to create a shell script and use the sudo command? here is how you do it:
read $passwd
echo $passwd | sudo -S touch test
WDDXConfig - replaces SimpleConfig.cfc now with more simple!
January 20th, 2009
Well I know I just released the SimpleConfig.cfc but, I didn’t think it was as flexible as some might need. The new version uses one config file and can load any datatype that ColdFusion will understand in WDDX format, so if you already have configuration variables in your App Scope you can just write them out as a WDDX file and copy the values into “config.wddx” under the “Base” node and then just add your instances under the INSTANCES node in “config.wddx”
Click to download source files
I think this is pretty self explanatory when you take a peek at the code, I even simplified the required application.cfc code to be as easy as possible:
Application.cfc:
<cffunction name="OnApplicationStart">
<cflock type="exclusive" scope="Application" timeout="60">
<cfset WDDXConfig = createObject("component","org.ross.WDDXConfig") />
<!--- optional parameters to WDDXConfig are as follows:
WDDXConfig.init("/config/", "config.wddx", "config")
"/config/" is the mapping where your config files are
"config.wddx" is your configuration file name
"config" is the name of your Application variable where your configuration options are going
--->
<cfset WDDXConfig.init() />
</cflock>
</cffunction>
config.wddx
This file is pretty simple, if you need some help understanding what it will translate to when you run the app, just run it and see the dump of “Application”
<?xml version="1.0"?>
<wddxPacket version="1.0">
<header/>
<data>
<struct>
<var name="INSTANCES">
<!-- don't for get to iterate the length below as you add instances -->
<array length="1">
<struct>
<var name="instanceType"><string>QA</string></var>
<!-- because you could be running multiple instances on the same machine
and thus the physical name could be the same (and we can't rely on CGI variables to be clean)
we use an identifying directory name here and the identifier will be placed
into the app scope as "ACTUALPATH" incase you are unsure of the physical path to your Application.cfc
C:\mysites\steve\appname\Application.cfc or mac: /mysites/steve/appname/Application.cfc -->
<var name="identifier"><string>/Volumes/Case Sensitive/www/simpleconfig/html/</string></var>
<var name="OVER_RIDE">
<struct>
<!-- override your base settings here -->
<var name="DSNs">
<struct>
<var name="marketing"><string>marketingDSNLocal</string></var>
</struct>
</var>
</struct>
</var>
</struct>
</array>
</var>
<!-- all of your base configuration data will go here -->
<var name="BASE">
<struct>
<var name="instanceType"><string>Development</string></var>
<var name="DSNs">
<struct>
<var name="marketing"><string>marketingPROD</string></var>
</struct>
</var>
<var name="additionalConfigFiles">
<array length="1">
<!-- as an example I'm just reloading the config.wddx file into another struct,
you can do as many additional wddx based config files as you want
(structName is the substruct name and fileName is the file name)-->
<struct>
<var name="structName"><string>sample</string></var>
<var name="fileName"><string>config.wddx</string></var>
</struct>
</array>
</var>
</struct>
</var>
</struct>
</data>
</wddxPacket>
When it comes time to deploy your application it is often difficult to manage application variables that change per instance. SimpleConfig aim’s to reduce the pain in running different environments. It does this by reading two xml files and taking those variables and placing them into your application scope for you to reference by using the prefix: Application.Configuration anywhere in your application.
source files: click to download
Setup and Configuration
Ok so lets dig into the file structure. When you download the zip file you will find a few directories listed as such:
/simpleconfig/config_files
/simpleconfig/html
The “html” directory is where you want to point Apache/IIS as the web root of your application. All you need to do is add a mapping of “/config” and point it to wherever you want to put the “config_files” directory and you are ready to start tweaking your config files.
Ok so on to configuring this puppy. Point Apache/IIS to the extracted directory /simpleconfig/html as your web root (again you can skip that step for demonstration purposes and just drop the contents of the directory “simpleconfig” onto your existing web root).
Defining your environments
Now go take a look at the file: /simpleconfig/config_files/config-instances.xml:
<configuration>
<option>
<description>Local Instance</description>
<name><![CDATA[simpleconfig.local]]></name>
<value><![CDATA[config-dev.xml]]></value>
</option>
<option>
<description>Configuration Files that pertain to all instances</description>
<name><![CDATA[BASE_CONFIGURATION_FILES]]></name>
<value>
<key>
<name><![CDATA[Base Config File]]></name>
<value><![CDATA[config-base.xml]]></value>
</key>
</value>
</option>
</configuration>
As you can see there is just some xml in here that defines each environment that you will be running. When you want to add an environment you simply add another node with the appropriate details. So to edit this for your own local machine you probably want to change the node to the host name of your machine, because CGI can be mucked with too easily on the client side I opted to use the java way at getting the machine name, most likely you will just have to run the app and see the dump to get your machine’s name so you can put the appropriate name in the config-instances.xml file. Next after that is the config file that pertains to your local instance. In this case we have “config-dev.xml”.
The idea here is to use this configuration file to define any differences from your base-config for your application. So say you have an email address that you want to use in your application, you probably don’t want to use your production account info while you are developing locally. However you probably do want the same DSN name and that would be put in your config-base.xml and not overridden in your config-dev.xml.
You should also note that the first word in the description will be the name of that environment type. So if you put into the description “QA” the “CurrentMode” variable in the configuration would become “QA” instead of “Local”. This is useful when you have to add more environments that you didn’t account for initially.
Also, this gives you the ability to quickly switch and test configurations by simply changing the xml file that you are loading for that instance. So if you had a “config-qa.xml” you could easily test that configuration locally by specifying that xml file instead of the “config-dev.xml”
h2. Configuring each environment The config-base.xml file:
<configuration>
<option>
<description>Application Status Struct</description>
<name><![CDATA[applicationStatus]]></name>
<value>
<key>
<name><![CDATA[isAvailable]]></name>
<value><![CDATA[true]]></value>
</key>
<key>
<name><![CDATA[unAvailableMessageHeader]]></name>
<value><![CDATA[Website Unavailable]]></value>
</key>
<key>
<name><![CDATA[unAvailableMessageBody]]></name>
<value><![CDATA[Application is temporarily unavailable.]]></value>
</key>
</value>
</option>
<option>
<description>An application variable</description>
<name><![CDATA[somevariable]]></name>
<value><![CDATA[something you need in the app scope]]></value>
</option>
<option>
<description>Some struct that you want in the app scope</description>
<name><![CDATA[theStructName]]></name>
<value>
<key>
<name><![CDATA[structkeyOne]]></name>
<value><![CDATA[~now()]]></value>
</key>
<key>
<name><![CDATA[structKeyTwo]]></name>
<value><![CDATA[some string]]></value>
</key>
<key>
<name><![CDATA[structKeyThree]]></name>
<value><![CDATA[some other string]]></value>
</key>
</value>
</option>
</configuration>
This file is a bit bigger and it contains some interesting stuff. Basically you can put pretty much anything into your application scope. You can even put calls to coldfusion functions in your xml that will be called when the xml is read and placed into your application scope. You can see a few lines up where there is the coldfusion function “now()” being called on “structKeyThree”. You tell SimpleConfig to evaluate the function by placing a tilde (~) before the function. I think the other huge advantage here is being able to define a struct that will go into your Application.Configuration object.
You can see a struct being defined in the applicationstatus node. You see that the first node contains a node then what will be created is a struct. The first node will be the struct name ie: Application.Configuration.MyStruct and then the additional nodes under the nodes will be the key in the struct and the will be the value for that key. This is much easier to see in action. So make a change to one of the struct keys or their values and you can see it work.
About the applicationstatus node
I built this node into the guts of the application. If for some reason you need to take your application offline (some back-end system is down perhaps). You can edit the applicationstatus node and set the isAvailable node to false and the Application.cfc will throw an exception (for every request) which you can then catch and display to your users on your own custom error page. Granted you don’t have to go this route but, it is there for you to use.
Reloading your configuration files
To reload the application you simply tack on a ?reload to the query string. Note that this only works when the application is not in production mode and also when trusted cache is off.
SimpleConfig.cfc
If you take a look at org/ross/SimpleConfig.cfc there are two places for you to add in your own methods that can be called when the application is starting up. The first place is the setup() method and the second is the start() method. The setup method is designed to be used when you need to call some other code before variables are placed into the Application scope and the start() method is designed to be used after those variables have been placed into the Application scope. Both of these methods are called each time the Application is reloaded (which you can see in the Application.cfc).
I hope this is enough to get you started. It really is a simple and elegant way to handle configuration variables. I will be adding additional text as I get time that will explain how you can add more configuration data into the application scope just by adding your own xml files and editing the config-instances.xml. Here is a hint: The SimpleConfig.cfc will keep loading any of the defined xml files in the BASE_CONFIGURATION_FILES node, just make sure you structure them exactly like the other config files.
This software is licensed under the CC-GNU GPL.
Open an ssh Tunnel to Administer MySQL (or anything else)
November 3rd, 2008
Pretty simple stuff, say you are using mysql administrator and you want to point it at a server that you have ssh access to but the firewall prevents you from making a direct connection over the internet (which it should).
Here is what you do (if mysql is running on its default port):
ssh -N -L3306:localhost:3306 username@server.com
You can also pass in a port variable if you are running ssh on a non-starndard port (which you should also do) all you do is add ” -p 1234” (1234 would be the port number where ssh is wanting you to connect)
Now just point mysql administrator at 127.0.0.1 and supply your credentials. Bang. You’re in.
Sync Google Contacts with your Mac/iPhone
October 23rd, 2008
Just passing this along. Found this article at google and yay! Sync’ing is cool! read
Vmware Fusion 2.0 final, get it while its hot
September 18th, 2008
Just in! Go grab some final code VmWare Fusion 2.0 After using the beta for awhile I can assure you that it is a vast improvement over 1.0 I have yet to try out this version. Downloading it as we speak and I’ll post an update soon.
Vmware Fusion 2 Beta 2
August 1st, 2008
Incase you missed it VMWare Fusion 2 Beta 2 is out (out yesterday). Seems like there are some nice tweaks and that resuming / suspending is even faster than beta 1. Also, sound is working again for me. I tested out playing a movie through netflix’s online viewer and the playback was very nice. I’ll give another update after some use.
Via destruct-o-bot 5000 (a co-worker at a client site) – Microsoft is giving away downloadable evaluation versions of windows xp and vista prebuilt with IE 6, 7 & 8 installed on each VM instance. I know what is the big deal, its an eval version, well supposedly when these expire they will make the next round available and so on and so forth. For those of you that use VMWare / VMWareFusion (myself included) it will automagically convert these VM’s to compatible ones. So Go download them already and make sure your site works in all these IE flava’s. So go get em!
Xray the CSS of any Website
July 23rd, 2008
This just came across the wire (my wire that is) hot way to view a site’s css definitions inline: XRAY: look beneath the skin
To steal two things from my co-worker Dan Skaggs (the term army proof for one) and the other is Buildix Super simple install of Subversion, Trac, Mingle, and Cruise Control.
Doubt me? On Ubuntu its as easy as “sudo apt-get install Buildix” done. Yep Done. I haven’t tried it yet but, check it out. Trust me it will save you time as I recently setup Trac and SVN the manual way.
Enjoy!
Not getting things done? Tools to help
May 16th, 2008
Not sure how this app slipped through the cracks: Thinking Rock If you are a fan of the book Getting things done (or you are just like me: a disorganized person with a lot of tasks on your plate). You may want to check this app out. Also, I highly recommend OmniFocus for those looking for a great Mac solution. It isn’t free but, if you have ever used any of Omni’s software you’ll know that their attention to detail is impeccable.
The cool thing about Thinking Rock is that it is cross platform and open source. You may want to check out the OmniFocus video if you are unfamiliar with the GTD methodologies. You can get that video here. while that does apply to OmniFocus the techniques of gathering information apply to any task management application.