Tag: development

  • How to redirect to WWW using JavaScript?

    Redirecting to a sub-domain, like “WWW” or another one, can be a choice or a way to solve a problem. Below is a way to do so using vanilla JavaScript, but before just performing a redirect we need to factor in items like protocol, navigation path, query strings, anchors (hash), and site environment. Let’s look…

  • 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…

  • 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…

  • 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…

  • Function: checkboxLimiter [JavaScript]

    The checkboxLimiter function will disable all checkboxes, which share common value for the name attribute after the user has checked a pre-set number of them. The limit number is set in the function source to avoid inconsistency if adding the onChange function call inline of the page source. This does not matter if you are using event…

  • Source Code DNA, a repository/library for code snippets in JS, PHP, Perl, C/C++ and Objective-C

    I have started a new section on Titan Fusion, specifically for programming. I have named it Source Code DNA. I am going to use it just as library/repository for various snippets of code, e.g. classes, functions, small scripts. At this time I am going to limit the content to the following languages: JavaScript, HTML5, CSS3,…

  • How to use array element references inside query strings? [PHP]

    Using braces “{ }”, i.e. curly parentheses, will make your life very easy. The braces will allow you to use complex variable expressions inside strings. This is called complex (curly) syntax. In other words you are encapsulating your variable call structure so it is parsed by PHP before continuing with the string. If you are…

  • How to automatically redirect between HTTP and HTTPS [PHP]

    Using HTTPS allows for secure and encrypted communication between your web site and the visitor’s browser. Sometimes the transition doesn’t happen automatically so we need to enforce that secure communication between the server and the client, e.g. when using a shopping cart. One way to automatically switch from HTTP to HTTPS, using php, is a…

  • The iOS Design Cheat Sheet V2

    The iOS Design Cheat Sheet V2 by Ivo Mynttinen is an excellent reference tool if you are an iOS developer. Ivo has organized display sizes and resolutions, as well as some other hardware data, for each device into nice, easy to follow data tables.

  • How To Split a Phone Number [PERL]

    Phone numbers, as we know, are most commonly made of three elements (area code) prefix-number. If your program or a script has to process phone numbers some times it is useful to separate the three elements and store them in separate variables. Below I will show you how you can achieve this in Perl using…