Daily Archives: February 4, 2010

iPhone Coding Recipe – Shortening URLs

I had some a to shorten URLs for an in-application Twitter client I’m working on and thought I would share my simple solution with you guys.

It’s actually pretty straight forward and can be done in 1 line of code.  I have broken it up into several for clarity.

NSString *url    = @"http://brandontreb.com"; NSString *apiEndpoint = [NSString stringWithFormat:@"http://api.tr.im/v1/trim_simple?url=%@",url]; NSString *shortURL = [NSString stringWithContentsOfURL:[NSURL URLWithString:apiEndpoint]  		 encoding:NSASCIIStringEncoding  		 error:nil]; NSLog(@"Long: %@ - Short: %@",url,shortURL);   // Outputs Long: brandontreb.com - Short: tr.im/MRDd

Pretty easy huh?

The magic here is in a method that Apple gave us as part of NSString. This method is called stringWithContentsOfURL. It will easily allow you to grab the text of any remote source.

I have used Tr.im as an example here because their service is very easy to use and has little overhead.  I would have used bit.ly but they return a JSON string which would then have to be parsed.  Tr.im’s trim_simple service simply outputs the string of the shortened URL.

Sure Twitter may shorten links for you automatically, but what if you want to use a custom service? Or,…wait for it… use it for something other than Twitter (please post in the comments if you do. I would love to hear some other uses :) )

Questions? Comments? Complaints?

Happy iCoding

Save CPU Cycles by Disabling the Windows 7 Search Feature [Windows Tip]

If you can’t get used to the new search feature in Windows 7, or you just prefer using Everything, Google Desktop, or Launchy, you might be interested to know you can disable it.

While we’re not recommending to average users to disable the built-in search functionality, if you really don’t use it, you could save yourself some CPU cycles by getting rid of it. Over at How-To Geek (my home away from Lifehacker), we’ve got a guide to the quick steps to disabling the built-in Windows Search feature, but you can do it easily by simply heading into the Control Panel, searching for “Turn Windows features on or off”, and then unchecking Windows Search from the list.

Once you’ve restarted your PC, you’ll notice that the search box is gone from the start menu, and there will no longer be a search box in Windows Explorer when you’re browsing through the file system. You should also note that Microsoft Outlook’s “Instant Search” feature depends on Windows Search, so that will use the slower Outlook search instead.

It's definitely not a setting for everybody—and frankly this writer loves the Windows 7 search box, but if you never use it, at least now you know how to disable it. If you prefer your instructions in step-by-step format, click the link for the full guide.

Get to Know Windows 7 Libraries Inside and Out [UltraNewb]

The new Libraries feature in Windows 7 makes it easier to manage your files and folders. Today we take a comprehensive look at everything you can do with Windows 7 Libraries.

The Libraries feature in Windows 7 provides a central place to manage files that are located in multiple locations throughout your computer. Instead of clicking through a bunch of directories to find the files you need, including them in a library makes for quicker access.

Access Libraries

To access the libraries in Windows 7, type libraries into the search box in the Start Menu and hit Enter.

The default libraries in Windows 7 will open up in Explorer which are Documents, Music, Pictures, and Videos.

Anytime you’re in Windows Explorer, you’ll be able to access libraries from the Navigation Pane.

Using Libraries

In these examples we’ll take a look at the Documents Library, but the procedures will work for any library you want to add locations to. If you’ve been working in Windows 7 for a while and storing documents to the My Documents folder, when you open the Documents Library, you’ll see those documents. Some applications install folders in the My Documents folder by default and you’ll see those as well.

What if you have documents stored in a folder other than My Documents? You need to add it to the Documents Library. There are a couple of ways you can go about it. Right-click on a folder and select Include in library from the context menu, then choose the Documents Library. Keep in mind that when you add a folder to a library, that folder is still in its original location.

Or when you have the folder containing your documents open, select Include in library and choose the library to put them in from the dropdown.

Here we take a look at the Documents library that contains files that are located in different places throughout the hard drive, including some on another partition.


You can also remove items from libraries as well. When you’re in a library, click on the locations link.


The Documents Library Locations window opens up and from here you can add or remove locations.

Create New Libraries

The default libraries are all well and good, but if you really want to take advantage of this feature, you’ll want to create your own. While in the libraries directory click on the New library button and give it a name.

In this example we made a new library called Work Projects. The first time you open it you’ll be prompted to include a folder.

Browse to the location with the files you want to add then click Include folder.

Now the files included in that folder will show up in the new library.

After you’ve created some libraries they’ll be added to the list to select from.


Add Network Locations

While libraries are a handy new feature, it’s not perfect. Not all folders can be added to libraries as Microsoft has stuck some rules on them. You can pretty much add anything from a local drive, including other volumes or partitions. External USB drives formatted as NTFS or Fat32 can be added as well. Things get kind of weird when you’re trying to add network and non-indexed locations.

Thankfully there’s a handy free utility you can use that makes adding network locations a lot easier. Win7 Library Tool is small and straight forward to use. Just click on the Create a new library button.

Then add the network location you want included in the library. Notice this tool will also allow you to easily change the library icon which is a neat additional feature.


In this example we’ve added a home network share that contains music files to a library named MP3 library.


This should help get you started using Libraries in Windows 7, which at first might take some getting used to. Once you understand how they work and start creating your own, you’ll find they’re actually pretty useful. Once you get going, you’ll find the Win7 Library Tool makes adding network locations a snap. How about you? Do you use libraries in Windows 7? Leave a comment and let us know what you like or don’t like about the feature.

Set Up a Low-Tech, Whole-House Speaker System Through Existing Phone Lines [DIY]

Ed. note: It can be pretty expensive (and a big pain) to install a wired, whole-house speaker system, but reader Tom O’Brien writes in with his low-tech solution: Route your speakers through the phone lines already installed in your house.

Here’s Tom’s set-up:

Using existing telephone wire and powered speakers, it’s fairly simple to connect speakers throughout the house via existing phone lines. This will work only if the lines have 3 extra wires, such as when no land line is in use, or if the house has 6 (very common) or 8 strand telephone wire. Cat 3 wire is 8 strand.

Each audio jack in the setup can connect to any source or supply output to speakers. All power is supplied by the input and output components. This is just a big complicated extension cable.

I live in an old 3 level house. This permits the same audio to be played throughout. Off/on and volume controls are on the remote speakers, as with any powered speaker. This will possibly violate the sensibilities of audiophiles, but the sound is fine for me.

Materials include:

  • 3.5 mm headphone jacks from Radio Shack
  • Repurposed Cat 5 or Cat 3 junction boxes drilled out for audio jacks. Home Depot’s are cheapest.


  • Soldering iron

All audio files, podcasts, etc are saved on netbook PC at “Home Base” (pictured above).

Note 2 cords plugged into panel. One is output from computer, other is to the speakers on shelf.

A CD player, portable mp3 player or any other source can be plugged in as well, hence so many jacks at home base.

The good speakers in living room.

3.5 mm headphone jacks from Radio Shack.

This is a cover panel for an in-wall junction box. The example has both speaker jacks and a phone jack and uses cat 3 (8 strand) wire. It would have been easier to just wire in a second box for the speaker jacks.

This is suitable for an in wall junction box.

The 3 screws at the top are for the audio jacks, the 4 screws at the bottom connect a 2 line phone via the cat 3 phone jack in the center.

External box wired in to existing phone system.

Double sided tape works well to secure wood to the box.

Thanks for the great suggestion, Tom! If you’re looking for a higher-tech solution that’ll still keep it cheap, check out our previous guide to using an AirPort Express to set up wireless, multi-room music playback.

How-To: Remotely Wipe an iPhone Using Exchange

The thought of your iPhone or iPod touch falling into the wrong hands is enough to scare anyone. The iPhone does have the passcode function to keep prying eyes out, but what if that’s not enough?

In a corporate environment, the loss of a device like this is a major ordeal. Apple has touted the MobileMe remote wiping capabilities, but what if you don’t use MobileMe? If you are in a corporate environment, you probably connect to an exchange server for mail. Using OWA (Outlook Web Access) you can remotely wipe your lost or stolen iPhone/iPod touch and breath easy knowing your data is safe.

As I stated, this relies on using the Exchange email push functionality in the iPhone OS. I have only tested this with Exchange 2007 so I can’t verify how or if this works in older versions of Exchange. OWA is Microsoft’s fancy name for web mail so the first thing you need to do is access your company’s web mail.

  1. After you successfully login, click on the Options button in the top right.
  2. Now click on the Mobile Devices option in the left-hand menu.
  3. You should now see your iPhone or iPod touch device listed. Click the radio button next to your device and the click Wipe All Data from Device…
  4. You will get a confirmation dialog to confirm you really want to do this. After you confirm, the Status will change to Pending Wipe.
  5. The next time your iPhone/iPod touch has an internet connection and checks in with Exchange, a secure wipe is initiated. This is what the screen looks like to the user.
  6. After the wipe has been started, the status for the device in OWA will change to Wipe Successful and you can remove the device from the list.

You can give this a try on your own device if you want to see the magic. Be advised that it will take about an hour to wipe the device so you can’t use it during that time. After the wipe, you can restore from a backup in iTunes. Since this is done in OWA, you don’t even have to bother your Network Admin. Maybe you are a little embarrassed that you lost your iPhone. This way no one has to know. Your secret will be safe with me.

Allerglobal Generates Allergy Travel Cards in Multiple Languages [Health]

Having food allergies are a big enough hassle in your native country, let alone when traveling where you don’t speak the language very well. Allerglobal helps you make language-specific food allergy cards to communicate in restaurants.

At Allerglobal you can select from dozens of food allergies and generate a printable card that you can use while traveling. Allerglobal translates the cards into 27 languages—although we selected English so that you could read what the stock phrases on the card were, you can just as easily select Italian, French, or other languages. If you're traveling and your use of the local language is shaky or nonexistent, it's definitely worth printing off a few cards before you leave the country.

Have your own tip, trick, or handy printout to make traveling easier? Let’s hear about it in the comments.

iTunes Provides Browser-Based iPhone App Previews [ITunes]

iTunes is letting more of its content out onto the open web these days, offering up song previews and, just recently, iPhone/iPod app details. You can check out screenshots, reviews, pricing, and most of the other details you’d get inside iTunes from your browser now when you click on a direct app link. Not every direct app link worked in a quick morning test, but over time, expect far fewer grumbles from those who don’t have iTunes installed but want to see just a few things inside Apple’s walled garden. [TechCrunch]

Ocster Backup Pro 3 keeps your data safe without being a hassle.

Ocster Backup Pro 3 is a great backup software that was designed from the start to work fully automatic.

Even though the software has a lot of advanced features, it is really easy to use. You simply specify what you want backed up and when. The software then takes care of the rest and automatically keeps your data safe!

Product Features:

  • Fully automatic
  • Very easy to use
  • Stop & Resume: backups can be interrupted at any time and can resume even after a reboot
  • Backup Reports: detailed backup reports can be generated each time the backup is updated and even automatically sent to an email address
  • Network support: backup to and from network drives
  • Encryption and compression
  • Incremental backup
  • Open File support
  • Hard Link and Symbolic Link support
  • … and much more

WP Like Button Plugin by Free WordPress Templates