Tuesday, August 24, 2021

SSH slow connection issues

When I connect to a Linux machine via ssh, it waits a long time (~ 10secs) before showing me the password prompt.

After some research, I found that it's caused by the GSS API authentication issue. Some suggestions to solve this issues are listed below (either one of this will work):

  1. Disable the GSS API authentication in sshd:

            Modify the file "/etc/ssh/sshd_config", disable the "GSSAPIAuthentication" by:

    GSSAPIAuthentication no 

     

  2. Disable GSS API authentication in PuTTY:

        Connection > SSH > Auth > GSSAPI

                    Uncheck "Attempt GSSAPI authentication (SSH-2 only)" 

 

 

Thursday, July 29, 2021

Disabling GeoNetwork XSL caching

In GeoNework (3.x), the XSL caching is enabled by default. To disable this, we can modify the following:

In the ZIP GeoNetwork version, find the file "<GeoNetwork-Directory>/web/geonetwork/WEB-INF/classes/META-INF/services/javax.xml.transform.TransformerFactory"

This file should contains the following:

    de.fzi.dbs.xml.transform.CachingTransformerFactory

Change this to the following:

    net.sf.saxon.TransformerFactoryImpl

Then the XSL transformation will not be cached.


Reference: http://mapas.mda.gov.br/geonetwork/docs/eng/users/quickstartguide/installing/index.html



Thursday, July 22, 2021

Oracle TO_DATE( ) this afternoon

Just being asked to convert string "1/1/2020 0:00' to date field in Oracle, and come up with this:

select to_date('1/1/2020 0:00', 'dd/mm/yyyy hh24:mi') from dual

Wednesday, July 7, 2021

Tips on GeoPandas

According to the documentation in GeoPandas, the following codes could read a local GeoJSON file and import to a PostGIS DB:


import geopandas

from sqlalchemy import create_engine


path_to_data = "./my_file.geojson"

gdf = geopandas.read_file(path_to_data)


db_connection_url = "postgres://user:pwd@localhost:5432/db";

engine = create_engine(db_connection_url)

gdf.to_postgis("my_file_table", con=engine)


I found the following tips:

  • "postgres://" has to be changed to "postgresql://"
  • Package "psycopg2" is required together with "sqlalchemy" (Details could be found in DBAPI support section in PostgreSQL documentation)
  • Package "GeoAlchemy2" is required together with "sqlalchemy"
Enjoy!

Wednesday, June 2, 2021

About CKAN installation from package

 In lubuntu 20.04, we can install CKAN from package via the following command:

# dpkg -i python-ckan_2.9-py3-focal_amd64.deb


The system fails with the following error:

ModuleNotFoundError: No module named 'distutils.core'


This error is caused by missing some essential Python modules, to solve this problem, install the 'python3-distutils' package by:

sudo apt-get install python3-distutils


 


Friday, May 28, 2021

About CKAN Sample Dataset

You can use "ckan seed" to create sample datasets

e.g. ckan seed basic, which creates two datasets: 

  1. annakarenina
  2. warandpeace


BUT, after you delete the two datasets, either via 

User Interface 

OR 

CLI: 

ckan dataset delete annakarenina 

ckan dataset purge annakarenina

 

You cannot run the "ckan seed basic" again to regenerate the two datasets. 


Why?

Since there are two records still in table "group" and 5 records created in table "user" (They are created by "ckan seed basic"). Remove those records and then you can run the "ckan seed basic" again.


Tuesday, May 25, 2021

Share folder in VirtualBox

I'd been creating a shared folder in VirtualBox guest (Lubuntu) in a Ubuntu host. While the folder path I entered is a symbolic link, it just NOT work at all.

So, always remember the "Folder Path" has to be a REAL PATH, no symbolic link !!





Monday, February 1, 2021

Tuesday, January 26, 2021

Neovim Setup

A very nice tutorial for neovim setup we found in medium.com:

https://medium.com/better-programming/setting-up-neovim-for-web-development-in-2020-d800de3efacd

There is something more about the setting:

  1. Run 'nvim +PlugInstall' if you added new plugin in ~/config/nvim/init.vim
  2. Run 'nvim +PlugClean' after you remove plugin in  ~/config/nvim/init.vi
  3. Avoid using plugin 'ryanoasis/vim-devicons' if you see strange characters in NERDTree

Sync multiple git repo at once

Use the following command in Linux will do the job:  ls -d RepoNames* | xargs -I{} git -C {} pull