Skip to content

Switching running Ubuntu to Lubuntu (14.04)

I wanted to test if my netbook will run more perfomant on Lubuntu, with its lightweigth LXDE desktop. But I always thought I have to re-install the whole system…which is not true! In fact, it is soo simple…

While noticing, that I’m not the only one having this missbelieve…I found this simple solution!

Simply:

  • open: Synaptic Package Manger
  • search for: lubuntu-core
  • check it, agree and apply the change
  • wait for total download and installation
  • you can select now after booting the system (by clicking the small ubuntu-symbol) to start a Lubuntu

Additional modifications after installation:

  • install ARandR: sudo apt-get install arandr (I need it to manage multiple monitors)
  • change keyboard layout: Preferences / Keyboard Layout Handler (‘Tastatureingabemethoden’)

Windows .exe*cutable from Python developing in Ubuntu

Puhh…that is a tricky one! After fiddling a lot it…it seems now so easy…

So I think I have to share that with…everybody who ever is also faced with that strange task😉

OK…I think you already know that it is not simply possible to make an executable file for a Windows system…with the well know extension: *.exe

But we will make that magic happen😉 … in fact it is not magic its just a combination of the following tools/versions:

Quick overview:

We will make an executable file from our python-project using pyinstaller. We do that in a simulated windows-environment using wine. This, lets call it, ‘simulated windows’ gets an installation of python and pywin32. As it is always a good idea to work clean…we do that in a virtual environment, so our major wine-installation wond’t get touched…isn’t that cool🙂 Let’s do it:

Make a test project

Actually, we could make a very simple example like:


mkdir ~/pyToExe
cd ~/pyToExe
nano test.py


# test.py
print "Hello, this is a test!"

But I a very good tutorial gave some more complex code that worked directly, so we’ll use that:


# test.py
import Tkinter
from Tkinter import *
root = Tk()
root.title('A Tk Application')
Label(text='I am a label').pack(pady=15)
root.mainloop()
print "Successfully, saved processed!'"

 

Install ‘pyinstaller’

As we can read in the same tutorial, but also here, we can simply make a single execeutable file doing that:

git clone https://github.com/pyinstaller/pyinstaller
python pyinstaller/pyinstaller.py test.py

Check it out…you can already execute it!

./dist/test

Setup a simple ‘virtual windows’

But try that on windows…you will fail! As this is made with Linux it is not executable on windows! I searched a lot for that ‘cross-compiling’ problem and found finally two very good links:

And found out that the guy, who gave the solutions (BTW: Thank you very much!!!) implemented a solution to start wine in a virtual environment. Let’s initialise it:

git clone https://github.com/htgoebel/virtual-wine.git
apt-get install scons
./virtual-wine/vwine-setup venv_wine

At the end you can choose the type of Windows…I chose Windows7!

Upgrade to a ‘virtual windows-python’

  • we can start the new virtual wine-environment (pretty similar to an normal virtualenv), and
  • install python and pywin32 (which we have dowloaded from the links above and saved in our folder ‘pyToExe’, in the the meantime🙂

(Helpfull, but I do it differently)

. venv_wine/bin/activate
wine msiexec -i python-2.7.8.msi
wine pywin32-218.win32-py2.7.exe

At this point it is very necessary to use versions that fit exactly to each other!

Make a real .exe*cutable

Now, we have a simple virtual ‘windows-python’ which we can give pyinstall as python-environment:

rm -r build
rm -r dist
rm test.spec
wine c:/Python27/python.exe pyinstaller/pyinstaller.py --onefile test.py
ll dist/

Yeah…there is the needed extension, but see test if it works in windows using wine:

wine dist/test.exe

What did I say simple isn’t it?!? Go on and try it on a windows…my test where successfull🙂

All still open tabs of my browser in one list, thank you so much!!!

Install latest TileMill on Ubuntu14.04 with installer (on terminal)

The original description is already very good, but I like to do it all on the terminal!

Get the ‘installer’:

wget http://tilemill.s3.amazonaws.com/latest/install-tilemill.tar.gz

Decompress ‘installer’:

tar -xf install-tilemill.tar.gz

Install TileMill:

sudo ./install-tilemill.sh

Open TileMill in Chromium (or simply click):

chromium-browser http://localhost:20009

Load module in function and make it globally available

I had the task to load a Pyhton-module within the ‘main’ function, but it must be globally available!

I found some solutions but they did not work…

…but finally, I found the correct solution:

exec("import my_module") in globals()

This implementation works great, solves my problem very good and I have not found any critical annotations!

Install git-gui on Ubuntu 14.04

So far, ‘gitg’ was always enough for me…check out the differences visually and make the add/commit stuff by hand.

But this simple handling reaches its limits as soon as you want to commit single lines of one file within different commits. So it’s time to dive more deeply into ‘git gui’…as I know that it makes me handle this task!

Simply install it:

sudo apt-get install git-gui

But where is it now? Typing…git-g[TAB]…nop…hmmm! After a while I realised, that it is called with:

git gui

As I think this is pretty unusual, I change the alias for that and thereby, use the opertunity and make it open in the background:

leafpad ~/.bash_aliases
alias gitgui="git gui &"

Now, I can run it very easy:

gitgui

But it opens with an allert like:

"No word lists can be found for the language..."

Quick googling tells me to install also the correct ‘aspell’ package (the german in my case):

sudo apt-get install aspell-de

That’s it!

 

Transfer a gist to a GitHub repository

Today, I had to manage the task of transfering data, that I previously managed in a gist, to a GitGub repository!

As this was pretty easy…I’d like to share the code with you!

Here’s the source: http://stackoverflow.com/a/13671484

1. Initialise a new, empty repository “GistOnGitHub” on GitHub

2. Add a new remote “github” and push the content to the repository

git remote add github https://github.com/username/GistOnGitHub.git
git push -u github master

3. Change the name of the origin of the gist to “gist”

git remote rename origin gist

4. Check out if you’ve typed in everything correctly

 git remote -v

That’s it!!!

From now on…you can push your data to the GitHub-gist and the GitHub-repository, by using:

git push github master
git push gist master

P.S.: I had some problems:

  • with the authentication…so I had to redefine the ssh-authentication!
  • used the wrong URL of the source description and had to change the new remote to the correct URL
    git remote set-url github https://github.com/username/GistOnGitHub.git

Set up gdal on Ubuntu 14.04

Recently, I updated my system to Ubuntu 14.04 and now I noticed that gdal is not running in Python anymore!

Importing gdal (respectively ‘osgeo’) broke with a command, that ended like:

"...version GDAL_1.8 not defined in file libgdal.so.1 with link time reference"

After a little investigation…I decided to (Re-) build gdal from source…like suggested:

http://gis.stackexchange.com/a/21739

But in contrast to the description…I installed the latest stable version of gdal (1.11.0):

http://download.osgeo.org/gdal/1.11.0/

So, here’s what I did:

Ctrl+Alt+T (Open terminal)

cd ~/folder/for/builds/from/source

sudo apt-get install build-essential python-all-dev

wget http://download.osgeo.org/gdal/1.11.0/gdal-1.11.0.tar.gz
tar xvfz gdal-1.11.0.tar.gz
cd gdal-1.11.0

./configure --with-python
make
sudo make install

The answer on http://gis.stackexchange.com/ recommends also to update the shared library cache…but this was not necessary, in my case!

Now it works perfect…again!

Follow

Get every new post delivered to your Inbox.