I had a URL for a file as a string returned from SharePoint web services, and this string contained two Unicode characters, an “A circumflex” (Â) and a soft hyphen.
The string returned by SharePoint was already percent escaped, however when attempting to use it with [NSURL URLWithString:] returned a nil object, which, as the documents states, is caused by a malformed URL. After spending quite a large amount of time on the issue and not finding much information about the issue, I visited Core Foundation as a last result and it proved to be most helpful.
The first step was to use - (NSString *)stringByReplacingPercentEscapesUsingEncoding:NSUTF8StringEncoding
Then using this new string object use (NSString *)CFURLCreateStringByAddingPercentEscapes(NULL, (CFStringRef)myURLString, NULL, NULL, kCFStringEncodingUTF8);
Finally, this new string object can be used to produce the NSURL object required.
NSString *unescapedURLString = [urlString stringByReplacingPercentEscapesUsingEncoding:NSUTF8StringEncoding];
NSString *escapedURLString = (NSString *)CFURLCreateStringByAddingPercentEscapes(NULL, (CFStringRef)unescapedURLString, NULL, NULL, kCFStringEncodingUTF8);
NSURL *url = [NSURL URLWithString:escapedURLString];
It should be noted that whilst Foundation and Core Foundation are toll-free bridged classes, ARC requires a few indicators to make this work (but nothing I can go into yet).
I was asked by someone to find the location of the HTML (Ruby on Rails) files for the Wiki server in 10.7 and I figured that I would write them down for anyone else looking for them.
The stylesheets can be found at /usr/share/collabd/coreclient/stylesheets/
The rails files can be found in the subfolders of /usr/share/collabd/coreclient/app/views/
The location of the splash page is /usr/share/collabd/coreclient/app/views/layouts/application.html.erb
Hopefully this information is helpful in someway.
After searching for a while I decided to “bite the bullet” and write the plist myself. The plist in question runs the distributed build executable (distcc) as a daemon using launchd.
You will most likely want to adjust the “-a” parameter to support your own subnets or addresses. The “–zeroconf” parameter is to broadcast the service using mDNS which is helpful if you use Xcode as the service will display in the “Distributed Builds” tab of the Preferences window.
To install just drop it into “/Library/LaunchDaemons/” and then you can tell launchctl to load it, or just wait until next boot/login.
The plist file can be downloaded here: distccd.plist (554 bytes).
I recently played around with Facebook’s Graph API and found it a quite a refreshing API to pull statistics from.
It got me thinking and I went and looked for some jQuery graphing libraries, came across 3 but found that Flot was what I was looking for.
By using Flot with ExplorerCanvas, jQuery and Facebook’s Graph API I produced a page for graphing the amount of likes on a Facebook page over time.
The “averaged” value can be used to extrapolate, eg. calculate the time in seconds, 1 hour is 60*60=3600 seconds, multiply the seconds by the “averaged” value 3600*0.6548=2357.28, therefore, in 1 hour Justin Bieber’s fan count should have increased by 2357.
http://www.woodnathan.com/fbgraph/
It supports two URL arguments – id and d:
‘id’ is the id of Facebook page to load, ie. ‘justinbieber’ in ‘http://www.facebook.com/justinbieber’
‘d’ is the delay, in seconds, between Facebook requests [Default: 1]
Examples
5 second delay between requests:
http://www.woodnathan.com/fbgraph/?d=5
Lady GaGa:
http://www.woodnathan.com/fbgraph/?id=ladygaga
Rihanna:
http://www.woodnathan.com/fbgraph/?id=rihanna
Justin Bieber:
http://www.woodnathan.com/fbgraph/?id=justinbieber
Daft Punk:
http://www.woodnathan.com/fbgraph/?id=daftpunk
All processing is done client side and can consume quite a large amount of memory if ran for an extended period of time. There is also a limit to the amount of requests that can be made to Facebook’s API and that limit may be reached, if so, increasing the delay value should overcome this.
So I just finished committing the first build of APProxyViewController at https://github.com/woodnathan/APProxyViewController
Currently, the username and password inside the Settings app for a HTTP proxy is stored inside a keychain that Apple’s apps can access. That means that the other applications don’t have access to it and must ask the user for the credentials. This class simplifies the process by providing the UI and the handling so that the connection request can continue.
I will be updating it soon with a delegate so that it’s dismissal can be handled correctly. Otherwise check out the README in the repository for how to use the class.
Josh Grenon has compiled a great list over at http://joshgrenon.com/2011/03/21/12-open-source-libraries-to-speed-up-your-ios-development/
It lists 12 libraries to speed up development, however I prefer TouchJSON over the JSON Framework listed in the post as there are slight differences between each.
In my previous post, http://www.woodnathan.com/2010/10/using-curl-to-authenticate-users-in-php/, I posted code that allowed you to check the HTTP response code to authenticate users from a form. In it I used the explode function to separate lines of the HTTP headers, however a better way to obtain the required “200 OK” would be to use the PHP function curl_getinfo it provides a much cleaner way of obtaining the HTTP response code.

You might have a login system in which you are required to authenticate your users against a realm on a separate web server.
With some minor adjustments you could make it work with some other authentication methods, but currently it just works with Basic authentication.
Well this is the code that I used to only get the HTTP status code:
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $settings[0]["value2"]);
curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_BASIC);
curl_setopt($ch, CURLOPT_USERPWD, ($username.":".$password));
curl_setopt($ch, CURLOPT_NOBODY, true);
curl_setopt($ch, CURLOPT_HEADER, true);
curl_setopt($ch, CURLOPT_HEADER_OUT, true); //Should be CURLINFO, however it's not required
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$data = curl_exec($ch);
curl_close($ch);
$data = explode("\n", $data);
$data = explode(" ", $data[0]);
$status = $data[1];
I always looked forward to the day when I could play AVI movies straight on my iOS device. However, here I sit now, writing this post whilst iSkysoft iPhone Video Converter runs in the background telling me that it will be completed 2-3 hours.
This arises from the fact that I just went to use VLC for iPad but found that it doesn’t work as well as I would like. It looks pleasant, the icon, the shelf type layout for the list of videos. The first issue I had with it was that I had to use iTunes to transfer the files to the application, but I could deal with that and it is the easiest for both the user and developer.
The biggest issue I had with VLC for iPad was that the audio and video dropped out of sync. It probably was just the fact that it was an AVI file, but in that case, I may as well use the built in Videos application.
I expected it all to work, but now I no longer have VLC for iPad installed.