Thursday, September 20, 2012

Mobile-friendly websites

Many people these days rely more on their mobile devices - phones, tablets etc - to access the Internet than on desktop / laptop computers. As such, it is a common requirement in many websites today that we design / test / tune the usability not just for different computer browsers but also for mobile devices.

While not every website has to cater to mobile devices this article gives some ideas on how you can make new and existing websites more mobile-friendly without requiring lots of coding or duplication.

Monday, September 10, 2012

My GoDaddy domain is down


My domain registrar (GoDaddy) is currently down (9/10/2012 11:20AM AZ) in what seems to be an attack from the group Anonymous. Not only their services are down, even their main webpage is down right now! Wow, that was ugly!

I am not hosting any of my projects with them. Everything is hosted on Google infrastructure (AppEngine, Apps for Business, Blogger etc). Unfortunately they are all down too because I still rely on GoDaddy's DNS servers! Grrrrr! :(

The only positive thing I can take from this issue is that my web monitor app Pingr worked as designed and quickly notified me about the problem. In this case there isn't much I can do to fix it though, have to wait for GoDaddy figure it out on their side. At least Pingr will tell me once their system is back up. Until then Pingr's main URL (http://pingr.eventfy.com/) will be unavailable.

P.S. If anyone else wants to receive a notification from Pingr when your system is backup you can use it from its Google AppEngine's URL: http://pingr-eventfy-com.appspot.com/.

Update: at 3:18PM AZ (about 4 hours since I found out about this issue!) my domain eventfy.com finally got back up.

It seems some sites are still affected but GoDaddy is slowly getting there. You can find a discussion about this issue here (Reddit).

Update: yesterday night (9/13) GoDaddy sent me an email taking the blame, stating that it wasn't caused by an external hacker but by themselves. Not sure if (i) I buy it and (ii) it makes me feel any safer if this is true. Anyways they gave me a 30% off new product or renewal valid for 7 days. Man, I am just happy I don't depend on this for my livelihood! :)

Wednesday, September 5, 2012

Server resource utilization monitoring

Pretty much every Linux distribution has tools to help sys admins monitor the utilization of common server resources such as CPU, memory and storage. For advanced monitoring and reporting we may need to install 3rd-party tools (e.g. Nagios or FAN) but sometimes we just want a simple way to get warnings when critical server resources may be close to overload.

Here is a set of simple shell scripts (tested in RHEL and CentOS) you can use to monitor CPU, memory and storage space. If utilization goes over a threshold these scripts will send you an email warning hopefully soon enough so that you can fix it before a system crash. Assuming you have access to basic commands like vmstat, df, mail and crontab these scripts can be setup even if you do not have root access to the server.

Monday, August 27, 2012

My Amazon Wish List


Selected items from

My Amazon Wish List

Lots of juice to power your gadgets during those long flights
If you have a compatible Mac get this and the Samsung SSD laptop kit for the best upgrade you can possibly get on your laptop!
Includes laptop upgrade kit accessories
This kit comes also with 4 rechargable batteries (2xAA and 2xAAA) and spacers to convert the batteries into C or D sizes
Hide your backyard and pool stuff in style
No, really, how cool is that?
Zap those flying bugs and reclaim your backyard!
Yes it is expensive as heck but this is a wish list right? :)
Get few of these and save energy (and $$$)
Helps you find the energy hogs in your house
Automate your house's cooling / heating
Set the temperatue with your smartphone
You should probably be extra careful shaving with this one
Is there any all-in-one better than this yet?
For the (weekend) handyman (wannabe)
This magical item not only gives you darkvision but if the need arises you can also use it as a club!
Hook this up on your living (or media) room HTPC and its "couch potato" time
Guess this is good for guitarists?

Friday, August 24, 2012

Translate your website with Google Website Translator

Oftentimes we want to support multiple languages in our websites. One "easy" way is to keep one separate resource bundle for each language we support, but this isn't as simple as it seems. First you need a tag / mapping mechanism to match labels in your pages with tags in the property files (frameworks like JSF already provide it) but then you need to maintain multiple sets of labels. Any new field / screen etc will require changes all resource bundles, which can quickly become a burden. In many cases this burden may be  acceptable in exchange for full control and performance, but in other cases we can use Google's Website Translator tool.

Follow these steps to find out how to easily include a styled language selector into your website, and to remove the Google Website Translator toolbar. I recently applied these steps in Eventfy and the final result looks like this:

eventfyEnglish

Wednesday, August 22, 2012

Hide input type file from older iOS devices

I recently added support for user image upload in Eventfy. You can find more details and screenshots here.

Safari mobile in iOS devices like iPhone and iPad do not yet support file uploads and render input type file disabled. It may change with the upcoming update to iOS 6, but until then our web applications must take that limitation into account.

I wanted to hide the file update controls in iOS and show a note in its place. Instead of checking the browser version I am simply checking the state of the input file, which may also cover other devices with similar limitations.

The code below describes how to set it up with jQuery, but it is simple to do the same with plain Javascript.

  1. HTML part:
  2. <div id="imageUploadDiv" class="control-group">
     <label class="control-label" for="imageUpload">Image</label>
     <div class="controls">
       <input id="imageUploadInt" name="imageUploadInt" class="input-file" type="file" />
       <p class="help-block">You can optionally include a picture or image in your invite</p>
       <span id="imgPreview" class="thumbnail" style="display:none;width: 250px;"></span>
     </div>
    </div>
    <div id="imageUploadiOSWarning" class="alert alert-info" style="display: none;">
     <button type="button" class="close" data-dismiss="alert">×</button>
     <strong>Note</strong> Image upload isn't supported by iOS before version 6.0
    </div>
    
  3. Javascript / jQuery part:
  4. <script>
    $(document).ready(function(){
        if ($("#imageUploadInt").prop("disabled")) { 
            $('#imageUploadiOSWarning').show();
            $('#imageUploadDiv').hide();
        }
    }
    </script>
    

In this simple example DIV "imageUploadInt" is presented by default. But as soon the document loads we check if the input file was automatically disabled by the browser, and if so we hide "imageUploadInt" and show instead DIV "imageUploadiOSWarning".

Note: this DIV structure and CSS classes are defined in Twitter Bootstrap. You can find more about Bootstrap control forms here, on section 'Validation States'.

Update: I tested the image upload function in Eventfy yesterday (9/19) with iOS 6 and this code works great. Now users can upload pictures (if their device supports it), otherwise they are presented with a message explaining why the control is disabled.

Here are some screenshots to show how it works with iOS 6:

Input type file is enabled with iOS 6

Photo selection

Photo uploaded to Eventfy

Sunday, August 19, 2012

My Amazon Favorite Buys


A list of

My Amazon Favorite Buys

Read the disclaimer or check this list out and you may find something interesting
Great case for your small USB drive and USB cable
Small but large capacity USB drive, fast transfers and no separate power chord, excellent for backups
Note: they released a new version available here
Here's a relatively inexpensive item (compared to this one, that is) that can make a big difference when you're flying.
Tiny wireless N adapter
Tire inflator with a built in pressure gauge and adapters for bikes, balls etc
Quite noisy but strong enough for SUVs
Cool mist humidifier, good for those in dry climates
Works great with iPhones
Hook up 2 computers to the same monitor, keyboard, mouse and audio
Worked great with my URB keyboard and mouse
Find those da$% scorpions! Or check out CSI-style how clean your hotel room really is, it may surprise you
This is one of those things you never need... until you need it, that is!
More HDMI ports for your TV
Switch inputs automatically so you don't even have to use the included control
Good UPS for computers
Get this if you want extra time to save your work during a blackout, or to ensure a graceful shutdown if you hook it via USB
Don't use it very often but has a good price, looks great and so far it worked for years without problems
Nice gift for the wife, it looks great (on her, that is!)
Great radio for the bathroom countertop. I wouldn't keep it in the shower like some people at Amazon though
If this one is OOS you can find a similar version here
Best kitchen (or general purpose) radio ever, great quality sound and design
Excellent classic D&D game for under $10. If you like D&D and CRPG but you never played BG2 do yourself a favor and get it now. Great stories with an amazing replay value
Amazing board game set on the Game of Thrones' universe
Broom? What broom? Every house should have one of these
Note: this product doesn't replace a full blown vacuum
I bought 2 more expensive ones (the most expensive from Norelco and one from Wahl) but ended up coming back to this cheap one
This compact fabric steamer worked so well for my sister-in-law's wedding the whole family used it. So much so they kept it as a "gift" and we now gotta buy another one for the next weddings
Great gift for babies, it plays different sounds and songs in English and Spanish
Hands free soap dispenser. Get it for the kitchen and the bathrooms
Gift
Gift


Disclaimer

I purchased all items on this list either from Amazon or from other merchants and I am very happy with them. I am sharing this list so that if you buy anything you like here there will be a (tiny) smaller chance for them to be taken out of the market. However, your own experience with these products may differ.
I found that in most cases Amazon has the best prices or is at least close. You may want to check it with Google Shopping, other price comparison tools or in deal sites like Slickdeals. Still, Amazon reviews are great to help you find your own great buys, even if you buy elsewhere.