Tuesday 10 April 2012

Primary Colors of Light and Pigment


How We See Color

The inner surfaces of your eyes contain photoreceptors—specialized cells that are sensitive to light and relay messages to your brain. There are two types of photoreceptors: cones (which are sensitive to color) and rods (which are more sensitive to intensity). You are able to “see” an object when light from the object enters your eyes and strikes these photoreceptors.
Some objects are luminous and give off their own light; all other objects can only be seen if they reflect light into your eyes. However, humans can only see visible light, a narrow band of the electromagnetic spectrum (which also includes non-visible radio waves, infrared light, ultraviolet light, X-rays, and gamma rays). In terms of wavelengths, visible light ranges from about 400 nm to 700 nm.
Different wavelengths of light are perceived as different colors. For example, light with a wavelength of about 400 nm is seen as violet, and light with a wavelength of about 700 nm is seen as red. However, it is not typical to see light of a single wavelength. You are able to perceive all colors because there are three sets of cones in your eyes—one set that is most sensitive to red light, another that is most sensitive to green light, and a third that is most sensitive to blue light.

The Light Primaries

Red, green, and blue are the primary colors of light—they can be combined in different proportions to make all other colors. For example, red light and green light added together are seen as yellow light. This additive color system is used by light sources, such as televisions and computer monitors, to create a wide range of colors. When different proportions of red, green, and blue light enter your eye, your brain is able to interpret the different combinations as different colors.

The Pigment Primaries

However, there is another set of primary colors with which you may be more familiar. The primary colors of pigment (also known as subtractive primaries) are used when producing colors from reflected light; for example, when mixing paint or using a color printer. The primary colors of pigment are magenta, yellow, and cyan (commonly simplified as red, yellow, and blue).
Pigments are chemicals that absorb selective wavelengths—they prevent certain wavelengths of light from being transmitted or reflected. Because paints contain pigments, when white light (which is composed of red, green, and blue light) shines on colored paint, only some of the wavelengths of light are reflected. For example, cyan paint absorbs red light but reflects blue and green light; yellow paint absorbs blue light but reflects red and green light. If cyan paint is mixed with yellow paint, you see green paint because both red and blue light are absorbed and only green light is reflected.

Thursday 8 March 2012

Creating your own Content Management System with PHP

There are various CMS systems available out there, such as phpnuke, IPB portal, VB portal and so on. Sure they are great, but they have a few problems.

1) Not original
It's not really original to just slap a script on, make a few changes and boom, you have your very own site...that someone else coded. It's always more fun to put some work into your site and get a unique result out of fully custom code.

2) They have security flaws
Allot of these portals are known to have security flaws. PHP Nuke for example has quite a few, and so does vB Portal, and while I never heard of any for IPB portal, I'm sure it has some too.

3) Most likely to have known security flaws
Having security flaws is one thing, and not as dangerous as having known security flaws. Basically, anything can have a security flaw. Heck maybe this article system has one that enables people to give it GET queries to execute code on the server (I highly doubt, don't bother trying) but it's not as dangerous as a known flaw in say, PHP Nuke. Because these systems are used by many people, and available to download by anyone, security flaws are more known, and can easily be found and targeted.

By making your own CMS system, you will minimize the chances of having security flaws (it will most likely be less complex, as it will be made simply for your very own needs), you will minimize the chances of script kiddies finding flaws, and you will make your site much more original. Script kiddies won't really be able to know how the back end of the site operates, because it's completely your own code, so if there are security flaws they will be nearly impossible to find without putting a bunch of noticeable stuff in your logs that will enable you to catch attempts at trying various things, before they have a chance to find a way in (most likely).

Another good security-related reason to make your own CMS is that you be much more familiar with it's code structure, because you made it.

In this article we'll go through the process of creating a very simple content management system. It will feature the following:

- Certain pages only viewable by registered members
- User can log in and out
- Ease of template editing - header, footer will separate from actual pages

While this will be a very simple CMS, it will give you an idea how you can make one, and add on more features from there, such as different permissions per user, email registration validation etc...

On the post we'll take a look at the process of loading a CMS page from this basic system.

Saturday 25 February 2012

What you need to get started with PHP

Before you can write and test your PHP scripts, there's one thing you'll need - a server! Fortunately, you don't need to go out and buy one.  That's why PHP is so popular! But because PHP is a server-sided scripting language, you either have to get some web space with a hosting company that supports PHP, or make your computer pretend that it has a server installed. This is because PHP is not run on your PC - it's executed on the server. The results are then sent back to the client PC (your computer).

Don't worry if this all sounds a little daunting - we've come across an easier way to get you up and running. We're going to be using some software called Wampserver. This allows you to test your PHP scripts on your own computer. It installs everything you need, if you have a Windows PC. We might not really all the time to explain how to get it installed in a moment, but you can get it from the link below. Please note, I really have Window users in mind.


Just install it like every other programs.

What is PHP, and why do I need it?

PHP is probably the most popular scripting language on the web. It is used to enhance web pages. With PHP, you can do things like create username and password login pages, check details from a form, create forums, picture galleries, surveys, and a whole lot more. If you've come across a web page that ends in PHP, then the author has written some programming code to liven up the plain, old HTML.
PHP is known as a server-sided language. That's because the PHP doesn't get executed on your computer, but on the computer you requested the page from. The results are then handed over to you, and displayed in your browser. Other scripting languages you may have heard of are ASP, Python and Perl. (You don't need to know any of these to make a start on PHP. In fact, these tutorials assume that you have no programming experience at all.)
The most popular explanation of just what PHP stands for is "Hypertext Pre-processor". But that would make it HPP, surely? An alternative explanation is that the initials come from the earliest version of the program, which was called Personal Home Page Tools. At least you get the letters "PHP" in the right order!
But PHP is so popular that if you're looking for a career in the web design/web scripting industry then you just have to know it! In these tutorials, we'll get you up and running. And, hopefully, it will be a lot easier than you think.

You'll also need to have a server, to test your scripts. Don't worry, though - we've found an easy way to get a server up and running on your own PC. Move on to the next part to learn more.