Tip: Generate a File List in TextWrangler [#devtips]

Here’s a really easy way to generate a list of files using TextWrangler:

  1. Open a new window in TextWrangler.
  2. Navigate to the folder you want in Finder.
  3. Drag that folder from the Finder window to the TextWrangler window.
  4. TextWrangler generates a cleanly-formatted listing of all the contents of that folder, including all sub-folders and their contents.

I would imagine this would work in BBEdit as well, but I have not tested it.

Source: See Post #17 here: Mac Rumors – How to print a list of files in a folder 

[self shoot:foot]; (#iosdev #xcode, #ios6)

If you need to stay with Xcode 4.3 and you’re not ready to make the 4.5 jump, be very careful when upgrading your devices to iOS 6 (i.e. consider not doing it).

Yesterday, I upgraded my iPhone 4 to iOS 6 and now my current version of Xcode (4.3.3) cannot deploy to it. 

I completely forgot that Xcode has this limitation. It’s similar to a situation that I encountered a while back when I upgraded my devices to iOS 5, but that was worse because at that time I couldn’t upgrade to Xcode 4.3 because my MacBook Pro had a Core Duo processor and could not be upgraded to Lion (Xcode 4.3 required Lion). Unfortunately, the development team I’m working with is sticking with Xcode 4.3 for the time being so that means my iPhone can’t be used for testing now.

This is really annoying.

The good news is that I have an iPad that is on iOS 5.1, and it can’t be upgraded. The bad news is that we’re working on a product for iPhone. The experience feels a bit different when using it on iPad, but I’ll just have to use the simulator most of the time and then the iPad when I need to do on-device testing.
Be careful out there.

Git Tip: How to Delete a Remote Branch

This is one of the many git functions I always have to look up, and it always makes me insane at its non-intuitiveness. However, as it is a necessary evil, I thought it useful to capture it here.

Believe it or not, you have to use git push to delete. You heard that right. Stop gawking. Jaw closed.

OK so here’s how you do it:

git push origin :[name of branch]

As a concrete, though perhaps not entirely realistic example:

git push origin :my-awesome-feature

Thanks to the following blogs for their constant assistance in helping me remember (or not remember) this function:

git ready : push and delete remote branches
Yuji Tomita : Git — Delete Remote Branch

Thanks guys!

Posted in Git

How to delete all .svn folders in Linux / Mac [#iosdev #git #svn]

I found this useful recently when receiving a batch of code from a client who still uses Subversion…

How to delete all .svn folders in Linux / Mac? – Techie Corner

To delete all .svn folder in Linux just follow the steps below:

  • Start Terminal
  • Change your current directory to your project folder (ex: /Users/me/Sites/project_a)
  • Enter the following into Terminal: find ./ -name “.svn” | xargs rm -Rf 

That should take care of it. In my tests I found one or two that still remained but this took most of the pain out of it.

Github Tip: What to do if Github is asking for Username and Password

Recently I had a strange thing happen with a new project hosted by Github, by which every transaction with the server requried a username and password. Thankfully, this Stackoverflow post helped me resolve it.

If Github is constantly asking for your credentials when you do a clone, pull, or push, and you know you have your SSH key already in your Github profile, check to see if you set up your local repository with the HTTPS version of the repository when you cloned it instead of the SSH version. If you can remember.

In either case, do the following:

  1. Blow away (or rename safely) your current repository directory.
  2. Go to the Github page of your project.
  3. Next to the text box that contains the URL for your repository to use for cloning purposes, click “SSH” to activate it. You will see the address change from “https://…” to “git@github.com…”.
  4. Copy the new address and use that to re-clone your repository in a fresh directory.

Hope that helps.

Resend a Message in Mac OS X Mail

I’ve been using Mac OS X Mail.app for some years now and have always wanted the ability to resend an email message after I had already sent it (e.g. resend it to another recipient, instead of forwarding). I always thought this was a missing feature of Mail.

Turns out it’s not. It has been there all along in various forms, and here’s how you do it:

How to Resend a Message in Mac OS X Mail – About Email

  • Resend a Message in Mac OS X Mail To send a message again in Mac OS X Mail:
  • Highlight the message in the Sent folder (or any other folder you have moved it to).
  • Select Message | Send Again from the menu (or press Command-Shift-D).
    • In Mac OS X Mail 1.x, select File | Open As New Message from the menu.
  • Edit the message and send it (again), like a new message.
Posted in Mac

How to retrieve the HTML contained inside a UIWebView in iOS [#iosdev]

Recently on a project I needed to see what was going on inside the UIWebView that I was working with. Turns out it is very simple to retrieve and then log the HTML contained inside the UIWebView, using the stringByEvaluatingJavaScriptFromString method of the UIWebView, coupled with a very simple JavaScript call…

- (void)logDocumentHtml {
    NSString *html = [self.chatWebView stringByEvaluatingJavaScriptFromString: @"document.documentElement.innerHTML"];
    NSLog(@"document HTML:\n%@\n", html);

Hope this helps!

UITextField: A Complete API Overview from iPhone Programming Tutorials [@icode_blog, #iosdev]

Great little rundown on the UITextField API. Very helpful!

UITextField – A Complete API Overview | iPhone Programming Tutorials

The UITextField is probably one of the most commonly used UI controls on the iPhone. It is the primary method of user input via the keyboard and provides a great deal of additional functionality. With the success of our las API tutorial on NSArray, I thought I would do another walkthrough, this time on UITextField. I will be explaining all of the properties for it as well as bringing up some functionality that you may not have known about.

How to customize your UINavigationBar in iOS4 and iOS5 (and presumably iOS6) [#iosdev]

Again with the customization of a UINavigationBar. No one likes blue.

At any rate, I can’t believe that I completely forgot how to do this. It’s like two months of Java and SQL erased my Cocoa/Objective-C side of my brain.

Thanks to the following article for a refresher course.

Mladjan Antic

As you know, until iOS 5 came out, we used drawRect override in AppDelegate to customize UINavigationBar. Now iOS 5 give us some new method for styling (and old doesn’t work). How to build app that will work on iOS 4 and iOS 5 with stylized UINavigationBar? You must to do both!