The file is not a valid Windows CE Setup file

By Jerome at February 07, 2007 04:35 Tags:

If you've tried installing Bluetooth Remote Control on your device, and you are having trouble, such as getting this message :

The file RemoteControl.ARMV4.CAB is not a valid Windows CE Setup file

You must be working on some Windows Moblile 2003 device. I did not have the time to fix this but if you are interested in getting it to work, you can proceed as follows, if you're familiar with a CE cab file structure :

  • Expand the files on the PC using WinRar for instance,
  • Rename 0SmartBT.001 to smarbt.exe
  • Rename BTHelper.002 to bthelper.dll
  • Just put those two files on the PPC wherever you want.

You won't have a nice icon on your programs list, but at least it should help you run it.

Enjoy !

Vista Versions and Confusion

By Jerome at January 31, 2007 15:36 Tags:

If you follow the news surrounding Windows Vista, this must not be a surprise for you but, Vista's commercial offer can be quite confusing. Confusing enough for jokes to surface like these two here and there.

Of course, Paul's trying to explain it simple enough by breaking down version features, but I'm not sure that end real end user's going to get it. Plus, if you add the OEM/Retail differenciation, that confuses it a bit more. And I too don't know which version I'm going to get...

Anyway, with "upgraders" the biggest problem for Vista is that there is no "gotta get" feature, but reather a myriad of features that are worth looking into but that are not visible at first sight.

One that is definitely not visible at first sight is SuperFetch, which actually has no UI. This one's tweaking your computer by trying to guess what you'll be doing next and prefetch files that you'll probably need. All that based on your computer usage. Obviously, if it is based on comptuer usage, and you just look at it for 2 hours, you're not going to get the best out of it. And this one's pretty effective.

So, my advice for people in that position, just give it a try and don't tell yourself  "Oh yeah, right... that's Windows XP with a fancy UI, that's all...", that's not the way to go.

Just my two cents...

Vista's Reliability Monitor in year 1970

By Jerome at January 30, 2007 17:56 Tags:

Vista's new reliability monitor is kind of great when you want check on your computer's overall performance. You get an index from 0 to 10 giving an overall performance rating of the system, which seems to be pretty accurate for what I can tell so far. It tracks hardware failures, software failures, windows failures, software (un)installs and some other failures, then gives you an index based on that info.

Actually, on a developer machine, this is a little biaised because any exception you raise from any of your program ends up lowering the index. That should invite you not to let unhandled exceptions exiting your programs... :)

Anyway, a few days ago, I went to look at that index and found that the only history I had was on the 01/01/1970... Rings any bell ? :)

Well, if you ever encounter this particular problem in case vista's not detecting that by itself and resets its database, just go there :

%ProgramData%\Microsoft\RAC

and remove the two directories that should be there. The Reliability monitor should detect it and restart just fine.

WPF, Xml namespace and XmlDataProvider

By Jerome at January 30, 2007 16:15 Tags: ,

I was playing with the XmlDataProvider in WPF and I wanted to bind the content of inline XML from that provider to a ComboBox.

So, with I wrote this little piece of code :

<XmlDataProvider x:Key="ops" XPath="/operations/op">  <x:XData>    <operations>      <op>A</op>      <op>B</op>      <op>C</op>    </operations>  </x:XData></XmlDataProvider>[...]<ComboBox   ItemsSource="{Binding Source={StaticResource ops}}" />

Turns out that the combobox does not display anything, even though the XPath for the XmlDataProvider is correct and the ItemSource binding as well.

In reality, the problem is not in the binding but rather in the XPath, where the XML "operations" node in the inline xml inherits from the System.Windows XML namespace, which renders the XPath "/operations/op" ineffective. In that case, the XPath expression selects nodes from the "" (empty) namespace.

I just needed to write this instead :

<XmlDataProvider x:Key="ops" XPath="/operations/op">  <x:XData>    <operations xmlns="">

to reset the namespace used for that node, and my ComboBox was filled ! 

As a side note on WPF, I am just wondering on how this technology will be adopted. Many concepts are fairly innovative and differ from the usual concepts found in Winforms or even MFC.

I'm convinced that it is definitely going in the right direction with the data and design separation, but I'm not sure on how beginners are going to apprehend all this. Maybe a new release of Cider is going to ease development with this technology...Wait and see. 

Meanwhile, I'm continuing to enjoy the fact that I can databind a TreeView very easily :)

Bluetooth Remote Control 0.6.0

By Jerome at January 26, 2007 16:57 Tags:

Since I had some spare time to work on Bluetooth Remote Control for Windows Mobile, here is version 0.6.0 :

  • Added support for Windows Media Center
  • Added Shuffle key for winamp
  • Fixed Media Player Classic bindings
  • Fixed bluetooth support for some HP devices having "Error getting bluetooth mode"
  • Has been tested on Windows Vista (RTM build 6000)

Since I do not own a Windows Media Center 2005, I've only tested on Media Center for Vista. If someone has one to try on to, let me know. I should work, though.

About the HP devices, a few of you having devices like acer N311, iPaq hw6915, you can now run this software properly.

You can download this new release here :

http://www.jaylee.org/files/BTRemoteSetup-0.6.0.msi

Have fun !

Playing with WCF and NuSOAP 0.7.2

By Jerome at January 25, 2007 10:24 Tags: , , , ,

.NET 3.0 has now been released, along with Windows Communication Foundation (WCF). I thought I could give it a shot for one of my projects at work, where I have to create an internal web service. The problem is that the client at the other end will be using NuSOAP 0.7.2 to contact this WebService, so I had to make sure it would work fine.

First observation, compared to ASP.NET generated WebService, the WCF wsdl is much more complex. Actually, it has a little bit more information such as the validation rules for a guid, but it also has its schema split up into multiple XSD files. I was a bit worried that NuSOAP wouldn't handle that well, but it does fine... I also wanted to be able to expose a signature like this :

1:     [DataContract]
2:     public class Parameter
3:     {
4:         private string _key;
5:         private object _value;
6:  
7:         [DataMember]
8:         public string Key
9:         {
10:             get { return _key; }
11:             set { _key = value; }
12:        }
13:  
14:        [DataMember]
15:        public object Value
16:        {
17:             get { return _value; }
18:             set { _value = value; }
19:        }
20:    }

You'll notice that the second property is an object, and that implies that the serializer/deserializer handles properly types defined at runtime, by using xsd:anyType in the schema.

So, after a few attempts to get working linux LiveCD distro, for which none of them had PHP compiled the correct --enable-soap flag, I decided to fall back from the native PHP SOAP extensions to the OpenSource SOAP library NuSOAP and use EasyPHP on Windows.

First, I had to change NuSOAP's response encoding to UTF-8 using soap_defencoding, which seems to be the default for WCF, then I had to figure out how to pass an arry of structures to call my method.

So, for the following signature :

    void MyMethod(string a, string b, Parameter[] parameters)

The caller's php parameter structure should be :

$params = array(
'a' => $a,
'b' => $b,
'parameters' => array(
'Parameter' => array(
array('Key' => 'abc', 'Value' => 10),
array('Key' => 'def', 'Value' => 42)
)
),
); 

Notice that you have to place a "Parameter" element inside the "parameters" parameter.

Then, to call the method, use the following line :

    $client->call("MyMethod", array($params));

by encapsulating the parameter array once again. This makes a lot of levels to call one little function... I prefer the .NET way of doing thing :)

An other problem came up right at this point : The array, although the information being in the soap body, was not filled on the .NET side. After comparing with a .NET to WCF call, I figured that there was a missing namespace. This is what is generated by default with the code I've presented above using NuSOAP :

<parameters>
<Parameter>
<Key>abc</Key>
<Value>10</Value>
</Parameter>
<Parameter>
<Key>def</Key>
<Value>42</Value>
</Parameter>
</parameters>

And this is what .NET is generating :

<parameters>
<Parameter xmlns="http://schemas.datacontract.org/2004/07/MyService">
<Key>abc</Key>
<Value>10</Value>
</Parameter>
<Parameter xmlns="http://schemas.datacontract.org/2004/07/MyService">
<Key>def</Key>
<Value>42</Value>
</Parameter>
</parameters>

For some reason, the WCF basicHttp binding point is generating two different namespaces for the service contract and for the data contract. To fix this, you just have to specify explicitly a namespace for each ServiceContract and DataContract attribute of your service :

    [DataContract("http://mywebservice.example.com")]

The other problem was about using an unspecified data type as a member of a structure, a System.Object in my case. Well, it turns out that NuSOAP does not support it, as it does not include the data type of the serialized element, so the WCF deserializer cannot interpret it. I changed the data type back to string, unfortunately losing the type information. I can get it from somewhere else but still, this can lead to serialization problems related to culture (comma being a dot and the opposite depending on systems, for instance).

Anyway, there are a few things to remember to get things to work fine with NuSOAP :

  • Change the encoding to UTF-8 or whatever encoding you choose to use,
  • Don't forget to specify the name of the type of an element in an array in PHP, 
  • Do not expose unspecified parameters or attributes,
  • Explicitly specify the namespace of each DataContract and ServiceContact attribute of your service.

It's been a while since I've written a line of PHP code, and I didn't miss it at all. I'm going back to WCF now :)

Some news

By Jerome at January 24, 2007 16:29 Tags:

Here it is ! I've promised for too long now that I'd be adding a blog to this web site, and here it is ! I had some time last weekend, and I decided to update the site to add it.

It's pretty simple stuff in ASP.NET 2.0 and SQL Server 2005, but it allows posts to have comments, to be grouped and shown in the rss by groups. Nothing new, really.

The point on creating this blog here is to be able to write in english and not bother french readers (my native language) on community blogs. Plus, I'll try to add some more frequent updates on Bluetooth Remote Control for which, wandering around the web, I've found some users having trouble with it that I did not know about.

I've also been busy lately getting on to certifications such as MCTS (via the MCSD Upgrade part 1), and MCT. Upgrade part 2 is coming soon too...

Anyway, if you want to get in touch with me directly and publicly, feel free to do so here.

ODP.NET 10.2.0.2.20 Connection Pool Race Condition

By Jerome at December 22, 2006 12:56 Tags: ,

Aaah, les joies d'Oracle. Ma base de données préférée... accompagnée de son cortège de bugs...

Bon, j'arrête là le sarcasme, mais j'ai du mal :)

Dans le cadre d'un projet sur lequel je travaille, je suis tombé sur un bug très, très gênant : Le provider ODP.NET d'oracle peut se connecter à un schéma sur lequel il n'est pas censé se connecter...

Je m'explique : dans le même AppDomain d'un même process, je crée dans des Threads différentes deux OracleConnection avec deux chaines de connexion différentes. Jusque là , rien d'anormal. Le problème est que de temps à autres, l'une de deux connexion va utiliser la chaine de l'autre thread !

Après avoir vérifé rapidement le contenu de l'objet OracleConnection, il se trouve qu'une variable nommée "m_InternalConStr" contient parfois une chaine qui ne correspond par du tout à celle qui a été passée en paramètre dans le constructeur... C'est très génant, car si l'on se connecte à une base alors que l'on pense se connecter à une autre, ... je vous laisse immaginer les dégats si on fait des updates.

Donc après de nombreuses tentatives, je suis arrivé à la conclusion qu'il faut synchroniser tous les appels à OracleConnection du constructeur jusqu'à Open avec un Mutex, et cela sur l'AppDomain courant. Vous imaginez aisément le goulot d'étranglement. J'aurais tout aussi bien pu désactiver le Connection Pool, mais la aussi, coté performance cela devient gênant.

Bien entendu, ce genre de problème apparait plus souvent sur une machine Multi Processeur. (En production dans mon cas, ca fait toujours plaisir...)

Je n'arrive pas à reproduire la Race Condition de manière systématique, mais je met avec ce post un exemple de code qui teste tout ca. Généralement, l'erreur apparait au bout de quelques essais. Pour tester si le ConnectionPool est consistant, j'effectue quelques lignes de Reflection pour aller chercher des variables interne... pas très propre, mais c'est suffisement déterministe.

Si quelqu'un se sent suffisement motivé pour tester... :)

IIS, HTTP 401.3 and ASP.NET directories ACLs

By Jerome at September 01, 2006 22:09 Tags: , ,

A few days ago, on a newly installed web server with all the appropriate security patches applied, I kept having the same error on every ASP.NET 1.1 application I was running :

HTTP Error 401.3 - Unauthorized: Access is denied due to an ACL set on the requested resource.

At first, the reflex is to check all the permissions of the mapped physical directory, that they match the Application Pool identity, the guest identity (IUSR_Machine on my server) and for some configurations, the impersonated identity any ASP.NET configuration. Even with all these checks, any ASP.NET application was returning the same 401.3 error for anonymous users...

Well, it turns out that the ACL of the %SystemRoot%\Microsoft.NET\Framework\v1.1.4322 is important too... I don't know how the ACL got changed in the first place, and I don't know either how I came to check on these ACL, but that can waste a lot of time...

Bluetooth Remote Control 0.5.0-Beta5

By Jerome at July 26, 2006 00:22 Tags:

Here is a new version of Bluetooth Remote Control for Windows Mobile, with some improvements :

  • Automatic installation of the CAB file,
  • The correction of some stability issues on SPV E200,
  • The ability to view slide notes in PowerPoint on the PPC/SmartPhone.

The version 0.5.0-Beta5 is available here :

http://jaylee.org/remotecontrol

About me

My name is Jerome Laban, I am a Software Architect, C# MVP and .NET enthustiast from Montréal, QC. You will find my blog on this site, where I'm adding my thoughts on current events, or the things I'm working on, such as the Remote Control for Windows Phone.