Tipue search

As the number of posts is growing, I think that having a search engine within the website is now relevant. This post only shows what I am using for that.

Instead of using an external search engine such as Google or DuckDuckGo, you have a plugin in Nikola than enables searching on the client side by using jQuery.

Assuming you have installed Nikola > v7.0, you can install the plugin like this:

nikola plugin -i localsearch

It will give you a configuration sample to paste in your config.py file.

Source: http://plugins.getnikola.com/#localsearch

Git branching strategy

Git Branching strategy

The git-flow strategy

Very nice cheatsheet: http://danielkummer.github.io/git-flow-cheatsheet/

The centralized worklow

Like Subversion, the Centralized Workflow uses a central repository to serve as the single point-of-entry for all changes to the project. Instead of trunk, the default development branch is called master and all changes are committed into this branch. This workflow doesn’t require any other branches besides master.

Pros

Developers are always working on the last version of the code.

Cons

If some code breaks something, the whole process is stuck, no release can be done.

Feature Branch Workflow

The core idea behind the Feature Branch Workflow is that all feature development should take place in a dedicated branch instead of the master branch. This encapsulation makes it easy for multiple developers to work on a particular feature without disturbing the main codebase. It also means the master branch will never contain broken code, which is a huge advantage for continuous integration environments.

Encapsulating feature development also makes it possible to leverage pull requests, which are a way to initiate discussions around a branch. They give other developers the opportunity to sign off on a feature before it gets integrated into the official project. Or, if you get stuck in the middle of a feature, you can open a pull request asking for suggestions from your colleagues. The point is, pull requests make it incredibly easy for your team to comment on each other’s work.

source: https://www.atlassian.com/git/workflows

Screen

Install screen

sudo apt-get install screen

Start a new screen session with session name

screen -S <script_name>

Attach to a running session with name

screen -r <script_name>

Escape key

Ctrl-a and d

Liclipse as Python editor

Installation

Liclipse seems to be the IDE to go for Python edition if you come from the Eclipse + pydev plugin world: Liclipse (Lightweight Eclipse)

It comes with pydev and gedit plugin already integrated.

On ubuntu 12.04, you need to install the following Java dependencies before being able to launch it.

sudo add-apt-repository ppa:webupd8team/java
sudo apt-get update
sudo apt-get install oracle-java7-installer

It'll keep your java 7 installation up to date.

To automatically set up the Java 7 environment variables JAVA_HOME and PATH:

sudo apt-get install oracle-java7-set-default

Source: http://stackoverflow.com/questions/16263556/installing-java-7-on-ubuntu

Importing a Git project

If the project is already cloned in your local environment, then click "File" | "Import"| Select "Git" | "Project from Git"| "Existing local Repository" and select the project you want.

Else, you can also clone the project from Liclipse by doing "File" | "Import"| Select "Git" | "Project from Git"| "Clone Uri".

Using eGit

Egit enables you to do the same as what git already enables but in a much more friendly way.

Because egit is already integrated in Jiclipse, you already have all its features. I recommend the documentation. Most of the egit features are available when you right click on a file and select "Team".

  • Annotations: When you are editing a file, you can access it by right clicking the file, selecting "Team" and "Show annotations".

    Similar to:

git blame
  • History: When you are editing a file, you can access it by right clicking the file, selecting "Team" and "Show in History".

    Similar to:

git log -p

Using Pydev

pydev is the Python IDE in Eclipse.

The debugging mode is very easy to use:

  • Place your breakpoints where you want by double clicking in the margin of the files.
  • Edit the "Run configuration" according to your project settings.
  • Click on "Run" | "Debug as" and select the configuration you created.

Alternatives

Development environments for Python are listed here: http://docs.python-guide.org/en/latest/dev/env/

As text Editors, Vim is also a good choice combined with the following plugins:

Unresponsive process

pkill -9f process-name

Example:

pkill -9f filezilla

If you have launch a command that you cannot directly stopped with usually ctrl+c, you can always put the process in the background with ctrl+z and then use the jobs command to list the job (command) that you have launched. Then, you have the number of the job and you can kill it with the command kill %<number_of_the_job>.

Example:

$ sleep 100
^Z
[1]+  Stopped                 sleep 100
$ jobs
[1]+  Stopped                 sleep 100
$ kill %1
$ jobs
[1]+  Terminated              sleep 100
$ jobs
$