#Python – The best way to explain how jupyter notebooks works with Visual Studio Code @Code

Hi !

So, after my yesterday post [Edit and work with Jupyter notebooks in Visual Studio Code], today some people asked me how the Jupyter Notebooks and Python integration works.

The best way to explain this is with a simple animated video with the following actions

  • Create a cell using the prefix # %%
  • Run the cell and display the output in Python Interactive
  • Create a new cell
  • Run the new cell and the previous one
  • Analyze output in Python Interactive

I think this 15 seconds are good enough to understand the benefits of Jupyter Notebooks and Visual Studio Code.

Happy Coding!

Greetings @ NY

El Bruno

References

Advertisements

#VSCode – Edit and work with #jupyter notebooks in Visual Studio Code

Hi !

I’ve been using Python and Jupyter notebooks more and more. And somehow, during this learning path I also realize that I can use Visual Studio Code to code amazing Python apps, and also to edit and work with Jupyter notebooks.

If you are VSCode python developer, you may know some of the features available in the tool. I won’t describe them, because you may find the official documentation very useful (see below links or references).

The Python extension provides many features for editing Python source code in Visual Studio Code:

However, during the part months I’ve also working a lot using Jupyter notebooks, and I was very happy when I realize that VSCode also have some cool features to work with notebooks. The core of the notebooks are cells, and we can use them with the prefix #%%.

This is how it looks inside the IDE, running a cell in the code

Another interesting feature is to run notebooks in a remote Jupyter server, maybe using Azure Notebooks. I haven’t tried this one, and it’s on my ToDo list for the near future.

On top of adding cells features into standard python [.py] files, we can also edit standard Jupyter files. I’ve installed jupyter into one of my anaconda local environments, and now I can edit files inside VSCode.

First, I’ll be prompted to import the file as a standard python file

And, done! Now I got my Jupiter notebook inside VSCode

The final step will be to export my file or debug session, and for this we have the command [Python: Export …]

Super useful!

Happy coding!

Greetings @ NY

El Bruno

References

#event – #DeepLearning for everyone @chicagocodecamp

Photo by Venkata Goli on Pexels.com

Hi !

So, I ‘m lucky enough to be part of the Speakers in the amazing Chicago CodeCamp on May 11th. This will be my perfect excuse to visit the city of Chicago and also to meet some of the amazing people in the Chicago Tech Community.

My session will be about Deep Learning for regular devs (like myself)

Deep Learning for Everyone

You probably read a lot about Machine Learning and Deep Learning these days; however, if you are a standard developer (like me), is hard to find a way to start with ML or DL. So, let’s avoid learning specific ML languages and tools, and let’s have some fun using a popular language like C# to create a DL model. And, let’s also try to run this model in a popular device like a Raspberry Pi (why not?). We may add some cloud, and some IoT pieces to the scene, however, keep in mind that during this session the idea is to LEARN and HAVE FUN. Creating something from zero is one of the best ways to understand how Deep Learning works!

More information: https://www.chicagocodecamp.com/

Happy Coding !

Greetings @ Burlington

El Bruno

#Humor – To Understand Recursion, You Must First Understand Recursion (Note: #Google does Understand Recursion)

Just search for recursion in Google, and you’ll get the joke …

Greetings @ Burlington

El Bruno

#Office – #Clippy is back in Office for Windows and Mac (powered by #AI)

Hi !

So, after my post yesterday, about the suggestions in Outlook based on an email content, somebody asked me why they don’t see this in Outlook.

I was sharing my experience in Outlook for Mac, in Windows we can find a [Suggested Meeting] option on top of the email content.

And then, when we expand the section, we may find the related meeting information

Happy coding!

Greetings @ Toronto

El Bruno

My posts

#Office – Clippy is back in Office (powered by #AI)

Hi !

I’ve already share some of the new AI features in Office, like Excel Ideas or real-time captions / subtitles in PowerPoint.

Today I’ll switch to Office editor, to share something amazing. I added Clippy to this post title and the idea is similar to the Clippy intents a long time ago:

An AI assistant will analyze the text while you are writing it or reading it, and it will suggest actions related to this text.

A single image is the best way to show this

I received this email last week and I notice that part of the text was automatically highlighted and show an amazing suggestion. It seems that the Word, Outlook editor is becoming more and more intelligent.

And I’m really looking forward to some extensibility SDK, so someone can really bring back Clippy at 100%

Happy coding!

Greetings @ Toronto

El Bruno

My posts

#Hololens – Developer Resources for #Hololens2

Hi !

Hololens 2 are on the way to some selected group of developers, so it’s time to start to collect and group some dev resources for the not so near future.

Let’s start with a couple of tweets

There is also a new Mixed Reality Toolkit, available as usual in GitHub https://microsoft.github.io/MixedRealityToolkit-Unity/README.html

What is the Mixed Reality Toolkit

MRTK is a Microsoft driven open source project.

MRTK-Unity provides a set of foundational components and features to accelerate MR app development in Unity. The latest Release of MRTK (V2) supports HoloLens/HoloLens 2, Windows Mixed Reality, and OpenVR platforms.

  • Provides the basic building blocks for unity development on HoloLens, Windows Mixed Reality, and OpenVR.
  • Showcases UX best practices with UI controls that match Windows Mixed Reality and HoloLens Shell.
  • Enables rapid prototyping via in-editor simulation that allows you to see changes immediately.
  • Is extensible. Provides devs ability to swap out core components and extend the framework.
  • Supports a wide range of platforms, including
    • Microsoft HoloLens
    • Microsoft HoloLens 2
    • Microsoft Immersive headsets (IHMD)
    • Windows Mixed Reality headsets
    • OpenVR headsets (HTC Vive / Oculus Rift)

Input Simulation Service

The Input Simulation Service emulates the behaviour of devices and platforms that may not be available in the Unity editor. Examples include:

  • HoloLens or VR device head tracking
  • HoloLens hand gestures
  • HoloLens 2 articulated hand tracking

As usual, a video is the best way to describe this

Unreal Engine 4.22 released

New: HoloLens Remote Streaming Support

Unreal Engine 4 now supports Holographic Remoting through the Windows Mixed Reality plugin! This allows Unreal applications to run on a Windows desktop PC and stream the rendered result wirelessly to HoloLens over a Wi-Fi connection in real time.

Happy coding!
Greetings @ Toronto

Resources

#Flow – Stop a screen saver using Flic buttons, @microsoftflow processes, @powershell and much more ! (Thanks @ShortcutLabs)

Hi !

Running an Innovation Center is half challenge, half fun. Everybody expect to have amazing experiences, and they must also be up and ready all the time! We are now updating / upgrading out Toronto IC, with all the new screens, we have some challenges and the screen savers is a good one.

The scenario is very simple: we have several Windows 10 machines connected to screens, and they go offline automatically until the W10 device screen gets back online. That’s the current scenario, however, before this I was working with the standards Windows 10 screen savers.

And I was wondering if I can find a fun way to disable all the screen savers at once using some kind of cool technology. So, after some tweets from @ChloeCondon where she described a cool scenario using Flic buttons, I decided to give them a try. And in my mind this is the process to follow

  • Click on a Flic button
  • Trigger a MS Flow
  • MS Flow will disable the screen saver

It’s seems easy and the connection between Flic and Microsoft Flow is already in preview! We can connect the events click, double click and hold to Microsoft Flow.

F1 settings for a button

The next step is to create a flow to process the event. Somehow I need to send a signal to the physical Windows 10 device to stop the screen saver. In my scenario, the signal will be the creation or update of a file in the remote machine (this is important, so I bolded it!) My 1st idea was to use Microsoft Flow Gateways, which seems to be the perfect tool to share data on-premise with Flows on the cloud.

So I created a blank Flow and added the Flic button trigger. The trigger settings allows me to select the type of event to hookup in the Flow.

01 microsoft flow flic button trigger02 microsoft flow flic button settings

And now it was time to setup my next step, the amazing Gateways. And, I didn’t like it. Hard coding paths, user names or password is usually a bad idea. And, after some minutes installing the gateway in a single machine, and this configuration screen, I decided to run some KMs and look for other options.

03 microsoft flow gateway file system configuration

Lucky me, I already have a distributed cloud File System, very reliable and secure running in all my demo machines: OneDrive. And OneDrive have tons of triggers and actions available for Microsoft Flow!

So I updated my scenario with the following steps

  • Click on a Flic button
  • Trigger a MS Flow
  • MS Flow will save a file in OneDrive
  • Somehow this file will disable the screen saver

And the Flow was very simple

04 microsoft flow flic button trigger and save a OneDrive file

Some notes here. The convertTimeZone() is a custom expression I created to have a unique File Name for each created file:

convertTimeZone(utcnow(),’UTC’,’W. Europe Standard Time’,’yyyy MM dd HH mm ss’)

The file content is Flic button information. I really don’t need this, but you never know :D. A sample list of created files:

onedrive files created by flic clic

I’m almost there. Every time I click my Flic button, after a couple of seconds I got a new file in each Windows 10 machine. So now I need some kind of File System Watcher to detect changes and stop the screen saver. I was thinking to create a simple .Net Core Console App to do this, and then I remember:

My ITPro friends usually do magic using PowerShell

A quick search returned this amazing post from Jessica Cook: Flow of the Week: Local code execution and she got almost everything I need. She is using gateways to save a local file and then she uses PowerShell to look for changes into a specific folder. I made some modifications to her PS script and I got my working one:

$watcher = New-Object System.IO.FileSystemWatcher
$watcher.Path = "<Folder to Watch>"
$watcher.Filter = "*.*"
$watcher.IncludeSubdirectories = $true
$watcher.EnableRaisingEvents = $true 
$action = {
Start-Process "taskkill /f /im bubbles.scr"
} 
Register-ObjectEvent $watcher "Created" -Action $action
while ($true) {sleep 5}

And done! I added my PowerShell script to the startup of the Windows 10 machine and it was amazing. A couple of seconds later after the clic, OneDrive sync the files, the PS script detect a new file and it stop the screen saver!

At the end my full process is

  • Click on a Flic button
  • Trigger a MS Flow
  • MS Flow will save a file in OneDrive
  • PowerShell script look for new files in the OD folder
  • When a new file is detected, PS script will kill the Screen Saver process

Of course, there is some room for improvement. Like in example, try to do something nicer than kill a windows process. I’ve tried sending keys or moving the mouse using PowerShell but it didn’t work. The kill process is the one!

Also, this is not real-time. Sometimes it sync and works in 1 second and sometimes it tooks 10 seconds, but it’s a great hack to connect dots and use some cool tech.

Happy coding!

Greetings @ Toronto

El Bruno

References

#Event – Resources used during the #GlobalAINight @metrotorontoUG

 

Hi  !

After an amazing event with my friends from Metro Toronto UG, it’s time to share some resources. It was initially supposed to be focused only on Azure Notebooks, but somehow we spend a lot of time talking about Cognitive Services and Custom Vision, that was great!

Let’s start with the 15 min Keynote video:

My Slides

And some interesting online resources

My posts on Custom Vision and ONNX

  1. Object recognition with Custom Vision and ONNX in Windows applications using WinML
  2. Object recognition with Custom Vision and ONNX in Windows applications using WinML
  3. Object recognition with Custom Vision and ONNX in Windows applications using Windows ML, drawing frames
  4. Object recognition with Custom Vision and ONNX in Windows applications using Windows ML, calculate FPS
  5. Can’t install Docker on Windows 10 Home, need Pro or Enterprise
  6. Running a Custom Vision project in a local Docker Container
  7. Analyzing images in a Console App using a Custom Vision project in a Docker Container
  8. Analyzing images using PostMan from a Custom Vision project hosted in a Docker Container
  9. Building the CustomVision.ai project in Docker in a RaspberryPi
  10. Container dies immediately upon successful start in a RaspberryPi. Of course, it’s all about TensorFlow dependencies
  11. About ports, IPs and more to access a container hosted in a Raspberry Pi
  12. Average response times using a CustomVision.ai docker container in a RaspberryPi and a PC

Windows 10 and YOLOV2 for Object Detection Series

Greetings @ Toronto

El Bruno