Thursday, February 24, 2011

AccuTimeCard for vWorker (RAC) crashes

The AccuTimeCard for vWorker (previously RAC – Rent A Coder) crashes when you first run it.

The exception dump is listed below is a Google-friendly search helper for people having the same issue.

I’m running Windows 7 (Ultimate) x64 and got this exception as soon as I ran the application. Thankfully, the application was written in .net so I was able to use the .Net Reflector to resolve the issue. The exception was occurring in the Form Load event in the application so I took that into disassembly in the reflector coming up with the following:

private void Form1_Load(object sender, EventArgs e)
{
this.Visible = false;
StringBuilder builder
= new StringBuilder();
builder.Append(
"-classpath ");
builder.Append(
".;");
builder.Append(
@"resources\jars\axis.jar;");
builder.Append(
@"resources\jars\commons-discovery-0.2.jar;");
builder.Append(
@"resources\jars\forms-1.1.0.jar;");
builder.Append(
@"resources\jars\jaxrpc.jar;");
builder.Append(
@"resources\jars\JMF2_1_1e\lib\jmf.jar;");
builder.Append(
@"resources\jars\org.apache.commons.logging_1.0.4.v200706111724.jar;");
builder.Append(
@"resources\jars\saaj.jar;");
builder.Append(
@"resources\jars\wsdl4j-1.5.1.jar ");
builder.Append(
"RacTimeCard");
string arguments = builder.ToString();
Process.Start(
"javaw.exe", arguments);
this.Close();
}





The offending line, the file it cannot find is, of course, Process.Start(“javaw.exe”, arguments); One quick check concluded that the path to the Java-Runtime was not present in my PATH environment variable.

Since non-technical people now use vWorker.com I will try to explain how to add this path to your own environmental variable PATH. These instructions are for Windows 7 and will likely work fairly closely to Vista (for those of you who are masochists and still use that OS Smile)

 

First, find your install of the Java runtime. Mine was located at: C:\Program Files (x86)\Java\jre1.6.0_13\bin. If you’re not using a 64 bit operating system it should be under C:\Program Files\Java\jre1.6.0_13\bin. Copy that path to your clipboard.

Open up your Control Panel and go to “System and Security”, “System”, “Advanced System Settings”. I’m sure there’s a faster way to do this but that’ll work for now. Go to the advanced tab: we’re getting really advanced now! Click on “Environment Variables”. In the second list box you’ll need to local your PATH variable. Double click on that and you should see something like the following when you’re done pasting at the end of your variable setting. Please note it’s very important you add a semi-colon “;” (no quotes) between the last path setting and your newly pasted path to your Java Runtime binary folder.

image

 

 

microsoft.NET Framework
The sistem cannot find the file specified
See the end of this message for details on invoking
just-in-time (JIT) debugging instead of this dialog box.
************** Exception Text **************
System.ComponentModel.Win32Exception: The system cannot find the file specified
at System.Diagnostics.Process.StartWithShellExecuteEx(ProcessStartInfo startInfo)
at System.Diagnostics.Process.Start(ProcessStartInfo startInfo)
at RacTimeCardLauncher.Form1.Form1_Load(Object sender, EventArgs e)
at System.EventHandler.Invoke(Object sender, EventArgs e)
at System.Windows.Forms.Form.OnLoad(EventArgs e)
at System.Windows.Forms.Control.CreateControl(Boolean fIgnoreVisible)
at System.Windows.Forms.Control.CreateControl()
at System.Windows.Forms.Control.WmShowWindow(Message& m)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
************** Loaded Assemblies **************
mscorlib
Assembly Version: 2.0.0.0
Win32 Version: 2.0.50727.4927 (NetFXspW7.050727-4900)
CodeBase: file:///C:/Windows/Microsoft.NET/Framework64/v2.0.50727/mscorlib.dll
----------------------------------------
RacTimeCardLauncher
Assembly Version: 1.0.0.0
Win32 Version: 1.0.0.0
CodeBase: file:///C:/Users/octa/AppData/Local/Exhedra/RacTimeCard/RacTimeCardLauncher.exe
----------------------------------------
Microsoft.VisualBasic
Assembly Version: 8.0.0.0
Win32 Version: 8.0.50727.4927 (NetFXspW7.050727-4900)
CodeBase: file:///C:/Windows/assembly/GAC_MSIL/Microsoft.VisualBasic/8.0.0.0__b03f5f7f11d50a3a/Microsoft.VisualBasic.dll
----------------------------------------
System
Assembly Version: 2.0.0.0
Win32 Version: 2.0.50727.4927 (NetFXspW7.050727-4900)
CodeBase: file:///C:/Windows/assembly/GAC_MSIL/System/2.0.0.0__b77a5c561934e089/System.dll
----------------------------------------
System.Windows.Forms
Assembly Version: 2.0.0.0
Win32 Version: 2.0.50727.4927 (NetFXspW7.050727-4900)
CodeBase: file:///C:/Windows/assembly/GAC_MSIL/System.Windows.Forms/2.0.0.0__b77a5c561934e089/System.Windows.Forms.dll
----------------------------------------
System.Drawing
Assembly Version: 2.0.0.0
Win32 Version: 2.0.50727.4927 (NetFXspW7.050727-4900)
CodeBase: file:///C:/Windows/assembly/GAC_MSIL/System.Drawing/2.0.0.0__b03f5f7f11d50a3a/System.Drawing.dll
----------------------------------------
System.Runtime.Remoting
Assembly Version: 2.0.0.0
Win32 Version: 2.0.50727.4927 (NetFXspW7.050727-4900)
CodeBase: file:///C:/Windows/assembly/GAC_MSIL/System.Runtime.Remoting/2.0.0.0__b77a5c561934e089/System.Runtime.Remoting.dll
----------------------------------------
************** JIT Debugging **************
To enable just-in-time (JIT) debugging, the .config file for this
application or computer (machine.config) must have the
jitDebugging value set in the system.windows.forms section.
The application must also be compiled with debugging
enabled.
For example:
<configuration>
<system.windows.forms jitDebugging="true" />
</configuration>
When JIT debugging is enabled, any unhandled exception
will be sent to the JIT debugger registered on the computer
rather than be handled by this dialog box.

Saturday, February 12, 2011

Software Development Productivity in Windows 7

   This won’t replace my AutoHotKey but it’s a step in the right direction from Microsoft Windows.

   I recently stumbled across some keyboard shortcuts in Windows 7 that have increased my productivity as a software developer. If you’re a developer you probably favor the keyboard over the mouse when getting your work done. I’m constantly on the lookout for keyboard shortcuts and new automation tools to help liberate me from that pesky mouse and speed up my work process.

   Windows 7 has some nice new keyboard features I didn’t know about until recently. I actually stumbled upon them quite by accident and did a little exploring. When I put 2+2 together in my head I came up with a quick way to jump around to all of the applications I use frequently during the day.

   Here are some applications I use constantly and their corresponding shortcut key combinations. These keyboard combinations are built into Windows (since Vista) as described by Wikipedia.

image

   That’s right – starting with the first application running it’s the Windows Key + 1 [ 2, 3, … n ] to bring up the application (Win+0 is the 10th and final application shortcut in the chain).

   Now the first thing that’s nice is that I will get the running instance of the application if the application is already running or a new instance of the application if it is not (singleton approach). If I want to start a new instance of the application rather than pop up the instance already running all I need to do is Win+Shift+1 [2, 3, … n].

   If I have multiple instances already running repeatedly hitting Win+Ctrl+1, Win+Ctrl+1 will alternate between (in my case) my instances of Visual Studio 2010 that are running. Alternatively, simply pressing Win+1, Win+1 will alternate between the desktop preview windows for that application and releasing will bring up the application instance.

   As long as I keep these application pinned to my taskbar in the same position Win+1 will ALWAYS be Visual Studio 2010, Win+2 will ALWAYS be Microsoft Blend, etc.. That is a big deal coming from the Alt+Tab world.

“Now you may be thinking “so what” I use a keyboard mapping or macro program called AutoHotKey (or something similar) and already have this set up. Me too - 

but wait, there’s more!

   If we press Win+Alt+1 [ 2, 3, … n] we get access to the application’s '”Jump List”. This is where these keyboard shortcuts really start to shine. Here’s what I get when I press Win+Alt+1 asking for Visual Studio 2010’s Jump List – and yep, I can use the good old arrow keeps to get to the solutions I’m currently working on

image

   I’m currently doing development in WPF so it is a HUGE time saver to switch between Visual Studio & Blend using Win+1 and Win+2 respectively. Alt+Tab is great but  sometimes you go to other application in between using your core tools and it’s always that few milliseconds spent recognizing where the application I need is in the Alt-Tab chain that drives me insane.

   By the way, if you use Alt+Tab quite a lot with many windows open, you can use the arrow keys to navigate the large tiled list. For instance the down arrow will take you down a row of applications after you’ve started the Alt+Tab maneuver, skipping a few Alt+Tab key iterations.