Posts

Showing posts from March, 2019

ERROR: GetProj4StringSPI: Cannot find SRID (4326) in spatial_ref_sys

If you are using postgis and a cleaner in your database, maybe you could have this error:

ERROR:  GetProj4StringSPI: Cannot find SRID (4326) in spatial_ref_sys
SQL state: XX000

This error means that your spatial_ref_sys table is empty
To fix it, just restore the information that postgis generate when you create this extension in your database.
To do it execute the following sentence:

psql -d $database_name -f $PATH/spatial_ref_sys.sql

where the PATH is the path to spatial_ref_sys.sql
For postgres 11 and postgis 2.5 the PATH is /usr/share/postgresql/11/contrib/postgis-2.5/

Other way to execute the same command is:

PGPASSWORD=postgres psql "host=localhost dbname=$database_name user=postgres" -f /usr/share/postgresql/11/contrib/postgis-2.5/spatial_ref_sys.sql

Enjoy it!

command not found: pip3

This is a common issue. If you try to execute pip3 you probably will get:

Command 'pip3' not found, but can be installed with:
sudo apt install python3-pip
or
pip3
zsh: command not found: pip3

although you install it, anyway the same error appears
To solve it, you can reinstall it:

sudo apt-get remove python3-pip
sudo apt-get install python3-pip

or execute pip3 as python module:

sudo python3 -m pip

Enjoy it!


How to send files throught bluetooth from nautilus

The best option is to use an extension to enable this option.

sudo apt install python-nautilus nautilus bluez gnome-bluetooth python3
cd ~/.local/share/nautilus-python/extension
wget https://raw.githubusercontent.com/TheWeirdDev/nautilus-send-to-bluetooth/master/SendToBluetooth.py
nautilus -q

HINT: Also you can use /usr/share/nautilus-python/extensions/ to store your extensions

Enjoy it!

Source: https://github.com/TheWeirdDev/nautilus-send-to-bluetooth

How to run terminator with rigth click inside nautilus

Image
First, we need to install nautilus-python extension:

sudo apt install python-nautilus

Now, you need to create the extensions folder:

mkdir ~/.local/share/nautilus-python
cd ~/.local/share/nautilus-python
mkdir extensions
cd extensions

To finish, download the extension to enable execute terminator in nautilus:

wget http://www.giuspen.com/software/nau3pyext/open-terminal-here.py

Edit it and change the label variable "Open Terminal Here" by "Open Terminator"

To restart nautilus, just execute:

nautilus -q
nautilus

If you don't have terminator as your default terminal, it is enough to choose it when executing the following command:

sudo update-alternatives --config x-terminal-emulator




Enjoy it!



How to run Matlab without root permissions

If you have issues with Matlab to run commands without root, probably you will see this:

INFO: READ:  OnSendHeadersMessage{type=OnSendHeaders, uid=557, browserContextId=0, requestId=57, url=https://localhost:31515/messageservice/async, method=POST, headers=Origin: https://localhost:31515

X-Requested-With: XMLHttpRequest

User-Agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/43.0.2357.52 Safari/537.36

Content-Type: application/json

Accept: */*

Referer: https://localhost:31515/remote/proxy/1.5/iframeProxyRelease.html

Accept-Encoding: gzip, deflate

Accept-Language: en-us

Cookie: JSESSIONID2=aUWOscLC3o6cqUdV; ssnc=24WR68u39rLEOyhW



}, SocketInfo{channelId=0, browserId=-1, channelType=Main}

To fix it, just add permissions to your user with:

sudo chown -R $USER:$USER /usr/local/MATLAB/R2018b

If you run Matlab again, you will see this:

at com.mathworks.mlwidgets.shortcuts.ShortcutUtils.getShortcutsFile(ShortcutUtils.java:703)
at com.mathworks.mlwidgets.shortcuts.Shortcut…

How to monitor your computer from your desktop

Image
As you see, system-monitor is not more available in Ubuntu 18.10
For this reason, I search another utility to monitor my system and I find conky.
It is a very personalizable tool that you can install with snap:

sudo snap install conky

Now, you need to configure it as you like, with you specific interfaces names, in /etc/conky/conky.conf

Here is my first configuration:

conky.config = {
  use_spacer = 'left',
  pad_percents = 3,
  background = false,
  double_buffer = true,
  font = 'DejaVu Sans Mono:size=10',
  use_xft = true,
  alignment = 'top_right',
  gap_x = 50,
  gap_y = 200,
  own_window_argb_visual = true,
  own_window_argb_value = 0,
  own_window_type = 'normal',
  own_window_hints = 'undecorated,below,skip_taskbar,skip_pager,sticky',
  own_window = true,
  update_interval = 5.0,
}

conky.text = [[
#\${color orange}Hostname: \${color}\${nodename}
${color orange}Kernel:   ${color}\${sysname} \${kernel} on \${machine}
${color orange}Uptime:   ${color}\${uptime}

How to backup/restore your linux packages in Ubuntu 18.10

Image
If you need migrate your packages to another computer, the best choice is to restore the packages to avoid install all of them again manually.
I'm going to describe three tools that I test to do it.

apt-clone is a tool for backup all your packages installed through apt. To install it just execute:

sudo apt install apt-clone
sudo apt-clone clone path_to_save_backup

Now, to restore the packages, just copy this file in your new station and execute the following:

sudo apt-clone restore apt-clone-state-*.tar.gz

It works very well, but some times you can get this error:



Deja-dup is other tool to make backups and restore your packages. When I run it, I got this message:

InvalidBackendURL: missing // - relative paths not supported for scheme invalid: invalid://




This bug was reported here 2 years ago, but still is not totally fixed

Aptik is tyhe most functional tool with GUI. To install it just execute:

sudo apt-add-repository -y ppa:teejee2008/ppa
sudo apt-get install aptik aptik-gtk

Is a ver…

How to create a requirements.txt for python

First, you must to detect every python package that you need to your proyect.
An option is to use the following sentence:

grep import file_name.py

Now, you need to create a file called requirements.in with every package per line as:

julia
networkx

To finalize, the version of each package must be included in the file. To do it, just use:

pip-compile requirements.in 

The file requirements.txt was created.  To run it in other environment, execute the following sentence:
pip install -r requirement.txt
Enjoy it!