Saturday, 2 August 2008

Stopping painfully slow backup on itunes/MAc and firmware 2.0

Well, I have been suffering for a long time from this issue. Every time I want to syn my iTouch wiht my mac, it takes ages. After googling a bit for a solution, it is straightforward:


1. - Quit iTunes.
2. - Open Terminal.app
3. - Copy and paste this in, then hit return:

defaults write com.apple.iTunes AutomaticDeviceBackupsDisabled -bool true

4. - Copy and paste this in, then hit return:

defaults write com.apple.iTunes DeviceBackupsDisabled -bool false

5. - Open iTunes
6. - Plug in your iPhone (2.0 or 3G) and sync.

Monday, 14 July 2008

Latex goodie - How to watermark things in Latex/PDFLatex

I have been having problems since ever when trying to distribute some content to people and keeping track of the NDAs I make them sign. A sound solution (good but not really impossible to break) is to watermark the documents before sending. Then if you detect it in the wrong hands, you can ate least trace who did it.

I had for a long time a code to do this, but the real problem was that this code was actually in TeX, meaning that to make it appear in a PDF I have to convert from dvi to ps and then to pdf. I real pain, plus you finish loosing all the goodies from pdflatex, in term of hyperref.

I found a site[1], and with his instructions I managed to produce my own code to put the copyright watermark in my pdflatex documents, here it is:

\usepackage{graphicx,type1cm,eso-pic,color}

\makeatletter
\AddToShipoutPicture{%
\setlength{\@tempdimb}{.5\paperwidth}%
\setlength{\@tempdimc}{.5\paperheight}%
\setlength{\unitlength}{1pt}%
\put(\strip@pt\@tempdimb,\strip@pt\@tempdimc){%
\makebox(0,0){\rotatebox{45}{\textcolor[gray]{0.95}%
{\fontsize{3cm}{3cm}\selectfont{Final Version}}}}%
\makebox(-100,-300){\rotatebox{45}{\textcolor[gray]{0.95}%
{\fontsize{2cm}{2cm}\selectfont{Internal Use}}}}
\makebox(-500,-0){\rotatebox{90}{\textcolor[gray]{0.95}%
{\fontsize{0.7cm}{0.7cm}\selectfont{\textcopyright Copyright 2008 - Jean Martina}}}}
}%
}
\makeatother


You should put this code in your preamble, and it will put a watermark in all your pages. You can change the texts and their positions quite easily, just try it.

[1]- http://filoxus.blogspot.com/2008/01/how-to-insert-watermark-in-latex.html

Latex Reference

Well today while surfing to find some things in Latex I discovered the following site:

http://en.wikibooks.org/wiki/LaTeX


This site brings a full reference for people using latex. The good thing is that they have a lot of examples that you can copy and paste and use in your documents.

Saturday, 12 July 2008

Ipod Touch V2.0

Well I took a decision today. Upgrade my jailbroken iTouch 1.1.4 to 2.0. The upgrade was smooth. You can do it via the new iTunes by paying $10. Safe and sound. Or you can got in the wild and do an upgrade by other means. If you choose the second options‚ remember:


  • Put the the iPod in recovery mode: Hold the home and power button until the iPod turns off. Then wait until you see your iPod turn on with the apple logo. Let go the power button‚ while still holding the home button. When you see the " Connect to iTunes" logo‚ you are in recovery mode.
  • Find the firmware somewhere
  • plug you iPod in the usb cable and go to iTune. 
  • cancel the automatic firmware install. click the restore button with shift key pressed (mac alt/option)
  • chose your firmware‚ and wait. It takes about 15 minutes to load
That′s it. But remember‚ if you love the Installer‚ there is no jailbreak software available yet‚ although the Dev Team‚ already claimed a jail break in it.

Monday, 7 July 2008

The Collection of Computer Science Bibliographies

I received from a friend other day the following link, and it is worth posting:

http://liinwww.ira.uka.de/bibliography/index.html

If you are a CompSci (Computer Scientist), you probably know the pain to arrange bibtex bibliography. This search engine gave me the right bibtex entry every single time I tried.

How to test Qmail+vpopmail for SMTP AUTH

Well, every time I need to check whether an installation of an email server is completely working I need to search google for this bit of information. Sometime is hard to fin exactly what you want. Suprisingly some of the examples don work with qmail.

To generate the AUTH string you need to issue the following command:

perl -MMIME::Base64 -e 'print encode_base64("\000user\@domain.net\000my.password")'

If you are using qmailrocks instalation, perl should have everything to handle this. If should generate an string like this:

AHVzZXJAZG9tYWluLm5ldABteS5wYXNzd29yZA==

To test you qmail instalation do the following:

> telnet newserver.net 587
Trying 123.123.123.1...
Connected to newserver.net.
Escape character is '^]'.
220 smtp.newserver.net ESMTP
ehlo my.machine.net
250-smtp.newserver.net
250-PIPELINING
250-8BITMIME
250-SIZE 0
250 AUTH LOGIN PLAIN
AUTH PLAIN
AHVzZXJAZG9tYWluLm5ldABteS5wYXNzd29yZA==
235 ok, go ahead (#2.0.0)
mail from:
250 ok
rcpt to:
250 ok
data
354 go ahead
Subject: Test

Test
.
250 ok 1215413930 qp 87194
quit
221 smtp.newserver.net
Connection closed by foreign host.

This should deliver the message (if you chnage the fake emails and server name to your reality). If you get any other message, your smtp auth is not working with qmail.

Sunday, 6 July 2008

Migrating between two qmail + vpopmail (qmailrocks) servers

This was my problem for today, how to migrate sound and safely from on old system running around 100 domains to a brand new configured qmail system. Both are running with the configuration suggested by www.qmailrocks.org and on a FreeBSD machine. So lets go:

  • First things stop the old qmail server to avoid loosing messages. Remember that you need to stop qmail from receiving any messages, and also stopping users from retrieving their email with pop3 or imap. The following commands would do it for you:
qmailctl stop
/usr/local/etc/rc.d/imap.sh stop
/usr/local/etc/rc.d/imaps.sh stop


  • After yo stopped qmail and the pop/imap daemons, you are able to start to transfer the vpopmail contents. Using rsync is a good idea, since that with it you can minimise the downtime, since you can run it in the hot system , before starting. This run is just to sync from the last call to the time you stopped qmail with the commands above. You are running this in your new server and server.xxx.com is you old server.
/usr/local/bin/rsync -avz --delete -e ssh root@server.xxx.com:/home/vpopmail/domains/* /home/vpopmail/domains

  • Luckily after some time rsync will finish running. If not, leave it working while go to change the other bits. In order to make the new machine recognise all the users and domains from the old server, you need to do the following:
import(merge) from the old server /var/qmail/assign
import(merge) from the old server /var/qmail/recipients
import(merge) from the old server /var/qmail/control/rcpthosts
import(merge) from the old server /var/qmail/control/virtualdomains


  • To finish add and delete a fake domain using vpopmail. This will make vpopmail read all the files you merged and reorganise them.
From now on, you just need to test the system to assure you got everythings working. A good idea before changing the DNS system is to configure an email client with the ip address of the new server an try to send and recieve some emails using all possible combinations.

Finally, keep checking the email server for a day. It is almost impossible to make everything work without mistakes.

Thursday, 3 July 2008

Creating Multiple Volume .tar.gz files

Well, today I came a cross a problem: I have to backup a 29GB file system to recreate it under the new rules here (I have ReiserFS, and as the guy is jailed for killing his wife, the policy is to convert everything to ext3, since it tends to be unmaintained). My external HDD is formatted in FAT32, for compatibility issues (Use in Mac , Linux and windows machines).

I did some research, and to create multiple tar.gz files, you need to use a combination of FIFO, split and tar. First you need to create a FIFO file (which can be reused in later uses):

mkfifo /tmp/test.fifo

After you can issue the following command line to generate the files:

split -b 200m /tmp/test.fifo /media/UNTITLED/filename.tgz- | tar -czvf /tmp/teste.fifo .

Basically what I am doing is sending the tar output to the FIFO (First In First Out), and then splitting the FIFO in 200MB files.

To recover things from the tar.gz file you just need the following:

cat /media/UNTITLED/filename.tgz-* | tar zxvf -

This should put all the bits back together.

Thursday, 29 May 2008

Digging the past of the Internet

This week I came across one very interesting web site. I was listening the TWIT (This week in tech‚ with Leo Laporte and John C Dvorak) and one guy that was invited to the show was the founder of this site. When he told the features‚ I said: " no way‚ some one can index the Internet historically"‚ but yes‚ he did

The site is www.archive.org. It contains a bunch of interesting web site‚ dating from 1996 up today. If you want‚ you can give a try in some of them. I suggest google‚ and microsoft‚ but be afraid to test other things. Even my very old page in geocites is available there.

Wednesday, 21 May 2008

Very interesting Security device

Today while listening to "Security Now" podcast, the guys mentioned about Yubikey, and I went out on some google search about it. Look very interesting and promising. The designs they developed is really nice indeed.

From the developers:

"The Yubikey is a new authentication solution, designed for the mass market of web 2.0 applications. The user inserts the YubiKey in any computer with a USB port on any platform or browser – no client software install needed – then press the YubiKey button to generate a one time passcode.

The secret behind the YubiKey is the fact that the little device is actually a USB keyboard. But with only one button and designed to do two things: To generate the user’s unique identity and a one time pass code that only works the very second it’s used. Every time the user presses the button it generates a new pass code."

More information can be found at:

http://www.yubico.com/products/yubikey/