Lateral Code
A Web Development Blog Focused on Code and Technology
Currently Browsing: Home
5 Must-Reads on JavaScript Inheritance
By Karthik Viswanathan on Sunday, June 20th, 2010 | Tags: javascript | No Comments »
Do you know inheritance in JavaScript? Do you truly understand how it works? Are you aware that JavaScript uses a prototypal inheritance scheme that is often disfavored or disliked? Have you used a script on the web to adapt this scheme to classical inheritance?

In these past few days, I’ve been writing a jQuery slider plugin with various transition effects. To make the code succinct, I decided to use a base Transition object that other objects, which define a specific type of transition, inherit from. This led me to the question of JavaScript inheritance.
Inheritance in JavaScript has been a controversial subject. Should a standard be set to use classical inheritance or should the base prototypal system be favored? Both paths have their own advantages and disadvantages. The readings listed below will hopefully give you enough information to choose which method you want to use.
Coding a Color Manager with Object-Oriented PHP
By Karthik Viswanathan on Thursday, June 17th, 2010 | Tags: php | No Comments »
Colors are a vital part of web design. They can easily make or break a design. Often times, designers are interested in modifying colors by mixing, fading, or brightening them. This will be the basis for today’s article.

We’re going to go through the process of creating a simple color manager with object-oriented PHP. Rather than focusing on multiple forms of modification, our color manager will perform one basic function: fading. Given a base color (hexadecimal) and a fade percentage, we will calculate a new, faded color.
How to Store Arrays in a Database
By Karthik Viswanathan on Tuesday, June 15th, 2010 | Tags: php | No Comments »
When working with databases, it is sometimes necessary to store an array in a MySQL field. Unfortunately, there is no way to directly pass in an array as a parameter. As a result, storing these data structures is a bit more complex, but by no means hard or impossible.

Prevent Form Attacks with Basic Math Security
By Karthik Viswanathan on Monday, June 14th, 2010 | Tags: php | 4 Comments »
Form security is a top priority these days due to the risks of losing sensitive information, getting spammed by bots, being exposed to viruses, and more. As a result, it is important to take steps to secure your forms in order to counter these risks.

In this article, we’re going to create a PHP class to help secure forms with basic math questions. This class will generate two random numbers that must be added by the user in order to ensure a human is submitting the form. Taken as a whole, this class only takes about 10 minutes to write. This begs the question: are you willing to secure your forms for a few minutes of work?
Want an Effective, Customizable Image Slider? Consider Nivo Slider
By Karthik Viswanathan on Sunday, June 13th, 2010 | Tags: javascript | 3 Comments »
Image sliders, once rarely found on websites, have become a new trend of web design. Indeed, they are present on free XHTML/CSS themes all the way up to commercial templates on sites like themeforest. Unfortunately, with this trend, many convoluted scripts aimed at providing easy sliders are now available on the web. They often times have complex, barely-documented installation and usage that makes it hard to integrate into modern websites.
Recently, I ran into this exact problem when finishing one of my XHTML/CSS templates. I couldn’t find a simple, effective slider that was easy to use, simple to style, and a breeze to get working. Luckily, after enough searching, I came across Nivo Slider, and my problems were solved.
