Software Development
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...
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...
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...
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....
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...
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) ...
One of the first things that I wanted to do when I got my brand new iPod Touch was create a webclip icon. It really annoys my that a lot of mainstream sites like Digg.com, Weather.com, etc. haven't bothered to create one. So, here we go.
First, start off with a 128x128 image. One of the things to keep in mind is that your iPhone is going to automatically apply some 'glossiness' to your image, so a nice flat image is ok. The other thing to keep in mind is that because it does that, you should make sure that your...
One of the biggest things that I've had a problem with C# is its complete, utter lack of string value enumerations. Enums provide strongly typed domain values that make programming easier to manage. However, since you can't include characters like wildcards, spaces, etc., this means that making a human readable enum a nearly impossible task. Until now. This takes a little more heavy lifting than I come to expect with the .Net framework, but is a relatively easy fix for what you get in return. This is broken into two parts:
Create the String value for the...
Many times, dynamic documents, images, zip files etc are created in memory. Rather than save them to the server's disk and provide a link, that dynamic file can be directly saved to the user's computer. By using MIME encoding and a little C# magic, downloading dynamic files is a snap!
If you're like me, debugging Regular Expressions can be a pain. There are an infinite amount of resources on the 'Net, but testing a home brew RegEx can be a pain. A little while ago I found this site that will not only guide you in making them, but help make sure that it does what you want it to validate.
Full Software Development Archive