Sunday, March 6, 2011

Windows 7 64-bit and Samsung Kies Mini

I was shocked to find out that AT&T and Samsung had finally provided a Froyo (Android 2.2) update for the Captivate Galaxy S phone.  All I had to do was download Samsung's Kies Mini firmware updating application (the version available was actually an AT&T modified stripped down version) and setup my phone correctly, backup critical data and press 'Upgrade.'

Of course, it never works out that way in the real world but I must admit that even a jaded and cynical software engineer like myself was disgusted and disappointed when every single time I connected my Captivate to my computer with Kies running, the Kies application would identify the phone and then promptly crash.

I Googled, Googled some more, tried compatibility settings, running as Administrator, I even tried using a Windows XP virtual machine in case it was a 32-bit issue - sadly Virtual PC 2007 (what I use on Windows 7) doesn't pass USB to a VM.

In any case, I was getting more and more frustrated and was ready to quit when I ran across an obscure tiny little message on some news server somewhere where a guy mentions - "Oh, yeah, and if you have IE9 installed on your machine, take it off."

Well, I just happened to have an IE9 release candidate installed.  How that crashed Kies escapes me since you'd have to be a pretty crap software engineer to have not tested your Windows only application, which you are releasing to MILLIONS of people to use, against IE6, IE7, IE8, and IE9 - but hey, Samsung are weird that way.  They make some wonderful things and somehow drop the ball on the really trivially simple things.

Long story shorter, uninstalled IE9, ran Kies Mini, phone showed up, chose 'Upgrade', a few minutes later I'm running flash on my Android phone.

Friday, March 4, 2011

AppleScript to add a 'new file' capability to Finder

Another convenience function you may wish to add to a button in your Finder toolbar is a 'new file' button that will deposit a blank file named 'NewFile' in the current Finder window directory. It also auto increments a counter if needed to ensure the new file doesn't overwrite an existing file. The code is below:

tell application "Finder"

#Create filename (avoid overwriting)
set current_path to (POSIX path of (the folder of the front window as text))
set good_filename to false
set loop_count to 0

repeat while good_filename is false

if loop_count is equal to 0 then
set NewFileName to (current_path & "/NewFile")
set NewFileName to (current_path & "/NewFile" & loop_count)
end if

if exists NewFileName as POSIX file then
do shell script "touch " & NewFileName
set good_filename to true
end if

set loop_count to (loop_count + 1)

end repeat

end tell

Add full path to title bar of Finder

Very simple, from the terminal:

defaults write _FXShowPosixPathInTitle -bool YES

Then in the terminal, to affect the change in your open Finder windows:

killall Finder

To revert, change YES to NO

(Btw, you can have a more UI oriented path shown by choosing View|Show Path Bar for the Finder but I find it easier to view the path in the title bar since I spend a lot of time in *nix)

This works in 10.6.6 but I'm not sure what other OSX versions it works on.

Thursday, March 3, 2011

Very cool feature of OSX to make up for uncool features...

The Finder in OSX is okay for the most part; however, Apple can be a strange mix of the 'well designed UI' approach and the 'keyboard shortcuts rule' approach. Often these approaches complement each other well - sometimes they do not.

One of the things about the Finder I don't like is that there's no path bar or button for simply letting you designate a path. I discovered that there is a 'Go To Folder' shortcut (command-shift-g) which proffers a little dialog box that I can do this with but there's no integrated path bar.

This is certainly an acceptable (mostly) alternative, but I really don't want to have to remember another intermittently used keyboard shortcut (I have several IDE's, Emacs, and different operating systems worth of shortcuts to remember as well, so one less would be nice.)

It turns out, very nicely, that you can add custom buttons to the Finder window simply by dragging an application onto the Finder's toolbar. So, I created a little AppleScript application that simply emitted command-shift-g to most recent finder window, and I gave it an icon. Now my finder window has a little terminal icon (I'll replace the icon later when I have more time) where I can click and it pops up a path dialog to change directories as seen below:

It is the little square black icon just to the right of middle.

Now, to do the same thing you need to open the AppleScript Editor and add the following text to your empty script:

tell application "Finder"
tell application "System Events" to keystroke "g" using {command down, shift down}
end tell

Open a Finder window if one isn't already open and then tell the AppleScript Editor to run the script to verify that it is functioning as expected.

You now want to save the script as an Application - I saved my script into my Applications folder accordingly (you can do what you like.)

Now, you can skip this step if you wish, but I wanted a custom icon (instead of the default script icon) as my button in the Finder window so I found an image that I wanted to use (after looking for about 8 seconds) and opened it. I then selected the portion of the image I wanted and chose 'Copy' (you can use the preview window for this or some other image viewing/editing application.) This placed the image I wanted to use on the clipboard.

In order to change the icon on OSX 10.6.6 I then located the script application and brought up the 'Get Info' dialog on it. I then clicked on the application's icon in the upper left hand corner of the Get Info dialog so that it was selected, I then pasted the clipboard contents which deposited the image into the icon.

The last step is to simply open a Finder window and then drag the application from where you have located it onto the Finder's toolbar and it should appear.