Sunday, 12 November 2017

How to install JetPack 3.1 on Nvidia Jetson TX2

Earlier this year I was writing about How to install JetPack on Jetson TX1. Soon after (in March) NVIDIA released a new version of the Tegra processor, TX2, and also its development board, Jetson TX2. Consequently, a new version of JetPack development toolset was released as well, with the major version increased to 3. See here the full spec of the Jetson TX2 Module and the Development Kit.

Jetson TX2 with connected peripherals on the right side: Ethernet, HDMI, USB (4-way USB hub for connecting keyboard, mouse and memory stick), micro USB (connected to host PC), 2 Wi-Fi antennas, power plug 
I got hold of Jetson TX2 and the first thing I did was installing the latest version of JetPack on my host machine and also on the Jetson board.

Jetson TX2

One significant change I noticed was that it is not necessary to switch back to Ubuntu 14.04 on a host machine anymore - entire installation goes well with running Ubuntu 16.04 (16.04.3 in my case) on the host. This is still not official recommendation though - official JetPack installation guide states that Ubuntu 14.04 is required.

Tegra TX2 module is under this heat sink and fan

Entire installation process is very similar to installing JetPack 2 on TX1. Nevertheless, I'll show you here all necessary steps.

Download first JetPack installer from Jetson Development Pack download page. At the time of writing, the latest was version 3.1: JetPack-L4T-3.1-linux-x64.run. Place it in the folder on the host machine where you intend to install JetPack. I chose /opt/JetPack. Make the file executable, either in Terminal or by right-clicking the file and opening Properties dialog: 



Running the installer from the terminal:


...opens an Installation Wizard:


We'll confirm the installation directory and Jetson module:



Installation requires elevation of privileges:


Component Manager opens where we have to select JetPack version we want to install and also Jetson module:


If we have previous version of the JetPack installed, we can uninstall it by selecting that version and set the Action to uninstall:


Component Manager shows suggested actions for each component for the selected JetPack and Jetson module. Components are grouped into two groups: Host (Ubuntu) and Target (Jetson).


We have to accept legal stuff:


...after which downloading of the installers for each component starts:


After all installers are downloaded and just before the installation starts, Component Manager will warn you to stay at your keyboard as your input might be required. When we hit Next button, installation starts.


Installation on the host will eventually be completed:


Now select your network configuration. In my case both host (PC with Ubuntu) and target (Jetson TX2) were connected to the local router (both via WiFi):


In the next step we have to select network interface through which is the host machine connected to the same network as the Jetson. Run ifconfig to get the names of all interfaces:


...then select in the Wizard the one connected to the local router:


In the next step Jetpack installer lists all actions that will be performed on the Jetson:


JetPack installer opens a separate Terminal window (on the host) with instructions on how to manually prepare Jetson for flashing:


Once Jetson is in recovery mode, host sees it as the USB device.


Flashing then starts:



Once flashing of the Linux for Tegra on the Jetson is done (via USB cable), installation of all Nvidia JetPack modules selected earlier starts. This happens via SSH connection so installer is trying to determine target's IP address:


Here I rebooted my Jetson after a while as thought Installation was stuck in this state forever...and later re-ran Jetson Installer. This was probably not necessary as next time I got the same message but waited a bit more after which I was prompted for entering the IP manually:




 JetPack installer will now push all modules listed below via SSH tunnel:



Installation of the modules eventually completes:


After closing the Terminal window, JetPack Installer Wizard shows the last page where we can opt for removing all module installers from the host machine:


In order to verify that installation was indeed successful, we can run the OceanFFT application - a demo suggested by Nvidia:



The duration of the entire installation process depends on the host's processing power and internet speed. With fast hosts and broadband connections it could last about 15 minutes.

What are your experiences with installing JetPack on TX2? Did you also have success with running Ubuntu 16.04 on the host PC?

How to find Windows Product Key

Thursday, 26 October 2017

How to save paths from Search results in Windows Explorer

From time to time I want to document location(s) of some file on my system. I usually use Total Commander which has built-in functionality of copying the paths of selected files but it is possible to achieve the same in good old Windows Explorer. Once search is complete and all results are displayed, select them all with CTRL+A, hold down SHIFT key and do the right click anywhere on the selection. In the context menu which appears, find and click on Copy as path. All paths are now copied in the clipboard.


Now I can paste all paths:


"C:\Windows\SysWOW64\ucrtbase.dll"
"C:\Windows\WinSxS\wow64_microsoft-windows-ucrt_31bf3856ad364e35_10.0.16299.15_none_d9020b8bbf051ead\ucrtbase.dll"
"C:\Windows\System32\ucrtbase.dll"
"C:\Windows\WinSxS\amd64_microsoft-windows-ucrt_31bf3856ad364e35_10.0.16299.15_none_cead61398aa45cb2\ucrtbase.dll"
"C:\Windows\System32\ucrtbase_enclave.dll"
"C:\Windows\WinSxS\amd64_microsoft-onecore-i..atedusermode-common_31bf3856ad364e35_10.0.16299.15_none_215b207fb180b0b9\ucrtbase_enclave.dll"
"C:\Program Files (x86)\Microsoft Visual Studio 15.0\Team Tools\Performance Tools\ucrtbase.dll"
"C:\Program Files\Microsoft Visual Studio 15.0\Common7\IDE\Remote Debugger\x86\ucrtbase.dll"
"C:\Program Files (x86)\Microsoft Visual Studio 15.0\Team Tools\Performance Tools\x64\ucrtbase.dll"
"C:\Program Files\Microsoft Visual Studio 15.0\Common7\IDE\Remote Debugger\x64\ucrtbase.dll"
"C:\Program Files\Microsoft Visual Studio 15.0\Remote Tools\DiagnosticsHub\ucrtbase.dll"
"C:\Program Files\Microsoft Visual Studio 15.0\Team Tools\DiagnosticsHub\Collector\ucrtbase.dll"
"C:\Windows\WinSxS\Backup\wow64_microsoft-windows-ucrt_31bf3856ad364e35_10.0.16299.15_none_d9020b8bbf051ead_ucrtbase.dll_a00b9625"
"C:\Windows\WinSxS\Backup\amd64_microsoft-windows-ucrt_31bf3856ad364e35_10.0.16299.15_none_cead61398aa45cb2_ucrtbase.dll_a00b9625"
"C:\Users\bojan\AppData\Local\Microsoft\OneDrive\17.3.7073.1013\ucrtbase.dll"

How to install Plugin Manager in Notepad++

I wanted to install a new plugin for Notepad++ via its Plugin Manager (which is plugin itself) but when I clicked on Plugins in the main menu I realized that Plugin Manager was missing. To install it, I did the following:

Go to Plugin Manager releases page and download the latest one. At the time of writing it was v1.4.9 so I downloaded file PluginManager_v1.4.9_UNI.zip.

Unpack the zip file. The content of the archive is:


..\PluginManager_v1.4.9_UNI\plugins
..\PluginManager_v1.4.9_UNI\plugins\PluginManager.dll
..\PluginManager_v1.4.9_UNI\updater
..\PluginManager_v1.4.9_UNI\updater\gpup.exe



Find the location of the Notepad++ installation on your machine. In my case, it was: C:\Program Files (x86)\Notepad++.

Copy ..\PluginManager_v1.4.9_UNI\plugins\PluginManager.dll to C:\Program Files (x86)\Notepad++\plugins and ..\PluginManager_v1.4.9_UNI\updater\gpup.exe to C:\Program Files (x86)\Notepad++\updater.

Restart the Notepad++. Plugin Manager now appears in the list of plugins.



Friday, 28 April 2017

How to build Chromium on Ubuntu


I followed official instructions and, with minor modifications, managed to build and run Chromium on 64-bit Ubuntu 16.04. Entire process on PC with Intel i7 with 16GB RAM takes couple of hours. I had Git and Python installed already so went straight into the process:

Clone depot_tools repository (this was in my ~/dev directory):

$ git clone https://chromium.googlesource.com/chromium/tools/depot_tools.git


The next step was to append depot_tools path to to PATH. I first tried:

$ export PATH="$PATH:~/dev/depot_tools"


This made running install-build-deps.sh script to fail as described here. I therefore applied suggestion from that forum thread and used the path in the following form:

$ export PATH="$PATH:${HOME}/dev/depot_tools"


Create directory for Chromium source code

$ mkdir chromium
$ cd chromium


Check out the code (without the full repo history) and its dependencies:

$ fetch --nohooks --no-history chromium


Fetch creates scr directory:

$ cd src


Install additional build dependencies:

$ ./build/install-build-deps.sh


Run hooks which fetch additional binaries:

$ gclient runhooks


Create a build directory:

$ gn gen out/Default


Set gn arguments in order to speed up build. The following command will open a config file in vi editor:

$ gn args out/Default


I added the following lines:

enable_nacl=false
symbol_level=1
emove_webcore_debug_symbols=true


Build Chromium:

$ ninja -C out/Default chrome


Run built Chromium executable:

$ ./out/Default/chrome


Et voila! Chromium opens:



NOTE: I didn't install Google API keys and this is the reason for the notification which appears in the browser.

Wednesday, 26 April 2017

How to add a NuGet package to C# project in VSCode on Ubuntu

In VSCode open Terminal and use dotnet CLI command package and specify the name of the desired package (e.g. Newtonsoft.Json):


$ dotnet add package Newtonsoft.Json



This will add a reference to that NuGet package in project:



Output in VSCode:


This can be verified in the project file:



VSCode notifies us that there are unresolved dependencies:


If we click on Restore newtonsoft.json library gets downloaded to ~/.nuget/packages directory.

After resolving them we can start using object from the newly added package. Intellisense also works for new dependency assembly:


Sunday, 23 April 2017

Strategy Pattern

Problem:

Context has to be able to apply different Algorithms (strategies, actions, behaviours) in the runtime but is coupled with their implementations. It contains all possible concrete implementations of an Algorithm family and has to change if:
  • implementation of some Algorithm has to change
  • a new Algorithm has to be added or some existing has to be removed
This breaks Single Responsibility Principle (Context has to change for more than one reason) and Open-Closed Principle (Context has to be modified if list of Algorithms gets extended).

Solution:

Remove Algorithm implementations out of the Context and separate them in their own classes which implement new interface IStrategy with method DoAlgorithm(). Introduce lookup table (Dictionary) which keeps all IStrategy implementations. When Context receives key from the input, it looks up the Dictionary and calls IStrategy implementation which matches the given key.

References:

Strategy pattern
Applying Strategy Pattern Instead of Using Switch Statements
Strategy