9thport ruby, rails, sysadmin, os x, and other stuff

22Feb/100

When starting Dreamweaver CS4 I get an error of microsoft visual c++ runtime library: runtime error

Today I got an error message of "microsoft visual c++ runtime library: runtime error ..." when attempting to run Adobe Dreamweaver CS4. This is horrible!! Here is a screen show showing what I got:

dreamweaver cs4 windows error

my dreamweaver cs4 windows error

My method for fixing this error on Windows XP was to do move the following directory into my Recycle Bin:

  • c:\Documents and Settings\[username]\Application Data\Adobe\Dreamweaver CS4

Note: The "Application Data" folder is hidden and you might need to do the following:

  1. Choose menu "Tools"
  2. Choose menu item "Folder Options"
  3. Choose tab "View"
  4. Enable "Show hidden files and folders"
  5. Click "OK"

After removing the directory, launching Dreamweaver worked! I was also surprised that I did not loose any of my site settings.

12Feb/100

bash script template to be used for parsing arguments to make your shell programming life easier

I found that all my bash scripts really bennifet with the following template because:

  1. it handles options with possible responses of needs
  2. debugging with a flag
  3. help description of the script

This template keeps proving to be enough to start my script building. There is really nothing more to say about this so here is my template:

#!/usr/bin/env bash

# created at: Wed Apr 04 10:03:41 PDT 2009
# updated at: Wed Apr 22 15:33:24 PDT 2009
# author: aaron addleman

# manage subversion with swatch and ftp log file. all actions will be sent to a file for throttling purposes to allow SVN to handle its own lock files
# BEGIN SCRIPT
usage()
{
cat << EOF
usage: $0 options
This script takes commands from a swatch and converts to svn commands for a directory under version control.
OPTIONS:
-h      Show this message
-a   Action needed (STOR, DELE, MKD, ENTRIES, SVNUPDATE)
-u      Username to use for commits
-f      File or directory being affected
-m      message to use
-x      Execute SVN commands from the $SVNACTIONS file
(when this option is used, all others are ignored)
-v      Verbose (boolean)
-t      Test (dont run any commands, but print them to the command line)
EOF
}

ACTION=
USER=
FILE=
MESSAGE=
VERBOSE=
TEST=
while getopts "h a:u:f:m:x:v:t" OPTION
do
case $OPTION in
h)
usage
exit 1
;;
a)
ACTION=$OPTARG
;;
u)
USER=$OPTARG
;;
f)
FILE=$OPTARG
;;
m)
MESSAGE=$OPTARG
;;
v)
VERBOSE=1
;;
t)
TEST=1
;;
?)
usage
exit
;;
esac
done

29Sep/090

RegExp Testing Tool

I would be lost with out my regexp, but writing them is sometimes very daunting. In the past I have tried many different regular expression builders or testers and ran into limitations of the wrong operating system, price is too high, or just plain bad application. Thankfully gskinner.com built an Online Regular Expression Testing Tool and there is also a desktop version written in Adobe Air.

30Jan/090

Making use of prefrences in applescripts with the Griffin PowerMate and email

Okay, I own a PowerMate gadget that I have not used in a very very long time. So this afternoon I deiced to play with it and make a couple of scripts that help me at work.

My first task was to make the thing pulse when I have unread email in my inbox. After some simple searching I found a nice entry at macosxhints.com about the script. I also found some smart posts that contained some very effcient apple scripts. One them had a nice idea of using the "say" command to make the mac speak some text! I found this to be very entertaining and started to think how I could use this when I wanted to.

Just a little side note: I have decided to stop checking my email ever 10 seconds and move that to 10 minutes. I find that checking email or seeing that I have unread email ever 10 seconds or so is very distruptive in the moment of my thoughts and projects. So I have decided to increment my email checking to 10 minutes for now. I might even increase this to 20 minutes. Not sure yet.

Back to the script. I liked the idea of a script telling me when it was checking my email but I wanted to have the ability to toggle this on and off with a prefrences setting. After a little searching, I found a great idea and put it to good use. It was so good that I had to write it down because I know I will be trying to implement this in future scripts.

Iteration 1

I came up with this design:

set mac_speak to (do shell script "defaults read com.AaronsAppleScripts.pref 'macSpeak'")

if mac_speak is "true" then
say "Processing email"
end if

try
tell application "System Events" to if (exists process "Mail") is false then
set theCount to 0
else
tell application "Mail" to set theCount to unread count of inbox
end if

if theCount > 0 then
tell application "PowerMateDaemon" to set pulse always to true
else
tell application "PowerMateDaemon"
set pulse always to false
set brightness to 0
end tell
end if
end try

if mac_speak is "true" then
say "Finished"
end if

Explanation of the preferences

To use the preferences here are the following examples of commands to type in your terminal:

set the value to true:

defaults write com.AaronsAppleScripts.pref 'macSpeak' 'true'

set the value to false:

defaults write com.AaronsAppleScripts.pref 'macSpeak' 'false'

read the preference:

defaults read com.AaronsAppleScripts.pref 'macSpeak'

use preferences inside apple scripts:

do shell script "defaults read com.AaronsAppleScripts.pref 'macSpeak'"

Filed under: Apple, Programming No Comments
20Jan/090

Ruby and AS3

When I saw this project, I was in shock. This is fantastic!! To combine Ruby, a great programming language with the universal power of AS3/flex. I have some application ideas using this language and I can't wait to learn it!!

http://hotruby.yukoba.jp/test-web/Box2DFlashAS3.html