Saturday, December 09, 2006

mark messages as unread

This blog moved to a new location, please visit us at http://ramble.m2m.at.

Found at a FAQ at the University of Michigan:

How can I mark messages as unread in Pine?
  • First you must set the flag command option. From Pine's main menu:
  • Type s (Setup).
  • Type c (Config).
  • Move the cursor down to highlight the enable-flag-cmd option, and type x to enable it if it is not already.
  • Type e to exit the configuration screen.
  • Go to your INBOX, highlight the message you want to mark, and type *
  • Type n to mark the message as new.

Tuesday, November 14, 2006

Find Files

This blog moved to a new location, please visit us at http://ramble.m2m.at.

To look for files older than a day:
find . -mtime +1
To look for files NOT older than a day:
find . -mtime -1
"." -> this folder and its sub folders
"-mtime" -> modification date
"+/-" -> older or newer
"1" -> number of days

Monday, November 13, 2006

44 Rules for Server Administration

This blog moved to a new location, please visit us at http://ramble.m2m.at.

The recent German Linux Magazin had a nice article about rules for server administration.

basics:
  1. use different machines for services which need the same performance resources
  2. monitor your services
  3. limit your swap processes
  4. do not waste memory installing unneeded applications
  5. separate partitions for system, logs and data
  6. log everything
  7. save the configuration before any change
  8. keep static content in the cache
  9. stop intruders at the firewall
  10. use port knocking
web server:
  1. choose the multi-processing module which fits your CPUs
  2. use caching
  3. limit usage of .htaccess
  4. do not use symbolic links
  5. do not use lookups
  6. optimize MaxClients
  7. do not log everything
  8. use sendfile
  9. use MMAP
  10. switch of server-status
mail server:
  1. limit the number of instances
  2. use the spam filter enabled RAM disk
  3. cache DNS requests
  4. use postfix only once per mail
  5. use reject_unkown_sender_domain
  6. only use local data for postfix lookups
  7. use rate limiting for clients
  8. kick problematic mails
database server:
  1. use the correct index type
  2. delete an unneeded index
  3. optimize your tables
  4. optimize your SQL statements
  5. use soft parsing
  6. limit the size of your tables
  7. separate OLTP and DSS
  8. use persistent connections
  9. be careful with the timing of batch jobs
  10. monitor the number of connections
samba:
  1. do not touch your configuration
  2. provide enough RAM
  3. monitor the network
  4. activate Oplocks
  5. use Winbind
  6. deactivate "case sensitive"
Read the article it is really nice.

Sunday, November 12, 2006

File Scrubber for iLiad

Copying files from Mac OS X to the iRex iLiad reader creates .DS_Store files and ._ files on the iLiad. Sometimes this seems to be a problem - some PDFs could not be opened any more. Unfortunately those files are not visible in the OS X finder. Connecting the iLiad to an WinXP computer allows to remove them but it is really clumsy having to use multiple computers.

Matt Jadud, wrote an OS X a application called iliad-scrub which runs through the iLiad folder and cleans the files automatically. Thanks Matt!

Friday, November 10, 2006

chm to pdf

CHM - Microsoft Compressed HTML Help - is a proprietary format for online help files, developed by Microsoft. Viewing CHM files using other operating systems is sometimes a little bit difficult.
Recently a CHM plug-in appeared for firefox which should be some help.
Sometimes it is still necessary to convert CHM files into other formats. While there are quite a lot of applications which could do that easily on Windows, it is still tricky for non-Windows systems.

e.g. for Mac OS X or other UNIX based OS

First you have to unpack the html files.
  1. Download the chmtools package.
  2. Unzip it: tar -zxf chmtools.tar.gz
  3. Go to the chmtools folder: cd chmtools
  4. Compile it: make
  5. Move the new command somewhere you can easily access it (you might have to become root to be able to do that), eg: su; cp chmdump /usr/bin
Step 1. to 5. you have to do only once.
  1. Now it is time to unpack the CHM file, eg: chmdump file.chm newFolder
Now we have to install two software packages which will do the actual html to pdf conversion.
  1. Download the fltk source (should be version 1.1 or above)
  2. Unzip it, eg: tar -yxf fltk-1.1.7-source.tar.bz2
  3. Go to the fltk folder, eg: cd fltk-1.1.7
  4. Compile it: make
  5. It could be you need to configure the compile process for your system - have a look at their manual.
  6. Install the new commands (you have to become root to be able to do that), eg: su; make install
  7. Download the htmldoc source
  8. Unzip it, eg: tar -yxf htmldoc-1.8.27-source.tar.bz2
  9. Go to the fltk folder, eg: cd htmldoc-1.8.27
  10. Compile it: make
  11. It could be you need to configure the compile process for your system - have a look at their manual.
  12. Install the new commands (you have to become root to be able to do that), eg: su; make install
Step 7. to 18. you have to do only once.
  1. Now look for the html files in the folder chmdump created.
  2. Go there, eg: cd newFolder
  3. Now you have to create a batch file containing all the html files you want to have in your pdf. Eg: ls *.thml > test.book
  4. Sometimes the files are not in the order you like. Use your favorite text editor to adjust that.
  5. Add the following two lines at the top of test.book to adjust the layout the pdf. The given format is best if you want to use the pdf file on your iLiad reader.
#HTMLDOC
-t pdf --webpage --size 12x15cm --pscommands --gray --jpeg -f test.pdf
  1. Run the batch file: htmldoc --batch test.book
  2. The result should be a pdf file called test.pdf.
Have fun

Monday, October 16, 2006

The Power of Touch

This blog moved to a new location, please visit us at http://ramble.m2m.at.

If you are using Linux or some kind of Unix you properly have noticed the command touch.
touch [-acm] [-r file] [-t [[CC]YY]MMDDhhmm[.SS]] file [...]
Mostly it is used to create empty files, e.g. to create an empty file called new.txt:
touch new.txt
But it can much more. Originally it was build to manipulate the modification and access times of files. E.g. if you want to trick make to recompile a project just touch a file:
touch project.c
Sometimes if you work with NFS drives of servers with asynchronous time stamps, some applications do not recognize updated files and will work with a cached version for some time. Then you can use touch as dirty work around, e.g.:
touch -m 209901018000 cachedfile.txt
Or give a whole folder identical timestamps.

Have a look at the man page for more information.

Sunday, October 15, 2006

Konquerer Shortcut

This blog moved to a new location, please visit us at http://ramble.m2m.at.

If you use Linux KDE with Konquerer you can just type
gg:linux
into the address line if you what to google for "linux". Or
wp:linux
if you want to look for "linux" in wikipedia.

This seems to be around for quite a while but I did not know it.

Friday, October 13, 2006

How long does it take to setup a Virtual Server?

For a new project we needed a new web server. Finally we had to choose between a dedicated server from a budget hosting company and a virtual web server from a reputable hoster.

Because we wanted to try something new, and we needed some features which a normal virtual web server does not provide. We decided to choose the budget company. Unfortunately it is situated in a neighbor state. This seems to be a bureaucratic obstacle. They could not accept our order. However, one day later they called to tell us it will be possible end of this year. We heard a lot of horror stories about this company. But after all their support was really professional and we will test it as soon as it possible.

So we went for the reputable hosting company based in our own country. Basically the same price but for a different product with less features. We have already other projects on their site so it should be no problem.

day 1

They had a nice web interface with a shop to choose your needs. We selected the virtual server, entered a domain name which comes for free (it's included in the price). Then we entered our customer ID, some additional information, and clicked on the continue button. A new window opened saying:

Please fill in all fields marked with *

Strange thing because there was no input field at all.

Well could be the interface does not like Safari. So we tried again with Firefox. Same result. Switched to another computer using Windows and Internet Explorer. Same result.

Fortunately there was a special support button for shop issues. Clicked. You had to be logged in to reach the support. We logged in. A new window appeared saying the requested page is unavailable.

So we clicked on the technical support button, described the problem and submitted the form.

day 2

We got an answer saying, they saw that our order could not be processed, but they didn't know why. However we could order by phone.

Perfect, so we called. Nice music. Quite fast we heard a human voice. We got a name of the selling man. Nice music. More music. A human voice. The responsible employee could not be reached. We got a phone number which would allow as to call directly.

Three phone calls later - Mr X was still unavailable - a nice man told us we can order by fax. He would send us the necessary forms by email.

A couple of seconds later we had the forms. Filled them in and returned them to a magical fax number.

day 3

nothing

day 4

nothing

day 5

Perhaps we used the wrong telephone number for the fax? Well, we called again. Mr X was again not available. After some music be were connected to Mr Y who told us that they received the fax and that our server would be available the very same day.

day 6

nothing

day 7

nothing

day 8

We received a mail that the domain had been registered.

day 9

We received the login data.

In German we have a proverb:

Good things take time.

The strange thing: Last year we ordered a server at the same company on the 24th of December (yes it is a working day in our country) and had it ready to go on next working day the 27th.


Tuesday, October 10, 2006

SpamAssassin

If you have not known SpamAssassin yet:
As it name might already say, it deals with spam (unwanted emails).

It can (and actually does quite often without your knowledge) run directly on your mail server. This has the big advantage that the spam mails can be eliminated already on your server and you do not have to download it to your computer.

However, it is very flexible. E.g. you might also want to receive spam, which SpamAssassin has marked as such and move it manually to your trash can.

More about SpamAssassin at its homepage.

Monday, October 09, 2006

train SpamAssassin

If you want to teach SpamAssassin and you are using pine, create two new folders e.g.
train-spam
train-ham
save the spam to train-spam and the non-spam mails to train-ham.

And tell SpamAssassin:
sa-learn --mbox --spam ~/mail/spam-train
sa-learn --mbox --ham /var/mail/{username}

use grep as search function

If you are looking for a file containing a certain string and want only the filenames as result, try:

grep -r -c theStringYouWantToFind * | grep -v :0

The first grep looks for your string theStringYouWantToFind in all files * and folders -r and returns how often -c the string has been found in each file.
The second grep shows only the files where the search result was higher then 0.