#VS2015 – Debugging #LINQ sentences

Hola!

If you use ReSharper, you probably note the suggestion you get to convert your ForEach() sentences into LINQ ones. I’m not going to get into details about performance into this options, the focus of this post is on the “clean code”. I mean, how easy is to read this code. Most of the time, LINQ sentences are a very good idea, and they are very straight forward to read and understand, however there are some evil in this world, and some people creates LINQ sentences who are as complicated as a complicated Regular Expression.

So let’s start with a simple simple, (with a very ugly piece of code)

When we translate this ForEach into LINQ, we can get something similar to this one

And, this are very simple lines to understand. But when you get to a point where you don’t understand a developer LINQ sentence, you can debug the LINQ sentence. This feature is available in Visual Studio 2015 (and in VS2013 also), and you can see line by line the execution of the LINQ sentence. In the following sample, we can see the step by step debugging and also the inline values of the debugged sentences in each step.

CAUTION: if you get to a point where you need to debug some code for sure YOU NEED MORE AUTOMATED TESTS in this code.

References

– MSDN for each, https://msdn.microsoft.com/es-es/library/ttw7t8t6.aspx?f=255&MSPPError=-2147217396

– MSDN LINQ, https://msdn.microsoft.com/es-es/library/bb397926.aspx

Saludos @ AVE to Málaga

/El Bruno

#EVENT- Materials used in #Coding4Fun event at Tenerife #Tlp2015 #TlpInnova

Hola!

The day before the event I upgraded my laptop to the RTM version of Windows 10, so the demo time during the session was a stressful one. Besides this, I have an amazing time, and the people at the room seems to enjoy my presentation also. I also had the chance to spend some quality family time in Tenerife, playing with Windows 10, drones, beach, running, Loro Parque and water attractions at Siam Park. So far I’m more tired than usual !!!! And of course, I must share a BIG THANKS to the TLP Innova team, to the attendes, the colleagues and friends, I really really love Tenerife.

I get a couple of questions in Twitter about the materials, so I share an evolution/copy/paste of the stuff I already share in Andorra a couple of weeks ago.

Slides

Source Code: https://github.com/elbruno/events/tree/master/2015%2007%2017%20TLP%20C4F

Some house cleaning

– The Simple HID Write tool, can be downloaded from here (thanks Jan Axelsons!)

– The USB MAIL device I used, is similar to this one (link), you can find this cheaper if you search online

– The Heart Rate sensor I used in the Bluetooth LE demo is this one (link)

– The “Drone” connected with BLE with Windows 10 (build 10240 it should fly!!!) is a Parrot Rolling Spider (link)

Saludos @ Tenerife

/El Bruno

References

– USB Email, http://es.aliexpress.com/store/product/USB-Webmail-Notifer-USB-Webmail-Web-Mail-E-mail-Notifier-Light-for-PC-Laptop-Computer/1292922_32273404408.html

– Parrot Rolling Spider, www.parrot.com/products/rolling-spider/

– Polar Heart Rate Sensor H7, http://www.polar.com/us-en/products/accessories/H7_heart_rate_sensor

#EVENT- Materials used in Windows 10 Developer Readiness by MVPs #IoT #MVPbuzz #webcast

Hola!

I’ve just updated to Windows 10 RTM today, so there is no better time to share the source code, video and slides I used a couple of weeks ago in the webcast for Channel 9 “Windows 10 for developers”. I was talking about Internet of Things and Windows 10.

You can access the webcast in Channel 9 https://channel9.msdn.com/Events/MVP-Virtual-Conference/Windows-10-Developer-Readiness-Powered-by-MVPs/Spain; my IoT speech starts at 01:55:00 aprox.

You can also take a look at my slides in

Finally, the source code of the demos is available in GitHub https://github.com/elbruno/events/tree/master/2015%2006%2011%20Windows%2010%20Developer%20Readiness%20by%20MVPs/WuaRpi01

Tomorrow some more Windows 10 with TLP-Innova friends 😉

Saludos @ Tenerife

/El Bruno

#VS2015- New features for Error List Panel: Filters and Online Help

Hola!

I’ve been using Visual Studio 2015 as my main IDE since a while. One the things I really like about this, is I find really cool stuff almost every day. A couple of weeks ago I was in Andorra and I was sharing one of this new features with my geek friends: New features for Error List Panel: Filters and Online Help

If you worked with my, you probably know I’m not a big fan of the Error List Panel. I always recommend to read the Output Log information instead the Error List information. That’s mainly because if you are focused on one project, the Error List panel display all the build errors and is sometimes kind of a mess. That’s why, use the Output Log.

Now with Visual Studio 2015 we have a new feature: Error Filter which display build errors on

– Entire Solution

– Current Project

– Current Document

– Open Documents

Also there is a filter for build errors, Intellisense errors or both. And if the error has a public reference on MSDN, there is a link to Access to the online help.

A 10 seconds video is the best Presentation for this.

And remember, in 7 days we’ll finally get the Visual Studio 2015 RTM version 😀

References

– Visual Studio 2015, https://elbruno.com/tag/visual-studio-2015/

– Visual Studio 2015 Release Date, https://elbruno.com/2015/06/29/vs2015-final-release-date-july-20th/

Saludos @ Madrid

/El Bruno

EVENT- #Coding4Fun 2.5 at #TLP2015 #TLPInnova (Required Update)

Hola!

Next week I’ll be hosting a Coding4Session on Tenerife in TLP. The event

2000 new technologies fans, 6 days 24 hours with increased connection of the country. More than 40,000 visitors will immerse in the world of comics, film, and Manga among others.

And in TLP Innova will enjoy more than 100 hours of training workshops and conferences of the best speakers.

And a cool one, every related to TLP Innova is Free. So you only need to Review the agenda and Start choosing some sessions.

On Friday July 17th, from 16:00 to 17:00 I’ll be doing a new version of Coding4Fun 2.5, with some contents from Internet of Things, Windows 10, Visual Studio 2015, Drones, etc.

There are some other very cool sessions about Azure, Project Oxford, Web Development, Minecraft and Azure, Windows 10, etc. No sun during this day for sure 😉

Important: This one is a required update because Visual Studio 2015 and Windows 10 are in almost RTM mode. So, there are plenty of updates and some demos are broken. In example>

Date Event Demo Status
Tuesday 30 June Windows 10 IoT for Channel9 100%
Wednesday 1 July Upgrade a Windows 10 Build 10162 75%
Thursday 2 July Family trip to Andorra 75%
Saturday 4 July Coding4Fun Andorra 75%
Today Upgrade to latest versions on SO and VS ¿?

References

– TLP Innova, http://tlp-tenerife.com/tlpinnova/

– TLP Agenda, http://tlp-tenerife.com/tlpinnova/agenda/mes/?tribe-bar-date=2015-07-13

– TLP Entradas, http://tlp-tenerife.com/entradas/

Saludos @ Madrid

/El Bruno

#WINDOWS10- Display Heart Rate Band battery status in a Windows Universal App #BLE

Hola!

Series

1. Pair Heart Rate Band using Bluetooth LE to be used in a Windows Universal App

2. Create a Windows Universal App and access to Heart Rate Band information

3. Display Heart Rate Band battery status in a Windows Universal App

In my previous post, I wrote a series of steps to create a Windows Universal App and using this app read information from a Heart Rate Band. This band also exposes the battery charge as a characteristics, so we need to update our package manifest to read this value.

Now we can access to a device Service to read the battery charge value. In order to do this, we can use these lines of code

Now we can really Start to have an app displaying all this information.

Saludos @ Madrid

/El Bruno

References

– Polar Heart Rate Sensor H7, http://www.polar.com/us-en/products/accessories/H7_heart_rate_sensor

#WINDOWS10- Display live Heart Rate information in Windows Universal app using Bluetooth LE #BLE

Hola!

Series

1. Pair Heart Rate Band using Bluetooth LE to be used in a Windows Universal App

2. Create a Windows Universal App and access to Heart Rate Band information

In my previous post I wrote on how to connect the heart rate band using Bluetooth and Windows 10. In today’s post I’ll how to quicly create an app to display the heart rate values

1. Let’s create an Windows Universal App

2. Edit package manifest

Add the Bluetooth generic attribute profile [<DeviceCapability Name=bluetooth.genericAttributeProfile>]

Add [<Device Id=any>] to connect with any device

Add the heart rate service[<Function Type=name:heartRate/>]

3. Nos let’s write some source code. In the Windows Load event, we will analyze the loca Devices collection and search for the name of our device “Polar H7 498C1817”

4. Once we found the device, is time to get the device service. This BLE Service is the entry point for the characteristics of the device. This device is simple enough, and based on our settings it only publish Heart Rate information. So let-s subscribe to the ValueChanged event and enable the Notify mode.

5. Now let’s process the sensor information. We get a byte array wand the 2nd byte is the current HR value

Next one, a full app interacting with the polar device.

Saludos @ Madrid

/El Bruno

References

– Polar Heart Rate Sensor H7, http://www.polar.com/us-en/products/accessories/H7_heart_rate_sensor

ENG #EVENT- Event Materials in the #Coding4Fun event for #GapAnd2015

Hola!

Today was a great day, and we enjoyed a lot with tons of Friends in the Geek-A-Palooza event. So to all the people involved THANKS A LOT !!!

As always, is a great placer to meet old Friends and to make new ones. Now is time to share slides and source code

https://github.com/elbruno/events/tree/master/2015%2007%2004%20Gap%20Andorra

And some house cleaning

– The USB MAIL device I used, is similar to this one (link), you can find this cheaper if you search online

– The Heart Rate sensor I used in the Bluetooth LE demo is this one (link)

– The “quiet drone” Connected with BLE with Windows 10 build 10159 (it should fly!!!) is Parrot Rolling Spider (link)

o As son as I get some Solution for the issue with BLE and Windows 10 I’ll create and upload a video

o I’ll Upgrade to Windows 10 build 10162 and I’ll try again

Saludos @ Andorra

/El Bruno

References

– USB Email, http://es.aliexpress.com/store/product/USB-Webmail-Notifer-USB-Webmail-Web-Mail-E-mail-Notifier-Light-for-PC-Laptop-Computer/1292922_32273404408.html

– Parrot Rolling Spider, www.parrot.com/products/rolling-spider/

– Polar Heart Rate Sensor H7, http://www.polar.com/us-en/products/accessories/H7_heart_rate_sensor

#WINDOWS10- Pair Heart Rate Band using Bluetooth LE to be used in a Windows Universal App

Hola!

I get this from my draft post so I can write a series of posts related to Bluetooth Low Energy and Windows Universal Apps. When you create Windows Universal Apps for Windows 10, you can deploy and use them in any kind of Windows 10 device (laptop, pc, phone, etc.).

As an starting example, I’ll write a sample post on how to get heart rate information from a heart rate sensor. For this sample, I’ll use the heart rate band included with my Polar M400 (this is a smartwatch I use for running) Even if the user manual does not go deeply in the documentation, you can easily get that this is a Bluetooth Low Energy device.

So we need to go navigate to [Settings // Devices // Bluetooth] and pair de device. Windows will automatically identify the device as a “Hear Rate device” and the device to the Bluetooth devices list.

In the next post I’ll share a simple Windows 10 Project which interactis with the device.

Saludos @ Madrid

/El Bruno

References

– Polar M400, http://www.polar.com/es/productos/improve_fitness/running_multisport/m400

– Polar Heart Rate Sensor H7, http://www.polar.com/us-en/products/accessories/H7_heart_rate_sensor

Bonus: Windows Phone and Android views of the device.