Tips and Tricks

Little tips and tricks to do helpful but obscure things.
UIWebView, Oh How I Hate You, Let Me Count The Ways

I've been working on an iOS application that allows the transfer of documents to a secure location for my company.  One of the use cases involves being able to preview the document in a UIWebView.  A user can open these document from another application into this one, which involves me receiving the document.  I take that and make a copy, changing its name to a universally unique name with my own custom file extension.  When I got the code written for previewing it, I always got this error from UIWebView: Error Domain=WebKitErrorDomain Code=102 UserInfo=0x145bc10 "Frame load interrupted" This error was very puzzling...

posted @ Friday, July 29, 2011 6:10 PM | Feedback (0)

How to create a pixel-perfect UIBarButtonItem of *any* color

One of the first big run-ins I had with the iOS SDK came in my first app, Chela's Tacos.  I wanted to be able to create a UIBarButtonItem that had a different tint to it than it's enclosing UIToolbar.  This proved a frustrating affair because there is no API for directly changing the button's tint: it always takes on a similar hue to its toolbar.  Today that has changed. While poking around a class dump of the private APIs for the iOS SDK, I stumbled upon what a UIBarButtonItem is.  It's really just a class that composes what is called a...

posted @ Monday, April 04, 2011 10:23 PM | Feedback (0)

How to do NTLM Authentication in iOS

One of the more vexing things in iOS is handling NTLM authentication.  There aren't very many good code examples, so this article will walk you through the process using an NSURLConnection object. First off, you need to initialize a new NSURLConnection object with a delegate: - (void) someMethod {     NSURLRequest* request = [[NSURLRequest alloc] initWithURL:[NSURL urlWithString:@"someURL"]     NSURLConnection* connection = [[NSURLConnection alloc] initWithRequest:request delegate:self];     [request release];     [connection release]; } This is all pretty straight forward.  It's in the delegate methods of the NSURLConnection where all the magic happens.  The delegate method of the NSURLConnection we're most concerned with is connection:didReceiveAuthenticationChallenge:. - (void) connection:(NSURLConnection *)connection didReceiveAuthenticationChallenge:(NSURLAuthenticationChallenge *)challenge {     if...

posted @ Monday, February 21, 2011 11:11 PM | Feedback (0)

Remote Access To ASP.NET Development Server

One of the more frustrating aspects of the ASP.NET development server is the impossibility of debugging on it from a remote location.  There are myriad use cases for this, such as doing browser dependent testing (IE6m for instance), debugging from mobile devices, etc. Being able to receive external traffic while debug locally is such a routine exercise (while doing Java professional work, for instance), that it befuddles the mind to think why Microsoft intentionally prevents developers from doing this. One way around this silliness is by doing a port forward.  I downloaded a free command line utility called rinetd....

posted @ Sunday, May 30, 2010 10:14 PM | Feedback (6)

Forefront Client Security On Windows Server 2008 R2 x64

One of the biggest challenges of running a bleeding edge OS is the inevitability of running into software incompatibility issues.  One such issue is running Forefront Client Security on Windows Server 2008 R2 x64.  As of this posting you cannot run the Forefront Management Server yet, but you can run the client with a little bit of command line action. Insert or mount the Forefront disc. Open a CMD or Powershell prompt as admin. Go to the following directory on the disc: \client\x64 Enter the following command: .\clientsetup.exe...

posted @ Tuesday, November 24, 2009 6:40 PM | Feedback (1)

Enable RDP Audio On Windows Server 2008/R2

Setting up a new Windows Server 2008 R2 has proven to be an interesting experience simply because it so different from Windows Server 2003.  Most of the services are the same, it is just different (and sometimes difficult) to configure them.  One of these is enabling audio through RDP sessions.  I use my server as my sync hub for my iPod/iPhone devices, so being able to listen to audio through an RDP session is an absolute must.  Unfortunately, Windows doesn't come with that loaded out of the box, so here's how you go about enabling it. Start...

posted @ Sunday, August 23, 2009 4:01 PM | Feedback (2)

iTunes 8.2 On Windows Server 2003

If you're like me, you run a Windows Server 2003 box and have iTunes on there for your various iThing devices.  It makes the most sense since that's where your music/videos/etc. are too.  Well, with iTunes 8.2 Apple decided to screw us over and not let AppleMobileDeviceSupport run on our machines.  Luckily, I found a nice clean hack here on an Apple forum.  Basically you download the Win32 components of the Windows SDK and an installer disassembler. You use the Windows SDK to remove the OS requirement check which allows the AppleMobileDeviceSupport installer to cleanly install and function normally.

posted @ Friday, June 19, 2009 2:33 PM | Feedback (2)

Xcode: How To Replace 'Company Name' In Your Classes

One of the (many) things that has frazzled me about Xcode is the fact that you cannot change the 'company name' that appears in your classes directly through the Xcode UI.  So, here's a way that you can do it, though it takes a simple Terminal hacking to accomplish.  Like I just mentioned, pull up a Terminal window (Applications --> Utilities --> Terminal).  If I wanted the company name to be waynehartman.com, I would type the following command in the Terminal window: defaults write com.apple.Xcode PBXCustomTemplateMacroDefinitions '{"ORGANIZATIONNAME" =  "waynehartman.com";}' Go ahead and fire up Xcode, create a new class, and kapow! there...

posted @ Sunday, March 22, 2009 8:23 PM | Feedback (0)

Apple Bluetooth Keyboard On XP

Today I picked up a cool new Apple Bluetooth keyboard to navigate with my media center PC.  It's small enough to easily fit into my coffee table drawers were it's out of the way when not in use, but I did have some difficulty getting it paired to my Kensington Bluetooth adapter.  In order to get it working I performed the following steps: Fire up regedit Expand HKEY_CURRENT_USER\Software\Widcomm\BtConfig\General Find and set the key 'PinCodeWord' to a decimal value of 1111 Find and set the key 'UseFixedPin' to a...

posted @ Sunday, November 23, 2008 1:47 AM | Feedback (0)

How To Convert From String To Hex To String

I was writing some code that required that all text be hex encoded and was appalled that the .NET Framework didn't have a Convert method for doing hex, so I had to write my own.  Converting text to hex is quite simple using the method below: public static String ConvertToHex(String asciiString) { StringBuilder sb = new StringBuilder(asciiString.Length); foreach (char c in asciiString) ...

posted @ Friday, November 21, 2008 10:35 PM | Feedback (0)

Full Tips and Tricks Archive