latest posts

After a failed attempt earlier this week (see my post from Tuesday night) to utilize the CLR that is bundled with Windows IoT, I started digging around for an alternative. Fortunately I was on Twitter later that night and Erik Medina had posted:



Not having any time Wednesday night to dive in, I spent a few hours Thursday night digging around for the Mono for Windows IoT. Fortunately, it was pretty easy to find Jeremiah Morrill's Mono on Windows IoT Blog post, download his binaries and get going.

For those wanting to use Xamarin Studio or MonoDevelop instead of Visual Studio after downloading the binary from Jeremiah, you'll need to add mcs.bat to your bin folder, with the following line (assuming you've extract the zip file to mono_iot in the root of your C drive):
[bash] @"C:\mono_iot\bin\mono.exe" %MONO_OPTIONS% "C:\mono_iot\lib\mono\4.5\mcs.exe" %* [/bash] For whatever reason this wasn't included and without it, you'll receive:
[bash] Could not obtain a C# compiler. C# compiler not found for Mono / .NET 4.5. [/bash] Inside of Xamarin Studio, goto Tools -> Options and then scroll down to Projects -> .NET Runtimes and click add to the root of the mono_iot folder. After you've added it, it should look like the following (ignoring the Mono 3.3.0 that I installed separately):

Xamar<span classin Studio with Mono for Windows IoT setup" />

In addition you'll need to copy the lib folder to your Galileo and at least mono.exe and mono-2.0.dll, both found in the bin folder from Jeremiah's zip file to the folder where you intend to copy your C# executable. You could alternatively after copying over the entire mono_iot folder structure add it to the path like so (assuming once again you've extracted to c:\mono_iot) over a Telnet session:
[bash] C:\mono_iot\bin>setx PATH "%PATH%;c:\mono_iot\bin" SUCCESS: Specified value was saved. [/bash] In order for the path variable to update, issue a shutdown /r.

If you want to see the existing variables and their values you can issue a set p which will list the following after you've rebooted your Galileo:
[bash] Path=C:\windows\system32;C:\windows;C:\wtt;;c:\mono_iot\bin PATHEXT=.COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.MSC PROCESSOR_ARCHITECTURE=x86 PROCESSOR_LEVEL=5 PROCESSOR_REVISION=0900 ProgramData=C:\ProgramData ProgramFiles=C:\Program Files PROMPT=$P$G PUBLIC=C:\Users\Public [/bash] With the environment variable updated, you'll no longer have to either copy the mono executable to the folder of your app nor include the full path over Telnet - definitely a time saver in my opinion.

Now back to deploying my little WebClient test from Tuesday with Mono...

From Visual Studio you don't need set anything up differently, however I was running into issues with the app.config when compiling from Visual Studio and deploying a little test app to my Galileo:
[bash] System.AggregateException: One or more errors occurred ---> System.TypeInitializationException: An exception was thrown by the type initializer for System.Net.HttpWebRequest ---> System.Configuration.ConfigurationErrorsException: Error Initializing the configuration system. ---> System.Configuration.ConfigurationErrorsException: Unrecognized configuration section [/bash] So I went back to using Xamarin Studio, but received the following:
[bash] System.Net.WebException: An error occurred performing a WebClient request. ---> System.NotSupportedException: http://www.bing.com at System.Net.WebRequest.GetCreator (System.String prefix) [0x00000] in :0 at System.Net.WebRequest.Create (System.Uri requestUri) [0x00000] in :0 at System.Net.WebClient.GetWebRequest (System.Uri address) [0x00000] in :0 at System.Net.WebClient.SetupRequest (System.Uri uri) [0x00000] in :0 at System.Net.WebClient.OpenRead (System.Uri address) [0x00000] in :0 --- End of inner exception stack trace --- at System.Net.WebClient.OpenRead (System.Uri address) [0x00000] in :0 at System.Net.WebClient.OpenRead (System.String address) [0x00000] in :0 at (wrapper remoting-invoke-with-check) System.Net.WebClient:OpenRead (string) [/bash] Not a good sign - essentially saying WebClient isn't supported. Got me thinking to verify the version of Mono from Jeremiah:
[bash] C:\>mono -V Mono JIT compiler version 2.11 (Visual Studio built mono) Copyright (C) 2002-2014 Novell, Inc, Xamarin Inc and Contributors. www.mono-project.com TLS: normal SIGSEGV: normal Notification: Thread + polling Architecture: x86 Disabled: none Misc: softdebug LLVM: supported, not enabled. GC: Included Boehm (with typed GC) [/bash] From the 2.x branch not the newer 3.x branch like what I utilize at work for my iOS and Android development, but not wanting to go down the path of creating my own 3.x port I kept diving in - attempting to try the HttpClient that I knew wasn't supported by Windows IoT's CLR. I threw together a quick sample to pull down the compare results from jcBENCH to the console:
public async Task < T > Get < T > (string url) {
     using (var client = new HttpClient()) {
     var result = await client.GetStringAsync(url); return JsonConvert.DeserializeObject < T > (result); }
}
public async void RunHttpTest() {
     var result = await Get < List < string > > ("http://www.jcbench.com/api/CompareResults"); foreach (var item in result) {
     Console.WriteLine (item); }
}
]]>
As far the project was concerned I added the .NET 4.5 version of Newtonsoft.Json.dll to the solution via NuGet and made sure it was copied over during deployment. With a bit of a surprise:
[bash] C:\winiottest>mono winiottest.exe AMD A10-4600M APU with Radeon(tm) HD Graphics AMD A10-7850K Radeon R7, 12 Compute Cores 4C 8G AMD A6-3500 APU with Radeon(tm) HD Graphics AMD A6-5200 APU with Radeon(TM) HD Graphics AMD Athlon(tm) 5150 APU with Radeon(tm) R3 AMD Athlon(tm) 5350 APU with Radeon(tm) R3 AMD C-60 APU with Radeon(tm) HD Graphics AMD E-350D APU with Radeon(tm) HD Graphics AMD E2-1800 APU with Radeon(tm) HD Graphics AMD FX(tm)-8350 Eight-Core Processor AMD Opteron(tm) Processor 6176 SE ARMv7 Processor rev 0 (v7l) ARMv7 Processor rev 1 (v7l) ARMv7 Processor rev 2 (v7l) ARMv7 Processor rev 3 (v7l) ARMv7 Processor rev 4 (v7l) ARMv7 Processor rev 9 (v7l) Cobalt Qube 2 Intel Core 2 Duo Intel Core i5-4300U Intel(R) Atom(TM) CPU Z3740 @ 1.33GHz Intel(R) Core(TM) i3-2367M CPU @ 1.40GHz Intel(R) Core(TM) i7-4650 Intel(R) Quartz X1000 Intel(R) Xeon(R) CPU E5-2695 v2 @ 2.40GHz Intel(R) Xeon(R) CPU E5440 @ 2.83GHz PowerPC G5 (1.1) R14000 UltraSPARC-IIIi [/bash] I should note even with the newly added Sandisk Extreme Pro SDHC card, the total time from execution to returning the results was around 10 seconds, where as on my AMD FX-8350 also hard wired it returns in less than a second. Given that also the Galileo itself is only 400mhz - you definitely won't be running a major WebAPI service on this device, but there are some definite applications (including one I will be announcing in the coming weeks).

More to come with the Galileo - I received my Intel Centrino 6235 mPCI WiFi/Bluetooth card yesterday and am just awaiting the half->full length mPCIe adapter so I can mount it properly. With any luck I will receive that today and will post on how to get WiFi working on the Galileo under Windows IoT.

After doing some research last night, it looks as though there is limited C# support on the Intel Galileo when using Windows IoT (see my Intel Galileo and Windows IoT post for more information on both the Intel Galileo and Windows IoT) per this August 20th, 2014 post from Pete Brown. This got me thinking what exactly is supported?

Checking the usual folder for Microsoft .NET under c:\Windows\Microsoft.Net was non-existent, so I started poking around. Low and behold under the c:\Windows \System32\CoreCLR\v1.0 folder all of the CLR dlls live.

Windows IoT CoreCLR Dlls
In looking at the list, Pete Brown was correct, outside of the System namespace we've got 0 support, but we do have LINQ, XML Support, Collections and IO. What about adding in let's say System.Net.Http?

Trying a simple HttpClient test with the System.Net.Http copied unfortunately gave a System.BadImageFormatException:
[bash] Unhandled Exception: System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.BadImageFormatException: Could not load file or assembly 'System.Net.Http, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. Reference assemblies should not be loaded for execution. They can only be loaded in the Reflection-only loader context. (Exception from HRESULT: 0x80131058) ---> System.BadImageFormatException: Cannot load a reference assembly for execution. --- End of inner exception stack trace --- at winiottest.Program.Main(String[] args) --- End of inner exception stack trace --- at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor) at System.Reflection.RuntimeMethodInfo.UnsafeInvokeInternal(Object obj, Object[] parameters, Object[] arguments) at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture) at AppDomainManager.HostMain(Int32 argc, Char** argv, Char* assemblyToRun, Int32 flags) [/bash] So I got thinking of using the older WebClient with the following code block:

static void Main(string[] args) {
     using (var webClient = new WebClient()) {
     using (var stream = webClient.OpenRead(new Uri("http://jcbench.azurewebsites.net/api/CompareResults"))) {
     using (var streamReader = new StreamReader(stream)) {
     var result = streamReader.ReadToEnd(); var list = JsonConvert.DeserializeObject>(result); foreach (var item in list) {
     Console.WriteLine(item); }
}
}
}
}
]]>
However, I received a System.IO.FileNotFoundException:
[bash] Unhandled Exception: System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.IO.FileNotFoundException: Could not load file or assembly 'System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' or one of its dependencies. The system cannot find the file specified. at winiottest.Program.Main(String[] args) --- End of inner exception stack trace --- at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor) at System.Reflection.RuntimeMethodInfo.UnsafeInvokeInternal(Object obj, Object[] parameters, Object[] arguments) at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture) at AppDomainManager.HostMain(Int32 argc, Char** argv, Char* assemblyToRun, Int32 flags) [/bash] At this point, I thought well what exactly is supported in the System.Net namespace? So I copied over the System.ni.dll from the c$\Windows\System32\CoreCLR\v1.0 path and opened it in the Object Browser inside of Visual Studio 2013 only to see not a lot is implemented...

Windows IoT System Dll
So at this point I ran out of ideas as far as getting any sort of System.Net component in C# at this time. Crossing my fingers it is on the horizon as I have a few ideas I'd love to implement in C# as opposed to C++ with the Galileo board.



Digital Personal Workstation 433a - Internet Explorer 2

After installing Windows NT 4 on my Digital Personal Workstation 433a and realizing I was going to be browsing the web on it with Internet Explorer 2.0, I started the arduous process of updating my installation to more recent versions of software.

First thing I did was install Service Pack 6 for Windows NT 4. Remembering back in the day on my Pentium how unstable NT 4 was pre-service pack 3, I figured this would be the best first step.

Having couldn't find Service Pack 6 for Windows NT 4 on Microsoft's website, I figured I would make the file available locally here.

After downloading SP6, click the Accept checkbox and then Install:

Digital Personal Workstation 433a - Windows NT 4 SP6

Digital Personal Workstation 433a - Windows NT 4 SP6 Installing

Digital Personal Workstation 433a - Windows NT 4 SP6 Finshed

Roughly five minutes later, click the Restart button and upon rebooting, the startup screen reflects the update:

Digital Personal Workstation 433a - Windows NT 4 SP6

Next up, I wanted to update Internet Explorer to the latest available which happens to be version 5. Like Service Pack 6, it was an effort in a half to find Internet Explorer 5 for NT4 Alpha. To make it easier for folks, you can download it here.

Digital Personal Workstation 433a - Windows NT 4 Internet Explorer 5 installed

Digital Personal Workstation 433a - Windows NT 4 Internet Explorer 5 installed

After extraction and installation, I was pleasantly surprised at how fast the browser was. After attempting to browse the internet with Firefox 3 on my "faster" Quad 700mhz Silicon Graphics Tezro, it was refreshing and a confirmation that web browsing on IRIX definitely needs to be readdressed at some point as I briefly discussed in my Cloud Based Web Rendering? post back in January 2012.

What's next? Getting Visual Studio 6 installed and diving into FX!32.
Had an unusual experience this morning when attempting to deploy an iOS MonoTouch app to a local iMac instead of the one I had previously done over the VPN from home to my office. The Build Server Icons on the Visual Studio 2012 Command Bar were all greyed out and for the life of me I could not find a context menu to have it refresh the available build hosts. Some digging into the documentation, the actual option is under TOOLS -> Options... -> Xamarin -> iOS Settings like so: [caption id="attachment_1930" align="aligncenter" width="300"]Xamarin iOS Settings in Visual Studio 2012 Xamarin iOS Settings in Visual Studio 2012[/caption] Once on that dialog, click "Configure..." and then you'll get a dialog like so, and click on the Mac you wish to deploy to: [caption id="attachment_1931" align="aligncenter" width="300"]Xamarin iOS Build Host Xamarin iOS Build Host[/caption]
I had previously been using Visual Studio 11 for the WinRT feature, but hadn't messed with the ASP.NET component. I have to say it much improved over 2010, even down to the base template that comes with the "default" ASP.NET Web Application. [caption id="attachment_1012" align="aligncenter" width="300" caption="Early jcPIDR Web Application using .NET 4.5 Screenshot"][/caption] Not being a Web Designer at heart, I am pretty happy with what comes out of the box. It allows me to focus on the code rather than CSS. More to come later this week...
Been working on my Silicon Graphics O2 a lot and surprisingly it's pretty responsive for directory browsing, C/C++ source code editing/compiling and software installation. For a 16 year old 180mhz machine with only 192mb of memory I am really shocked what an optimized and lightweight operating system can do. For web browsing, FLAC music playing etc, it won't stand up against my Phenom II X6, but for everything I'm doing, it is neck and neck. This thought got my thinking, everyday new cpus/apus, gpus etc come out, the last generation is put into bargain bins or rebadged as a lower end part of the next generation. I'm voting to rethink "computer performance", at least its definition. If someone running Microsoft Word, Zune and Chrome on a Windows 7 machine with 6 cores and 16gb ram notices no difference when he or she is on 2 core, 4gb ram system, then why justify the badging of that machine as a lowerend? To me it is all relative to what you're actually doing. I can browse to a C++ file from a terminal window, open it in vi and start editing on my SGI O2 faster than I could open up Visual Studio 2010, then browse to the project and start coding on my Phenom II system. It saddens me to know that so many people will frown upon not top of the line specs even if they are only going to use 50% of the power available. Gluttony it seems has taken hold of consumers...
I was reading about AMP the other night, basically a light weight C++ wrapper that is used to offload tasks to your GPU. I was going to brush off my C++ skills tonight, but luckily I don't have to after reading this article. WinRT makes using C++ libraries a breeze, finally you don't have to use p/invoke. I'll definitely be playing around with this as soon as my Visual Studio 11 installation issues get resolved. A word to the wise, if you're installing Windows 8, install it with the Developer Tools. I made the mistake of installing the non-developer tools Windows 8 Developer Preview, which doesn't install the necessary SDK for C++ compiling. If you're only doing C#, I had no trouble programming/compiling WPF and WCF apps.
Finally got a Silicon Graphics Visual Workstation 330. Not a traditional Silicon Graphics by any means, but the case was neat and fufills a nostalgic purpose. [caption id="attachment_29" align="aligncenter" width="550" caption="SGI VS 330 in box"][/caption] [caption id="attachment_31" align="aligncenter" width="550" caption="SGI VS 330 Sideview"][/caption] Not wanting to be limited to Dual Pentium 3 933mhz CPUs and no SATA support, I used a spare CPU, ram and motherboard I had laying around. [caption id="attachment_32" align="aligncenter" width="550" caption="Asus M4A89GTD/USB3, Corsair XMS3 16gb, Athlon II X3 435 and Crucial 64gb"][/caption] In addition I swapped out the rear fan, being 11 years old it was quite noisy. I had a spare CoolerMaster 120mm low-rpm Blue LED fan that fit perfectly in the back. All in all, pretty smooth swap. Downloaded the Network Install CD of OpenSuse 12.1, installed it and was ready to go in under an hour. In it's completed form: [caption id="attachment_33" align="aligncenter" width="550" caption="Completed swap of parts out of the SGI VS 330"][/caption] All that's left now is to de-scuff the case to bring it back closer to a new state.