Simon Fell > Its just code > December 2006

Sunday, December 24, 2006

Couple of new builds out with some minor bugs fixes, first up, a new build of PocketHTTP that fixes an intermittent problem some people had seen when its reading gzip compressed responses. Second up, an update to SF3, this fixes a problem caused by a particular combination of contact details in address book on initial sync, it also addresses a problem with reading all day events from salesforce and them ending up with the wrong date in iCal. Next time you start SF3 it'll tell you about (and offer to install) the updated version, assuming you left the check for updates preference on. Right now I'm suffering from having way more idea's than time to work on them. Happy Holidays!

Saturday, December 23, 2006

So I read the docs multiple times, looked at source for the sample app talked about in the docs, it made my head hurt and my code not work. I finally stumbled across Matt Neuburg's tutorial which totally rocks, it got me up and running pretty quickly. So for anyone else stumbling into the "wonderfull" world of trying to apple script enable an application, start with the tutorial, your head will thank you. I'm off to buy Matt's book now.

Thursday, December 21, 2006

I've been using Cocoa bindings more and more, they do a great job of hanging a UI together without writing a bunch of glue code, master detail views seem to be the killer application for them. On a recent app I did almost the entire UI with bindings, then I needed a custom view, and started looking into how that could support binding. After a bit of reading, it turns out its painfully trivial, expose the thing you want to bind to as a regular property, then in the class initializer call exposeBinding, doesn't get any easier than that. If you want to see how easy bindings and coredata can make things, check out this great core data video tutorial.

Saturday, December 9, 2006

And I don't mean all the rain we had, as Adam reported over on the ADN blog, for those people lucky enough to have login's for the Sandbox edition Winter '07 is here and with it API v8.0, which has a ton of new stuff in it.

Friday, December 8, 2006

Over on ADN there's a tech note that explains how to add request & response compression support to .NET generated web services clients. As .NET 2.0 provides support for response compression out the box now (once you've turned it on), you'll find this code fails on .NET 2.0 because it ends up trying to decompress the response twice. So I updated the code for .NET 2.0, it now only has to handle compressing the request. The nice thing about the approach it takes (subclassing the generated proxy class), is that you don't have to change the generated code at all, so it doesn't matter how many times you do update web reference, you'll still be in compressed goodness. So, all you need is this one subclass wrapper around your generated proxy class and you're good to go.

    class SforceGzip : sforce.SforceService
    {
        public SforceGzip()
        {
            this.EnableDecompression = true;
        }

        protected override System.Net.WebRequest GetWebRequest(Uri uri)
        {
            return new GzipWebRequest(base.GetWebRequest(uri));
        }
    }

Then in your code that uses the proxy, just create an instance of this puppy instead of the regular proxy, e.g.

    sforce.SforceService svc = new SforceGzip();
    sforce.LoginResult lr = svc.login(args[0], args[1]);

All this is included in the sample project in the download, share and enjoy, share and enjoy

Tuesday, December 5, 2006

Arrghh, so all the time i burnt yesterday on finding the linker options was wasted, as the bundled version libxml has a woefully broken sax2 implementation (it doesn't null terminate the attribute value in the startElementNs callback).

Monday, December 4, 2006

I hunted and hunted for some hint of this, both zlib and libxml are in the standard xcode install, I couldn't however workout how to link to the libraries. Instinctively, I tried dragging the libraries to the Linked Frameworks folder, which didn't work, neither did dragging into the link binary with libraries step in the target definition. I finally found enough pointers to tryout setting -lz and -lxml2 additional linker flags (-l for link and z for libz.dylib, and -l for link and xml2 for libxml2.dylib, the prefixed lib and suffix .dylib not being needed). I guess this is obivous to everyone else, but not me, so this post is for any other lost souls trying to track this own down. Also, because libxml is actually burried in a libxml2 directory, you'll need to add /usr/include/libxml2 to your header seach paths.


Friday, December 1, 2006

No points for guessing which bridge it is...

Friday, December 1, 2006