Page-crunch, the Linux Fineprint.

November 6, 2009 eduardomucelli Leave a comment

Since I’ve been using only Linux for some years I missed Fineprint a lot. It is a nice app and I’ve never found nothing similar for Linux, even with the raw psutils (that I’ve been struggling with for some weeks long) I could not have the things done the way I would like.

I was pleased with Page-crunch, a tk-based application that does a front-end to psutils with everything I wish to print pdf files maximizing the useful space. Check out the following screenshot, the interface displays the enough options for printing and visualization. With some tests, for sure, Page-crunch will provide you a nice print work. VoilĂ .

A page-crunch screenshot

Categories: Linux Tags: ,

Ubuntu : Real transparence in Terminator

October 28, 2009 emanuelvianna Leave a comment

Hi fellows,

Following a tip to configure the terminator terminal to real transparence.

First, if you don’t know terminator take a look (it’s a useful tool!)

Once you have installed it:

sudo apt-get install terminator

You’ll see that even if you mark “real transparency” through righ click in the screen > Edit Profile > Appearence tab, it didn’t work.

So the workaround to this issue is to use transset-df tool that turn any window transparent:

Unfortunately, the transset that are found in apt is not the right one, so you should install it from the source:

wget http://forchheimer.se/transset-df/transset-df-4.tar.gz
tar -xvzf transset-df-4.tar.gz
rm transset-df-4.tar.gz
cd transset-df-4/
make
make install
rm -r transset-df-4

Once installed, create a launcher to terminator (at /usr/local/bin for instance):

sudo touch /usr/local/bin/terminator
sudo chmod +x /usr/local/bin/terminator

And paste the following commands (using vim with sudo for instance):

#!/bin/sh
exec /usr/bin/terminator $@ &
sleep 2s
transset-df --id `xprop -root |
grep "_NET_ACTIVE_WINDOW(WINDOW): window id # " |
grep -o -E -e 0x[a-z0-9]+` 0.75 &> /dev/null
exit

Now run terminator from this launcher and it should be transparent!

transparent terminator

Some useful shortcuts:

Ctrl + Shift + O: Split horizontally
Ctrl + Shift + E: Split vertically
Ctrl + Shift + P: Turn to the previous terminal view (ou Ctrl + Shift + Tab)
Ctrl + Shift + N: Turn to the next terminal view

Ctrl + Shift + W: Close the current terminal view
Ctrl + Shift + Q: Quit terminator

If the Terminator’s title-bar is showing “None” in spite of the current directory it is because your environment does not know the variable PROMPT_COMMAND. So, add the following line to your .bashrc file:

PROMPT_COMMAND=’echo -ne “33]0;${USER}@${HOSTNAME}: ${PWD/$HOME/~}07″‘

See ya

See more:

http://crunchbanglinux.org/forums/topic/1003/terminator-transparency-workaround/
https://help.ubuntu.com/community/TransparentTerminals

Ubuntu : Script to format your PDF before printing

October 25, 2009 emanuelvianna 1 comment

Hi,

Following a script which receive the PDF filename and format it to print in Ubuntu. First it crop the empty space around the page, cutting the margins (pdfcrop). Then it put two pages side by side (pdfnup) and rotate it (pdftk) to allows to print from console (lpr). When it finishes is generated a file name ready_<file_name>.pdf

It requires the following packages:

sudo apt-get intall -y pdfcrop
sudo apt-get intall -y pdfjam
sudo apt-get intall -y pdftk

### pdf2print.sh ###

#! /bin/bash
FILE=$(echo $1 | sed ’s/.pdf//’)
echo “pdfcrop –margins 12 $FILE.pdf”
pdfcrop “$FILE.pdf”
echo “pdfnup $FILE-crop.pdf –nup 2×1″
pdfnup $FILE-crop.pdf –nup 2×1
echo “pdftk $FILE-crop-2×1.pdf cat 1-endE output ready_$FILE.pdf”
pdftk $FILE-crop-2×1.pdf cat 1-endE output ready_$FILE.pdf
rm $FILE-crop.pdf $FILE-crop-2×1.pdf

See ya

Categories: Ubuntu Tags: , ,

LaTeX : Drawing figures with PSTricks

October 23, 2009 emanuelvianna Leave a comment

Here is an interesting made on Java named PSTricks, that provide a GUI so you can draw and it convert it to LaTeX commands. Nice to be used with beamer!

example_latexdraw

See more:

http://ac.jiruan.net/2008/04/easily-draw-figs-with-latex/

Categories: Latex Tags: , , , ,

Basic usage of MPI (Message Passing Interface)

September 29, 2009 eduardomucelli Leave a comment

If you do not know why use MPI, check out here. If that’s your first time struggling with MPI you will need [download (Linux) | download (Windows)] it first. That’s the MPICH, one of the MPI’s “code-approach”.

Linux users: Extract it in any folder you want and using console step into this folder and:

./configure
make
make install

Before you try code your parallel application, there is some things to do. First you need to create a .mpd.conf file and define its secretword:

cd $HOME
touch .mpd.conf
chmod 600 .mpd.conf
echo “secretword=secret12345″ >> .mpd.conf

If you’re trying use your app and receiving:

“cannot connect to local mpd (/tmp/mpd2.console_machinename); possible causes:
1. no mpd is running on this host
2. an mpd is running but was started without a “console” (-n option)”

You should create the .mpd.conf file (description above).

Well, let’s create the first parallel app that uses MPI.

      #include "mpi.h"
      #include <stdio.h>

      int main( int argc, char *argv[] ) {
      int numprocs, rank;

      MPI_Init(&argc, &argv);
      MPI_Comm_size(MPI_COMM_WORLD, &numprocs);
      MPI_Comm_rank(MPI_COMM_WORLD, &rank);

      printf ("Number of procces: %d My ID is: %d\n", numprocs, rank);

      MPI_Finalize();
      return 0;
}

Save it as peer.c and compile and generate the executable:

mpicc -o peer peer.c.

Start one instance of mdp and run four instances of your app:

mpdboot -n 1
mpiexec -l -n 4 ./peer

That’s all for now.

Categories: Linux Tags: , ,