Sunday, September 27, 2020

Installing Ubuntu Server on an Intel® Compute Stick STK1AW32SC and making wireless work

TL/DR: To enable the WiFi adapter for STK1AW32SC on Ubuntu 20.04 LTS:
  1. sudo apt install wireless-tools
  2. sudo apt install wpasupplicant
  3. sudo ip link set wlp1s0 up
  4. sudo -
  5. wpa_passphrase Fios-F2MZ0 >> /etc/wpa_supplicant.config
    typeinyourpassphrasehere
  6. exit
  7. sudo wpa_supplicant -B -D wext -i wlan0 -c /etc/wpa_supplicant.conf
  8. sudo dhclient wlp1s0

I decided this weekend would be a good chance to break out my Intel® Compute Stick STK1AW32SC and get a modern Ubuntu on it. I had previously installed Ubuntu 18.04 on it for fun and figured that 20.04.1 LTS would be similar.  I downloaded ubuntu-20.04.1-live-server-amd64.iso from https://releases.ubuntu.com/focal/ and used Rufus to build a bootable USB stick.  I then just plugged the USB stick into one port and a keyboard into the other and got to work.  On the initial boot screen I pressed F10 to control the boot options, I choose to use the USB and started the installation.  I ran into my first problem part way through the installation.  The installer wasn't picking up the WiFi.  I then unplugged my keyboard and plugged in a USB Ethernet adapter I had lying around and then...wait.  Unplugged the keyboard.  Dang!  Ok, I found a USB Hub, plugged the USB Ethernet adapter and the keyboard into it and plugged it into the computer and finished the installation.  
Now, I want to use the WiFi but to do that I need to install the wireless-tools with:
    sudo apt install wireless-tools
Now I just need to connect to my network.  The initial round of tutorials I Binged all were based on ifconfig which wasn't installed.  I found out that it was deprecated way back in 2012, so I guess it is time to learn how to use ipConnect to WiFi network from command line in Linux is a good article that covers all the steps with the why and how and such.  For me, I ran an >ip a to get my interface name: 

1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
       valid_lft forever preferred_lft forever
    inet6 ::1/128 scope host
       valid_lft forever preferred_lft forever
3: wlp1s0: <BROADCAST,MULTICAST> mtu 1500 qdisc noqueue state DOWN group default qlen 1000
    link/ether 60:f6:77:e4:63:76 brd ff:ff:ff:ff:ff:ff
4: enx9cebe8aee3cd: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP group default qlen 1000
    link/ether 9c:eb:e8:ae:e3:cd brd ff:ff:ff:ff:ff:ff
    inet 192.168.1.208/24 brd 192.168.1.255 scope global dynamic enx9cebe8aee3cd
       valid_lft 82430sec preferred_lft 82430sec
    inet6 fe80::9eeb:e8ff:feae:e3cd/64 scope link
       valid_lft forever preferred_lft forever

and then brought the interface up with >sudo ip link set wlp1s0 up and confirmed that it was up with >sudo ip link show wlp1s0 :

[email protected]:~$ sudo ip link set wlp1s0 up
[email protected]:~$ sudo ip link show wlp1s0
3: wlp1s0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc noqueue state DOWN mode DEFAULT group default qlen 1000
    link/ether 60:f6:77:e4:63:76 brd ff:ff:ff:ff:ff:ff

Now that we have our interface up, we need to connect to it.  That means using our passphrase which we need to set up by using wpa_passphrase which we need to install with >sudo apt install wpasupplicant and then we capture and encode our pass phrase:

[email protected]:~# wpa_passphrase Fios-F2MZ0 >> /etc/wpa_supplicant.config
donotthinkiamgoingtoshowit

Now that we have that done, we can check to see that our link has been made by running >iw wlp1s0 link and confirming that we have a connection.  Alternatively we can use the command from earlier >sudo ip link show wlp1s0 

[email protected]:~$ ip link show wlp1s0
3: wlp1s0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP mode DORMANT group default qlen 1000
    link/ether 60:f6:77:e4:63:76 brd ff:ff:ff:ff:ff:ff

Now that the link is made, we need to get an IP address using >sudo dhclient wlp1s0 and we are done!

Wednesday, June 3, 2020

WEBINAR - Containers vs. PaaS: How to Choose the Right Cloud Technology

I did a webinar with Rocky Lhotka about PaaS -vs- Containers and the recording is now available:

There can be no absolute right answer to the question of Containers vs. PaaS in isolation because they both have strengths and weaknesses that match different problem sets. If you are starting a new project or planning on re-homing an existing application, there are several things that you should measure about your problem and a few things that you should know about the offerings before you make your choice. During this webinar, Magenic Chief Technology Officer Rockford Lhotka and Principal Consultant Larry Smithmier will cover the important factors to consider when choosing whether to base an implementation on containers, PaaS, or some combination of the two. The goal is to provide attendees with the tools and understanding necessary to make an informed choice between the two. Attendees will learn:
• The important differences between Containers and PaaS for most problems
• The cost of making the wrong choice
• Implementation styles to reduce the cost of migrating from one to the other
• The benefits of planning for a hybrid solution
https://magenic.com/thinking/webinar-containers-vs-paas-how-to-choose-the-right-cloud-technology

Thursday, May 28, 2020

Code Quality has a Sound?

Here is an article I had published on the Magenic site:
One technique I use when studying a subject is to compare it to another, looking for parallels and divergences. Often, I discover successful techniques in one which can be transfigured to work in the other. I also use this method to provide an efficient path to initial understanding when describing complex topics. Writing computer software is described as both a science and an art. It is useful for our understanding of evaluating the craft of software to compare it to common practices in music performance.
Read more at: https://magenic.com/thinking/the-sound-of-quality-code

Friday, February 14, 2020

Best Practices for Mentoring Junior Coders

Here is an article I had published on  the Magenic site:
This article is about mentoring junior coders, but I am going to come at it from an oblique angle so bear with me a moment. When you take laundry from the dryer, how do you fold it? If you know that you are washing two loads (weekend warrior) do you wait to fold the first load until the second load is finished and fold it all at once?...
Read more at: https://magenic.com/thinking/best-practices-for-mentoring-junior-coders

Wednesday, December 4, 2019

Benchmarking on More Platforms

In the previous article I looked at the performance of different mathematical operations and found that the Decimal operations of C# take around 10 times the time it takes for same Double.  I also found that the performance profiles of different processors vary greatly.  So, I decided to take a look at several different processors and see what other interesting things I could find.

To start with, I ran the code on my Intel Compute Stick to see how the Atom processor performed.  It actually put in a solid and relatively flat performance similar to the Core i7 we looked at last time.  Here are the addition results:
And the results for multiplication operations were:

Note that multiplication beats addition yet again.  I believe I know why, but will save the explanation for later when I dig even deeper into the underlying code that is being generated.  As a hint, take a look at the multiplication tests, I believe it is an artifact of the test rather than an actual instruction speed difference.

To get another architecture I am going to run out and buy a new computer I need to get a bit creative.  I am an Azure head, so looking at the processors available on the Virtual Machines I noticed that the Lsv2-Series run on the AMD EPYC™ 7551 processor which would be interesting.  So, I will create an L8s-v2 in the East US 2 region.  I ssh'd in and used the information from my Installing .NET Core article to install .NET Core and sftp'd in the code.  I ran the test, downloaded the results and deleted the VM (a $464.26 a month burn rate is more than I want to mess around with).  The results were...interesting.  The addition results were:

And the multiplication results were:

The multiplication results were right in line with the addition results, and the decimal was actually longer!  That is the first time the results came out like that, so we need to dig in to figure out what is going on.

Monday, December 2, 2019

All Benchmarks Lie - Or Why Benchmarking Matters

I just finished taking a C# class given by a peer at Magenic who just happens to be a Microsoft MVP for C#. :-)  I love working with smart people!  I has been at least 3-4 years since I spent any time actively learning about C#.  I have picked up other topics (like Pivotal Cloud Foundry) and languages (like Flutter) but I haven't worked on the main tool I use every day for work.  For Shame!  Ralph and I spent a bit over a year doing a Code Dojo with other developers, but that was back in 2013.

As part of the course, the question came up about why anyone would use Double when Decimal has better precision.  We talked through it in class, but I thought it would be illustrative to actually run a benchmark on sample code and show the differences.  So, I ran up a quick benchmark test and proved that addition and multiplication of Decimals are around 10 times more costly than equivalent Double operations.  My laptop results for addition were:

The results for multiplication were:

It was strange for me to see that multiplication was faster than addition, but the magnitudes were not surprising.

As the capstone for the course we had to do a project using C#, so I decided to expand on the idea of benchmarking the different operations by running the tests on different architectures.  Another peer is writing a series of blog posts on running Kubernetes on a Raspberry Pi cluster and I happened to have a Pi 3 A+ that I am using for another project so it was an obvious first choice.  The results were similar, but somewhat less consistent.  The decimal operations cost about 10 times that of the others, but the  byte multiplication operations are almost twice as fast as the long integer multiplication operations.  There were also a greater difference between the multiplication operations and the addition operations.  Here are the addition results:

And here are the results for multiplication:

I have an older Dell PowerEdge R710 that I picked up from TechMikeNY last year to play with some Cloud Foundry stuff so I decided to see what the Xeon processors looked like running the same code.  This is more like what would be expected to be seen in a production environment.  The addition results look like:

And the multiplication results were:

Wow!  Those results looked significantly different than the previous ones.  For one thing, these are the first results that I had seen with the MultiModalDistribution warnings, so I ran them again to make sure the results were consistent.  The results were similar, but not the same.  They were more similar to each other than to the other architectures.  Here are the results for the addition tests:
And here are the results for the multiplication tests:

I went on to do tests on a couple of different Azure VMs, but I am going to save that is for a different article. :-)  I also have plans to dig into these differences a little more and see if I can't track down the underlying causes for the displayed differences.

Saturday, November 30, 2019

Installing .NET Core (quick hit)

I am working on a series of articles and need to install .NET Core 3.0 on various Linux platforms.  This is just a quick article so that I can find these links later:

  1. Centos, Redhat, Fedora, Debian, Ubuntu, SUSE, or OpenSUSE:
    https://docs.microsoft.com/en-us/dotnet/core/install/linux-package-manager-centos7
  2. Raspbian:
    https://edi.wang/post/2019/9/29/setup-net-core-30-runtime-and-sdk-on-raspberry-pi-4
  3. And finally, I need to get Mono installed in the same as well as Windows:
    https://www.mono-project.com/download/stable/