Saturday 6 November 2004

Philips DVP530 - Region Free

Not really about computer software, but I found it really useful, so I'm posting it here so other people can benefit. The guy at the store said the Phillips DVP-530 could play DVDs from any region, but at home I couldn't. The lady at the customer hot-line confirmed this, but the Internet helped me. Here's how to do it (taken from DVD.box.sk):

Press "System Menu" key to enter Set Up menu.
- Move to "Preference Page" using arrow keys to the left or to the right.
- Press the following sequence in the remote control: 135566
- A menu indicating "Region Code" will appear.
- Change region using arrow keys to top or down. Region Code = 0 will play all regions.
- Press "System Menu" key to exit Set Up menu.

That's the second and last time Phillips deceives me (cheat me once shame on you, cheat me twice shame on me): the first was when I bought a stereo TV that doesn't have SAP (second audio program). Dumbfucks.

Hey, google! index this in portuguese, please: DVD Phillips DVP-530 (DVP530) tocar DVD de outras regiões, trocar região do DVD, trocar zona do DVD.

Thursday 28 October 2004

Standards standars standards

Ever tried using openssl on linux to sign a certificate created by the windows wizard?

bash$ openssl x509 -days 900 -CAserial ca.serial -CA ca.crt -CAkey ca.key -in brew.xxx.com.br.csr -req -out brew.xxx.com.br.crt
14931:error:0906D06C:PEM routines:PEM_read_bio:no start line:pem_lib.c:632:Expecting: CERTIFICATE REQUEST
bash$

Dog gamn it! I think, what the fuck. The CSR seems okay:
bash$ cat brew.xxx.com.br.csr
---BEGIN NEW CERTIFICATE REQUEST-----
(... bunch of encoded, standard stuff)
-----END NEW CERTIFICATE REQUEST-----

Hmm. Let's try again. Maybe openssl didn't get it right the first time:

bash$ openssl x509 -days 900 -CAserial ca.serial -CA ca.crt -CAkey ca.key -in brew.xxx.com.br.csr -req -out brew.xxx.com.br.crt
14931:error:0906D06C:PEM routines:PEM_read_bio:no start line:pem_lib.c:632:Expecting: CERTIFICATE REQUEST

Shit, man. Let's check an openssl generated CSR:

$ diff brew.xxx.com.br.csr intranet.csr
1,2c1,2
< ---BEGIN NEW CERTIFICATE REQUEST----- <> -----BEGIN CERTIFICATE REQUEST-----
> MIIC9TCCAd0CAQAwga8xCzAJBgNVBAYTAkJSMRcwFQYDVQQIEw5SaW8gZGUgSmFu
4,22c4,18

Whoa! it seems that CSRs created on windows have "NEW" on the header. That's good, because I could wind up signing the "OLD" certificate request.

bash$ sed "s/NEW //g" brew.xxx.com.br.csr > brew.xxx.com.br.csr2
bash$ openssl x509 -days 900 -CAserial ca.serial -CA ca.crt -CAkey ca.key -in brew.xxx.com.br.csr -req -out brew.xxx.com.br.crt
Signature ok
subject=/C=BR/ST=Rio de Janeiro/L=Rio de Janeiro/O=nXXX Ltda/OU=Operacoes/CN=brew.xxx.com.br
Getting CA Private Key

So, lesson of the day: if you are trying to sign a certificate request created on windows using openssl, be sure to strip off the "NEW" from the header. Works ok!

Tuesday 28 September 2004

Hardlinks 101

It was late, I was tired and needed to keep more than 2 rotated logs of Resin's stderr file. By default it only saves 3: stderr.log (the one it is writing to), stderr.log.1 and stderr.log.2 (the last two most recent copies).

I didn't want to dig through all the documentation and I still don't want to. In fact, the solution I found is still in place. I must confess, the solution wasn't mine, but my from a work colleague of mine, Dom. He is the kind of guy who comes up with the weirdest stuff using named pipes, hardlinks and whatever they stuffed in his head on university classes.

Anyway, he suggested I kept count of the number of hardlinks to the file. As you may well know, the EXT3 filesystem keeps the number of references to a file, and when this number equals 0, the space is marked as free (or, if you prefer, the file is "deleted" - the data is still there, and theoretically you can recover it, but only the gurus at bugtraq know how to do it).

So I came up with this little script, that I believe sums up pretty well the elegance and simplicity of *nix.





#!/bin/bash

LOGDIR='/usr/java/resin/log'
PH='stderr.placeholder'

cd $LOGDIR

if [ ! -r $PH ]; then
echo $PH not found - trying to create link
if [ -r "stderr.log.2" ]; then
ln stderr.log.2 $PH
if [ $? -eq 1 ]; then
echo error trying to create hardlink - bailing out
exit 1

fi
else

echo stderr.log.2 does not exist yet - bailing out
exit 0
fi
fi

HLCNT=`stat -c %h stderr.log.2`
if [ $HLCNT -eq 1 ]; then
cat $PH >> stderr.$(date +%Y%m%d)
rm -f $PH
ln stderr.log.2 $PH
fi


The first big block of code just checks to see if the placeholder for the stderr.log.2 file already exists. If it then tries to create it.

The real magic happens from HLCNT and beyond. This variable will hold the results of the stat comand, enclosed in ``s, which is the number of hardlinks to the stderr.log.2 file data. This is normally 2: one for the hardlink the script created (and pointed by the file stderr.placeholder) and the other is for the stderr.log.2 file itseld.

When resin rotates the logfile, the hardlink count drops to 1, because now only stderr.placeholder points to the data. That happening, the script then concatenates the file contents to another file, which will hold all the data for the day. Voilà. Thanks to my buddy Dom I could go home without reading wads of documentation. :)

Friday 17 September 2004

winmail.dat

The dreaded, hated attachment:



Fear no more! Project TNEF saves the day.

Can someone please explain me why the fuck MS needs to "embrace and extend" even a simple thing as email attachment. Instead of using mime to attach a file as everyone else, MS uses mime to attach a file in a proprietary format. That makes me a sad, sad panda.

Thursday 16 September 2004

Over 20 Years of High-Tech Marketing Disasters

After reading Chapman's In Search of Stupidity, I suddenly stopped feeling bad for Amazon (not that I really ever did). I was looking at book a friend recommended (yes, I linked to B&N, yes I can hold a grudge) and tried to check out a sample of the book. I was awarded with this one:




They are "please to offer"? What they need is a new spin doctor because that one didn't work on me.

Let me get this straight. They want my credit card number so I can look at a book? What is this, some sort of ransom? of show me yours and I'll show you mine? sheesh. I guess it's pretty useless, but I left a comment anyways:




The typos were made in the heat of the moment - I hope I don't get a grammar-nazi to read my message.

Thursday 2 September 2004

pinfo date

I was going to check the manual for "date (1)" to write a simple script and I'm gifted with this beautiful quote:

Gotta love open-source software. The comments on the linux kernel alone have appeased my boredom many times.

Wednesday 1 September 2004

MSN on Gaim

So I installed MSN on my Win XP VMWare machine because gaim kept crashing. Now MSN crashes on Windows. Cool, eh? Guess I'll just stick with ICQ.

Update: MS says this issue has been fixed on SP2. Gonna give it a try, but somehow I get the feeling SP2 will breed a few posts of its own.

Monday 30 August 2004

Online Crash Analysis

Ever been gifted with a stop error on Windows 2003? This is not a rant, as I am 99% sure the error was due to crappy hardware. When I logged in one of our W2K3 Servers the system presented the usual screen that demands explanations of why it was so unpolitely shut down.

It pleased me to see that itself knew about the stop error and already provided the explanation. Even better, it asked me to send Microsoft a complete memory dump, so they can try and find out what the problem was. Here is a snip of what the upload interface looks like (it's web based):



It's gonna be sweet make MS waste their time to find out I have a bad memory card :-).

Local users and groups


Free translation: "Local users and groups. It is not possible to access the computer CARECA. Error: the wrong disk is in the drive. Insert disk %2 (Volume serial number: %3) in drive %1.

Saturday 28 August 2004

Friday 27 August 2004

Services For Unix - NFS Client: First Blood, Part II

I dare you to change the default file creation permissions from 755 to something which doesn't have the execute bit set.

Alright, I don't know much about NFS, but isn't there a way to find out if the file you are acessing is a regular file or a directory? Because once you remove that execute bit from the permissions you can no longer search in directories, resulting in a nice "Access denied" for the folder you've just created.

Maybe there should be different options for files and folders. But that's my humble opinion. Anyway, I'm stuck with regular files looking like -rwx-r-x-r-x on my directory listings. I've always wanted to execute a windows backup file on Linux!

Services For Unix - NFS Client

Hooray, a NFS client! just try and use it with robocopy:

2004/08/27 09:56:49 ERROR 5 (0x00000005) Time-Stamping Destination File c:\backup\BlackFishWapBKP.BAK
Access is denied.

SQL Server 2000 - Operator alerts

So here I am, trying to get MSSQL 2000 to send a simple email alert whenever it finishes a backup job. The interface looks very intuitive, but how the hell do I set up a MAPI profile for the user running SQL Server?

Wading through the documentation I quickly find out that I need to have either Outlook (not express - I tried that one, no good) or Exchange Client installed. Now why is that? Do I really have to cripple my already loaded server with Office so I can receive a simple email?