Updates from April, 2012 Toggle Comment Threads | Keyboard Shortcuts

  • Tomás Augusto Müller 2:42 pm on April 26, 2012 Permalink | Reply
    Tags: , , short,   

    [short-tip] Extract range of pages from a PDF file 

    Let’s assume you downloaded a PDF file with 700 pages. But you want to send by email only pages 7 to 27.

    Ghostscript to the rescue! Available in every UNIX/Linux distribution, you can leverage the gs command to do this.

    gs -sDEVICE=pdfwrite -dNOPAUSE -dBATCH -dSAFER /
       -dFirstPage=7 -dLastPage=27 /
       -sOutputFile=name_of_outfile.pdf name_of_inputfile.pdf
     
  • Tomás Augusto Müller 2:09 pm on February 28, 2012 Permalink | Reply
    Tags: benchmark, , , , JIT, , ,   

    Benchmarking NeoQuotes (Jetty + JRubyRack) 

    To perform basic HTTP benchmarks against a web application, you can start with ab – Apache HTTP server benchmarking tool. speed

    If you use Ubuntu, the installation is very simple:

    sudo apt-get install apache2-utils

    I used this tool to benchmark NeoQuotes application, testing how Jetty with JRuby-Rack are performing against multiple concurrent requests.

    First, start up Jetty with mvn jetty:run or with the command defined in project Procfile (sh target/bin/jruby -S config/jetty.rb for NeoQuotes).

    Next, execute multiple times the following command:

    ab -n 10000 -c 25 http://localhost:8080/

    where n = number of requests and c = concurrency level.

    Is worth to look to the number of requests per second, that are increasing every time the benchmark is executed. This happens thanks to JIT!

    Below some results after running ab -n 10000 -c 25 http://localhost:55012/ three times in a commodity hardware (all tests were performed on the application homepage where there is no interaction with Neo4j and no cache mechanism is configured):

    First execution:

    Time taken for tests:   73.162 seconds
    Requests per second:    136.68 [#/sec] (mean)

    Second execution:

    Time taken for tests:   67.006 seconds
    Requests per second:    149.24 [#/sec] (mean)

    Third execution:

    Time taken for tests:   65.725 seconds
    Requests per second:    152.15 [#/sec] (mean)

    Also, take a look at Min and Max threads of Jetty QueuedThreadPool, at config/jetty.rb configuration.

    Depending of your hardware and your VM configuration,the more threads you configure into min and max, the worse your throughput gets when your VM starts to reach its resource limits.

     
  • Tomás Augusto Müller 2:19 pm on June 9, 2011 Permalink | Reply
    Tags: , ,   

    Close process by port number with one line 

    Recently I encountered myself executing so many times the following unix commands:

    1: $ netstat -anp | grep :port_number
    2: (search manually the output for the PID that is using the given :port_number)
    3: $ kill -9 :pid

    Bored, I challenged my friend Alisson to build a command to perform those three steps, in one single line.

    He came up with the following solution:

    kill -9 $(sudo netstat -anp | grep :[port_number] | awk '{print $7}' | cut -d '/' -f 1)

    Congratulations man! You deserve a very cold Heineken!

     
  • Tomás Augusto Müller 10:23 am on October 8, 2010 Permalink | Reply
    Tags: , svn, ubuntu   

    Resolving svn RA layer request failed error 

    Still using Subversion?

    Are you using Ubuntu, under a network which has a proxy configured?
    And, after installing the Subclipse Eclipse plugin you are getting the “RA layer request failed” error?

    Configuring proxy by entering the address and port number in Eclipse preferences will not solve this.

    Proceed with the following:

    1. $ cd ~/.subversion/
    2. $ vim servers
    3. In the servers file, find the lines with http-proxy-host and http-proxy-port under [global] section.
    4. Uncomment those lines and enter the host address and the port number respectively for http-proxy-host and http-proxy-port.
    5. Save and close the editor.
    6. In the SVN Repository view in Eclipse, try adding a new repository location.

    Note: Make sure you don’t leave a space before the statements after uncommenting the two lines as said above, else you are likely to get the error Cannot map the project with svn provider.

    ps: tested using Ubuntu 10.04; SVN interface: JavaHL (JNI) 1.6.6

    sudo  apt-get install libsvn-java, to install the JavaHL interface.

    The default installation dir is: /usr/lib/jni

    If Eclipse do not pick automatically this directory, add the following line to your eclipse.ini, as a argument bellow of “-vmargs”:

    -Djava.library.path=/usr/lib/jni

    sorces:

    http://varshamyspace.blogspot.com/2010/08/setting-up-proxy-for-subclipse-in.html

    http://islandlinux.org/howto/installing-javahl-subclipseeclipse-ubuntu

     
  • Tomás Augusto Müller 10:23 am on July 30, 2010 Permalink | Reply
    Tags: gnome   

    Terminal Quick Launch 

    Very useful Nautilus plugin:

    nautilus plugin for opening terminals in arbitrary local paths

    nautilus-open-terminal is a proof-of-concept Nautilus extension
    which allows you to open a terminal in arbitrary local folders.

    To install this quick launch to the terminal, simply run:

    sudo apt-get install nautilus-open-terminal

    and restart your gnome session for the change to take effect.

    Afterwards you’ll have a “open terminal” button on your right-click menu anywhere within nautilus or gnome-desktop area.

     
  • Tomás Augusto Müller 10:56 pm on July 26, 2010 Permalink | Reply
    Tags: firefox, , ,   

    Instalação manual do Java Plugin no Firefox (Ubuntu) 

    Localize o diretório de instalação do Firefox, mais precisamente a pasta “firefox-addons/plugins” (normalmente em: /usr/lib/firefox-addons/plugins).

    A JDK contém o plugin para o browser. Está localizado em:

    <JDK>/jre/lib/i386/libnpjp2.so

    Apenas um plugin do java pode ser utilizado pelo navegador. Portanto elimine qualquer link simbólico que aponte para javaplugin-oji.so e libnpjp2.so.

    Feito isso, crie um link simbólico para o plugin distribuído com a JDK, utilizando o comando abaixo:

    /usr/lib/firefox-addons/plugins$ sudo ln -s <JDK>/jre/lib/i386/libnpjp2.so

    Reinicie o Firefox, e digite about:plugins na barra de endereços. Localize o plugin do java, confirmando a instalação.

     
    • Yves 8:45 am on January 19, 2013 Permalink

      Muito obrigado!!!

  • Tomás Augusto Müller 10:36 pm on July 26, 2010 Permalink | Reply
    Tags: , ,   

    Instalando a Sun JDK 6 no Ubuntu 

    Registro aqui alguns passos para instalação da Sun JDK 6 no Ubuntu (10.04 – lucid), para fins de consulta pessoal. Se foi útil para você, deixe seu registro.

    1. Faça o download do .bin (jdk-6u<version>-linux-i586.bin) no site oficial da Oracle.
    2. Execute o seguinte comando sobre o arquivo: $ chmod a+x jdk-6u<version>-linux-i586.bin
    3. Agora com as devidas permissões configuradas, execute o arquivo: $ ./jdk-6u<version>-linux-i586.bin
    4. Utilizando o comando mv, altere o local dos arquivos extraídos para por exemplo: /usr/local/java/jdk<version>
    5. Crie um link simbólico para este diretório. Ex: /usr/local/java$ ln -s jdk<version>/ jdk
    6. Exclua o arquivo .bin

    Configurar a variável de ambiente $JAVA_HOME:

    Abra o arquivo ~/.profile com o editor de sua preferência e adicione no final do arquivo:

    JAVA_HOME=/usr/local/java/jdk
    export JAVA_HOME
    
    PATH="$JAVA_HOME/bin:$PATH"

    obs.1: repare na utilização do link simbólico na variável de ambiente JAVA_HOME
    obs.2: para executar alguns dos comandos listados serão necessárias permissões de super usuário.

     
c
compose new post
j
next post/next comment
k
previous post/previous comment
r
reply
e
edit
o
show/hide comments
t
go to top
l
go to login
h
show/hide help
shift + esc
cancel
Follow

Get every new post delivered to your Inbox.

%d bloggers like this: