Firefox: spell check any field

firefoxlogo.gif

I can’t spell. That no joke. If you have read my blog for any length of time, you will know this. One of my saving graces has been the built in spell checker in Firefox (I’ve already used it 5 times in this post!)

By default Firefox will only spell check large text areas. This is great for the bodies of forum and blog posts, but it doesn’t help when I am filling out a single line text box, like the subject of this blog, or a forum topic title.

There is a solution to this, so you can have Firefox’s spell check available to all fields in a browser:

In Firefox, do the following (ignore all quotes)

  1. type this in the browser address bar “about:config”
  2. look for “layout.spellcheckDefault”
  3. change the value to “2”
  4. restart firefox

cpanel broke mysqlhotcopy 1.22 but here is a fix!

mysql-logo.gif
Yesterday I logged into my server to back up my databases. I back up the mysql databases using a tool called “mysqlhotcoy”. It’s a handy perl application that copies the database files for easy restores, and it also works really quick when you run it.

I ran the mysqlhotcopy command as root, and was greeted with an error similar to this:
Invalid db.table name 'foo.foo`.`bar'

um, no…. this table exists

I have cpanel installed on my server, a lot of server do. cpanel does updates to many application, mysqlhotcopy is one of them. It looks like my version of mysqlhotcopy was updated to 1.22, and there is some major problems with mysqlhotcopy 1.22.

I did some googeling and I found some people talking about the problem. I even found a quick patch for the problem. The problem comes from a host adding the username and an underscore before a database name (example: “username_databasename.table“). mysqlhotcopy only looks for databasename.table

The following patch instructions will fix mysqlhotcopy 1.22

  • Open the perl script for editing. It is located at /usr/bin/mysqlhotcopy
  • find the following subroutine

    sub get_list_of_tables {
    my ( $db ) = @_;

    my $dbh = DBI->connect(“dbi:mysql:${db}${dsn};mysql_read_default_group=mysqlhotcopy”,
    $opt{user}, $opt{password},
    {
    RaiseError => 1,
    PrintError => 0,
    AutoCommit => 1,
    });

    my @dbh_tables = eval { $dbh->tables() };
    $dbh->disconnect();
    return @dbh_tables;
    }

  • look for this line (mine was link 821):

    my @dbh_tables = eval { $dbh->tables() };

  • immediately after that line add the following:

    map { s/^.*?\.//o } @dbh_tables

Here is my patched subroutine:

sub get_list_of_tables {
my ( $db ) = @_;

my $dbh = DBI->connect(“dbi:mysql:${db}${dsn};mysql_read_default_group=mysqlhotcopy”,
$opt{user}, $opt{password},
{
RaiseError => 1,
PrintError => 0,
AutoCommit => 1,
});

my @dbh_tables = eval { $dbh->tables() };
map { s/^.*?\.//o } @dbh_tables;
$dbh->disconnect();
return @dbh_tables;
}

After I applied the patch, everything was back to working order.

Some people have other approaches that would work also, like downgrading mysqlhotcopy all together.

Personally, I think adding one line of code wasn’t that big of a deal to fix the program

My router is running linux

tomato_linux_router.jpg

Its no secret, I like to install Linux on things that should be running Linux, like my iPod.

My friend at work, Stephen, recently told me about installing Linux on a linksys router. To be honest, I looked into my router in the past, but it was years ago, and required soldering wires and things inside of it. I don’t have the best luck when it comes to hardware mods, so I didn’t do it.

Stephen turned me on to a new Linux based firmware for older linksys routers called “Tomato”.

Tomato is a 3rd party firmware that voids the warranty on your router, but lets you do some awesome stuff you weren’t able to do with the original firmware.

It took all of about 5 minutes to download the firmware and reflash my router with it. You can get a copy of it at http://www.polarcloud.com/tomato

The interface is ajax based and really clean. Because its all powered with ajax, there is some really cool monitoring features, like real time bandwidth monitoring (flash movie)

If you have a weak wifi signal from your router, you can use the tomato firmware to crank up the output of the signal.

All in all you turn your $50 router into a $500 router with this open source firmware.

You have to have a Linksys WRT54G, version v1-v4. Newer ones are v5, so before upgrading be sure to check yours.

If you aren’t a big geek, this mod is kind of useless, but how awesome is it to say that you are running Linux in your router.

Who is listening to your iTunes?

sharing_itunes.gif

If you use iTunes while your computer is hooked to a network (work, dorms, and coffee shops are good examples), you can share your iTunes with other people. This feature has been around for a long time in iTunes. Something that isn’t included is the ability to see how many, and who is listening to your music.

I did a little bit of searching an found that iTunes uses port 3689 to share music on. Reaching back into my DOS days, I came up with this:

press the windows key + r
enter “cmd” and press enter
at the prompt type:
netstat | find “:3689”

you will get a listing of all the computers connected to your iTunes. A useless but interesting trick.

If you are running a mac, I’m sure you can do the same thing but with grep.

cfdump in php!

At work, I write ColdFusion, at home I write PHP. I bounce back and forth between worlds. Jack of all trades, master of none I guess.

One thing that I have always loved about ColdFusion is the cfdump tag. You feed it any variable, and it will spit out whats in it. Struct, String, Array, Query, Object, XML, it doesnt matter, it just works. I would go as far to say that its one of the best native debugging resources I have ever seen in a web development language.

In PHP, you can do a print_r() and look at the source, but that is no where as cool as cfdump. I have longed for a cfdump style resource to be available in PHP. Today I got my wish when I stumbled upon “dBug”. http://dbug.ospinto.com

dBug is a small PHP class that duplicates the cfdump tag from ColdFusion

look how simple it is to use:

include_once("dBug.php");
new dBug($myVariable);

The output looks like this:
phpdump.gif

dBug will handle anything you throw at it, just like cfdump does. This is going to help me so much in the future. If you develop in PHP, I think that this class is a must have in your tool kit.

dBug is free! get it today from http://dbug.ospinto.com