How to Remove a Workspace from Team Foundation Server 2008 [#TFS #dotnetdev]

Recently I ended up having a workspace conflict in Team Foundation since it paired another user’s name with my machine’s name, and then when I attempted to establish a new workspace, it complained with a message like:

The working folder C:\dev\MyWorkingFolder is already in use by the workspace MYMACHINENAME;otherguy on computer MYMACHINENAME.

So after a fair amount of research, I did the following:

Launch the command line prompt (Start Menu >> type “cmd” into the Search text box, hit Enter).

Navigate to “C:\Program Files (x86)\Microsoft Visual Studio 9.0\Common7\IDE”, using:

CD "C:\Program Files (x86)\Microsoft Visual Studio 9.0\Common7\IDE"

List the other user’s workspaces using the tf workspaces command:

tf workspaces /owner:otherguy

Find and note the offending workspace (in this case, it’s a workspace with my machine name), and then delete it using the tf workspace command:

tf workspace /delete MYMACHINENAME;YOURDOMAIN\otherguy

That did it for me, your mileage may vary, but hopefully this will prove helpful to someone in the future…

Thanks also to this post.

How to Add a “Send Link” Button to the Bookmarks Bar in Chrome

Really helpful tutorial about how to add a bookmarklet to your Chrome Bookmarks Bar that emails the URL to the current page open in Chrome.

I needed to do this recently so this really came in handy, and it’s super easy to implement.

Basically here are the steps:

  1. Open Chrome (if it’s not already…).
  2. Right-click the Bookmarks bar and select Add Page.
  3. In the Name textbox, input the word Send Link.
  4. In the URL textbox, input the following:
    javascript:location.href='mailto:?SUBJECT='+document.title+'&BODY='+escape(location.href);
  5. Make sure that the Bookmarks bar folder is selected and click OK.

Source: Google Chrome: Add a Send Link Button to the Bookmarks Bar | a Tech-Recipes Tutorial

Separation Anxiety from Apple Magic Trackpad Eased with Logitech T650

I love my Apple Magic Trackpad, but it can be tricky to get working on a Windows machine, so I decided instead to try out the Logitech T650 Wireless Rechargeable Touchpad. So far so good. The feel is very similar to the Apple trackpad, and the gestures (even under Windows 7) are tweakable so they feel more at home.

For instance, if you go into Logitech Mouse and Keyboard Settings application, you can adjust the two-finger scroll to behave like OS X’s tracking of your finger movement, effectively inverting the scroll (though the settings doesn’t word it that way…).

They can be had at Amazon for under $40, and to have more of a Mac-like experience on a Windows machine, I think it’s worth it.

Adding your iOS App’s Build Number to UIWebView Content [#UIWebView, #iOSDev]

Recently I needed to automate the retrieval of the build number for the app I am currently developing, and instead of including the build number in a standard UI component like a UILabel, I needed to add it dynamically to some HTML that was being used as an About Us view.

The solution was pretty simple, but I thought I’d share it anyway since it was fun.

The first thing to do is edit the HTML, so at the place I needed to insert the build number, I simply added a rudimentary replaceable tag to the body of the HTML:

<p>Build: [BUILD_NUMBER]<p>

The next step was to add a method (though I could have also done this inline) to replace the tag with the build number, using [[[NSBundle mainBundle] infoDictionary] objectForKey:@”CFBundleVersion”] to retrieve the build number:

- (NSString *)insertBuildNumber:(NSString *)htmlContent {
    NSString *buildNumber = [[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleVersion"];
    htmlContent = [htmlContent stringByReplacingOccurrencesOfString:@"[BUILD_NUMBER]" withString:buildNumber];
    return htmlContent;
}

Then, we put it all together in the method I was using to load the HTML. In this case I was just using ViewWillAppear.

- (void)viewWillAppear:(BOOL)animated {
    // get the file path
    NSString *htmlFile = [[NSBundle mainBundle] pathForResource:@"about_us" ofType:@"html"];
    // get the file content
    NSString* htmlString = [NSString stringWithContentsOfFile:htmlFile encoding:NSUTF8StringEncoding error:nil];
    // replace the tag with the build number
    htmlString = [self insertBuildNumber:htmlString];
    NSString *basePath = [[NSBundle mainBundle] bundlePath];
    // load the HTML into the UIWebView
    [self.webView loadHTMLString:htmlString baseURL:[NSURL fileURLWithPath:basePath]];
}

The final result worked great and now I can show the build number in the app as it gets updated via the Archive process (I have a separate script for that).

iFunBox Recovers PhotoStream Photos [@ifunbox_dev, #PhotoStream, #iOSDev]

After the announcement of iOS 8, I realized that I had an old iPhone 4 lying around, and locked away inside that device were some photos that I had a feeling were on the device, but not in the PhotoStream for the associated iCloud account. So the next question was… how do I get at those photos? Is it even possible?

Then I remembered that a former coworker had recommended a utility called iFunBox (Twitter: @ifunbox_dev) and it seemed like it might be the right tool for the job.

Turns out it worked very well. I was able to use iFunBox (awful name, sorry guys.) to navigate through the file system and find the PhotoStream files and save them!

iBeacon Compatible Apple Devices

I was doing a little research to see if I could use my retired iPhone 4 as an iBeacon test device for either advertising or detecting, and unfortunately the answer is no.

Here is the list of Apple devices that officially support iBeacon, taken from the Apple KB article iOS: Understanding iBeacon (KB: HT6048):

To use iBeacon, you need iOS 7 or later, Bluetooth turned on, and a compatible iOS device:

  • iPhone 4s or later
  • iPad (3rd generation) or later
  • iPad mini or later
  • iPod touch (5th generation) or later

I was a little disappointed, but not really surprised. The iPhone 4 can barely run iOS 7, so it’s usefulness is rapidly declining, especially on the eve of WWDC 2014 (literally!)…

Open PDF Documents Full-Screen in Dropbox for iPad [#dropbox, #ux]

This was actually surprisingly difficult for me to figure out since there is basically no discoverability hints anywhere, and I literally found it by accident.

In the Dropbox app for iPad, if you open a Word or other Office document, there is a little button in the lower right hand corner for viewing the document in full-screen. However, if you open a PDF document, that button is not present. Hmmm…

Additionally, in the iOS 5 version of the Dropbox app, there used to be an arrow button in the navigation bar area to toggle the visibility of the navigation panel on the left. This served as an adequate almost-full-screen view of a PDF, but the (as of March 10, 2014) current version of the Dropbox app removed that functionality.

So for months I was in a bit of a predicament regarding how to view a PDF in the app – double-tap zoomed, but didn’t remove the Panel from the split view controller. But just this weekend, immedately after sending an email to Dropbox lamenting the loss of the full-screen PDF feature, I discovered accidentally how to do it. It’s not immediately obvious how to view it in full screen, but thankfully, it is possible!

Turns out the answer is…. Single Tap. [facepalm!]

Just tap once on a PDF in Dropbox for iPad and your document will be shown in full-screen, and better yet, all of the other UI elements like the navigation bar fade away and you just see the document itself. So, while it was a little more difficult for me to find, once I discovered it I like the improvement in the full-screen view. I’m not sold on single-tap as a full-screen view gesture, but at least it’s there in some fashion.

How to edit an incorrect commit message in Git [#git]

This was a new one on me… and I needed it recently. I accidentally committed a change with a totally nonsensical message since I accidentally copy-and-pasted some code into the message field of my commit, which automatically commenced.

Thankfully, there is a way to update it before you push (that seems to be the key to success here… don’t push it after you do the commit with the bogus message):

version control – How do I edit an incorrect commit message in Git? – Stack Overflow

git commit --amend -m "New commit message"

I’m just relieved that this can be done… and a little surprised — given how grumpy and curmudgeonly Git feels sometimes.

How to Format JSON in TextWrangler [#iosdev, #json, #webdev]

If you’re a TextWrangler user and you wanted to be able to format a block of JSON, you can do it yourself by following the instructions at Java Dev on Mac OS X: Format JSON in TextWrangler

1. Create text (Python) file called “Format JSON” in the following location:

~/Library/Application Support/TextWrangler/Text Filters/Format JSON.py

2. Add the following Python code to take care of the formatting:

#!/usr/local/bin/python
import fileinput
import json
if __name__ == "__main__":
  text = ''
  for line in fileinput.input():
    text = text + ' ' + line.strip()
  jsonObj = json.loads(text)
  print json.dumps(jsonObj, sort_keys=True, indent=2)

One thing that tripped me up is that you need to select a block of text before running the macro. Otherwise it works great.

Thanks for the tip!

UPDATE:
I’m not sure if it was due to installing newer versions of Xcode or Mountain Lion, but I noticed that I was getting an error when attempting to run the script.

Evidently the first line:

#!/usr/local/bin/python

Might need to be:

#!/usr/bin/python

…or maybe you could create a symbolic link as well, but for me, since I’m not a Python guru, modifying the script was the easiest way to fix the problem.