Home Page
DIY: Extending VGA over UTP
Say you want to watch that movie you download last night on your new 42-inch HDTV Plasma Display but there’s no way you are going to move your PC near your TV just to move it back to your room when the movie ends. What you need is a long VGA cable. Although if you have a 42-inch Plasma TV you could buy a 25 feet VGA cable you could also just do it yourself! It’s cheap, it’s easy and it’s fun! … if you find soldering fun. So, you need a long VGA cable and you want to do it yourself but how could you do that? Using cheap UTP cable!
Let’s start with a list of materials, yo need:
- Two male HD-15 VGA connectors
- About 12m of cat5 UTP cable
- Solder and a soldering iron
- to be on your techie mode
Now that you’re ready you need to connect the wires of the UTP as listed in the following table, wire both connectors the same way:
HD-15 pin – VGA signal – UTP wire
1 – Red – Orange
2 – Green – Green
3 – Blue – Blue
6 – Red GND – Orange/White
7 – Green GND – Green/White
8 – Blue GND – Blue/White
13 – H Sync – Brown
14 – V Sync – Brown/White
That does the trick. The only drawback is the ‘ghosting’ effect as a result of the difference in impedance with a regular VGA cable (75 Ohms vs 100 Ohms on UTP). I made two extensions, one of 12m and other of about 18m. With the first that ghosting isn’t to noticeable, but it is on the 18m extension. If you really care about the quality, you should use an STP instead of UTP.
Posted by the one who pulls the strings on Thu, 4 Feb 2010
Save web pages as PDF: PDFmyURL.com
There are times when you need to save a web page to view it offline. I suppose every browser can save it as HTML, but if you prefer PDF you can use PDFmyURL, an online service to convert any live website into a PDF file you can read offline, send by e-mail, archive or view on PDF-friendly e-book reader (like Amazon’s Kindle).
And just because i like recursion, here you can download the PDF version of this very post.
Posted by the one who pulls the strings on Sun, 31 Jan 2010
User friendly shell scripts with Dialog
Shell scripts are text files that contains list of commands to perform a specific task, frequently a repetitive task. A very good example of a shell script is the following bash script that batch resize images:
#!/bin/bash
# Batch resize jpg images.
# User must define size when using this script, e.g.
# ./batchresize 800x600
dir="resize-$1"
mkdir -p $dir
for file in `ls *.jpg`; do
echo "Processing $file"
convert -resize $1 $file $dir/$file
done
As you can see in the comment of the script the user must define the desired image size when running the script. That’s really simple, isn’t it? Yes, it’s simple for the users who know how they should run the script, but it isn’t for all those regular users who didn’t bothered to read the script source. What we need to do is making our scripts more User Friendly!
Now, how on earth could we do that? … Using Dialog, a utility used to create dialog boxes from within shell scripts, so now we can have more interactive shell scripts. Let’s start the User Friendliness writting down the dialog version of “Hello, world!”. Fire up your favorite text editor and write the file helloworld:
#!/bin/bash
# Hello, world! script with "dialog"
dialog --title "Message Box" \
--msgbox "Hello, world!" 6 25
The dialog command used in the script will draw a message box 6 lines high and 25 columns wide on the screen, containing nothing but the message “Hello, world !” and an OK button, that when it’s selected, ends the script. Save the file, make it executable (chmod u+x helloworld) and run it to see what happens (./helloworld):

With dialog we can also have text boxes, they are just like message boxes but used to display text files. The following script, named showcode, shows it’s source on a text box:
#!/bin/bash
# showcode script with "dialog"
# It shows it's very own source on a text box
dialog --title "Text Box" \
--textbox ./showcode 12 50
This example draws a text box 12 lines high and 50 columns wide, displaying the text on the file “showcode” and nothing more than a Exit button:

And how about an input box? Sure, why not, with dialog we can have some input boxes so the user can give some feedback.
#!/bin/bash
# inputbox script with "dialog"
# Shows an input box, and nothing more...
dialog --title "Input Box" \
--inputbox "Hello there!" 8 40 "Here you can share your feelings"

Now let’s make something interactive. This script ask the user’s name and displays a greeting message:
#!/bin/bash
dialog --title "Hi there" \
--inputbox "Please, tell me your name" 8 40 2>hithere.ans
name=$(cat hithere.ans)
rm hithere.ans
dialog --title "Hi there" \
--infobox "\nHi $name, keep it metal!" 8 40
There are a few things new here. First, the last dialog is an infobox, this is like a message box but it’s just informative, it doesn’t have any Ok button. Other new thing is that “2>hithere.asn” on the first dialog command, that is used to save the input of the inputbox to a text file named hithere.ans. The contents of the text file are then passed to the name variable and then the text file is deleted. We are doing that in order of getting the users input to show users name on the infobox. Try that one yourself and see what happens.
Now, remember that first batch resize script? Let’s make it user friendly and let the user select the desired resolution from a list. Check the code:
#!/bin/bash
# This batch resize script let the user
# select the resize resolution from a list
# using dialog's radiolist
dialog --backtitle "Batch Resize jpg files" \
--radiolist "Select the desired resolution:" \
10 40 3 \
1 640x480 on \
2 800x600 off \
3 1024x768 off \
2>radiolist.ans
ans=$(cat radiolist.ans)
rm radiolist.ans
if [ $ans = 1 ]; then
size="640x480"
elif [ $ans = 2 ]; then
size="800x600"
else
size="1024x760"
fi
dir="resized-$size"
mkdir -p $dir
for file in `ls *.jpg`; do
convert -resize $size $file $dir/$file
done

This examples show just a little preview of what can be done using Dialog. For more advanced information please refer to the dialog’s man pages or help.
Posted by the one who pulls the strings on Tue, 26 Jan 2010
Google Calculator vs Simple Arithmetic

Maybe Google is right and maths are wrong?
Posted by the one who pulls the strings on Tue, 26 Jan 2010
OCR and Google Docs
OCR (optical character recognition) is used to convert paper books into a computer editable document. Google offers an experimental feature in wich one can upload a scanned document, perform OCR on it and then edit the resulting document on Google Documents. That feature is available on the Google Data API (Import Scans) and there’s also a live demo.
To try the live demo you just need a Google Account and a high resolution PNG, JPEG or GIF image that weights less than 10MB. I tried it using a high-resolution screenshot of the first two parragraphs from the last post. This was the result:

My test returned a few errors and for what I’ve seen the Google OCR service is not yet reliable, but at Google they are constantly improving their services, just two days ago they announced a new ability to upload to Google Docs any file up to 250 MB, so let’s keep an eye on their OCR system.
Posted by the one who pulls the strings on Thu, 14 Jan 2010
