Linux: PDF

A nice tool for playing with PDF files using Linux is the PDF toolkit Pdftk:

Pdftk - The PDF Toolkit

 

VN:F [1.9.17_1161]
Rating: 0.0/10 (0 votes cast)
VN:F [1.9.17_1161]
Rating: 0 (from 0 votes)

The vServer Experiment: Idea

So a friend and I found a place were we can test a vServer for seven days for free. The host is Alphahosting.de.

The link to the offer is http://alfahosting.de/server_kostenlos_testen/server_testen_gratis.htm?wmid=google062011_serverkostenlos-testl.

In this post we will collect some ideas for what are going to do in our seven days testing period. In the follow-ups we will report how far we got and what we had to do to get things up an running.

Basics:

  • Setup Apache
  • Setup MySQL
  • Setup a mail server

Advanced:

  • Divide user areas

Additional:

  • Setup a SVN-Server
  • Setup a GIT-Repository
VN:F [1.9.17_1161]
Rating: 0.0/10 (0 votes cast)
VN:F [1.9.17_1161]
Rating: 0 (from 0 votes)

Citations III & Parody

This statement was made by Gary Marshal (Read more: http://www.techradar.com/news/internet/google-s-1-do-not-like-939357#ixzz1OC8sxK6p) concerning Google's "+1 Button":

Right-wing creationist nut-jobs can have interesting things to say about iPads; I don't want their input in my political or science searches, thanks very much.

Furthermore I found this page, which I thought was pretty funny at the time:

http://thecontentfarm.tumblr.com/

I read this article:

http://thecontentfarm.tumblr.com/post/3701750679/how-to-find-proper-skiing-attire-at-the-last-minute

VN:F [1.9.17_1161]
Rating: 0.0/10 (0 votes cast)
VN:F [1.9.17_1161]
Rating: 0 (from 0 votes)

Music

Well, I am desperate, I guess. Let's see, if I actually use those:
http://www.earpower.com/ssing.htm
http://www.earpower.com/ohrpower.htm

This is German page for music theory:
http://www.lehrklaenge.de/html/primen_und_oktaven_horen_.html

Update: Never mind those first two programs. They are shareware and only work for a limited time.

VN:F [1.9.17_1161]
Rating: 0.0/10 (0 votes cast)
VN:F [1.9.17_1161]
Rating: 0 (from 0 votes)

Linux: SED and GREP and RegEx

Just a little note. When using real regular expressions with grep and sed, meaning some expression using i.e. ? or +, one needs be aware to use the right options:

GREP

egrep

SED

sed -r

There are other switches and options, but those are enough for me at the moment.

VN:F [1.9.17_1161]
Rating: 0.0/10 (0 votes cast)
VN:F [1.9.17_1161]
Rating: 0 (from 0 votes)

Try a little multitasking

http://wearefuntastic.net/imageserver/swf-spiele/1sdr2gt/MultitaskGame.swf

VN:F [1.9.17_1161]
Rating: 0.0/10 (0 votes cast)
VN:F [1.9.17_1161]
Rating: 0 (from 0 votes)

JUnit 4 - Test suites using annotations

JUnit 4 provides annotation for testing. I had trouble finding how to bundle several test cases together in a test suite using that method. Finally, this article helped:
http://radio.javaranch.com/lasse/2006/07/27/1154024535662.html

It seems that not that many developers migrating to JUnit 4 are aware of the replacement for the old way of building suites--using the static suite() method and the junit.framework.TestSuite class--I decided to blog a simple example for Google's indexing hamsters to grab hold of.

Here we go:

import org.junit.runner.RunWith;
import org.junit.runners.Suite;
 
@RunWith(Suite.class)
@Suite.SuiteClasses({
  TestCalculatorAddition.class,
  TestCalculatorSubtraction.class,
  TestCalculatorMultiplication.class,
  TestCalculatorDivision.class
})
 
public class CalculatorSuite {
    // the class remains completely empty, 
    // being used only as a holder for the above annotations
}

The above class is a simple placeholder for the suite annotations, not containing any other functionality as such. The key is in the @RunWith annotation, which tells the JUnit 4 test runner to use the org.junit.runners.Suite class for running this particular class. The @Suite annotation, on the other hand, tells the Suite runner which test classes to include in this suite and in which order.

I hope this helps folks out there since it doesn't seem to be documented too well in junit.org.

update: there's an upcoming book - a 2nd edition of JUnit in Action that's going to cover JUnit 4. Its release is scheduled for June 2009 so there's still some time before the apparent documentation gap should be gone. Having said that, the book is on Manning's early access program (MEAP) so we should start seeing more and more chapters as we near the release date.

VN:F [1.9.17_1161]
Rating: 0.0/10 (0 votes cast)
VN:F [1.9.17_1161]
Rating: 0 (from 0 votes)

Linux commands

I am very forgettable, so I will collect some Linux commands that are useful to me. This is by no means a complete documentation of each command.

ls

Lists contents of a folder. Example:

martin@darkcloud:~$ ls
Desktop    hs_err_pid2413.log  Programs   scripts    workspace
Documents  Music               Public     Templates
Downloads  Pictures            resources  Videos

Nicer output can be achieved by using:

ls -lh

The argument -l lists folder content by line. -h makes folder content sizes human readable. Example:

martin@darkcloud:~$ ls -lh
total 132K
drwxr-xr-x  2 martin martin 4,0K 2010-12-20 09:24 Desktop
drwxr-xr-x  4 martin martin 4,0K 2010-12-22 10:39 Documents
drwxr-xr-x 14 martin martin  20K 2011-01-11 09:44 Downloads
-rw-r--r--  1 martin martin  76K 2011-01-11 12:06 hs_err_pid2413.log
...

Another important argument for ls is -a, which shows hidden folder content.

ls -a

Folder size:

du -sh folder/

When using the command cut, the delimiter is selectable with the -d option. If the delimiter is supposed to be TAB, hit <CTRL>v<TAB> to put the TAB between the quotation marks.

cut -d"<CTRL>v<TAB>"

Another example using file tools, is to extract the second column with delimiter : of the file doc_tags.sql (cut -d":" -f2 doc_tags.sql) sort the output (sort), extract unique entries and count the duplicates (uniq -c) and finally count the number of unique entries (wc). OK, counting the duplicates does not get us anywhere as we only count lines with the wc command (first number), but this is for illustration purposes, so whatever.

cut -d" " -f2 doc_tags.sql | sort | uniq -c | wc

Count files in directory dir:

find dir -type f | wc -l

Find and count empty files in dir:

find dir -type f -empty | wc -l
VN:F [1.9.17_1161]
Rating: 0.0/10 (0 votes cast)
VN:F [1.9.17_1161]
Rating: 0 (from 0 votes)

Citation II

Sometimes it is amazing what people say:

Ähnlich äußerte sich der amerikanische Präsident Harry Truman, als er sagte: "Mich interessiert nicht, ob er mit Ziegen fickt. Wenn er uns hilft, benutzen wir ihn."

from: http://www.sueddeutsche.de/politik/usa-heimat-fuer-nazi-taeter-uncle-sam-und-seine-nuetzliche-nazis-1.1024754-2

VN:F [1.9.17_1161]
Rating: 0.0/10 (0 votes cast)
VN:F [1.9.17_1161]
Rating: 0 (from 0 votes)

SSH Proxy and SSH Port Forwarding

I found two (rather) nice explanation of

While those might not be the most straight forwards ones. I found them to contain the information most clearly, when taking a little time to skip over them.

Some hosts seem to have disabled certain forwarding/tunnel options in their /etc/ssh/ssh_config resulting in errors resembling

channel x: open failed: administratively prohibited: open failed

Not much I could do about it as the server was not mine to administer. But there are a lot of Google results coming up how to solve this if you should be a more powerful entity than I am ;) .

Update: It turned out that, when I tried to establish a SSH tunnel, it was not the hosts fault that I could not establish the SSH tunnel correctly. Rather I was using the -L switch not correctly. I used:

ssh -L 7777:user2@server2:7778 user1@server1

where the user@ was causing the problem. So this worked:

ssh -L 7777:server2:7778 user1@server1

Stuff like directly SSH-ing to server2 is now possible on localhost by doing this:

ssh -p 7777 user2@localhost

Notice the user2@ before localhost. user2 is a user on server2.
See this awesome! (German) article for details and further SSH flags: http://www.planet-metax.de/html/Weblog/SSH-fuer-Fortgeschrittene-I-SSH-Tunnel/

And while we are at it: FoxyProxy is a nice Firefox add-on to work with SSH proxies. Proxy Switchy! is the equivalent for Google Chrome. Yet I was only able to get proxy usage to work with Firefox. But on the other hand, I did not try very hard with Chrome.

VN:F [1.9.17_1161]
Rating: 0.0/10 (0 votes cast)
VN:F [1.9.17_1161]
Rating: 0 (from 0 votes)
Return top
 

Warning: array_filter() [function.array-filter]: The first argument should be an array in /var/www/web41/html/hp_fstyle/wordpress/wp-content/plugins/wordpress-tweaks/tweaks.php on line 650