Monday, October 18, 2004

Everybody has been talking about Service-Oriented Architecture (SOA) lately. And it’s not about Web Services, but essentially about service been abstracted from the implementation, published specs of its interface and a formal contract between service provider and its customer.  So, mostly it is about standards in the communication between different platforms and systems – this is where SOAP, WSE (Indigo in the future) come to play. It’s all nice and dandy when you develop SOA systems for desktops/servers, but we’d immediately step into uncharted territory if you try to apply SOA principals when developing for mobile devices. Yes, we can call to Web Services from .NET CF client, we can even communicate with servers which implement WSE (big thanks to Casey for his wonderful work here), but you’d fall short if your project should require a 2 way real-time communication with a desktops or other devices in the almost always connected (WIFI) environment. So this rant is to bring attention of Microsoft folks on this very important subject. Mobile devices are not only used in the end-user retail environment, but also in the enterprise. We need WSE or Indigo for mobile devices.

10/18/2004 3:03:05 AM (GMT Daylight Time, UTC+01:00)  #     | 
 Thursday, September 30, 2004

You have probably heard about .NET to Go Mobility Road Show. It is a “FREE deeply technical and eminently useful mobile applications solutions workshop”. I am all setup at New York location for the partner / “Ask the Experts” table. Swing by to say hello or any other questions you might have.

9/30/2004 2:21:04 PM (GMT Daylight Time, UTC+01:00)  #    Comments [34]  | 
 Tuesday, September 14, 2004

In this old post of mine I was asking for more access to the native windows and graphics handles in CF. Things are really getting better in the Compact Framework V2. We get what we were asking for.  The Graphics.FromHdc is there, as well as Bitmap.LockBits (UnlockBits) and Image.Save. Although the Bitmap.GetHbitmap and Image.FormHandle are still seems to be missing.

We still don't have the ability to access WinProc of the managed control or to host a native control in the managed environment, but hopefully this will be changed when (if) CF V2 will support native callbacks.

9/14/2004 2:34:51 PM (GMT Daylight Time, UTC+01:00)  #     | 
 Wednesday, September 08, 2004

A lot of questions on inter process communication (IPC) in Compact Framework have recently popped up on the CF NG. And one of the options for IPC is to use Memory Mapped Files (MMF). So what are those? Here's the quote from MSDN documentation:

“A memory-mapped file, or file mapping, is the result of associating a file's contents with a portion of the virtual address space of a process. It can be used to share a file or memory between two or more processes...”

Windows CE supports both named and unnamed file-mapping objects. I'd say that named object to be more useful.  If the created object has a name you can easily pass that name to other processes so these processes can access the same object.

While doing investigation on my current project possibility of IPC, I've made some research on available C# code that wraps MMF. I've found quite a few implementations available on various web sites (CodeProject.com, Gotdotnet.com, etc...), but I've decided to port the implementation of MemoryMappedFileStream that comes with the Smart Client Offline Application Block. The conversion to CF was easy - changed the import dll to coredll.dll and added some functionality to handle named MMF's.

You can download the project from here.

9/8/2004 6:52:00 PM (GMT Daylight Time, UTC+01:00)  #     | 
 Thursday, August 26, 2004

While doing modeling for the new project that requires a HTTPS communication by posting some xml messages, I've encountered a few intricacies in the Compact Framework. First problem I’ve hit when trying to use the code that’s been working fine for me in the previous project to send a POST request over SSL is the known bug that throws a Socket exception. To workaround it I had to stop using ContentLength of the request class and set the AlllowWriteStreamBuffering to true. Another problem I ran into is that I was getting a TrustFailure exceptions due to a security certificate on the web server I was accessing is not fully trusted. A quick search on the Google brought up a great post by Jan Tielens that suggested implementing the ICertificatePolicy interface. It worked like a charm. The last problem came into play when I discovered that the web site requires passing a session cookies after logging in. That was easily resolved by getting the cookies from the WebResponse.Headers collection and setting it back in the request object. Here’s the snippet of the final working code:

request = (HttpWebRequest)WebRequest.Create(url);

request.Method = "POST";

request.ContentType="application/x-www-form-urlencoded";

//request.ContentLength = parameters.Length;

request.AllowWriteStreamBuffering  = true; //required for bug workaround

request.Timeout = 60000;

     

if (sessionCookies!="")

{    

      string[] cookies = sessionCookies.Split(';');

      // We've got some cookies

      if (cookies.Length > 0)

      {

            request.Headers.Add("Cookie", cookies[0]);

      }

      else

      {

            request.Headers.Add("Cookie", sessionCookies);

      }

}

//Get request stream

Stream requestStream = request.GetRequestStream();

//Write a post values

requestStream.Write(Encoding.ASCII.GetBytes(parameters), 0, parameters.Length);

requestStream.Close();

// Get response

response = (HttpWebResponse)request.GetResponse();

if (sessionCookies == "")

{

      //Get the cookies

      sessionCookies = response.Headers["Set-Cookie"];

}

 

reader = new StreamReader(response.GetResponseStream());

result = reader.ReadToEnd();

response.Close();

 

8/26/2004 2:25:12 PM (GMT Daylight Time, UTC+01:00)  #     | 
 Thursday, July 15, 2004

I've been busy these days with a new major CF project at some famous company, but I don't want you to miss a few important and interesting things happening on the CF horizon:

1. I am sure you're seen the announcement about OpenNETCF Coding Competition.

2. Mark Clifton of the MyXaml fame has created a forum for using MyXaml with the Compact Framework. You can already download the bits for CF. Very interesing stuff!

3. How about a Class Browser running on the device?

7/15/2004 4:02:28 PM (GMT Daylight Time, UTC+01:00)  #     | 
 Tuesday, June 29, 2004

If you haven't done so, go to msdn web site and download the Beta1 of the VS Express tool(s) of your choice. I've downloaded and installed C# Edition and all I can tell you - it rocks! It's small, lean, fast and choke full of features that make code writing a breaze and a pleasurable experience. The IDE itself is written in .NET, comes with .NET v2.0 and to top it off it'll probably be free. Microsoft, I am really impressed.

6/29/2004 3:57:39 PM (GMT Daylight Time, UTC+01:00)  #    Comments [29]  | 
 Monday, June 28, 2004

Seth's posted an invaluable info on Managed App Startup and Retargeting. I wish we had more of these “brain dumps“.

 

6/28/2004 4:30:39 PM (GMT Daylight Time, UTC+01:00)  #     |