Review: FatCow Web Hosting

Friday, February 28th, 2014

Disclosure: We are a professional company that sometimes receives compensation from the companies whose products we review. We test each product thoroughly and give high marks to only the very best. We are independently owned and the opinions expressed here are our own.

When I needed a web hosting company for my website a few years ago, I came across FatCow, and I’m so glad I did! They have been an excellent web hosting company for me and for several of my clients as well.

There are several things I really like about FatCow.

Excellent Pricing

FatCow starts you out at a ridiculously low price when you first sign up with them. But the good news is, even after the promotional period is over, their prices are still very reasonable and competitive.

Easy to Use

The web panel for the hosting service is very user-friendly. I have had no trouble figuring out how to use it at all. And if you can’t find what you’re looking for, a quick search of their knowledgebase will get you what you are looking for.

Friendly and Helpful Customer Service

Every time I’ve had to call or email FatCow‘s customer service with a question, I have had nothing but great responses from them. They are quick to help, professional, and get you the information you need.

I have to tell a quick personal story here about FatCow. When I first signed up with them for one of my sites, I got a promotional price for the first year, then it reverted to their regular prices. After a couple of years, FatCow‘s customer service contacted me and said they would like to lower my price! For just a little more than what I would pay for 1 year of hosting, they gave me 3 years! I can’t promise they’ll do the same for you, but it just goes to show what a great company they are to work with.

Go check them out!

affiliate_link

Perl: Using the Date::Calc Module to Generate Date-Related Strings

Saturday, February 8th, 2014

I have found the Date::Calc module to be quite handy on several occasions. It has many, many methods to do just about anything you can think of with dates. If you haven’t used it before, I would suggest you check it out and give it a try.

Today I’m going to show how I recently had to come up with a string that represented the first 3 characters of the current month in all lowercase plus the current 4-digit year. So if this is February of 2014, the string needed to be “feb2014.” The Date::Calc module came in quite handy for this task.

First I start out by including the module in my script:

use Date::Calc qw(:all);

I will get today’s date with the Today() method:

($today_year, $today_month, $today_day) = Today();

Next we will get the actual name of the month (e.g., February). The second parameter here is the language:

$full_mon = Month_to_Text($today_month, 1); #1 = English

We’ll lowercase the month name:

$short_mon = lc($full_proc_mon);

And then we use a regular expression to discard everything after the first 3 characters:

$short_mon=~s/^(.{3}).*$/$1/g;

Now we combine the month and year to get our string (e.g., “feb2014”):

$month_year = $short_mon . $today_year;

Some of these steps could have been combined, of course, but I have broken it out here for ease of reading and debugging.

Have you used the Date::Calc module for any interesting applications? Share your thoughts in the comments.

Perl: Processing a CSV or Tab-Delimited File into a Hash of Hashes

Saturday, December 28th, 2013

Perl is a great language when it comes to processing data. The biggest reason is because its powerful regular expression support makes it easy to find the data you’re looking for.

When you have a file that is in CSV (comma-delimited), tab-delimited, or some other delimited format, Perl is the perfect option for reading in the file and doing something with its data. In this example we will store it into a hash of hashes.

Let’s jump right into the code.

First, we initialize an empty hash where we’ll store the data, then open the file for reading:

%file_data = ();
unless (open (IN, "tab_file.txt"))
{
    print "ERROR: Could not open input file tab_file.txt: $!\n";
    exit;
}

Now we will read in each line in the file:

while ($line = <IN>)
{

Get rid of the ending newline:

    chomp($line);

Here’s the key to getting the data on the line. We’re splitting the line (here on the tab character, but it can be any character) into parts and storing those parts into an array:

    @line_info = split(/\t/, $line);

Let’s say the key field to the line’s information is in the first field, so we store that temporarily:

    $key_fld = $line_info[0];

Now we’re going to iterate through the tab-delimited fields from the line and store them into a hash of hashes for easy retrieval later on. The first line here is converting the array into a reference. The second line is then iterating through that array reference. The line inside the loop stores each field into a hash of hashes: the first key field is the first field on the line, which we defined above, and the second key is just the number of the field. (This might not be the most practical way to store the data, but you get the idea.)

    $line_info = \@line_info;
    for ($i = 0; $i <= $#$line_info; $i++)
    {
        $file_data{$key_fld}{$i} = $line_info->[$i];
    }
}

We close our input file, since we’re done reading it:

close(IN);

Now if we want to iterate through the hash of hashes we created with the data, we can do something like this:

foreach $key (keys %file_data)
{
    print "Key field: $key\n";
    foreach $key2 (keys %{$file_data{$key}})
    {
        print "- $key2 = $file_data{$key}{$key2}\n";
    }
}

And that’s it–we’re done!

Welcome to PHP!

Saturday, December 28th, 2013

This category will contain information about PHP.

Welcome to Perl!

Saturday, December 28th, 2013

This category will contain information about Perl.

Welcome to JavaScript!

Saturday, December 28th, 2013

This category will contain information about JavaScript.

Welcome to HTML/CSS!

Saturday, December 28th, 2013

This category will contain information about HTML/CSS.

Welcome to AJAX!

Saturday, December 28th, 2013

This category will contain information about AJAX.