Raspberry Pi: How to debug Dart command line applications in IntelliJ

How to debug with gdb on command line – see Raspberry Pi: gdb debugging, command line.

How to debug with gdb in Eclipse – see Raspberry Pi: gdb debugging in Eclipse.

  • Ubuntu 18.04 LTS
  • IntelliJ IDEA Community 2018.3
  • Raspberry Pi 3 Model B

Create Dart Remote Debug configuration for your Dart application:

Ubuntu terminal

Copy your application and open an ssh session to Raspberry Pi :

$ scp -r dartapp/ pi@
$ ssh pi@
SSH session on Raspberry Pi
$ cd ~/dartapp
$ pub get
Resolving dependencies... (1.9s)
Got dependencies!
$ dart --enable-vm-service:5858/ --pause_isolates_on_start bin/main.dart 
Observatory listening on

Now you can start debugging your application in IntelliJ.

Ubuntu: How to reschedule mlocate

What is mlocate can be found here.

By default it is scheduled to execute daily – that might not meet your expectations what you computer should do when you power it on.

Here is how to reschedule it to execute weekly:

### In the terminal
sudo chmod -x /etc/cron.daily/mlocate
sudo cp /etc/cron.daily/mlocate /etc/cron.weekly/mlocate
sudo chmod +x /etc/cron.weekly/mlocate

This has been checked with Ubuntu 18.04 LTS.

WordPress: changing permalink settings and 404 page not found

Taken from:

To be able to change permalink settings you might need to change access rights of the /var/www/html/<blogfolder>/.htaccess from 644 to 666:

### On your web server
$ cd /var/www/html/<blogfolder>
$ sudo chmod 666 .htaccess
### Do not forget to change back to 644 after you are done with permalinks
$ sudo chmod 644 .htaccess

If after changing WordPress permalink settings you get notorious “404 page not found” then check that the bold options in the <Directory /var/www/> section in the /etc/apache2/apache.conf file look like this:

<Directory /var/www/>
 Options Indexes FollowSymLinks
 AllowOverride All
 Require all granted

OpenSSL hints

  • Ubuntu 16.04 LTS
  • OpenSSL 1.0.2g 1 Mar 2016
Download server certificate
### Show certificate
$ openssl s_client -connect host:port -showcerts
### Download certificate
$ echo | openssl s_client -connect host:port 2>&1 | sed -ne '/-BEGIN CERTIFICATE-/,/-END CERTIFICATE-/p' > server.crt.pem
2-way TLS authentication test

Say, we’ve downloaded server certificate and generated your client private key and certificate. Now we want to test if everything works:

$ openssl s_client -connect hostname:port -CAfile server.crt.pem -cert client.crt.pem -key client-private.key.pem

If you private key is protected with a password you’ll be prompted to enter the password.

remove password (passphrase) from private key

You might want to remove the password from private key:

openssl rsa -in private.key.pem -out newprivate.key.pem




Raspberry Pi: Flower Care (aka MI Flower) sensor

  • Raspberry Pi 3 Model B
Flower Care sensor

See http://www.huahuacaocao.com/product.

Looks and feels very nice:

Be aware that there are two versions of the sensor – Chinese and  international. I saw complains on internet about chinese sensor that were bricked after software upgrade when used outside of China. It is not quite clear what exactly was bricked – mobile phone app or the sensor itself.

Python demo on Raspbery Pi

Details see on GitHub.

$ git clone https://github.com/open-homeautomation/miflora.git
$ cd miflora/
$ . ./build.sh 
$ python3 setup.py build
$ sudo python3 setup.py install
$ python3 demo.py C4:7C:8D:xx:xx:xx
Getting data from Mi Flora
FW: 2.7.0
Name: Flower care
Temperature: 18.3
Moisture: 27
Light: 105
Conductivity: 59
Battery: 100


Raspberry Pi: installing Mosquitto MQTT broker

  • Raspberry Pi 3 Model B

Taken from: YouTube.

$ sudo apt-get update
$ sudo apt-get dist-upgrade
### Install mosquitto
$ sudo apt-get install mosquitto
### Install mosquitto clients
$ sudo apt-get install mosquitto-clients
### Console 1
$ mosquitto_sub -t "hellomosquitto"

### Console 2
$ mosquitto_pub -t "hellomosquitto" -m "Hello, Mosquitto!"

### Console 1 will print
Hello, Mosquitto!


Raspberry Pi: cross-compile Boost libraries

  • Ubuntu 16.04 LTS
  • arm-linux-gnueabihf (Ubuntu/Linaro 5.4.0-6ubuntu1~16.04.4) 5.4.0 20160609
  • Raspberry Pi 3 Model B
Install toolchain

See C++ cross-compiling.

Download boost source code

Boost source on Sourceforge. In my case boost_1_63_0.tar.bz2.


Say, we need boost-iostreams, installation folder /usr/local/boost:

# Unpack the archive
$ tar --bzip2 -xf boost_1_63_0.tar.bz2
$ cd boost_1_63_0
$ ./bootstrap.sh
# In the project-config.jam file replace
# using gcc ;
# by
# using gcc : arm : arm-linux-gnueabihf-g++ ;
$ sudo ./bjam install toolset=gcc-arm --prefix=/usr/local/boost --with-iostreams