AWS Micro Servers Are Not Cheap But You Have Options

Amazon Web Services (AWS) has an amazing array of web servers and options for everyone (Netflix is their biggest customer).
For a new customer, the first year includes a ‘free-tier‘ which generously reduces prices, and some services are even free.

I signed up and moved to AWS a little over a year ago. You need familiarize yourself with their nomenclature and how to navigate their control panel. Once you get the hang of it, everything goes very smoothly. They even give you basic server monitoring tools for free during the first year. The free support is good too, if you’re willing to read through forums of how others solved your problems. You can pay for a higher level of support that gives you one-on-one responses.

In the back of my head I remembered that the first year was coming to a close. I thought the micro server cost (their smallest dedicated size) was under $10/month…
So, when I received an automated email from AWS reminding me that the year would end in July, I figured I’d let it continue until I had time to look into alternatives.

Well, today I had a look… They offer a very good online calculator for you to plan and know exactly what your monthly costs will be (actually, they bill in hourly segments. It actually gets that granular!). Bottom line, 1 micro (tiny) server at their Virginia location, with a dedicated ip address (“Elastic IP”) and one volume, currently costs about $18.50 / month with no long term commitments. You can even start up and terminate a server for a few hours to test something and only pay for the hours used.

There are ways to lower the annual cost for a dedicated server. For example, you can commit to a yearly contract, and pay a reduced upfront fee, and then a small monthly charge. Doing it that way drops the cost to less than half.

Here’s a link to the Amazon AWS Web Services Monthly Cost Calculator where you can calculate your own costs if you’re thinking of moving there.

Unable to open HTML href link in iOS iPhone

URL’s opening to the same page on your iOs, iPhone, iPad development HTML.

The Problem – href links open to the same page, sometimes with a dot or grey plus sign appearing on the page.

If you’re developing an html page for iOS devices such as the iPhone, iPad, and iPod, and you’re wondering why the href links all open back to the same page, then I think I have a simple solution for you. There’s an explanation for why this is happening, but that’s beyond the scope of this post. I’ve seen others suggest to build your entire website into one index page, but that’s not feasable for more than a very simple static website.

The Solution
Add target=self to the “a” tag and that should bypass the navigation issues.


< a target=”_self” href=”page2.html” class=”ui-btn ui-shadow ui-btn-corner-all ui-btn-up-c btn-showpg list-bttn” id=”showpg”>Link Description

Nikon D600 Spots Problem Fix

Nikon D600 : The Photo Enthusiast’s Dream DSLR
As an owner of several Nikon bodies and lenses, I was very excited when Nikon released the D600 camera.
Finally, an “affordable” full frame DSLR (assuming you consider $2,000 for just the body as “affordable”).
It’s somewhat of a hybrid in performance, features, and cost between it’s older brother, the D800, and it’s cousin the D7100.

The early reviews were very positive on image quality and features. See Popular Photo December 2012 issue for a detailed review, and a November 2012 DPREVIEW does a nice in depth review here. I waited a month or so for the early bugs to be discovered and then jumped in.

Spots Noticed
The buzz from the early birds was that there was a pattern of spots growing on the upper-left to center of the frame as more shots were taken. Some bloggers suggested it was from oil spots that were spattering from the back of the mirror. They suggested that as the mirror flies up to expose the image sensor, apparently some of the lubrication on the mirror was making it’s way to the sensor.

Meanwhile, Nikon hadn’t officially responded to these claims. Other owners were syaing that Nikon had resolved the issue and in updated versions of the camera, the problem had been fixed. This is very unlikely in such a short timeframe to engineer a fix and ramp up production with the fix, and ship all these fixed cameras around the world. I figured, more likely, that the problem was overstated and/or limited to specific uses – perhaps heavy zoom lens users that pump air in to the camera.

I Had Spots Too
My first images with the new camera were simply stunning. Nothing like slapping a super wide lens on a full frame DSLR. The landscapes were rich with color and the images were startling clean and beautiful. Then, the spots came… And, they came, and they came. And before I knew it, the images were filthy with spots just as the others had written about.

Nikon Official Announcement
On Mar 25, 2013 Nikon finally acknowledged that there was a problem here. The announcement goes like this:

Some users have indicated the appearance of multiple granular dust spots in images captured with the Nikon D600 digital-SLR camera. These granular dust spots are reflections of internal dust generated with camera operation, or external dust particles that have found their way into the camera, either, or both of which, have adhered to the camera’s low-pass filter.

The good news is that they also offer a resolution to the problem:

“As a first step, please follow the guidance from the User’s Manual (pages 301-305) related to the “Clean Image Sensor” function and manual cleaning using a blower. If these measures do not remove all dust particles and you are still experiencing problems, then please consult your nearest Nikon service center.” …

Actually, you can set your D600 to automatically clean the image sensor when you turn on and off the camera – however, that’s not likely going to solve this problem. By the way, here’s a link to the Nikon D600 manual in case you don’t have your’s handy.

Do What Nikon Says to Do!
First thing I noticed about the announcement: they do not mention oil ever. They said there may be “external dust particles”. I do not believe in conspiracy theories. With litteraly thousands of blog posts from users complaining about spots, I’m sure Nikon wouldn’t try to cover it up with lies. You can only fool the public for so long. If there is/was an oil spots problem, Nikon would have to fess up. At least as of now, they are not calling it oil, but dust. That’s good news for camera owners! Dust can be blown away, oil, not so much…

Here’s the Fix – It’s as Simple as 1-2-3
Who wants to deal with the hassle of getting an authorization from the service center, sending it back, and waiting for its return? Instead, just as Nikon suggested, I disbelievingly took out my blower and blew on the inside of the camera, first on the back of the mirror, and then by pressing the live view, which opens the mirror and locks it up, I blew into the sensor area and lightly on the sensor itself. I was not able to see any spots physically accumulating on the sensor before blowing, and didn’t notice any change afterwards. However, to my great surprise, the photos taken after the blower cleaning were spotless. Have a look at the before and after and let me know what you think.

1. Before With Spots – Photo untouched, cropped to enlarge the upper left portion of the frame.

Click on photo to see detail.
Nikon D600 With Spots

Nikon D600 With Spots
2. The Fix: Use Blower on Camera’s Image Sensor

3. After Without Spots – Photo untouched, cropped to enlarge the same area.

Click on photo to see detail.


Conclusion & Reccomendation
If you have spots accumulation problems, first check to see if Nikon has issued any new announcements on the D600. They may also release firmware updates, so it’s a good idea to check their website from time to time. Assuming there isn’t a recall, or some new information about these dreaded spots, simply pick up your blower (or buy one at your favorite camera store for about $8 — The Rocket Blower costs about $7.99 online). Clean the inside of the camera where the lens is mounted by pumping air in and around with the opening to the camera facing down so that the agitated dust particles can fall safely out of the camera. If that doesn’t do the trick, then call Nikon for a service authorization. From my experience though, the blower solution should work. Please let us know how it worked out for you.

Update August 2013:

As others have commented, this issue is not going away. I’ve personally cleaned my D600 Sensor 3 more times since first writing about this problem. Fortunately, I haven’t had to send it in for servicing yet. I am using the Digital Survival Kit with Type 3 swabs (24.0 mm) that I purchased on Amazon for about $22. It is a bit tedious, but it does work if you follow the directions.

Although the images are stunning when the sensor is clean, the concern is how to maintain this $2,000 camera body going forward. Having to clean sensors every 1,000 or so images is a lot of work. I also have a lot invested in Nikon glass, so I’m not running to another system just yet. However, I can’t in good conscience recommend others to purchase the Nikon D600 until the spots on sensor problem is confirmed fixed by the user community.

Have a look at the photos below. Wallace Falls National Park near Seattle WA. The falls shots got spotted up, which is clearly seen in the middle photo, as I didn’t check it that morning before heading out. I cleaned the sensor and the bird shots near Tacoma the next day came out fine.

_ABC2945 _ABC2978 _ABC3192

Recommendation: At this point, I would suggest anyone considering purchasing a Nikon D600 body, or any advanced DSLR for that matter, to make sure that these spotting issues have been resolved before you chunk down your wad of money. Try to get a range of serial numbers or manufacture after date that is known to be good. It’s not always feasible to know what serial number you’re getting – especially from mail order. If you want to be sure, go to your favorite local camera store and purchase one there, having inspected the box before pulling out your credit card. It may cost you a few extra dollars (everyone pays taxes, even Amazon customers, right…), but at least you’ll have some peace of mind. Please let us know your experiences…

Ubuntu Server Setup – Top 5 things to do on the First Day

You’ve just unwrapped your new Ubuntu server running on Ubuntu 12.04 LTS and now it’s time to roll up your sleeves and get started. What should you do first? Here’s a checklist of the top things I do for each new Ubuntu server that I install.

Let’s approach it from two ways:
– You’re working with a managed network provider like Rackspace, etc… or
– You’re doing it yourself on AWS as a new EC2 instance (Similar to managed, with some caveats).

You have your server credentials and have logged on to your server with a SSH connection. You are staring at your command prompt and are ready to begin…
1. Check your server to make sure you got what you wanted

Are the drives partitioned right? Do you have any space on /var to work?

df -h

What release are you running? The current (as of 2/13) latest LTS version of Ubuntu is 12.04.x

lsb_release -a

2. Update your copy of distribution files.

sudo apt-get update

This will make sure that as we get started installing new software, we’ll have the latest and greatest of everything.

3. Install The LAMP stack ([Linux], Apache, MySQL, PHP) We’ll want to throw in phpmyadmin here as well. In case you aren’t familiar, phpmyadmin is great for setting up database permissions and general DB management from within a browser-based GUI.

sudo apt-get install lamp-server^ phpmyadmin

Answer Yes to the prompts as it installs each of the requested programs in the LAMP stack. You’ll need to pick out a password for MySQL and then confirm it. Later you’ll be asked for a password for phpmyadmin. Use the same password, it will make things easier for later. (You can always change your password later from within MySQL or PhpMyAdmin.

4. Install htop
htop is essentially “top” on steroids. It gives you a good visual picture of your server’s load and what processes are running. It’s sort of like the baby monitor of servers.

sudo apt-get install htop

5. Setup a test web page
You’ve installed apache, so you can test that everything is set correctly. Go to your default web root directory /var/www (this can be changed later, and we’ll show you how to do that in our next blog in this series)

cd /var/www

Now, edit the file index.html and put in some text that identifies it as your new server.

sudo vi /var/www/index.html

(or .php, or .htm depending on your configuration)

Now start or reload apache to make sure everything is running right.

sudo service apache2 reload

After you’ve saved the file, you can go to a browser window and type in your server ip address. You should see your temporary index page that you just created/edited.

Configuring Apache, setting up cron jobs, rsync to synchronize with multiple servers, setting up MySQL database connectivity, and more…
Check out our other blog posts on these topics.

Ubuntu Server AWS EC2 ELB Apache Log Fix

If you’ve launched AWS EC2 server instances behind a load balancer, then you’ve probably noticed that your Apache logs are showing the internal ip address of the load balancer for all entries.

I’ve seen a few blogs that explain that the reason for this is that the ELB load balancer is configured as a reverse proxy and the actual ip address of the origin is masked.  Aside from the cosmetics of seeing thousands of log entries all with the same ip address, this is actually bad for SEO as your sitemaps will also be showing all your visitors coming from one ip address.  Also, if you are using geoip the country filter won’t work as it will be looking at all visitors as coming from Amazon’s region that your EC2 instances are located.

Here’s the fix:
Very simple actually.  It worked for me on Ubuntu 12.04 LTS and I assume it will work on any Linux configuration.  Instead of logging the Host (which in our case is the internal ip), we want to log the X-Forwarded_for which is the origin ip for the entry.
Open your apache configuration file for edit.  On Ubuntu it’s at /etc/apache2/apache2.conf    You can also use locate to find it on your instance if it’s not on Ubuntu.  locate apache2.conf

sudo vi /etc/apache2/apache2.conf

Next within configuration file look for the section with LogFormat   There should be several lines beginning with LogFormat.  The top three should be for vhost_combined, combined, and common.   In all three lines where you see %h  (which is echoing to the apache log the host) change that to %{X-Forwarded-For}i


LogFormat “%v:%p %h %l %u %t \”%r\” %>s %O \”%{Referer}i\” \”%{User-Agent}i\”” vhost_combined
LogFormat “%h %l %u %t \”%r\” %>s %O \”%{Referer}i\” \”%{User-Agent}i\”” combined
LogFormat “%h %l %u %t \”%r\” %>s %O” common


LogFormat “%v:%p %{X-Forwarded-For}i %l %u %t \”%r\” %>s %O \”%{Referer}i\” \”%{User-Agent}i\”” vhost_combined
LogFormat “%{X-Forwarded-For}i %l %u %t \”%r\” %>s %O \”%{Referer}i\” \”%{User-Agent}i\”” combined
LogFormat “%{X-Forwarded-For}i %l %u %t \”%r\” %>s %O” common

Then remember to reload apache

sudo service apache2 reload

Note of Caution: It’s relatively easy for someone to spoof the header and change the X-Forwarded-For to whatever address they want. That would mask from you their actual ip. Therefore, this solution is not intended for applications that have security implications.

Another tip. Within your web application if you are using the ip for any purpose, like Maxmind’s geoip, you’ll need to echo the X-Forwarded-For instead of the Remote host as well. e.g. $ip=$_SERVER[‘HTTP_X_FORWARDED_FOR’];

Let us know if you have any suggestions on how to improve this method.

Ubuntu Server – How to Sync Files Between Multiple Web Servers

Another installment in our How to Set up an Ubuntu Server Series:

Synchronizing multiple servers – You have more than one web server in your host configuration. What’s the easiest way to synch files among the multiple web servers?
Solution – rsync does the trick efficiently and easily.

This tutorial assumes you are comfortable on the linux command line.

Steps to Set up rsync for multiple servers synchronization:

Step One

First make sure rsync is installed on each server that you’ll be working with.  By typing rsync from a command prompt, you should get the rsync response asking you for parameters.  If rsync isn’t found, then install it.

sudo apt-get install rsync

Step Two

Test synchronizing files.  From a command prompt on your 2nd server, type in an rsync command to retrieve files from the 1st server.  Let’s assume you have a directory /var/www/ set up on both servers and you wish to synchronize the files from the first server to the 2nd. The first server acts as the master.  Any new files or changes to existing files on the master will overwrite existing files on the 2nd server.  Type in from the command prompt on server 2

sudo rsync -ra user@FirstServerIP:/var/www/ /var/www/

The first server in this example sends all the files in /var/www/ along with the (-r) recursive subdirectories. You can also sync only specific files, etc…
If this works, you are ready to move on to step 3. If not, check your connectivity with the FirstServer. Generally, if you can ssh to another server, you should be able to rsync with it as well. AWS EC2 Users If you are using AWS Amazon’s ec2 servers, which require a passkey, the rsync command will look like this:

rsync -rave “ssh -i /home/ubuntu/.ssh/passkey.pem” ubuntu@EC2ServerIP:/var/www/ /var/www/

Note that for AWS EC2, you will first need to copy your passkey over to your .ssh directory

Step Three

Next, let’s set this up to synchronize all the time automatically. We accomplish this with a cron job. Here again, we’re assuming you are familiar with how to set up and edit crons. From your root user (sudo su) edit your crontab

crontab -e

Then, add a line to the crontab that tells it to run the rsync command every minute (or any frequency that suits you).

* * * * * rsync -ar FirstServerIP:/var/www/* /var/www/

Test your configuration!  Go to your first server and make a change or add a file to the synchronized directory. Then go back to the 2nd server and see if the file is there. You can replicate this process to as many servers as you need, but keep in mind that frequency of sync and amount of data passing on your internal network can get costly and cause a hit on performance.

I hope this little tutorial was helpful.  Please drop me a note if you have any questions or comments.


Fix WordPress Plugins Auto Update

Summary: Fix WordPress to auto update plugins without requiring an FTP password.

If you manage your own blog with WordPress you will often need to update plugins to their newer versions. Depending on how your blog was initially set up, when you click on update you may get a screen that asks for a FTP username and password. There is a fix that will enable you to automatically update all your plugins and themes.

This fix should work for versions of WordPress 2.8 and above.

Continue reading “Fix WordPress Plugins Auto Update”

Increase Contrast VIM editor color scheme

Problem:  Low contrast VIM on SSH and Telnet

If you work over SSH or telnet on VIM (VI) text editor, then you are probably experiencing a low contrast page that’s very hard on the eyes.  I searched all over the net and VIM’s wiki but didn’t find a fix.

Solution: Change setting in VIM’s config file

Continue reading “Increase Contrast VIM editor color scheme”

AdEngage is Shutting Down

AdEngage Ad Network is Shutting down

AdEngage (one of the better known ad networks and a Google Adsense alternative)  sent a stunning letter yesterday to all its affiliates and advertisers that as of Feb 8,2011 it will be closing the site.  Visitors to their website receive the same message that was sent by email to all existing account holders.

Continue reading “AdEngage is Shutting Down”

How to Play Windows Media Files on your iMac Macbook Pro

Want to play Windows Media files (wmv, mms, wma, asx) on your Macintosh Safari and Chrome browser?

You’ll need to install a free plugin that will give your Mac Quicktime player the extensions it needs to play Microsoft Windows content.

Here are the steps to install the required plugin:

Continue reading “How to Play Windows Media Files on your iMac Macbook Pro”