Skip to main content


Format a number as US currency [JavaScript]

A recent project I worked on allowed customers to request cloud computing resources. One of the requirements was to display the cost for each resource amount and the totals for one and two years for the resources the customer was requesting. In the United States, numbers are formatted with a period for the decimal mark and a comma as the thousands separator, e.g. 1,234,567.89.
The function below is going to: Assume that the input is either an unsigned integer or a float, ex. 1234567 or 1234567.90.Insert a "," delimiter every third digit.Optionally, add a currency symbol to the returned string. Let’s review: On lines 2 - 4 I defined some default values.On line 6 I defined a closure called formatNumber. The logic in the closure is going to format the number string.Starting at line 28 I am making sure that when the formatCostNumber function is called it does receive a value to format, and that…
Recent posts

Format MAC Address [JavaScript]

I am currently working on a project which will allow users to register their Wi-Fi enabled, non-web browser enabled, devices on the network. These are devices like printers, Apple TV, and Xbox*. One of the data points that have to be collected from the user is the device MAC address. The project customer wants that address to be properly formatted when they see it in the support ticket.

We have several options. We can format the address either on the back-end after the form has been submitted. Or we can format it on the front end via a separate text field for each character pair, but that is too many fields to handle. A better solution is to use a single field and format the user input at the time of input or upon submit. In those cases, the former is better because the data will already be formatted when the overall form input is being validation after the user clicks the “Submit” button.

We are going to format the user input as it is being provided, thus having proper data when vali…

Apple, AirPort Network Devices, and WiFi Mesh Networking

WiFi mesh routers are the “new” hottest set of tech gadgets to have. WiFi mesh networks allow for multiple access point in the same structure, e.g. your house, to provide proper WiFi network coverage, eliminating low signal or dead zones. What really captured my attention was the Google WiFi mesh routers. They are beautiful and I look forward to having a set of them in my home. Before them and for lack of interest, the term WiFi Mesh Network was pretty vaguely defined in my mind. But as it happens, I have been utilizing the concept of WiFi mesh networking in my house for years, just under a different name.
Apple has offered mesh networking for years on the AirPort Routers, but no one noticed! It just used technical terms like Wirelessly Extended Network and Wireless Distribution System. Not as easy to roll off the thong as “mesh network”. I guess no marketing staff were involved since it wasn’t also pushed as a selling feature.
Now that Apple is exiting the router market, whilst othe…

SNOOZ: Sound. Sleep.

I was on the Snooz Kickstarter page today, revisiting the project’s details and timeline progress. The device, which is a white-noise generating machine, recently became available for pre-order. Snooz is meant to be an alternative to having a TV or a stationary fan running at bed time. In my case, I bought it for my wife so we can get the TV out of the bedroom.

Whilst on the comments page I read the following comment, posted recently by Ken Tran:

I'm not a fan of the new fabric design. ...
I must disagree. If you take a look at the original design, which is all plastic and no style, I must say it is fugly. It is all utilitarian - not something I rally want to look at or see when I walk into the room. The final design, seen on the right, is something that beacons to be explored, looked at, utilized.

I am a big fan of Bang & Olufsen. They use fabric from Kvadrat in their line of products. Incorporating soft materials like fabric or leather in something which is meant to be place…

Validate Email Address [JavaScript]

The following is a quick and dirty way to validate form input, using JavaScript, from a user to confirm that they are entering a value, which could be interpreted as an email address. The function below is meant to quickly and simply ensure that the value provided by the user contains the at '@' symbol and a period '.', nothing more!

// Vanilla JavaScript function validateEmail(emailAddress) { if (emailAddress.value.indexOf('@') == -1 || emailAddress.value.indexOf('.') == -1) { alert("Invalid Email!"); document.getElementById(; return false; } }
The validateEmila function relies on the global method indexOf. That method returns the first position at which the specified string value occurs.

Keep in mind that this is not a complete and exhaustive method of validating an email address. There are better and more comprehensive ways to do so. For example, make sure that the email add…

Messing with WordPress SPAM Bots

If you have a WordPress based blog, or otherwise use WordPress as a CMS for your website, you are either getting a lot of bad user accounts being created or noticing a lot of knocking on your wp-login.php page. WordPress has a nice feature which allows you to install WordPress in a directory other than the root one. For example, your site is served from, but WordPress can be installed in In past versions of WordPress, prior to 3.8 or maybe be older than that, unless you knew the exact path to where WordPress was installed you could not get to the dashboard. That has changed! Now even if WordPress is installed in some random directory, if you navigate to you will be redirected to the actual WordPress login page. Convenient, but not helpful when dealing with SPAM bots.

Balloon Flowers of 2014

We have Balloon Flowers (platycodon grandiflorus) in a half barrow pot. They are one of my favorite flowers that we have around the house. Simply because of how the flower forms. It starts as a small ball, which slowly grows into the shape of a hot air balloon, and once it opens it looks like it had exploded.

I planted the flowers from the pictures above about seven years, ago.

Backyard Garden - May 28th, 2014

The weather is finally "stabilizing" to where the temperature is more consistent and higher like it should be for this time of the year. Also, it is not raining every single day, or hailing, like it has been in the last few weeks. So, now the flowers are starting to come out and they look really nice.