14/01/17

My typical configuration on Bunsen labs/Debian

(just a fast track to my own reinstallations)
 
Various applications

apt-get install meld git baobab keepassx graphviz imagemagick

meld: file comparisons
baobab: disk utilization
keepassx: password maintenance utility
graphviz: automatic visualizatior for graphs, trees, etc. 
imagemagick : image manipulation tools 

Others (to be downloaded from their site):

anaconda: python development enviroment with scientific libraries
pycharm: python IDE from JetBrains
mendeley: bibliography management

My own scripts

I install them by running this command to be run in ~/bin

wget https://gist.githubusercontent.com/s1l3n0/81a5d947398306fff470/raw/e9dd25e634e912ab85c5caffe3b3339a774ef740/gitpull
wget https://gist.githubusercontent.com/s1l3n0/16880fcdc69639a40d68/raw/5eefbcbd457b6c0335f65cb4b584cf55cca8a5d7/gitpush
wget https://gist.githubusercontent.com/s1l3n0/b4be7dc6c92ad218c63a/raw/aa519ef8ef35296a72a5308eeaa1c4c0bc50cce9/findgrep
chmod +x gitpull
chmod +x gitpush
chmod +x findgrep

gitpull, gitpush: short hands for full pull/push
findgrep: look for a text recursively on all files starting from ./


Oracle Java 8

sudo -i
echo "deb http://ppa.launchpad.net/webupd8team/java/ubuntu xenial main" | tee /etc/apt/sources.list.d/webupd8team-java.list
echo "deb-src http://ppa.launchpad.net/webupd8team/java/ubuntu xenial main" | tee -a /etc/apt/sources.list.d/webupd8team-java.list
apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys EEA14886
apt-get update
apt-get install oracle-java8-installer


source: http://www.webupd8.org/2014/03/how-to-install-oracle-java-8-in-debian.html

Compiling Clingo with Anaconda (to enable the Python bridge to Clingo)

Compiling clingo

I have downloaded the sources of clingo from https://github.com/potassco/clingo/releases.

apt-get install gcc g++ scons bison re2c pkg-config python-dev

I discovered that without python-dev pkg-config was not able to correctly identify python. If you already launched scons before, and it does not find python after installing python-dev, try to delete the directory and unzip again the source files, the scons cache seemed to give me some problems.

I added the flags '-pthread' in CXXFLAGS and LINKFLAGS in build/release.py, as solveIter() asked for thread support. 

According to the INSTALL instructions, I had to install the tbb library (I also installed cppunit, which was in the initial check of scons).

apt-get install libtbb2 libtbb-dev libcppunit


Python module with Anaconda 

Even with this discovery, I was not able to compile clingo with python support. Despite all my efforts, although python-config and pkg-config were available on the command line, they were not recognized by scons, when following the INSTALL instructions. I decided to work out a solution with anaconda.

I finally managed to run it modifying by hand the build/release.py [replace my anaconda2 path with your own path]

CXX = 'c++'
CC = 'cc'
CXXFLAGS = ['-std=c++11', '-O3', '-Wall', '-fvisibility=hidden']
CFLAGS = ['-O3', '-Wall']
CPPPATH = ['/home/giovanni/anaconda2/include/python2.7']
CPPDEFINES = {'NDEBUG': 1}
LIBS = ['python2.7']
LIBPATH = ['/home/giovanni/anaconda2/lib']
LINKFLAGS = ['-std=c++11', '-O3']
CLINKFLAGS = []
RPATH = []
AR = 'ar'
ARFLAGS = ['rc']
RANLIB = 'ranlib'
BISON = 'bison'
RE2C = 're2c'
PYTHON_CONFIG = 'python-config'
PKG_CONFIG = 'pkg-config'
WITH_PYTHON = 'auto'
WITH_LUA = 'auto'
WITH_THREADS = 'posix'
TESTS = ['libreify', 'libgringo', 'libclingo', 'liblp', 'clingo']


In this way it worked, as I checked with:
 
> scons configure --build-dir=release 
output:

scons: Reading SConscript files ...
Checking for bison 2.5... (cached) yes
Checking for re2c... (cached) yes
Checking whether the C++ compiler works... (cached) yes
Checking whether the (shared) C++ compiler works... (cached) yes
Checking for C++ thread_local keyword... yes
Auto-detecting python (python-config)... yes
Auto-detecting lua (pkg-config)... no
Checking for C++ function snprintf()... yes
Checking for C++ function vsnprintf()... yes
Checking for C++ function std::to_string()... yes
scons: done reading SConscript files.
scons: Building targets ...
scons: Nothing to be done for `configure'.
scons: done building targets.

13/01/17

Anaconda (Python) and PyCharm on BunsenLabs/Debian

I have encountered several problems in using the standard python (2.7.9) that comes along with Debian in installing packaged I needed for my projects (e.g. PIL).

I decided therefore to turn towards anaconda.

Download the file on https://www.continuum.io/downloads#linux

Follow the installation instructions, in my case:

> bash Anaconda2-4.2.0-Linux-x86_64.sh

I installed it in the default directory (/home/giovanni/anaconda2)

Then in PyCharm (Community Edition 2016.3.2), I went to File > Settings > Project .. > Project interpreter, and I changed it on anaconda2.


Install and configure GRUB on USB key from Live CD

I had problem with my laptop, as it is a UEFI device.

Even if in the BIOS I've put the option "Legacy ..." for booting, I am able to boot the USB, then install Linux on a partition but not run it directly after the boot: writing GRUB on the MBR seems not to work. I guess there is some protection, or automatic recovery from Windows 10 going on.

Anyway, I decided to install the GRUB booter on a USB key, so that at least I can bypass this problem.

first mount the USB key (change sdb1 with your own, use fdisk -l or gparted)

> sudo mount /dev/sdb1 /mnt

then install grub on it

> sudo grub-install --no-floppy --root-directory=/mnt /dev/sdb

and then create a running configuration:

>  sudo grub-mkconfig -o /mnt/boot/grub/grub.cfg

Voila!

19/08/16

Install Simit on BunsenLabs/Debian jessie

Simit is a new language for simulation developed at MIT.
http://simit-lang.org/ 

It can be downloaded here:
https://github.com/simit-lang/simit

It builds upon LLVM. The compilation is not direct however.

First, I had to install:

> sudo apt-get install clang llvm

Executing cmake following the instructions on the simit page, I saw that I had also to install:

> sudo apt-get install libeigen3-dev freeglut3 freeglut3-dev

But I still had problems, that I solved following suggestions taken on internet. First,

Could not find OpenGL or GLUT so simviz will not be built

Which, following here, can be corrected with:

> sudo apt-get install libxmu-dev libxi-dev

At this point cmake did not give me any error, so I could launch make; but there was an error again:

Linking CXX shared library ../lib/libsimit.so
/usr/bin/ld: cannot find -ledit
collect2: error: ld returned 1 exit status


Fortunately, as suggested here, this can be solved like this:

> sudo apt-get update libedit-dev

03/08/16

Inkscape halts after editing text (typically newlines, but not only) on Debian jessie

This problem was really driving me crazy: Inkscape was halting -- somehow unpredictably -- often after editing text (typically newlines, but not only).

I looked on the internet, but I haven't found a lot, beside an advice to put the language support to "None" in the preferences. It did not work.

However, at a certain moment I start receiveing a few dialog windows asking for installing python-uniconvertor, as it was necessary for inkscape.

I discovered that this package exists in Debian wheezy, in stretch, but not in jessie.

I installed the version from the stretch distribution: 
https://packages.debian.org/search?keywords=python-uniconvertor

and now everything seems to work!

28/04/16

Change of screen resolution of Linux/BunsenLabs-Debian on Virtual Box

So, I don't have enough priviledges on my office machine. As I want to work with my own suite of stuff, I'm installing a fresh BunsenLabs (the supposed child of the discontinued CrunchBang) - always Debian-based - via VirtualBox.

The problem is that it fails to recognize the right screen resolution and I was stuck on 1024x768.

I first tried to install guest-additions (Devices > Install Guest Additions on the VirtualBox window of the running virtual system). The cd was mounted automatically, all I had to do was to open a terminal in the cd directory, and run:

> sudo ./VBoxLinuxAdditions.run

and then reboot.

I had better resolution as a result:

> xrandr

VBOX0 connected 1600x1200+0+0 0mm x 0mm
   1024x768      60.00 +  60.00
   1600x1200     60.00*
   1440x1050     60.00
   1280x960      60.00
   800x600       60.00
   640x480       60.00  


But still I didn't have the right resolution of the screen. (Update: I discovered that the guest additions weren't installed correctly. This determined the error. Reading the messages after running VBoxLinuxAdditions.run I installed the missing libraries and the system was correctly aligned. I leave the following part as it still provides a way to proceed in case of problems.)

I went on the original system anche checked which it was:

> xdpyinfo  | grep 'dimensions:'
  dimensions:    1680x1050 pixels (474x303 millimeters)


a (first-time seen for me) 1680x1250 resolution!

So I checked which options I should use:

> gtf 1680 1250 60
  # 1680x1250 @ 60.00 Hz (GTF) hsync: 77.64 kHz; pclk: 176.40 MHz  Modeline "1680x1250_60.00"  176.40  1680 1792 1976 2272  1250 1251 1254 1294  -HSync +Vsync


And I created the new mode, copying the result of the previous command:

> xrandr --newmode "1680x1250_60.00" 176.40  1680 1792 1976 2272  1250 1251 1254 1294  -HSync +Vsync
I added it

> xrandr --addmode VBOX0 "1680x1250_60.00"

and run it, to test if it worked, yes!

> xrandr --output VBOX0 --mode "1680x1250_60.00"

now, in order to put it the screen into the system for the next reboot, edit /home/.config/openbox/autostart (BunsenLabs-related, may be different for other distros), adding all the lines:

xrandr --newmode "1680x1250_60.00" 176.40  1680 1792 1976 2272  1250 1251 1254 1294  -HSync +Vsync
xrandr --addmode VBOX0 "1680x1250_60.00"
xrandr --output VBOX0 --mode "1680x1250_60.00"


Voilà. After the login, we have the new screen resolution!