Posted by & filed under Developer Blog.

I finally made the switch!

I’ve been working on migrating this old blog to Mephisto blogging system. Mephisto runs on Rails which I have blogged about before and still continue to love and swear by.

The old blog I wrote in PHP a few years ago. I was just getting sick of re-inventing the wheel every time I wanted to add and maintain a new feature. I wanted a new system that I didn’t have to build and maintain so that I could focus more on the actual content. Mephisto also allows you to use Akismet for spam defense. Akismet is typically used with WordPress and does a great job of keeping comment spam out of your blog. I was spending way too much time removing spam from the old blog, so Akismet is a welcome change!

Also, for the sake of time, I decided to download a theme for Mephisto rather than design one myself. I chose the Lucid theme which is actually a port of the Lucid Typo theme (Typo is another Rails based blogging system). I have tweaked the default theme quite a bit to be better suited for SEO as well as handle my google ads. I also changed the default color from Ruby to Mint. But if you like the Ruby better you can change it in the upper right corner. You can also change the layout from static to liquid. These options are a few of the reasons I chose the Lucid theme.

Last but not least, I’ve finally made the transition from using Webalizer as my tracking software, to using Google Analytics instead. Google Analytics is a robust tracking application that is comparable to expensive tracking apps like Omniture but is offered as a free service. I’m extremely impressed with Google Analytics’ capabilities and how easy it is to implement. I’d recommend it for any website, big or small!

Let me know what you think of the new do.

Posted by & filed under Developer Blog.

There are many examples of how to parse through an XML document using PHP out on the web by doing a quick google search. I was having problems because even while following all of those examples, I was getting the following error:

PHP Fatal error: Call to undefined function: xml_parser_create()

Everywhere I searched said “you need to recompile PHP and use –with-xml and it will get rid of this error. Well, I didn’t compile PHP in the first place, I installed Apache2 as an RPM in Mandrake and the PHP module (apache-mod_php) to go with it. I couldn’t find anywhere that told me how to add XML support to PHP in that case.

After many hours of searching, I finally discovered that you need to also install the php-xml RPM and the problem will go away. Seems easy enough now, but I was really having a difficult time finding the answer to this.

Posted by & filed under Developer Blog.

(NOTE: Since this post was first written, I have since abandoned Super for the far superior Movavi Video Converter which will do everything Super does, but is much easier to use and obviously much easier to download. It even rips DVDs which Super cannot do. It’s not free like Super, but it’s well worth the cheap $30. Trust me on this one!)

Ever get stuck in an endless loop, trying to download video converter, Super? Here’s how to break the loop.

I’ve never once been able to download it using Firefox, so if I were you I wouldn’t even bother trying.

Basically, you need to add the download site to your trusted sites in IE. But wait! I said the download site. Although it may appear that you are downloading directly from the www.erightsoft.com domain, you will actually be downloading from gpl.download.free.fr/Super.html so go ahead and point your browser there now.

Once you are on the right domain, open up your internet options and click the ‘security’ tab. Then hit the ‘trusted sites’ icon and add the current domain (be sure to un-check the option that requires it to be an https site). Now that gpl.download.free.fr has been added to your trusted sites list, change your trusted sites level to ‘Low.’

Now all you need to do is scroll to the bottom of the page and click ‘Start Downloading SUPER’ which will take you to http://gpl.download.free.fr/Superdc.html where you will see a link that says ‘download and use’ near the top of the screen. Click that and it will take you to http://gpl.download.free.fr/S6Kg1.html where you will see the download links at the bottom of the screen. Why didn’t I have you go there to begin with instead of clicking all these links? Well, the good people of erightsoft (or whoever they are) don’t want you to download Super from anywhere but on their site, so they check the referrer of how you got to the download page and if you don’t get there in the order I described above, you will be redirected to the begining and have to start all over.

Happy video converting!

Posted by & filed under Developer Blog.

I wanted to set up a cronjob to backup my photos from a Windows computer to my linux server. To do so I simply set Windows to share the photos directory, then mounted the directory in linux.

The rsync command seemed like the most logical way to sync the mounted directory with my backup directory. However, every piece of documentation I could find online showed examples of rsync communicating with an external server. I’m here to tell you that’s not entirely necessary and setting it up to synchronize 2 local directories works just as well.

rsync -vur --delete --exclude=*.db --exclude=*.info /mnt/photos/ /home/jgill/photos/

Posted by & filed under Developer Blog.

In order to be more user friendly and make our forms as easy as possible to fill out, we’ve decided to combine email and phone number fields within our forms to be a single field and let the user decide which method of contact they prefer to give us quickly and easily. The field is required because the whole purpose of the forms is to get contact information.

Requiring the field in Rails is easy, simply add the following in the model:

validates_presence_of :phone_or_email

where :phone_or_email is the name of the field.

But how to validate at least the email address format or the phone number format? And to make it a truely user friendly form, allow the user to enter the phone number in any format they wish as long as it has a valid phone number. In other words, let the user use spaces, dashes or periods; let the user use parentheses to denote area code or leave them off if they wish; and let the user include or exclude the 1 at the beginning.

Here’s the rails code I added to my model to get this working and it seems to be pretty solid! Feel free to use this code in your app and if you happen to be an expert in regular expressions and want to give me pointers on how to clean it up a bit, please comment below!

validates_format_of :phone_or_email,
 :with => /^([a-zA-Z][\w\.-]*[a-zA-Z0-9]@[a-zA-Z0-9][\w\.-]*[a-zA-Z0-9]\.[a-zA-Z][a-zA-Z\.]*[a-zA-Z]|[1]?[\-|\s|\.]?\(?[0-9]{3}\)?[\-|\s|\.]?[0-9]{3}[\-|\s|\.]?[0-9]{4})$/,
 :message => "is not a valid phone number (incl. area code) or email address"

(Keep in mind that the company I work for does not currently do business outside the US, so I’m not interested in supporting foreign phone numbers and prefixes)