Fighting with computers

Computers are not always friendly.

Thursday, December 31, 2009

Happy New Year and other stuff

This year has been an exciting one on the technology side but it is been a crappy year for most economies of the world. I keep my fingers crossed for a better 2010 on all fronts.

As you can see in the picture of the right, the Kindle DX has an annoying "feature" of showing the full media box of PDF files instead of the crop box. That means you have to recreate the PDF file if you want to get rid of these elements only useful for the print house. The problem they create is that some of the screen real state is wasted on them, making the rest of the page smaller.

My verdict about Kindle DX screen size is that it is too small for viewing A4 or US letter PDF documents comfortably but most PDF formatted books will be ok tough.

January issue of Circuit Cellar magazine will carry an article I authored. It is an Arduino-based project for a three axis stepper motor PC interface. Please note simultaneous use of several axis was not desired nor implemented. Popular stepper motor driving modes are explained and Arduino source code is provided. If you need simultaneous axis working at a time, you can check Reza's blog that contains a more professional approach.

From what I have read, it seems that Circuit Cellar magazine will join forces with Elektor magazine for a better worldwide coverage.

Sunday, December 27, 2009

Hack-a-watch


Latest development system for Texas Instruments "wireless" micro-controller comes in the form of a watch. Yes, a regular watch that can track several variables besides the time passing.

Besides the watch, the kit includes an USB RF interface and a USB emulator for software debugging. The watch itself includes a 3-axis accelerometer together with temperature, pressure and battery-level measurements.

At $49 it is a steal. No wonder they are out of stock. There is a wiki too.

Thursday, December 17, 2009

Ultrasound ranging on Arduino


I've recently bought a sonar circuit for distance and temperature measurements. Actually you need to know the temperature if you want to get an accurate distance measurement as it affects sound's propagation speed.

Less than $20 shipped, the URM37 unit is compact and full of interesting features: It has a dual interface as it can use RS-232 levels or TTL levels. Be careful because it defaults to RS-232 and these voltage levels can damage many 5V devices, including Arduino inputs.

It has several operating modes but I've used the serial interface. URM37 library comes with a modified software serial port library that allows you not to use any two available digital pins to interface with the sensor. This way arduino hardware serial port is free to be used for code uploading.

Another cool feature of the sensor is that it can control a RC servo so you can mount the sensor in a mobile platform to get the distance measurement at different angles.

Tuesday, December 15, 2009

Excellence in Teaching award

I've been granted an Excellence in Teaching award from the local government. Among other things lecturing in English (or other foreign languages) and having high-marks on student surveys of teaching were topics assessed.

Now it is time to look around and thank all the people that made this possible: from my colleagues who share an interest on teaching to my students who keep on asking questions. From all of them I learn a lot every day.

I'm also grateful for my University and government that through various programs have supported different visits and stays at foreign universities.

And last, but not least, to my dear family and friends who have always been there for me.

For all of these I'm grateful.

Saturday, December 12, 2009

Enable USB Networking on Kindle DX

The first thing is why in hell you may want to do this? Or even what the hell is this usb networking thing?

The thing is that those who are outside of coverage of Whispernet wireless network cannot get some of the Kindle features to work. But even if you enable usb networking you are not getting back 100% of the functionality. Let me tell you some of the things I've learned:

Apparently Amazon will send you a client digital certificate to your Kindle through Whispernet (and only that way), so future orders from you Kindle can be properly authenticated as yours (so you cannot refuse payment I guess, among other things). That means that even if you get your Kindle to access the Internet (ie enabling USB networking) you won't be able to register it to your account (though no error message is presented to the user).

So what USB networking can serve for? Well, enabling USB networking allows you to connect to the Kindle as a network device and to access its Linux system for doing changes, checking what's inside and, if you are not careful enough, to brick it.

If you still are curious about playing this game let me tell you what you need to do:

  1. Get a Kindle.
  2. Get the binary from this thread.
  3. Copy the proper .bin to the root folder of your Kindle.
  4. Do a manual upgrade of Kindle firmware (you do this by pressing Menu/Preferences and the Menu again/Upgrade Firmware).
  5. On the seach box of you Kindle type ;debugOn and `usbNetworking
  6. Connect USB to your computer and you should get a new network interface (defaults to 192.168.2.1 and Kindle would be 192.168.2.2 device).
  7. If you want Kindle to have Internet access you'll need to enable Internet connection sharing on your computing and to populate /etc/resolv.conf on Kindle with a valid DNS nameserver.
  8. You can restore normal USB behavior on Kindle but restarting it (just make sure you delete /mnt/us/usbnet/AUTO file or you'll be running circles).
But at the end of the whole process the most useful thing I could achieve was to set the date on my Kindle DX. Browsing Amazon's Kindle bookshop is possible too but ... as you do not have a digital certificate you cannot download book samples nor you can get access to wikipedia. However, as you are connecting through your computer ... well, you can use your computer to do all these things faster and better than with you USB connected Kindle.

And, regarding my current experience with Kindle DX I would say that size matters and DX is lacking a couple of inches more. If I just could use one of the techniques I get on my mailbox to get a few more inches ...

Sunday, December 06, 2009

Got Kindle!

Though it's been one of the most difficult items to buy, I finally manage to get my Kindle DX. In a previous post I detailed the different failed attempts, but finally at the third one I've got my Kindle DX delivered.

Incidentally I discovered that my first buy from Amazon was stolen and being already used in USA. How did I learn that? Easier than you may think: When you buy a Kindle form Amazon (unless it is a gift for another person) it is registered automatically to you account. Next you can manage your Kindle from Amazon's website. One of the things you can do is to check the status of the documents that have been delivered through Whispernet and those that are still pending.

There is a default "Thank you letter" that is delivered to each customer. As Amazon sent me two Kindles (first shipment was lost, replacement shipment arrived) I had got two Kindles registered on my account. Each one had different email address and to my surprise I could see that that the "Thank you letter" had been delivered to my first unit (the one never arrived) on Nov 13th. This unit was shipped on Nov 10th but it was never received. The second Kindle (the one I received) had that same letter pending as I'm based in Spain now and Whispernet does not work here.

I notified this fact to Amazon and my first Kindle was removed from my account. I was warned that the did this to protect me: Those who stole it form the mail could buy books that would be charged to my account. I haven't thought about this but I'm glad Amazon did it for me.

My first experience about DX is that it is comfortable, the 5-way joystick works well but I wonder how durable it will be. A4-size PDF read well, though I expected DX to be slightly larger. Right now I'm upgrading it to the version 2.3 firmware.

Wednesday, December 02, 2009

Postgresql UTF-8 weirdness

I was recently moving data from a Postgresql version 8.0 database to a 8.4 on a new server. The database dump was made on a UTF-8 system and it was moved to another system using the same encoding. However I was getting some errors when trying to recover the data. Several encoding errors where poping out. A closer inspection revealed that those were indeed a few encoding-rule violations. For some odd reason some data fields ended up with bad data, some double-byte characters had the first byte missing (it was 0xc2 in my case).

I solved the problem creating a small filter program to add the missing byte of these characters from the database dump. Not very nice but it worked. Why the problem developed in the first place I do not know.


#include <stdio.h>

main() {
int a,c;
while((c=getchar())!= EOF)
{
if(c>0xe0) continue;
if(c>0xc0) {
a=getchar();
if(a>0x7f) putchar(c); putchar(a);
} else if(c<=0x7f) putchar(c);
}
return(0);
}