#RaspberryPi – Where is my Add/Remove programs? let's use Synaptic

Buy Me A Coffee

Hi!

When I wrote about the latest version of Visual Studio Code working on the Raspberry Pi, I realize that I used a couple of commands to find an installed application.

The following command will list all the installed apps

sudo apt list --installed

Which is great, but hard to read in bash mode. So that’s why I use grep to filter for the app I want.

sudo apt list --installed | grep -i code-oss

So far, so good. The command did the trick, and I got my result: app name, version and details. However, as a long time Windows user, I was wondering if Linux users have a visual interface for this. And then I found: Synaptic.

The command to install Synaptic is maybe the last command we will use to install or uninstall an app

sudo apt install synaptic -y

And then we can launch the app using this command, and it’s need to be with sudo permissions (learned in the hard way)

sudo synaptic

At this moment, I can browse in the all list of apps. And I can quickly perform a search for my installed Visual Studio Code.

I get the result, with details, version and more.

And if you are wondering what’s the main difference with the bash command? So, I didn’t need to search and learn a command, the universal visual clue of the magnifier, or the search button were good enough for me.

Playing around with the app, I found I can display much more information for each installed app. Which is great, because I start to understand the idea and concepts of dependencies, where Linux install software, etc.

Happy coding!

Greetings

El Bruno

My posts on Raspberry Pi

Dev posts for Raspberry Pi
Tools and Apps for Raspberry Pi
Setup the device
Hardware

#HowTo – Grant permissions to a folder after #Git clone, to perform #dotnet restore on a #RaspberryPi #dotnetcore

Buy Me A Coffee

Hi !

Quick post today, to leave this as a public note. And, disclaimer, I’m not a Linux expert, just a normal user; I’m sure there are plenty of better ways to do this. Any advice will be appreciated.

Context: I’m working with Git and .Net Core 3.1. Just cloned a repository and ready to run my 2 favourite commands

dotnet restore
dotnet run

However, I found this error

raspberry pi dotnet restore access denied error
/home/pi/dotnet/sdk/3.1.100/NuGet.targets(123,5): error : Access to the path '/<path>.csproj.nuget.dgspec.json' is denied. [/<path>..csproj] 
/home/pi/dotnet/sdk/3.1.100/NuGet.targets(123,5): error :   Permission denied

I’m running dotnet under the user pi, and I haven’t found a way to automatically grant permissions to new folders for this user. So everytime I clone a repo I need to grant permissions with the command.

# sudo chmod -R 757 '<path>'
sudo chmod -R 757 '/home/pi/srcebgit/testsGit/20191227MLNet/myMLApp/consumeModelApp'

And now, it’s working

raspberry pi dotnet restore working after grant user permissions

Of course, I still need to deal with other permissions issues because this project has some copy files actions on the build. Now I know the way!

raspberry pi dotnet restore working error on run

Happy coding!

Greetings @ Burlington

El Bruno

My posts on Raspberry Pi

Dev posts for Raspberry Pi
Tools and Apps for Raspberry Pi
Setup the device
Hardware

#Windows10 – How to Install Connect app (yes, somehow is not part of my Windows 10 installation)

Buy Me A Coffee

Hi!

I’ve been using the Connect App for several years. It’s super useful when you need to share your Android screen to your Windows device, or any other device sharing screen scenario.

However, today I realized that I don’t have my Connect app installed in my Windows 10

no connect app

I don’t know why, maybe one of the Insider Builds remove the App, or any other crazy ideas. Moving on, I put my focus to figure out how to install this app. I really need it!

There is not much information about how to install this, but I found that I had the [Projecting to this PC] feature in Windows 10. Which was disabled for me.

windows 10 settings projecting to this pc

So, browsing the additional features, I found [Wireless Display]. That should be the one:

windows 10 add wireless display feature to w10

Warning, after the install time, is also REBOOT time! Windows being Windows.

windows 10 installing wireless display

And, now I had the connect App up and running to rock some Hololens demos

windows 10 connect app as new app

Happy coding!

Greetings @ Toronto

El Bruno

References

#VS2019 – How to fix the [obj\project.assets.json’ not found] when building a #NetCore project

Buy Me A Coffee

Hi!

Quick post today. This one is to save me 30 minutes of internet search next time I face this error.

Context:

New .Net Core Console App.

When I build the console app for the 1st time I got this error.

  • Error: NETSDK1004
  • Assets file ‘<Path> \EventConsoleApp01\obj\project.assets.json’ not found.
  • Run a NuGet package restore to generate this file.
  • C:\Program Files\dotnet\sdk\3.0.100\Sdks\Microsoft.NET.Sdk\targets\Microsoft.PackageDependencyResolution.targets
visual studio 2019 new dotnet core console error on 1st build, cant find assets json.jpg

It’s a very silly error. However, if you are old school, the standard methods to fix this won’t work.

So the right way to fix this is to open the NuGet Package Manager Console [Tools // Nuget Package Manager / Package Manager Console] and type the command

dotnet restore
visual studio 2019 dotnet restore on nuget package manager console.jpg

Then rebuild the project, and that’s it! The new build will restore all the package, and also install everything necessary for a console app to run

visual studio 2019 project after dotnet restore.jpg

Happy coding!

Greetings @ Toronto

El Bruno

#Windows10 – Fixing Mouse Without Border DPI screen settings (very easy!)

Buy Me A Coffee

Hi!

A while ago, I wrote about the awesome [Mouse without Borders] application. This app is extremely useful, and it’s becoming very handy in scenarios like the Avanade Toronto Innovation Center.

In our Innovation Center, we have plenty of different machines, and it wasn’t a good moment when I realize that this is how the App Settings looks in a Windows 10 machine with some DPI customization.

mouse without borders crappy UI experience

I don’t have a lot of Windows Presentation Experience, however I know that we can solve this via some configuration / manifest changes for the App. I look up for the application folder [C:\Program Files (x86)\Microsoft Garage\Mouse without Borders], and I opened the [MouseWithoutBorders.exe.manifest] file with Visual Studio Code.

mouse without borders change app manifest to enable DPI experience.jpg

Lucky for me, the section that I needed to add it was already there. It was commented, so I un-commented this, save the file and restart the application. Of course, you need elevated privileges to do this.

5 seconds later my Settings windows was finally amazing again!

mouse without borders improved UI experience

Happy coding!   

Greetings @ Burlington

El Bruno

References

Mouse without Borders, https://www.microsoft.com/en-us/garage/profiles/mouse-without-borders/

Download Mouse without Borders, https://www.microsoft.com/en-us/download/details.aspx?id=35460

El Bruno, Mouse without borders, a Must Have App if you work with 2 or more computers https://elbruno.com/2019/10/30/windows10-mouse-without-borders-a-musthave-if-you-work-with-2-or-more-computers/

#VSCode – Installing Visual Studio Code @code in a #RaspberryPi, run as root, fix black screen (Updated)

Buy Me A Coffee

Hi!

Now that I have my amazing Raspberry Pi 4 with 4GB RAM, it’s time to see how serious the device is. So, I decided to install and use some developers’ tools in the RPi. My dev list will be something like this

  • Python
  • Some ML and AI Python packages
  • GIT
  • Arduino
  • Visual Studio Code

It’s been a while since I installed VSCode in the device. The last time I did this, I needed to download the code from GitHub and compile the tool in the Raspberry Pi. As far as I remember this was a +25 min process.

Lucky for us the process can now be much simpler, thanks to Headmelted (see references). Now, we only need a single command to install VSCode:

. <( wget -O -
https://code.headmelted.com/installers/apt.sh )

Install process started! Or Maybe not because I found this amazing GPG error

python error installing visual studio code in raspberry pi
pi@rpidev3:~ $ curl -L https://code.headmelted.com/installers/apt.sh | sudo bash
   % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                  Dload  Upload   Total   Spent    Left  Speed
 100  2349    0  2349    0     0  19739      0 --:--:-- --:--:-- --:--:-- 19906
 Detecting architecture…
 Ensuring curl is installed
 Reading package lists… Done
 Building dependency tree       
 Reading state information… Done
 curl is already the newest version (7.64.0-4).
 The following packages were automatically installed and are no longer required:
   python3-pyperclip python3-thonny rpi.gpio-common
 Use 'apt autoremove' to remove them.
 0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
 Architecture detected as armv7l…
 Retrieving GPG key headmelted…
   % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                  Dload  Upload   Total   Spent    Left  Speed
   0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
 gpg: no valid OpenPGP data found.
 Removing any previous entry to headmelted repository
 Installing [headmelted] repository…
 Updating APT cache…
 Hit:1 http://raspbian.raspberrypi.org/raspbian buster InRelease
 Hit:2 http://archive.raspberrypi.org/debian buster InRelease
 Get:3 https://packagecloud.io/headmelted/codebuilds/debian stretch InRelease [23.4 kB]
 Err:3 https://packagecloud.io/headmelted/codebuilds/debian stretch InRelease
   The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 0CC3FD642696BFC8
 Reading package lists…
 W: GPG error: https://packagecloud.io/headmelted/codebuilds/debian stretch InRelease: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 0CC3FD642696BFC8
 E: The repository 'https://packagecloud.io/headmelted/codebuilds/debian stretch InRelease' is not signed.
 Done!
 Repository install complete.
 Installing Visual Studio Code from [stretch]…
 Reading package lists… Done
 E: The value 'stretch' is invalid for APT::Default-Release as such a release is not available in the sources
 Visual Studio Code install failed.

There a public GPG key used to verify the package and the SH script somehow does not download it (I think the ARM RPI version is still not defined). So, before the previous command, I need to run this command

wget https://packagecloud.io/headmelted/codebuilds/gpgkey -O - | sudo apt-key add –

Then run this command

curl -L https://code.headmelted.com/installers/apt.sh | sudo bash

Now we have Visual Studio Code installed!

raspberry pi visual studio code installed

Old Issue, not needed since 2020 January

But, yes another but, you may note that the tool open and display a black window. Again, I need to go deeper on the details, but the latest version does not work well. There is some context information on GitHub (see references), and the proposed solution is to rollback to a previous version

sudo apt-get install code-oss=1.29.0-1539702286

And we also need to disable the automatic updates on this tool

sudo apt-mark hold code-oss

The following command will remove the hold for Visual Studio Code

sudo apt-mark unhold code-oss

And now, yes, we got a fully functional Visual Studio Code in our Raspberry Pi!

How to run VSCode as root

Another update, is a command to run VSCode as root

# open VSCode in default source code folder with root
sudo code-oss --user-data-dir=/home/pi/src/vsCodeUsrData

Of course this is not the best way to use VSCode, however something it helps 😀

Note: Due some Deep Neural Network and docker process, my device is starting to heat a lot, so I’ll try a next generation cooler like this one: Blink Blink ICE Tower CPU Cooling Fan for Raspberry Pi (Support Pi 4)

Happy Coding!

Greetings @ Toronto

El Bruno

References

My posts on El Bruno

My posts on Raspberry Pi

Dev posts for Raspberry Pi
Tools and Apps for Raspberry Pi
Setup the device
Hardware

#RaspberryPi – Where is my Task Manager? let’s try #htop

Hi !

As a Windows user, I use task manager a lot. You know that moment when

  1. Your PC start to work very slow
  2. You press CTRL+SHIFT+ESC to open Task Manager
  3. Select the not amicable process
  4. And Kill it !

Bonus: another group of people uses a more classic way

  1. Press CTRL+ALT+DEL
  2. Select Task Manager

These days where I’m doing part of my developer work in a Raspberry Pi 4 (see references), I was also in the need for a “Task Manager”. So a quick Bing/Google search pointed a couple of products, and htop seems to be a very popular one. And I also like the official product description

This is htop, an interactive process viewer for Unix systems. It is a text-mode application (for console or X terminals) and requires ncurses.

Official htop page (see references)

It seems that initially the product was created for Unix, and now supports FreeBSD, OpenBSD, macOS, and more. And, of course, it runs on Raspbian.

Question: Should I write a post on how to install Raspbian for Raspberry Pi? My guess is no, there are so many of this already out, but ... if get bored.

Before I move on, let’s take a look at htop running in my device, while I’m building a docker image using some amazing TensorFlow image analysis models.

The way to install htop is very straightforward.

sudo apt-get install htop

Then you can launch the app with

htop

Super Easy ! And again, the UI gives you a lot of very useful information, and because Linux users are heavy on commands and not mouse, 99% of the actions to control the app are using these commands

  • F1 – Help (explains everything, always nice)
  • F6 – SortBy (You can sort the list processes with this option. Sorting by user, CPU usage and memory usage can be useful.)
  • F9 – Kill (You can select a process and send a kill signal)
  • F10 – Quit (sometimes you gotta leave htop)
Note: Get the commands and learn from David Walz post (see references)

Happy Coding!

Greetings @ Burlington

El Bruno

References

My posts on Raspberry Pi

Dev posts for Raspberry Pi
Tools and Apps for Raspberry Pi
Setup the device
Hardware

#VSCode – Let’s do some #Git dev in #RaspberryPi (GitHub and Azure DevOps!)

Buy Me A Coffee

Hi!

In my previous posts I wrote about how to prepare a developer station with a Raspverry Pi 4. I wrote on how to install Visual Studio Code, how to install .Net Core and how to build and run C# projects. Of course, the next step is to work with Git.

The command to install git is

sudo
apt-get install git

However, I already have Git installed. I haven’t checked, but it seems to me that the latest Raspbian distro includes by default git. I was hoping that VSCode will recognize and use this, but in order to work with Git in VSCode I need some extra work in the IDE settings.

raspberry pi git installed but not integrated in visual studio code

I was able to clone some repositories from GitHub and Azure DevOps, directly from bach

raspberry pi 4 git clone azure devops repository

So, let’s fix Visual Studio Code and Git integration. This one is very easy, I just need to go to Settings, search for Git and define the Git path for VSCode.

raspberry pi 4 visual studio code preferences git

In order to find the git path, we need to use the [which] command

pi@rpidev3:~ $ which git

/usr/bin/git 

My got location is [/usr/bin/git].

I’m not a command line dude! I like User Interfaces, so now it’s time to open one of the cloned repositories in Visual Studio Code. I can see that VSCode recognices Git and I can start to commit my files.

raspberry pi 4 visual studio code using git

This is also a perfect moment to define Git user name and user email.

git config --global user.email "email@email.com" 
git config --global user.name "your name"

I like to do this in the Terminal in VSCode, just to check all is working fine.

Happy coding!

Greetings

El Bruno

My posts on Raspberry Pi

Dev posts for Raspberry Pi
Tools and Apps for Raspberry Pi
Setup the device
Hardware

#VSCode – Installing Visual Studio Code in a #RaspberryPi, a couple of lessons learned – @code

Hi!

Now that I have my amazing Raspberry Pi 4 with 4GB RAM, it’s time to see how serious the device is. So, I decided to install and use some developers’ tools in the RPi. My dev list will be something like this

  • Python
  • Some ML and AI Python packages
  • GIT
  • Arduino
  • Visual Studio Code

It’s been a while since I installed VSCode in the device. The last time I did this, I needed to download the code from GitHub and compile the tool in the Raspberry Pi. As far as I remember this was a +25 min process.

Lucky for us the process can now be much simpler, thanks to Headmelted (see references). Now, we only need a single command to install VSCode:

. <( wget -O -
https://code.headmelted.com/installers/apt.sh )

Install process started! Or Maybe not because I found this amazing GPG error

python error installing visual studio code in raspberry pi
pi@rpidev3:~ $ curl -L https://code.headmelted.com/installers/apt.sh | sudo bash
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 2349 0 2349 0 0 19739 0 --:--:-- --:--:-- --:--:-- 19906
Detecting architecture…
Ensuring curl is installed
Reading package lists… Done
Building dependency tree
Reading state information… Done
curl is already the newest version (7.64.0-4).
The following packages were automatically installed and are no longer required:
python3-pyperclip python3-thonny rpi.gpio-common
Use 'apt autoremove' to remove them.
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
Architecture detected as armv7l…
Retrieving GPG key headmelted
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0
gpg: no valid OpenPGP data found.
Removing any previous entry to headmelted repository
Installing [headmelted] repository…
Updating APT cache…
Hit:1 http://raspbian.raspberrypi.org/raspbian buster InRelease
Hit:2 http://archive.raspberrypi.org/debian buster InRelease
Get:3 https://packagecloud.io/headmelted/codebuilds/debian stretch InRelease [23.4 kB]
Err:3 https://packagecloud.io/headmelted/codebuilds/debian stretch InRelease
The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 0CC3FD642696BFC8
Reading package lists…
W: GPG error: https://packagecloud.io/headmelted/codebuilds/debian stretch InRelease: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 0CC3FD642696BFC8
E: The repository 'https://packagecloud.io/headmelted/codebuilds/debian stretch InRelease' is not signed.
Done!
Repository install complete.
Installing Visual Studio Code from [stretch]…
Reading package lists… Done
E: The value 'stretch' is invalid for APT::Default-Release as such a release is not available in the sources
Visual Studio Code install failed.

There a public GPG key used to verify the package and the SH script somehow does not download it (I think the ARM RPI version is still not defined). So, before the previous command, I need to run this command

wget https://packagecloud.io/headmelted/codebuilds/gpgkey -O
- | sudo apt-key add –

Then run this command

curl -L https://code.headmelted.com/installers/apt.sh | sudo bash

Now we have Visual Studio Code installed!

raspberry pi visual studio code installed

But, yes another but, you may note that the tool open and display a black window. Again, I need to go deeper on the details, but the latest version does not work well. There is some context information on GitHub (see references), and the proposed solution is to rollback to a previous version

sudo apt-get install code-oss=1.29.0-1539702286

And we also need to disable the automatic updates on this tool

sudo apt-mark hold code-oss

And now, yes, we got a fully functional Visual Studio Code in our Raspberry Pi!

Happy Coding!

Greetings @ Toronto

El Bruno

References

My posts on Raspberry Pi

Dev posts for Raspberry Pi
Tools and Apps for Raspberry Pi
Setup the device
Hardware

#RaspberryPi – Running a #python script in a Python Virtual Environment on reboot / startup

Hi!

Adrian Rosebrock is a very smart person who has tons of great resources about Computer Vision in PyImageSearch.com. Most of them are with Python, and he also have some of them focused on how to perform CV using OpenCV in a Raspberry Pi.

In the post [Running a Python + OpenCV script on reboot, see resources] he explains how to automatically run a Python script when a Raspberry Pi starts. He uses python virtual environments, so the first 2 commands are focused on to load the virtual env. Then, move to the app folder and run the python script.

source ~/.profile
workon cv
cd /home/pi/pi-face-recognition
python startup.py

Something like this:

python source and cv on raspberry pi.

The suggested approach consists on create a Schell Script [.sh file] with these lines and add them to the auto start. However, once you create the file and test it, there seems to be an issue with the Source command.

python source not working on SH file

Ok, so no source command in an SH file. I started to think on install all my python dependencies directly in the main user, however the idea of working with virtual environments is very useful for me. It was to read online about Linux, python and more.

Note: Before moving forward, I may need to add some context. I need to run my python script in a Terminal. My device will always auto-start with a 3.5 inches touch screen and a camera, so I need some GUI loaded.

This is an excellent article on how to add actions to the Raspberry Pi start-up [How to Execute a Script at Startup on the Raspberry Pi, see resources]. So I added my SH file here and it didn’t work and I need to figure out how to load a virtual environment and run a python script.

After a couple of tests, I realized that all the files I need are part of the virtual env location in the device.

raspberry pi python folder for virtual envs

So, I only need to add the full path to my command to make it work without the and [workon] command. My complete command will became:

/home/pi/.virtualenvs/cv/bin/python /home/pi/pi-face-recognition/startup.py

So, I edited my autostart file adding this command

raspberry pi auto start file launching python script with a virtual env

And done! My python script running on a python virtual environment on the device startup is working!

Happy coding!

Greetings

El Bruno

Resources

My posts on Raspberry Pi

Dev posts for Raspberry Pi
Tools and Apps for Raspberry Pi
Setup the device
Hardware