Archive

Archive for March, 2012

Tents and Trees

March 20, 2012 Leave a comment

Tents and trees is an excellent logic game. Here is a screenshot:

Rules
“You have a grid of squares, some of which contain trees. Your aim is to place tents in some of the remaining squares, in such a way that the following conditions are met:

  • There are exactly as many tents as trees.
  • The tents and trees can be matched up in such a way that each tent is directly adjacent (horizontally or vertically, but not diagonally) to its own tree. However, a tent may be adjacent to other trees as well as its own.
  • No two tents are adjacent horizontally, vertically or diagonally.
  • The number of tents in each row, and in each column, matches the numbers given round the sides of the grid.”

Another description of the rules can be found here.

Installation

$ sudo apt-get install sgt-puzzles
$ tents

Control
With left click you can place a tent. With the right click of the mouse you can place a field of grass. While holding the right button of the mouse, you can select multiple fields.

Categories: games Tags: ,

Play an interlaced video without those funny lines

March 20, 2012 Leave a comment

Problem
I wanted to watch a DVD but it was interlaced, thus it contained lots of disturbing horizontal lines. How to get rid of those lines? Is there a way to filter them out?

Solution
Mplayer has an option for that :) Try this:

mplayer -vf pp=lb interlaced_video.iso

This procedure is called deinterlacing.

Tip from here. Image borrowed from here.

Update
VLC can do this too. Available under Video -> Deinterlace. You can also choose the deinterlacing method under Video -> Deinterlace mode.

Open Firefox with lots of tabs in an instant

March 14, 2012 Leave a comment

Problem
You open Firefox with tabs from the last time. However, reloading these tabs takes lots of time and thus Firefox starts slowly. What to do?

Solution
Go to Preferences -> General, and check “Don’t load tabs until selected”.

Categories: firefox Tags:

Firefox 11 for Ubuntu

March 14, 2012 Leave a comment

There is an official PPA that contains releases of Firefox from the beta channel: https://launchpad.net/~mozillateam/+archive/firefox-next.

If you want to install Firefox from this PPA, execute the following commands:

$ sudo add-apt-repository ppa:mozillateam/firefox-next
$ sudo apt-get update && sudo apt-get install firefox

This tip is from here.

Categories: firefox Tags: ,

Proxy Explorer

March 10, 2012 Leave a comment

Problem
You need a list of working US proxies for listening to Pandora Radio.

Solution
What you need is jabbapylib’s proxy explorer script.

Example

$ ./proxies.py
# extracting list..............................done.
Working US proxies:
(1) {'ip': u'209.239.112.78:8080', 'type': u'Transparent', 'avg_time': 133.46, 'country': u'United States'}
(2) {'ip': u'173.236.204.117:8080', 'type': u'Transparent', 'avg_time': 186.14, 'country': u'United States'}
__END__

The list of proxies changes minute by minute, so don’t use these IP addresses, they must be outdated by now.

Categories: python Tags: , ,

clang: a C language family frontend for LLVM

March 5, 2012 Leave a comment

Clang is considered to be a production quality C, Objective-C, C++ and Objective-C++ compiler when targeting X86-32, X86-64, and ARM… If you are looking for source analysis or source-to-source transformation tools, clang is probably a great solution for you.

User’s Manual

Clang vs Other Open Source Compilers

Example

$ sudo apt-get install clang
$ clang hello.c
$ ./a.out
hello world

I didn’t dive into it but for “hello world” it works just like GCC :) I added some errors intentionally and the compiler told me exactly what and where the problem is. The warning/error messages were very informative.

minted – highlighted source code for LaTeX

March 4, 2012 Leave a comment

minted is a package that facilitates expressive syntax highlighting in LaTeX using the powerful Pygments library. The package also provides options to customize the highlighted source code output using fancyvrb.

PDF doc is here.

Example (minimal.tex):

\documentclass{article}
\usepackage{minted}    % import the package here
\begin{document}
\begin{minted}{c}
int main() {
    printf("hello, world");
    return 0;
}
\end{minted}
\end{document}

Compilation:

$ pdflatex -shell-escape minimal

Alternatives

  • \begin{verbatim} ... \end{verbatim}
  • \begin{lstlisting} ... \end{lstlisting}

Object-oriented programming in C

March 2, 2012 Leave a comment

Yes, it’s possible. See Axel-Tobias Schreiner’s book on this topic. Source code of the book is here.

Links