How to play your BlurayDisks on ubuntu

After several attempts and a few “ok I just go on using my PS3 to do it” I finally got the solution to play those BlurayDisk on linux (in my case on ubuntu 14.04). Got to thank my buddy negativo17 for the help!

The main trick is to use MakeMKV. The latest release at this moment is v1.9.5 and it’s available on makemkv.com forum. As a first step download both binary and source files from the forum page then run following command on a shell.

$ sudo apt-get remove libaacs0
$ sudo apt-get install build-essential pkg-config libc6-dev libssl-dev libexpat1-dev libavcodec-dev libgl1-mesa-dev libqt4-dev

In my case I found that the removal of libaacs0 was not enough (probably I messed around a bit in the previous attempts): in case the file /usr/lib/libaacs.so.0 is still present just delete it manually.

Extract makemkv-bin-1.9.5.tar.gz and makemkv-oss-1.9.5.tar.gz in a temporary directory.

Access makemkv-oss-1.9.5 directory and execute following commands:

$ ./configure
$ make
$ sudo make install

Then access makemkv-bin-1.9.5 and execute following commands:

$ make
$ sudo make install

Now execute following commands:

cd /usr/lib
sudo ln -s libmmbd.so.0 libaacs.so.0
sudo ln -s libmmbd.so.0 libbdplus.so.0

Now your VLC can play BD disks (just the movie, not the menu)!!

Enjoy.

References

  • http://www.makemkv.com/forum2/viewtopic.php?f=3&t=7009
  • http://www.makemkv.com/forum2/viewtopic.php?f=3&t=224

Python project documentation with Sphinx

This post is an “open post” where I put useful tips & tricks about documentation in Python projects.

Most used inline formatting rules

  • **bold** which render bold
  • *italics* which render italic
  • “inline literal monospace“ which render inline literal monospace
  • `Python <http://www.python.org/>`_ which render Python

 

Reference:

Eclipse shortcuts

A few useful shortcuts to use in Ecplise:

  • column mode toggle: ALT + SHIFT + A
  • text to lower case: CTRL + SHIFT + Y
  • text to upper case: CTRL + SHIFT + X
  • switch to other editors: CTRL + [SHIFT +] E
  • navigate members: CTRL + SHIFT + ↓ or CTRL + SHIFT + ↑
  • jump to line n: CTRL + L
  • last edit location: CTRL + Q
  • navigate viewed editors chronologically: Alt + ← and Alt + →

Google material design icon set

Google revealed, at I/O 2014, his new review of flat design named “Material Design“.

I’m not a designer so I won’t review this style per se: I’ll link down here some interesting articles and resources!

Polymer project by Google

Polymer Project is a new easy way to use Google APIs.

They simplified to the basic the usage of Google Apps in your webpage: to integrate something in your code you just need to load platofrom.js script and then write a link tag  with attribute rel set to “import” and attribute href set to the name of component you want to load.

You can find a quick example here on github.

References

Python development setup

Pip

Pip is a package manager for Python packages. The list of more common packages can be found on Python Package Index (PyPI).

To install or remove a package you just need to do

$ pip install <package_name>
$ pip uninstall <package_name>

A cool feature coming with Pip is an easy way to manage “requirements” through a simple list (package name with versions). You can extract that and use it to replicate the environment with these commands:

$ pip freeze > requirements.txt
$ pip install -r requirements.txt

VirtualEnv

The cool feature this tools gives you it’s the ability to manage completely separated environments to develop in a non-messy environment. This also helps when you got to keep different versions of Python and libs for different projects.

To install it just do

$ pip install virtualenv

To create a new virtual environment just do

$ virtualenv TEST

That command will create a local folder with inside everything need to manage your new separated world. To use that (to install packages in it and run your project inside it) you should do

$ source bin/activate
(TEST) $

With the activate command your shell environment has been manipulated to let you run your python project within this new separated space. Your $PATH has been manipulated to have this virtualenv’s bin/ as first entry and your prompt now displays the name of the environment you’re in.

Now you can go on and install whatever you need with pip.

While inside your new environment your prompt will be modified to display in which environment you are (the “(TEST)” part).

and to exit it just and restore your shell environment just do

(TEST) $ deactivate

VirtualEnvWrapper

This project exploits VirtualEnv adding some other cool stuff and make the day to day work so much easier. The best things you got with this tool are:

  • virtual environments all stored in a single place, not spread around like before
  • wrapper to create, delete, copy and activate virtual environments with tab completion (!)

To install and setup it just do

$ sudo pip install virtualenvwrapper
$ export WORKON_HOME=~/Envs
$ mkdir -p $WORKON_HOME
$ source /usr/bin/virtualenvwrapper.sh

and insert following lines in .bash_rc to have this tools ready next time too

$ export WORKON_HOME=~/Envs
$ source /usr/local/bin/virtualenvwrapper.sh

Now that it’s installed let’s create a new environment

$ mkvirtualenv env1
New python executable in env1/bin/python
Installing setuptools, pip...done.
(env1) $

As you can see that command will also activate the environment. Now you can install whatever package you want with pip as usual. To list all installed packages you can use lssitepackages command.

To switch to another environment or to activate one just use workon (you can use tab to invoke the list of available environments or just issue the command alone to get a plain list)

$ workon
env1
env2
env3
$ workon (press tab)
env1      env2      env3
$ workon env3
(env3)$

To delete a virtual environment just do

$ rmvirtualenv env1

A full list of command can be found here.

ipython

IPython (capital ‘i’) it’s a powerful interactive shells that we can use within our preferred IDE (eg Eclipse+PyDev) to get cool features like tab completion (eg for attribute navigation), object exploration, magic functions, etc.

To install it and invoke it just do

$ pip install ipython
$ ipython
Python 2.7.6 (default, Mar 22 2014, 22:59:56)
Type "copyright", "credits" or "license" for more information.

IPython 2.2.0 -- An enhanced Interactive Python.
? -> Introduction and overview of IPython's features.
%quickref -> Quick reference.
help -> Python's own help system.
object? -> Details about 'object', use 'object??' for extra details.

In [1]:

References

  • http://virtualenv.readthedocs.org/en/latest/
  • http://mrcoles.com/tips-using-pip-virtualenv-virtualenvwrapper/
  • http://virtualenvwrapper.readthedocs.org/en/latest/
  • http://ipython.org/documentation.html

How to install and build a custom Zepto library

If you’re searching for a light-weight JavaScript library similar to jQuery to use in your development for mobile hybrid app (i.e. with PhoneGap) then Zepto is your choice! This library it’s really compact, open source (MIT license), weights just 9.2kB and if you already know jQuery (who doesn’t?) Zepto APIs match jQuery ones…

Zepto’s default package contains these modules: zepto, event, ajax, form and ie (check Zepto site for explanations and full list of modules!).

A very cool thing about Zepto is that you can create your own package with only needed modules! To build a custom Zepto library you should have Node.js installed on your system and follow these steps (for linux and OSX):

  • download Zepto source code from Github (i.e. in zip archive)
  • unzip it and open a terminal in that directory (i.e. you should be inside something like ‘/tmp/zepto-master/’)
  • execute following command:
    • npm install
    • npm run-script dist
    • MODULES=”zepto event data” npm run-script dist

…where “zepto event data” is a space-separated list of wanted modules! After this you should find your Zepto custom library (uncompressed, minified and gzipped) inside ‘dist’ directory (i.e. ‘/tmp/zepto-master/dist/’)…

Please note that inside your custom library you can find in the first line a comment with your choosen modules.