scott.hodson.blog

June 17, 2008

Use Gmail as a Secure SMTP Server

Filed under: Internet — scott @ 3:26 pm

As part of my job I visit a lot of client sites throughout the week, frequently connecting my laptop(s) to various LANs. I also work on my home network and various WiFi hotsports. Needless to say, I’m attaching and detaching to a lot of networks throughout the week. In fact I’m typing this from a Starbucks in Orange, California, USA.

More and more networks are blocking port 25 (SMTP) to prevent spam from being sent from their network. As an Outlook user that makes my life difficult because, unlike Apple’s Mail.app, which can automatically work with multiple SMTP settings, each email account is mapped to one single set of SMTP server settings at a time, and when I switch networks I have to go in and manually make changes in about 3 different screens per account. I usually have to do this 3-5 times a day and it’s a hassle.

I’ve considered for some time to switching my email to be hosted by Google Apps, and I’m still leaning that way, mainly for spam filtering. However one other main reason is that I’d have one SMTP server that doesn’t run on port 25, so my SMTP traffic won’t be blocked (assuming they don’t block Gmail’s port 587). Also, Gmail’s SMTP servers uses TLS for encrypting outgoing messages, so network nodes between me and Gmail can’t read my outgoing email. Well, in a short-term fix to this problem I just set up my Outlook to use Gmail as an SMTP server, but kept my POP settings the same.

Just follow these instructions for configuring POP with Outlook 2007 but ignore the POP settings and just setup the SMTP settings using your Gmail account. It’s working fine for me now!

February 24, 2008

How to Restore MySQL Databases Without a mysqldump Backup

Filed under: MySQL — scott @ 9:15 am

A server that had some MySQL datases (including the one for this blog) on it became unbootable after performing some Windows Updates, so I had to migrate everything to another server. When I went to get the mysqldump’s of the databases a few of the database dumps were blank for some reason. I’ll have to figure out why later. So now I had no backup when I thought I did.

Luckily, I figured out how to pull the raw data files MySQL uses and was able to restore the databases using the native DB files. Here are the steps I took. This was a MySQL 4.1 server.

  1. Each DB is stored in a folder in the “data” folder where MySQL Server runs.
  2. Copy the folders of the databases you want to store to another location
  3. Since the server I wanted to migrate to was running MySQL 5.0 and not 4.1, to get access to my data I had to install an instance of MySQL 4.1 on another machine, stop the MySQL service, then copy the data folders of my databases to this other 4.1 server’s data folder. Then restart the MySQL server.
  4. Then, with the databases back online, I attempted to perform a mysqldump, but I got errors that the “.cnf” on some of the tables were not available. Then I tried doing a backup from the MySQL Administrator GUI tool and got a similar error message when it showed the list of tables. The tables that didn’t have errors were MyISAM tables, and the ones that did have errors were InnoDB tables. From the MySQL website about MyISAM Table Storage:

    Each MyISAM table is stored on disk in three files. The files have names that begin with the table name and have an extension to indicate the file type. An .frm file stores the table format. The data file has an .MYD (MYData) extension. The index file has an .MYI (MYIndex) extension.

    These three files for each table are stored in the database folders that we copied. The reason some of the other tables were not working was that InnoDB tables are stored differently. Again, from the MySQL website about InnoDB Table Storage:

    If you specify no InnoDB configuration options, MySQL creates an auto-extending 10MB data file named ibdata1 and two 5MB log files named ib_logfile0 and ib_logfile1 in the MySQL data directory. To get good performance, you should explicitly provide InnoDB parameters as discussed in the following examples. Naturally, you should edit the settings to suit your hardware and requirements.

  5. These InnoDB data and log files are stored in the root of the MySQL data folder and I was getting the errors because I had not copied those over as well. The new machine that has 4.1 on it already had these files but I didn’t care since I didn’t have anything important on that server’s databases so I just deleted the new server’s InnoDB files and replaced them with the ones from the server that I was trying to recover.
  6. When I started the server with these updated InnoDB files I got another error, something about the file length not matching the correct file length. So I just deleted the log files and left the ibdata1 file there by itself. When I restarted the server hat state t came up fine. I quickly did a mysqldump of these databases then restored the dumps onto the server running MySQL 5.0 and I was back up and running

Now I need to figure out why the dumps weren’t executing properly in the first place, which caused me to go through all of this. This teaches an important lesson that I already knew: practice disaster recovery so when a disaster actually hits you’re sure that you have the knowledge, data and files that you need in the correct state that you need them in. If I had practiced recovering from a server crash and tried restoring my databases from my backups I would have noticed that some of the databases weren’t creating good MySQL dumps and I could have prevented myself from doing a MySQL restore without good .sql dumps.

January 29, 2008

Cancel Your Cox Telephone Service!

Filed under: Cox — scott @ 9:49 am

I recently received a phone bill of more than $300 on my fax line the other day. The fax line number is a Cox Telephone number. The reason the bill was so high was that there were several strange calls to Asia (South Korea, Singapore, and Japan). I never call anyone in Asia, and the only device attached to the line is a fax machine. I thought maybe my kids were pushing buttons on the fax machine but the calls were too late at night for them to be playing with it.

After calling Cox and complaining about these calls they kept trying to upsell some international dialing plan. They didn’t believe me that I didn’t make these calls! I finally got them to submit a refund request and turned off all international dialing capabilities for that phone line.

Recently, I received a letter denying my request for a refund, stating that their switch showed that the calls originated from my line. I still have no idea how that’s possible. I’m certain it’s a bug or someone hacked into their phone network to make these calls against my account.

If you have Cox Telephone service, keep an eye on your long distance calls because their phone network or billing system is incorrect and/or vulnerable to hackers using their network at your expense.

January 16, 2008

Macbook Air Will Fail…at Least v1.0 Will

Filed under: Apple, Mac — scott @ 12:48 pm

So I think the MacBook Air will be a flop. It is the same size (screen-wise) as a MacBook, has less horsepower (slower CPU, slower and smaller hard drives, etc), fewer connectivity options, and it costs more. And for what? Just to be thinner and have the latest, coolest looking one? It’s a CEO, show-off send email, process docs, etc, laptop that’ll turn some heads next time he’s in the First Class cabin of his LA to NYC flight, not a mobile knowledge worker productivity workhorse. I guess students will like it too for coolness as well to write their papers on.

I guess if you don’t mind trying to get important stuff done at a slower speed, but at least you’re looking sexy doing it, and don’t mind paying more money for it then it’s for you!

I think eventually this will replace the MacBook and then it won’t matter: if you need a notebook that cranks speed-wise then you’ll get a MacBook Pro.

I’m all for ditching the optical drive though, not needed 99% of the time. I think we’ll see a thinner MacBook Pro sometime this year as well.

P.S. Don’t laugh at me or call me a hypocrite if you see me strutting around with one of these at some point. :)

Here’s a comparison of similar small notebooks from other vendors, compared to the MacBook Air

January 13, 2008

gem install mysql error

Filed under: Technology — scott @ 8:07 pm

On OS X 10.4.11 (no leopard yet!) when I try to install the mysql gem I get an error, something about native bindings.

ScottBook:~ root# gem update mysql
Updating installed gems...
Bulk updating Gem source index for: http://gems.rubyforge.org
Attempting remote update of mysql
Building native extensions. This could take a while...
ERROR: Error installing mysql:
ERROR: Failed to build gem native extension.
/usr/local/bin/ruby extconf.rb update mysql
checking for mysql_query() in -lmysqlclient... no
checking for main() in -lm... yes
checking for mysql_query() in -lmysqlclient... no
checking for main() in -lz... yes
checking for mysql_query() in -lmysqlclient... no
checking for main() in -lsocket... no
checking for mysql_query() in -lmysqlclient... no
checking for main() in -lnsl... no
checking for mysql_query() in -lmysqlclient... no
*** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of
necessary libraries and/or headers. Check the mkmf.log file for more
details. You may need configuration options.
Provided configuration options:
--with-opt-dir
--without-opt-dir
--with-opt-include
--without-opt-include=${opt-dir}/include
--with-opt-lib
--without-opt-lib=${opt-dir}/lib
--with-make-prog
--without-make-prog
--srcdir=.
--curdir
--ruby=/usr/local/bin/ruby
--with-mysql-config
--without-mysql-config
--with-mysql-dir
--without-mysql-dir
--with-mysql-include
--without-mysql-include=${mysql-dir}/include
--with-mysql-lib
--without-mysql-lib=${mysql-dir}/lib
--with-mysqlclientlib
--without-mysqlclientlib
--with-mlib
--without-mlib
--with-mysqlclientlib
--without-mysqlclientlib
--with-zlib
--without-zlib
--with-mysqlclientlib
--without-mysqlclientlib
--with-socketlib
--without-socketlib
--with-mysqlclientlib
--without-mysqlclientlib
--with-nsllib
--without-nsllib
--with-mysqlclientlib
--without-mysqlclientlib
Gem files will remain installed in /usr/local/lib/ruby/gems/1.8/gems/mysql-2.7 for inspection.
Results logged to /usr/local/lib/ruby/gems/1.8/gems/mysql-2.7/gem_make.out

This should fix it (and yes after the first “–” there is another “–” preceeding the “/usr/local…” path).

sudo gem install mysql -- --with-mysql-config=/usr/local/mysql/bin/mysql_config

References:

November 11, 2007

WEBrick won’t start on Windows

Filed under: Rails, Ruby — scott @ 9:35 pm

If you get a strange error trying to start WEBrick on Windows like this…


[2007-11-11 20:23:42] INFO WEBrick 1.3.1
[2007-11-11 20:23:42] INFO ruby 1.8.6 (2007-03-13) [i386-mswin32]
[2007-11-11 20:23:42] WARN TCPServer Error: Bad file descriptor - bind(2)
c:/bin/ruby/lib/ruby/1.8/webrick/utils.rb:73:in `initialize': Bad file descriptor - bind(2) (Errno::EBADF)
from c:/bin/ruby/lib/ruby/1.8/webrick/utils.rb:73:in `new'
from c:/bin/ruby/lib/ruby/1.8/webrick/utils.rb:73:in `create_listeners'
from c:/bin/ruby/lib/ruby/1.8/webrick/utils.rb:70:in `each'
from c:/bin/ruby/lib/ruby/1.8/webrick/utils.rb:70:in `create_listeners'
from c:/bin/ruby/lib/ruby/1.8/webrick/server.rb:75:in `listen'
from c:/bin/ruby/lib/ruby/1.8/webrick/server.rb:63:in `initialize'
from c:/bin/ruby/lib/ruby/1.8/webrick/httpserver.rb:24:in `initialize'
from c:/bin/ruby/lib/ruby/gems/1.8/gems/rails-1.2.5/lib/webrick_server.rb:58:in `new'
... 7 levels...
from c:/bin/ruby/lib/ruby/gems/1.8/gems/rails-1.2.5/lib/commands/server.rb:39
from c:/bin/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in `gem_original_require'
from c:/bin/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in `require'
from script/server:3

This is most likely caused by some other already listening on the default port 3000. Perhaps you have another WEBrick server instance running. To see if you have another app running on that port you can run

netstat -a -b

To show the list of applications and what ports they are listening on. If you want to release the port just kill the application listening on that port, or you can run WEBrick on another port like 8080 like this:

ruby script/server -p8080

References:

August 25, 2007

My First Computer(s)

Filed under: Family, Technology — scott @ 2:44 pm

I stumbled across this series about old computers from the 1970s and I found the first 2 computers we had growing up in my house in San Jose, CA. Having an electrical engineer for a father made it more likely I’d have access to cool gear like this at such an early period in Silicon Valley’s early days.

My first computer was a variant of the IMSAI 8080. At the time my dad and his other hobbyist
friends assembled these computers together. The Altair was an earlier favorite and the IMSAI was an evolutionary follow-on. I think the one my dad had was a little better because it had the Zilog Z80 chip in it (oooh!). It had 64K 8″ floppy disks and ran CP/M. Before we had an OS on it I would have to enter in a 20 or so byte sequence on the front panel, setting each of the 16 bits of each byte, then pressing the Enter switch to enter the byte into memory. When I was ready to run the program I would push the Run switch and it would allow me to type on the keyboard and see what I was typing in the display. This was my first program! When we got CP/M I enjoyed playing some sort of ASCII Star Trek game and another adventure game where you would type commands like “open door” and it would respond with “The door is open but you can’t go in, a troll blocks its path”. You could call this an all-text precursor to Warcraft.

Then later on my dad got the Interact Model One, at that time sold by Micro Video in Ann Arbor,
MI. This was cool because it had some games and joysticks! All storage was on a standard tape deck. Eventually I got tired of the games and wanted to buy more but they were very expensive ($40!) so I picked up a book that taught how to program BASIC on it and I figured out how to write my own games. Those were the funnest games because they were made by me and I think I was about 10 or 11 years old while making my own games. I remember spending hours into the night trying to figure out how to make images move across the screen, how to react to joystick input and collision detection.

We’ve certainly come a long way since then, but I know my love for technology started at a very young age thanks to exposure from my dad, who gave me the tools to discover how much I enjoyed writing software that is useful and fun for me and others to use.

August 20, 2007

Why I Still Buy CDs

Filed under: Music — scott @ 10:46 am

As we mark the 25th anniversary of the CD some of my colleagues and friends are surprised that such a technofile as myself still buys CDs. These detractors fall into 2 camps: one that believe I shouldn’t pay for it because I can get it for free from P2P networks, and the others just buy all of their music on iTunes or some subscription service.

I’m not any particular supporter of the RIAA, and I’ve been down the P2P route. In fact I used to write software using the Gnutella protocol (R.I.P. Gene) and loved P2P as a disruptive and innovative way to provide network services, which eventually led me to found Ubero as a distributed processing service in 2000.

As far as buying music online, I loved AllOfMP3.com not only because of it’s price, but mainly the fact that it was DRM-free and you could buy high bit-rate versions of songs for a higher price that was still very reasonable. However, Russia wants to get in the WTO so they shut it down, although it has resurfaced as MP3Sparks.

So to not upset Russia, I continue to acquire the bulk of my music by buying CDs. Here’s what I get with it

  • All of my songs stored on a physical media that can act as a backup, packaged in a pleasing and artistic manner
  • High bit-rate (about 320kbps) versions { CD-quality :) } of my music
  • DRM-free, can be played at high quality in my car, computer, home audio system, or ripped to MP3s for my computer or MP3 player
  • Usually $9.99 each from Amazon, tax free, 2-day free shipping (I’m an Amazon Prime member) so the price is the same or better than buying a whole album on iTunes
  • CDs usually come with some extras that can’t be had by buying the album online. The music companies are trying to incentivize people to keep buying CDs.

I’m not one to acquire or buy 1 song at a time unless I need it for a specific reason like I want to integrate it into a slide show or something. For those reasons then I’d usually acquire it online. But if an artist I like or follow comes out with a new album I want the whole album, not just the singles they cherry-picked by radio DJs and program managers.

As we look back on the 25th anniversary of the CD many have asked themselves “what was the first CD you bought?” If you don’t know what a CD is then stop reading this blog now. Otherwise, my answer is Love and Rockets “Express“.

August 13, 2007

Suffering from “E-mail Stress”? Achieve “Inbox Zero”

Filed under: GTD — scott @ 12:53 pm

This recent article demonstrates what most people know: we are being flooded and overwhelmed by email! If you’re feeling the same way check out this speech at Google given by Merlin Mann about his GTD-inspired “Inbox Zero” initiative. Following these simple steps will help you achieve an empty inbox and relieve the stress of being overwhelmed by incoming email.

  • Get a System
  • Email’s just a medium
  • One place for everything
  • Process to zero
  • Convert to actions
    • Delete
    • Delegate
    • Respond
    • Defer
    • Do

August 10, 2007

CakePHP: Tasty, Still Undercooked

Filed under: PHP — scott @ 10:53 am

CakePHPLast night I went to a Orange County PHP Roundtable meeting for the first time, primarily to learn about CakePHP, a PHP framework that implements MVC and ActiveRecord a-la Ruby on Rails but for PHP. I was impressed with the amount of work that has gone into the framework and the passion of the presenter (Garrett something, President of the Cake Software Foundation). He was there to demonstrate some of the new features coming out on their 1.2 version.

Having developed in PHP for some time I could appreciate all of the pain and agony they are trying to resolve with CakePHP. The problem is that they’re perhaps 1-2 years too late because many disgruntled PHP developers have already moved onto Rails. Also, Cake is Rails-y in its implementation of ActiveRecord, scaffolding, and RESTful service support, but it doesn’t have any unit testing or database migrations features in it. Also, I think the fact that they go out of their way to support PHP 4 only holds them back. And I couldn’t get over the pain of seeing all of those dollar signs all over the code and having the type “new array()” every time you would create an associative array in PHP, which is used often throughout the framework.

The advantage, however, is that PHP is much more mature and has wide community support and is nearly ubiquitous on the Internet as the lingua-franca of website development. People who have large investments in PHP and plan to continue to leverage those investments should take a look at CakePHP.

CakePHP is a valiant effort to prop up the annoying verbosity and syntax of PHP and will extend the life of those teams that have been eating out of the PHP bakery for some time now.

Next Page »

Powered by WordPress