Thank you everyone who attended my session at both DevConf Cape Town and Johannesburg I met so many awesome people during DevConf inside and outside of my session! Thank you for making DevConf 2024 the incredibile conference it was!
I’ve included the slides for those interested in building your own DIY Microscope, or something similar to help you with your own accessibility challenges. If you have an imaging device with some intelligence, there’s so many things you can do!
The project is using a Raspberry Pi 3B (4 and 5 works too). It is build using C# and .NET 8. The user interface is created using AvaloniaUI. There’s nothing better that Avalonia if you need to create small, incredibly fast user interfaces on Linux using .NET. I really recommend trying it out!
The backend is using Azure CosmosDB for storage. The MongoDB VCore Implementation. This is chosen for it’s vector search capabilities. Perfect for a conversational solution using OpenAI.
The whole premise of the talk was to inspire developers to think about using all these tech components in your toolbox. Both AI and IoT bits and use it for good. There’s so many solutions that could be created especially for accessibility, to make people’s life a little easier. This is also exactly why I created this Microscope, to solve my own accessibility problems when building IoT solutions. Think about what you could do!
.NET core is really easy to get up and running. Download the installer relevant to your environment from https://www.microsoft.com/net/download/core An IDE such as Visual Studio is optional. I’m going to start with the command line version as it’s really quick to get running. It also doesn’t need much resources for a development environment, which is great as I’m currently using a Samsung Tablet with 2 Gig of RAM to write this blog post.
There is a “Current” and a “LTS” version. Choose which version suites your support needs. “LTS” versions are supported for 3 years. “Current” is the latest version, and is supported for 3 months. I’m going to use “Current” here as it contains all the new juicy bits.
.NET Core Installer
The installer will take a minute or two to run. Once installed, the executable “dotnet” will be added to the path. Also different version of .NET will be installed side by side.
C:\blog\dotnet
Microsoft .NET Core Shared Framework Host
Version : 1.1.0
Build : 928f77c4bc3f49d892459992fb6e1d5542cb5e86
Usage: dotnet [common-options] [[options] path-to-application]
Common Options:
--help Display .NET Core Shared Framework Host help.
--version Display .NET Core Shared Framework Host version.
Options:
--fx-version <version> Version of the installed Shared Framework to use to run the application.
--additionalprobingpath <path> Path containing probing policy and assemblies to probe for.
Path to Application:
The path to a .NET Core managed application, dll or exe file to execute.
If you are debugging the Shared Framework Host, set 'COREHOST_TRACE' to '1' in your environment.
To get started on developing applications for .NET Core, install the SDK from:
http://go.microsoft.com/fwlink/?LinkID=798306&clcid=0x409
C:\blog\
To create a new app, there’s a “new” command. On first execution it will extract and expand, which may take a moment.
Welcome to .NET Core!
---------------------
Learn more about .NET Core @ https://aka.ms/dotnet-docs. Use dotnet --help to see available commands or go to https://aka.ms/dotnet-cli-docs.
Telemetry
--------------
The .NET Core tools collect usage data in order to improve your experience. The data is anonymous and does not include commandline arguments. The data is collected by Microsoft and shared with the community.
You can opt out of telemetry by setting a DOTNET_CLI_TELEMETRY_OPTOUT environment variable to 1 using your favorite shell.
You can read more about .NET Core tools telemetry @ https://aka.ms/dotnet-cli-telemetry.
Configuring...
-------------------
A command is running to initially populate your local package cache, to improve restore speed and enable offline access. This command will take up to a minute to complete and will only happen once.
Decompressing 100% 2294 ms
Expanding 100% 4502 ms
By default, the “dotnet new” command will create a console app. Issuing a “dotnet restore” command, all required packages will be fetched.
C:\blog\dotnet run
Project blog (.NETCoreApp,Version=v1.1) will be compiled because expected outputs are missing
Compiling blog for .NETCoreApp,Version=v1.1
Compilation succeeded.
0 Warning(s)
0 Error(s)
Time elapsed 00:00:00.6861620
Hello World!
C:\blog\
There are various project types: console, web, lib and xunittest. The type can be specified with the -t parameter. The language can be specified with the -l parameter. The available languages are C# and F#
To create a ASP .NET Core / web app, type: “dotnet new -t web”
C:\blog\web>dotnet new -t web
Created new C# project in C:\blog\web.
C:\blog\web>dir
Volume in drive C has no label.
Volume Serial Number is 4A07-921B
Directory of C:\blog\web
02/14/2017 03:12 PM <DIR> .
02/14/2017 03:12 PM <DIR> ..
11/11/2016 12:10 AM 36 .bowerrc
11/11/2016 12:10 AM 3,889 .gitignore
11/11/2016 12:10 AM 265 appsettings.json
11/11/2016 12:10 AM 214 bower.json
02/14/2017 03:12 PM <DIR> Controllers
02/14/2017 03:12 PM <DIR> Data
11/11/2016 12:10 AM 1,193 gulpfile.js
02/14/2017 03:12 PM <DIR> Models
11/11/2016 12:10 AM 239 package.json
11/11/2016 12:10 AM 574 Program.cs
11/11/2016 12:10 AM 3,397 project.json
11/11/2016 12:10 AM 2,229 README.md
02/14/2017 03:12 PM <DIR> Services
11/11/2016 12:10 AM 3,193 Startup.cs
02/14/2017 03:12 PM <DIR> Views
11/11/2016 12:10 AM 563 web.config
02/14/2017 03:12 PM <DIR> wwwroot
11 File(s) 15,792 bytes
8 Dir(s) 92,065,746,944 bytes free
C:\blog\web>
Running the web application is simple: the “dotnet run” command will make this happen. It will even host it in web container.
C:\blog\web>dotnet run
Project web (.NETCoreApp,Version=v1.1) will be compiled because expected outputs are missing
Compiling web for .NETCoreApp,Version=v1.1
C:\blog\web\project.json(5,30): warning NU1007: Dependency specified was Microsoft.NETCore.App >= 1.1.0-preview1-001153-00 but ended up with Microsoft.NETCore.App 1.1.0.
Compilation succeeded.
1 Warning(s)
0 Error(s)
Time elapsed 00:00:01.3100351
info: Microsoft.Extensions.DependencyInjection.DataProtectionServices[0]
User profile is available. Using 'C:\Users\apead\AppData\Local\ASP.NET\DataProtection-Keys' as key repository and Windows DPAPI to encrypt keys at rest.
Hosting environment: Production
Content root path: C:\blog\web
Now listening on: http://localhost:5000
Application started. Press Ctrl+C to shut down.
ASP .NET core landing page
Browsing to the URL presented: “http://localhost:5000” will display the ASP .NET core default landing page. This page is also quite useful as it contains links to various learning resources.
.NET core development can be done using any text editor, or in the cross platform lightweight editor Visual Studio Code, or if you prefer the full featured IDE Visual Studio.
Being a C# .NET developer and a Xamarin developer, it was just a matter of time before I had to have Mono on my pcDuino. A default package installation of Mono on any ARM (ARMhf) device (like the pcDuino with it’s A20 processor) at this moment is unfortunately not possible as it’s not available yet. However luckily Mono can be compiled directly on the pcDuino. I’ll share my exploration of building Mono 3.12.0 here.
Attempting to install the current Mono packages on a system with an ARMhf processor will currently yield the following unfriendly error messages:
sudo apt-get install mono-devel
Reading package lists... Done
Building dependency tree
Reading state information... Done
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:
The following packages have unmet dependencies:
mono-devel : Depends: mono-runtime (>= 2.10.1) but it is not going to be installed
Depends: libmono-cecil-private-cil (>= 3.12.0) but it is not going to be installed
Depends: libmono-cecil-private-cil (< 3.12.1) but it is not going to be installed
Depends: libmono-codecontracts4.0-cil (>= 1.0) but it is not going to be installed
Depends: libmono-compilerservices-symbolwriter4.0-cil (>= 3.6.0) but it is not going to be installed
Depends: libmono-corlib2.0-cil (>= 3.2.8) but it is not going to be installed
Depends: libmono-corlib4.5-cil (>= 3.12.0) but it is not going to be installed
Depends: libmono-peapi2.0a-cil (>= 3.2.8) but it is not going to be installed
Depends: libmono-peapi4.0a-cil (>= 3.2.8) but it is not going to be installed
Depends: libmono-relaxng4.0-cil (>= 2.10.1) but it is not going to be installed
Depends: libmono-security2.0-cil (>= 3.0.6) but it is not going to be installed
Depends: libmono-security4.0-cil (>= 3.0.6) but it is not going to be installed
Depends: libmono-system-componentmodel-composition4.0-cil (>= 3.0.6) but it is not going to be installed
Depends: libmono-system-componentmodel-dataannotations4.0-cil (>= 3.2.3) but it is not going to be installed
Depends: libmono-system-configuration-install4.0-cil (>= 1.0) but it is not going to be installed
Depends: libmono-system-configuration4.0-cil (>= 1.0) but it is not going to be installed
Depends: libmono-system-core4.0-cil (>= 3.2.8) but it is not going to be installed
Depends: libmono-system-data-linq4.0-cil (>= 1.0) but it is not going to be installed
Depends: libmono-system-data2.0-cil (>= 3.12.0) but it is not going to be installed
Depends: libmono-system-data4.0-cil (>= 3.12.0) but it is not going to be installed
Depends: libmono-system-numerics4.0-cil (>= 1.0) but it is not going to be installed
Depends: libmono-system-runtime-serialization4.0-cil (>= 1.0) but it is not going to be installed
Depends: libmono-system-runtime4.0-cil (>= 2.10.1) but it is not going to be installed
Depends: libmono-system-security4.0-cil (>= 1.0) but it is not going to be installed
Depends: libmono-system-servicemodel4.0a-cil (>= 3.2.3) but it is not going to be installed
Depends: libmono-system-web-services4.0-cil (>= 1.0) but it is not going to be installed
Depends: libmono-system-web2.0-cil (>= 2.10.3) but it is not going to be installed
Depends: libmono-system-xml-linq4.0-cil (>= 3.0.6) but it is not going to be installed
Depends: libmono-system-xml4.0-cil (>= 3.12.0) but it is not going to be installed
Depends: libmono-system2.0-cil (>= 3.12.0) but it is not going to be installed
Depends: libmono-system4.0-cil (>= 3.12.0) but it is not going to be installed
Depends: libmono2.0-cil (>= 3.6.0) but it is not going to be installed
Depends: mono-mcs (= 3.12.0-0xamarin3) but it is not going to be installed
Depends: mono-gac (= 3.12.0-0xamarin3) but it is not going to be installed
Depends: mono-xbuild (= 3.12.0-0xamarin3) but it is not going to be installed
Depends: libmono-cil-dev (= 3.12.0-0xamarin3) but it is not going to be installed
Depends: libmono-2.0-dev (>= 3.12.0-0xamarin3) but 3.2.8+dfsg-4ubuntu1 is to be installed
Recommends: mono-csharp-shell but it is not going to be installed
E: Unable to correct problems, you have held broken packages.
To solve this problem we will make our own ARMhf targeted build. Let’s start by finding a USB memory stick or a SD card with sufficient space. The Mono source repository is quite large and it occupies about two gigabytes of storage. I would suggest a size of four gigabytes or more (I used an eight gigabyte module myself). Make sure it’s formatted to the Ext file system. FAT32 will not work for compilation. I wasted a good couple of hours with error messages caused simply by the chaos caused using the wrong file system.
To figure out what to do, I referred to the official Mono documentation for the installation steps I list below. These compilation instructions can also be found here on the Mono site: http://www.mono-project.com/docs/compiling-mono/linux/
Let’s first make sure we have the tools available to build Mono.
Clone the Mono source code from the git repository.
$ cd /media/[path to your external media]
$ git clone git://github.com/mono/mono.git
The cloning of the Git repository can take a while depending on the internet connection. The size of the repository is just under two gigabytes so try to be patient.
The entire process of compilation will take about five hours on the pcDuino, so best to do this overnight..
$ cd mono
$ git checkout mono-3.12.0-branch
$ git submodule init
$ git submodule update --recursive
$ git submodule
$ ./autogen.sh --prefix=/usr/local --with-sgen=yes --with-large-heap=yes --with-xen_opt=no --enable-parallel-mark --with-libgdiplus=/usr/local/lib
$ make get-monolite-latest
$ make EXTERNAL_MCS="${PWD}/mcs/class/lib/monolite/gmcs.exe"
$ make
Build in progress!
Compiling is complete! So to conclude we will install the build locally.
$ sudo make install
Once installed check the Mono version.
$ mono --version
If you are seeing the message below, congratulations you have successfully built Mono 3.12 on your device!
Mono JIT compiler version 3.12.0 (mono-3.12.0-branch/501f5a9 Mon Feb 2 12:41:29 UTC 2015)
Copyright (C) 2002-2014 Novell, Inc, Xamarin Inc and Contributors. www.mono-project.com
TLS: __thread
SIGSEGV: normal
Notifications: epoll
Architecture: armel,vfp+hard
Disabled: none
Misc: softdebug
LLVM: supported, not enabled.
GC: sgen
For the non-adventurous or if you are just needing to save time, you can download my Mono-3.12.0 package here: http://1drv.ms/1zvLtgN
Now that we have mono installed we can explore some pcDuino .net (c#) related topics in future posts.