Monday, November 19, 2007

Turning rpm's into deb's

The phone system we use at work right now has a program called MXIE that handles telephone call logging and other whatnotery on your computer. They are nice enough to have a Linux version of the software, but not nice enough to provide source to build it from. They have binary installation files, but only in rpm format. I'm running Kubuntu on my work laptop. Rpm's will do me no good.

Enter Alien. This nifty little utility will convert those pesky rpm's into deb packages so that you can install them easy-peasy on a Debianish system like Ubuntu.

If you don't have Alien already, make sure you have universe repositories set up, and then, from the command line
sudo apt-get install alien

Now you are ready for this
sudo alien -k name-of-rpm-file.rpm

Dun-du-dun!!! You are now ready to install your package
sudo dpkg -i name-of-deb-file.deb

Sunday, November 18, 2007

Internationalization/Localization Cheat Sheet

ISO 639-2 Language Codes live here:
http://www.loc.gov/standards/iso639-2/php/code_list.php

Command Line Tools
xgettext will collect all your strings for you from a file or set of files into a po file.

msgfmt will turn your po files into mo files.


info gettext will get you all the info you need to use the GNU gettext utility.


File Structure
Stick your po and mo files into a structure like this:

/src
/locale/en/LC_MESSAGES/messages.mo
messages.po
es/LC_MESSAGES/messages.po
messages.mo


PHP Functions
putenv ("LC_ALL=es"); sets your locale to Spanish.
bindtextdomain ("messages", "./locale"); shows where to find the translation tables.
textdomain ("messages"); says what domain we're using.

Internationalize your strings in PHP using the handy-dandy underscore operator.
print(_("Hello World"));

More info on gettext functions in PHP:
http://php.net/gettext

Thursday, November 15, 2007

Cups Printing from the Command Line

Sometimes you just need to print something without going into an application. Here's how...

First, find out what printers are available
lpstat -a

That will tell you what printers are available to you. Then you can print to one of them
lpr -P [printer_name] [file_name]

Need to find out what jobs are running right now?
lpstat -o
(that's the letter oh, not the number zero)

Need to cancel a job?
lprm [job_id]

For more information and all sorts of other CUPS goodness, check http://www.cups.org

Sunday, November 4, 2007

Modding an old Razr V3

Work gave me what is possibly the worst Motorola Razr phone ever. Not only that, they gave me a phone that someone must have bought on a trip to Thailand or something. It had no Hebrew fonts. No predictive typing. You couldn't move photos or videos that you took with the phone on to your computer using a USB cable the way that I can with the Razr v3x that I bought in New Zealand in December. Nope, none of that very basic stuff.

They told me to have the secretary call up Orange (our company's mobile provider) and ask them to upgrade the system. Celcom (my mobile provider) had no problem whatsoever in upgrading my Kiwi Razr. Orange, however, balked. They weren't going to be "responsible" for a firmware upgrade on a phone that they did not sell. Grrr...

So my boss told me to take the phone to one of the somewhat shady used phone shops that you see around town. They'll unlock phones and everyone assumed that they'd change the firmware for me, too. I tried a few places, and none would upgrade my firmware. Not one. Try here. Try there. Try the central bus station. Nope. No help at all.

So, today I buckled down and decided to do it myself. I had looked around at this before, and not found tools for linux, but today I found all the tools I needed. If you are on Linux and want to change your Motorola, add new skins, flash it with new firmware, or whatever, here are some links to get you going:


Moving Files Around:
Use moto4lin for connecting your phone to your computer with a usb cable.
http://moto4lin.sourceforge.net
I had lots of trouble at first, but this page helped me fix it all up.

Flashing (upgrading firmware on) Your Phone:
There is a nifty tool called Flasher. I used it to get my new language pack working.
http://moto4lin.sourceforge.net/wiki/Flashing

Language Packs:
http://www.motomodders.net/default.aspx?tabid=116

Monster Packs:
http://www.planetmotox.net/monster_packs.php

Useful Information:
(though written for Windows users, you will still get what you need)
http://www.motomodders.net/Default.aspx?tabid=69

Hint for Installing Skins:
Make sure that the directory name of your skin is the same as the name of the skin files. I had one skin named "Dragon's Dream" and I thought I was making it better by renaming the directory to "Dragons_Dream" but that just made my skin not work.


WARNING! MODDING YOUR PHONE CAN KILL IT!
Make sure that you have a backup. Make sure that you are using software you trust, and that you've read enough about the process that you know how it works.

Happy modding!