• RSS
  • Add To My MSN
  • Add To Windows Live
  • Add To My Yahoo
  • Add To Google

.Net Micro Framework and regular expressions … “out of range exception” ! 

Posted by Paolo Patierno Thursday, May 07, 2015 9:34:00 PM
Rate this Content 0 Votes

Developing a new library for accessing to the Microsoft Azure Service Bus (event hubs, queues, topics / subscriptions) based on AMQP (and AMQP .Net Lite library) I came across a bug in the code of the regular expression in the .Net Micro Framework.

The bug occurred by chance, when I had a "connection string" in which there was the "SharedAccessSignature" field that has a value when we use the AMQP connection with CBS (Claim Based Security); for example when we publish to a "publisher" endpoint in the event hubs with a SAS-based security token.

In this case, the above field has a quite long value. Following the "connection string" I came across :

To extract all the fields from the connection string, I wrote the following code :

   1: Regex regex = new Regex("([^=;]+)=([^;]+)");
   2:  
   3: IDictionary connectionStringParams = new Hashtable();
   4:  
   5: MatchCollection matches = regex.Matches(connectionString);
   6: foreach (Match match in matches)
   7: {
   8:     connectionStringParams[match.Groups[1].Value] = match.Groups[2].Value;
   9: }

On second iteration extracting the "SharedAccessSignature" field I came across an OutOfRangeException ... due to what ?

 

regex_netmf

 

The screenshot shows that the field "Length" of the match has a negative value of -80. Why ?

Well, the value of the "SharedAccessSignature" field (the SAS token) has a length equal to 208 and doing a simple subtraction 128-208 is exactly equal to -80.

Probably in the .Net Micro Framework, a variable of the type "signed byte" is used to hold such a value that causes an obvious overflow; the maximum length of a value in a match was probably set at 128.

I suggest you avoid matching with values longer than 128 characters waiting the team to fix the bug

Winking smile

Windows IoT Core, Raspberry PI 2 and HDMI to VGA Converter 

Posted by Mirco Vanini Monday, May 04, 2015 9:31:38 AM
Rate this Content 0 Votes

Last week I installed the Windows IoT Core Technical Preview on my Raspberry PI 2 but I had some issues with my cheaper HDMI to VGA converter. During the test, I used my old Samsung CRT monitor without any output from the board! I tried using a HDMI cable with other monitor and the board work fine. Then I connected the converter to my laptop HDMI port and it worked. The problem was on the board OS Image. After a few hours, I found the solution. On the OS Image root path there is the config.txt file. On this file I appended the following lines:

hdmi_drive=2
hdmi_group=2
hdmi_mode=16
hdmi_force_hotplug=1

Here there is a brief description about the parameters available for the config.txt

Enjoy

MQTT & Eclipse Paho : new releases for M2Mqtt client and GnatMQ broker !! 

Posted by Paolo Patierno Saturday, March 28, 2015 2:20:33 PM
Rate this Content 0 Votes

Finally the new M2Mqtt 4.1 version is out !

In the last months, my library was under pressure thanks to my friends Olivier Vigliengo (from Adeneo) and Nicolas Besson (Microsoft MVP on Windows Embedded, from Adeneo). They used the MQTT client for their hobbistic projects and stressed it a lot !

After exchanging a lot of emails with log traces, I fixed some bugs and added some improvements to the library :

  • Exposed IsPublished flag in the published event to know if message is published or not due to timeout;
  • Internal changes for event management;
  • Fixed bug on negative timeout;
  • Improved stability on not reliable network;
  • Fixed bug on session management;
  • Added trace on queueing operations;

Of course, all changes had a great impact on the GnatMQ broker project related to M2Mqtt. The MQTT broker is still in Beta but I’d like to release it as Stable : I hope that people using it give me a feedback. It seems that XSocket team is using it to support MQTT in their platform. Smile

As always you can find M2Mqtt under Eclipse Paho project, CodePlex and Nuget. GnatMQ is available only on CodePlex. Finally, I updated the M2Mqtt4CE (for Windows Embedded Compact 2013 OS) on CodePlex as well.

CDays 2015 – IoT & Azure 

Posted by Mirco Vanini Wednesday, March 11, 2015 3:53:44 PM
Rate this Content 0 Votes

Anche quest’anno mi sarà data la possibilità di partecipare come speaker ai Community Days, in dettaglio nella giornata di martedì 24 marzo terrò una sessione dal titolo: IoT con Azure:

In questa sessione verranno analizzate e discusse le problematiche legate alla pubblicazione dei dati da devices in un tipico scenario IoT. Vedremmo come il servizio Event Hub di Microsoft Azure gestisce l'inserimento per pubblicazione e sottoscrizione offrendo una scalabilità flessibile, adattabile a profili di carico variabile e ai picchi provocati dalla connettività intermittente

Eccovi una piccola anticipazione dei devices che saranno coinvolti durante la presentazione:

NETMF 4.4 Beta 

Posted by Mirco Vanini Wednesday, March 11, 2015 3:23:41 PM
Rate this Content 0 Votes

Inizia a delinearsi la prossima versione di. .NET Micro Framework, Con questo rilascio Microsoft ha spostato il progetto da CodePlex a GitHub, il nuovo indirizzo è http://netmf.github.io. Solo la release corrente è stata spostata mentre le vecchie versioni rimarranno su CodePlex. In questa versione la novità principale è la riscrittura dello stack di rete per migliorare sensibilmente la stabilità delle connessioni. Oltre a questo le altre aree di intervento riguardano: la parte di distribuzione, stabilità del fw e le funzionalità di debug. Sempre in questa release iniziamo a vedere il supporto per AllJoyn, VS2015 e le API WinRT.

Page 1 of 48 1 2 3 4 5 6 7 8 9 10 20 > >>