Saturday, June 26, 2010

I've finished a new iPhone app that shows several technologies I've developed and how they can be used on the iPhone.

http://bit.ly/chAcWE

Sunday, June 13, 2010

JSON vs XML feeds on iPhone

Reading from a JSON feed is pretty easy on the iPhone, I've had to recently create an app that parses XML data, and found this to be much more cumbersome. While timing the performance I realized that parsing the data was taking as long to do as the actual retrieving of the data. Part of this is because there isn't any native XML parsing on the iPhone. I'm trying to get all feeds we create from now on to serve data in multiple formats, just to make things like this easier in the future.

Labels: , , , , ,

Sunday, November 29, 2009

Creating barcodes readable off of the iPhone

The iPhone app I've created creates barcodes on the fly, that are scannable directly off of the iPhone. Creating the barcodes is relatively easy, figure out the encoding system you'll be using (these were Code 128 barcodes), the string of numbers you are encoding gets run through a function that creates start and end codes (that the scanner uses to verify it has correctly scanned the number). There are several true type fonts of barcode schemes available, and so you can just use the font to image tricks I've gone over before.

Because a piece of paper is reflective and the iPhone screen isn't, older barcode scanners will not work. They depend on the laser reflecting off of the paper and this won't work off of the iPhone (its screen transmits light, but doesn't really reflect it). I tried tweaking the colors of the coupon, but nothing helped. Fortunately most scanners are moving towards a system that is more like taking a digital image of the barcode (you can tell these because the laser doesn't just create a straight line on the coupon, it'll create a box, or something two dimensional). Since these scans are just looking at the image transmitted back, they'll work fine off of the iPhone (even when screen protectors are used).

Click here to see a sample

Labels: , , , , , ,

Sunday, November 15, 2009

Unsafe code and visual studio 2008

I had some code I was using to apply a smoothing filter to an image that used the unsafe tag in visual studio. Unfortunately all the references I found about allowing this in the compilation weren't referring to how to set this up for a web project. It actually needs to be set in the web.config file:
....
<system.codedom>
<compilers>
<compiler language="c#;cs;csharp" extension=".cs" warningLevel="4" type="Microsoft.CSharp.CSharpCodeProvider, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" compilerOptions="/unsafe">

The important part being the compilerOptions at the end.

Labels: , , , , ,

Friday, September 18, 2009

App available in App Store

The app I've been working on is now available through the App Store

Click here

The app pulls down coupons for adidas outlet stores, which can be sent to specific users based on location they are in (so if a store in my area has too much of something I might get a coupon for it).

I create the barcodes on the fly, which are actually scannable directly from the screen (on most of the scanners in the stores). It has a custom interface, links to maps for the locations of the stores, and I think is a pretty decent app for my first "official" one.

Friday, August 07, 2009

Navigating to local anchor link, even though your setting relative paths in a UIWebView

I've got a UIWebView that I wanted to set a baseURL for (it is a local to the iPhone html file, and has local image references). Unfortunately loadRequest doesn't allow you to set the baseURL (only loadHTMLString). I really don't know why.

So if you use loadHTMLString and pass it a blank string (and set the baseURL) and then call loadRequest, you can make it work.


NSString *path = [[NSBundle mainBundle] bundlePath];
NSURL *baseURL = [NSURL fileURLWithPath: path];
NSString *filePath = [[NSBundle mainBundle] pathForResource:@"stores" ofType:@"html"];
NSURL *fullURL = [NSURL URLWithString:@"#OR" relativeToURL:fileURL];
NSURL *fileURL = [NSURL fileURLWithPath:filePath];
[webView loadHTMLString:@"" baseURL:baseURL];
[webView loadRequest:[NSURLRequest requestWithURL: fullURL]];

Labels: , , , , , , ,

Tuesday, August 04, 2009

Javascript printing in Safari

Because safari seems to cheat with browser speed tests and calls javascript before the page has finished rendering, I ran into a problem with having a javascript windows.print(); function on the page, the print box would come up before the page had finished loading.

Took me a while to figure out a solution, but by making the body tag a server control, I could call:
body.Attributes.Add("onload", "javascript: window.print();");

To programmatically add the javascript, which would only load _after_ the page had rendered.

Labels: , , , , , , ,