Blog Break

Well, this post actually is a test of a WordPress iPhone app Genius suggested me to try. And I think I like it!

BTW, the first alpha build of a foo_touchremote is almost here. There’s still a lot of things to do (it doesn’t even support a library yet), but there should be something to start with, right?..

Life is life!

Awesome. I have got another set of plugins to write for MS CRM, still working on its integration with HP PPM and writing a DRM license server for another project.
There’s almost no time even to live ;)
But there is some progress on foo_touchremote. I’ve managed to pair my own server with Apple’s client app and made a http processing engine based on mongoose (it seems to be the most adequate implementation of http server) sources. So the very first betas would appear soon.
Stay tuned.

Continue Reading »

Sync: “Slide to cancel”

Slide to CancelYeah, I’ve just found out how to handle this and terminate sync when user slides cancel switch.

We need following functions (meta-language):

ERROR AMDObserveNotification(HANDLE proxy, CFSTR notification);
ERROR AMDListenForNotifications(HANDLE proxy, NOTIFY_CALLBACK cb, USERDATA data);

and callback delegate:

typedef void (*NOTIFY_CALLBACK)(CFSTR notification, USERDATA data);

First, we need AMDObserveNotification to subscribe notifications about “com.apple.itunes-client.syncCancelRequest”. Then we should start listening for notifications (second function) until we get “AMDNotificationFaceplant”.
That’s it. When notification got, you should unlock and close lock file handle (don’t sure if you need to post “syncDidFinish” to proxy, seems it doesn’t matter) and terminate sync gracefully.

P.S. The same notification is also got when you unplug your device, so you should always be ready for errors.

ArtDoctor for Mac OS X: possible!

Some time ago a Mac port of Mono was released, so it made completely possible to run .NET applications there. But ArtDoctor needs to operate directly with device and was strictly tied with iTunesMobileDevice.dll, which has no analog on a Mac.

And today I’ve managed to create a fully cross-platform .NET library to deal with Apple devices. It even works without re-compiling for target platform. The trick is to use MobileDevice (dll on Windows and framework on Mac OS X) instead and apply some dll redirections for Mono.

However, it’s not just to change referenced library name. Unlike iTunesMobileDevice, MobileDevice framework doesn’t use native threads on both platforms. Also it is more strict about strings, so hand-made CFStrings most likely won’t do.

P.S. I really have no idea why both of these libraries are included in Windows distribution of Apple Mobile Device Support, ’cause they don’t even reference each other.

Lost records in DataView

What should you do if you need to get position of a record in DataView? Generally, DataView implements an IList interface, so you may concider calling ((IList) dataView).IndexOf(dataRowView) would do all the magic for you.
I thought in such a way before I found out, that calling IndexOf on a DataRowView being edited would return “-1″ (i.e. not found).

It happens because a DataRow creates a temporary copy of itself when calling BeginEdit() and associates a DataRowView with that copy. And calling IndexOf on DataView performs lookup through DataTable’s index, who has no idea about that temporary copy and returns nothing.

So you should finish with editing before performing any lookup.