BM-Bloggers

The blogs of Black Marble staff

Follow up from my session at the Black Marble Tech Update 2016

There have been some requests for more information about the areas I convered in my presentation at the Black Marble Tech Update 2016 that we held last week.

I could send out slides, but I think it is far more useful to point you at the ‘live’ resource on the Internet. The key reason for this is that the whole of the Visual Studio family is now being released at a ‘cloud cadence’ i.e. new features are appearing rapidly, so anything I write will soon be out of date. Better to look at the live sources where possible.

Hope you find these useful pointers

NDC London 2016 (Post 5 Raspberry PI, Fez Cream and Windows 10)

 

One of the things I showed at NDC was a Raspberry Pi 2 with a FEZ Cream Hat (I know that sounds just so wrong, but that is its name). The FEZ Cream offers Gadgeteer ports out of the Pi, which is just awesome. What this means in reality is you get objects to program against not ports and lines which is mush easier; for time, teaching children and me.

 

Not all gadgeteer modules are supported, mainly those that either are already on board the Pi or dont make sense (display,sd card,wifi etc), but all the ones you want are.

Development is done in Visual Studio inside a UWP application. I think this key point of the application is a C# / XAML application which is retargeted for the Pi by selecting ARM instead of x32/64. I will do a video as a follow up.

Picture1

 

Fez Cream – GHI Electronics

https://www.ghielectronics.com/catalog/product/541

Everything you need can be found in the FEZ Cream Developers' Guide.

I bought mine from Generation Robots http://www.generationrobots.com/en/

 

Here is a rough walkthrough of building and running an app on Windows 10 IOT core on a Pi, video to follow

 

You will need a Raspberry Pi 2b a SD Card ( 8Gb+ )

 

Windows 10 on PI Check List

  • Windows 10 IOT Core Dashboard is your friend download it from http://ms-iot.github.io/content/en-US/GetStarted.htm
  • Build a SD card using the core dashboard
  • Insert into Pi and Boot (wait, the first boot takes a while), remember to connect a display, for the first boot I suggest unplugging all external usb devices bar keyboard and mouse.
  • Update Visual Studio 2015 to Update 1 (if you dont have 2015, download the community edition and update that) here
  • Install the IOT core Templates from Tools-Extensions Updates into Visual Studio here
  • Build a UWP application
  • Reference Manager - Universal Windows - Extensions - Windows IOT extensions for the UWP

Select

  • Change build to ARM
  • Change Local Machine to Remote Machine, in the dialog select the IP address your PI is showing on its display
  • Deploy and Run (F5)

 

 

Tips

The management portal is Windows 10 Device Portal (IP:8080)

Set the package name in the packaging section of the package.appmanifest, so when you select it from the portal it is easy to find

Remember to shut the device down.

b.

 

 

 

 

NDC London 2016 (Post 4 Intel Edison )

 

The Intel Edison unit is great for building IOT, people have been asking where to get the bits and for more general information

intel.web.368.207

http://www.intel.com/content/www/us/en/do-it-yourself/edison.html

I would suggest getting the Arduino kit to get started with. I enjoy the Xadow(below) much more but I struggled to get the Edison updated first time on the Xadow but not the Arduino (but that could have been me).

Intel IOT https://software.intel.com/iot

Intel Examples http://www.instructables.com/id/Intel/

Intel Edison Suppliers ( for reference )

 

I also showed in my talk the Seed Studio Xadow kit, it comes with a mini screen and sensors

The Xadow kit allows you to build rather nifty devices by plugging modules together which is just superb.

300px-Xadow_Wearable_Kit_For_Edison02

http://www.seeedstudio.com/wiki/Xadow_Wearable_Kit_For_Edison

 

in the UK (for reference)

Active Robitics Stock the Xadow kit http://www.active-robots.com/xadow-wearable-kit-for-intelr-edison

b.

 

I do not recomend or warranty any suppliers, they are for reference only

NDC London 2016 (Post 1 thanks)

 

I had a great time at NDC 2016. It was a very well organised event, everybody enjoyed the event, content and the food.

Huge thanks to the great and efficient organisation by the NDC team.

Also thanks to the great people with clearly great taste who attended my talk.

I am separating the post into a few areas so I can keep updating them without people having to read long lists and work out what has changed.

 

b.

 

 

Fixing cannot load dashboard issues on BlogEngine.NET using sub blog aggregation

As I discovered during my BlogEngine upgrade, there is an effort within the project team to focus the codebase on three possible usage models on any given BlogEngine server instance:

  • Single blog with a user – a personal blog (default)
  • Single blog with many users – a team/company blog
  • Many blogs each with a single user – a set of related blogs that can be agregated togther

I needed the third option, problem was in its history our blog has been both of the other two types, so I have multiple user accounts for each blogs, and login usernames are repeated between individual blogs on the server.

This is not fundamentally an issue for a server running in the third mode, except on the primary blog that is setup to provide agregation of all the other blogs.  Even here, on a day to day basis, it is not an issue either, basic post RSS aggregation is fine. However, when you login as an administration user and try to access the dashboard you get the error

Item has already been added. Key in dictionary: 'displayname' Key being added: 'displayname'

The workaround I have used in the past was to temporarily switch off blog aggregation whenever I needed to access the primary blog dashboard – not the best solution.

After a bit of investigation of the codebase I found that this issue is due to the fact we had users  called ‘admin’ on the primary and all the child blogs. The fix I used was a bit of SQL to do some user renaming from ‘admin’ to ‘adminblogname’ . I needed to rename the username in a few tables.

AS USUAL BEWARE THIS SQL, MAKE SURE YOU HAVE A BACKUP BEFORE YOU USE IT, IT WORKS FOR ME BUT I MIGHT HAVE MISSED SOMETHING YOU NEED


update p
set p.SettingValue = concat (p.SettingValue , ' ', b.BlogName)
from be_Profiles p
    inner join be_Blogs b on
        b.BlogID = p.BlogId
where
SettingName ='displayname' and
SettingValue = 'admin';

update p
set p.UserName = concat (p.UserName , b.BlogName)
from be_Profiles p
    inner join be_Blogs b on
        b.BlogID = p.BlogId
where
username= 'admin';

update u
set u.UserName = concat (u.UserName , b.BlogName)
from be_Users u
    inner join be_Blogs b on
        b.BlogID = u.BlogId
where
username = 'admin';

update r
set r.UserName = concat (r.UserName , b.BlogName)
from be_UserRoles r
    inner join be_Blogs b on
        b.BlogID = r.BlogId
where
username = 'admin';

 

This is not a problem specific to admin users, any username duplication will cause the same error. This basic SQL script can be modified to fix any other user accounts you might have username clashes on.

Once this SQL was run I was able to login to the dashboard on the primary blog as expected.

Upgraded to BlogEngine.NET 3.2

I have just completed the upgrade of this blog server to the new release 3.2 of BlogEngine.NET. I did a manual upgrade (as opposed to the automated built in upgrade) as I needed to make a few changes from the default settings. The process I used followed the upgrade process document

  1. Downloaded the latest release and unzip the folder
  2. Run the SQL upgrade script (in /setup/sqlserver folder), this adds some new DB constraints
  3. Created a IIS web site using the new release
  4. Copied in the sample web.config from the /setup/sqlserver folder.
  5. Copied in my App_DATA folder
  6. Accessed my site

As I had not copied anything from the old custom folder, I had theme issues at this point. However, I decided to moved all the blogs to the newest generation of theme templates, so did a quick fix up by hand on each one, picking the required theme and making sure any settings, like Twitter accounts, were set (note these are set on a per blog/per theme basis, so changing a theme means you need to reenter any custom values). I also needed to copy in a few missing logos and any extra widgets from my old custom folder the blogs were using.

Once this was all done I had an upgraded blog server.

Running CodeUI tests on a VM with on remote desktop session open as part of a vNext build

If you want to run CodeUI tests as part of a build you need to make sure the device running the test has access to the UI, for remote VMs this means having a logged in session open and the build/test agent running interactivally. Problem is what happens when you disconnect the session. UNless you manage it you will get the error

Automation engine is unable to playback the test because it is not able to interact with the desktop. This could happen if the computer running the test is locked or it’s remote session window is minimized

In the past I would use a standard TFS Lab Management Environment to manage this,you just check a box to say the VM/PC is running coded UI tests and it sorts out the rest. However, with the advent of vNext build and the move away from Lab Manager this seems overly complex.

It is not a perfect solution but this works

  1. Make sure the VM autologs in and starts your build/test agents in interactive mode (I used SysInternal AutoLogin to set this up)
  2. I connect to the session and make sure all is OK, but I then disconnect redirecting the session
    • To get my session ID, at the command prompt, I use the command query user
    • I then redirect the session tscon.exe RDP-Tcp#99 /dest:console, where RDP-Tcp#99 is my session ID
  3. Once I was disconnected my CodeUI test still run

I am sure I can get a slicker way to do this, but it does fix the immediate issue

Updated:

This bit of Powershell code could be put in a shortcut on the desktop to do the job, you will want to run the script as administrator

$OutputVariable = (query user) | Out-String

$session = $OutputVariable.Substring($OutputVariable.IndexOf("rdp-tcp#")).Split(" ")[0]

& tscon.exe $session /dest:console

Live Writer becomes Open Live Writer

My primary blog editor has been Microsoft Live Writer for years, but it has always been a pain to install via Windows Essentials (as I don’t want the rest of the product), also I was never able to find the right version when I rebuilt a PC. This was not helped by the fact there has been no development of the product for years, so I struggled to remember what year version I really needed (last one was 2012 by the way).

So it is great news that the code base has gone Open Source at  http://openlivewriter.org/, and this is my first post using the new editor. Seem to work great.