Just another Filipino Programmer’s blog by Nick Fernandez III, on web development using PHP in LAMP framework and random information about everything I would tought interesting on and off the IT world.
Random Bytes:
Words to live by: Just say what you mean and mean what you say. Don't expect someone to read your mind and don't play games with heads or hearts. Don't tell half truths and expect trust.
Christmas is just around the corner so I decided to tweak my website design a little bit. If you like it or have an idea/suggestion just give me a comment. Oh by the way, you guys need to register first to comment, I would appreciate it a lot. I will be adding a few changes later which unfortunately I was not able to finish but I am planning to roll out all new changes on my site this month. So stay tuned.
A new beginning of change is coming. This will be dedicated to you all readers and bloggers. Thank you for the support.
With so many success stories about PHP programming, may it be in web development side or scripting side. Programmers around the world know PHP, but have you ever asked the question about PHP History? Who created PHP and how it started to be one of the most used and successful web development language.
It all started at “Home”
I will share you a little PHP history I have learned since I began using PHP. First what does “PHP” means? Well when Rasmus Lerdorf created the first binaries of what we called PHP today it was used as a small tool to display his personal home page, which is in fact his resume, and to do some certain tasks, such as how much traffic his page was receiving.
PHP Development Timeline
In June 8, 1995 Lerdorf publicly released “Personal Home Page Tools” after Lerdorf combined it with his own Form Interpreter to create PHP/FI (this release is considered PHP version 2). Two Israeli programmers Zeev Suraski and Andi Gutmans on that time working at Technion IIT, rewrote the parser in 1997 which formed the base of PHP 3, changing the language’s name to what we know now as PHP: Hypertext Preprocessor. After of months beta test, PHP 3 began and the official launch on June 1998. Soon after that Suraski and Gutmans then started a new rewrite of PHP’s core, producing the Zend Engine in 1999. They also founded Zend Technologies in Ramat Gan, Israel, which actively manages the development of PHP. In May 2000, PHP 4, powered by the Zend Engine 1.0, which is one of the two major versions of PHP are being actively developed, PHP 5 which was released on July 13, 2004 by the new Zend Engine II. PHP 4 will be supported by security updates until August 8, 2008. PHP 6 is currently under development, and is slated to release in conjunction with the decommission of PHP 4.
While spending 3 long days of no work, I have looked into the web for some puzzles and trivia dealing with dominant brain puzzles and informations. Accidentally I found an article about Bill Gates, and his story about the game Petals Around the Rose. Unfortunately Bill, solved this game longer than I tried the game myself. Okay so you might be thinking how the games work, well the games need a regular dice, it does not matter how many but, the game usually uses 5 dice. The rules are simple :
1. The name of the game is Petals Around the Rose, and the name is significant.
2. The roller will tell you how many petals are around the rose based on the dice roll results
3. If you have figured out the answer for 5 or more consecutive rolls, it is understood that you have solved the puzzle, and you should not tell the answer to anybody.
I have created a simple PHP script which emulates the games, if you are up to the challenge play Petals Around the Rose
This female musician/songwriter I have stumbled upon Youtube is worth listening to. She is known as Daisy, GUIZELLADAY, or MizzDAIZYD, this Australian beauty (with Asian features) is truly amazing. She writes and sings her own song, I do sometimes feel she sings like Avril and I really love the Alternative/Acoustic touch on her songs. As a tribute to her songs and talent, here is one of her latest composition and one of my favorite songs of her.
Alone tonight,
I called you up and said hey boy, come over here
and spend the night baby with me
but then i realized it was a bad idea,
it’s just the wine talking and another day will come
and our issues will still be here
* Refrain:
here we go again,
is it ever gonna change?
**Chorus:
Everything about you and me
Seems so dated, it’s so tainted
Everything about you and me
Seems so hazy, it’s so crazy
Could’ve been sweet, but there was just a small stain
Slightly incomplete
There’s something missing, something missing
We could try again but the damage still remains
I don’t know how to change
That’s why it’s over
Everything about you and me
Seems so jaded, it’s so tainted
Don’t wanna fight
I called you up and said hey boy stay over there
cause tonight I’m needing room to breathe
You saying it’s alright, gonna see and old girlfriend
Goin’ out for the evening and another day will come
when you’re thinking ‘i should have been there’
Everything about you and me
Seems so dated, it’s so tainted
Everything about you and me
Seems so hazy, it’s so crazy, crazy, crazy
Could have been sweet, but there was just a small stain
Slightly incomplete
There’s something missing, something missing
We could try again but the damage still remains
I don’t know how to change
That’s why it’s over
Everything about you and me
Seems so jaded, it’s so tainted…
(Daisy) : I hate feeling, who doesn’t hate feeling?
You can also check her myspace account for studio version of her original songs: www.myspace.com/mizzdaizyd
The tiny book featured on this clip is 0.95mm by 0.95mm, though the book might seem useless, this technology enables countries like Japan to produce a new paper currencies that are harder to counterfeit. The application for this technology is limitless.
2. 3D Printer
The examples shown in this video include a life-like reproduction of a melon and a model of a house (including the interior of the building!). At a price of just under 40 thousand dollars, this printer makes color 3D printing accessible to everyone.
3. D-Touch Pen
This technology is one of my favorite, it involves two separate technology, the first one is the print technology which is invisible to the naked eye, which can be used to send data or instruction to another device such as the D-Touch Pen, which reads the fine print on the paper and sends the data into a device which in turns provide information on what the location in the paper are. This is a very interesting discovery, where in a new breed of input device has been developed which makes use of paper or other tangible things a new set of computer per say.
You are coding a HTML form with the following form elements:
- checkbox
- mutiple select
Normally you would name the [checkbox] a “name” for all instances example:
<input type="checkbox" name="btype" value="a"> Type A
<input type="checkbox" name="btype" value="b"> Type B
<input type="checkbox" name="btype" value="o"> Type O
<input type="checkbox" name="btype" value="ab"> Type AB
For your [mutiple select] you just add “mutiple” on the select tag to make the dropdown element select mutiple items defined on the options tag.
Problem:
When submitting a group of checkboxes with the same name and a mutiple select, values passed on POST is the last item selected. For example, if you selected all checkbox named [btype] you are expecting the values (a,b,o,ab) will be returned as a string. But the problem is on PHP only value (ab) is returned.
In PHP POST and GET variables are treated differently, in order to retrieve all selected checkboxes and select option, you need to name your form elements with a “[]” (bracket) after the name, implying that the element will contain array values. In PHP you can define form elements as array values by adding “[]”, you can also explicitly define key names for array like for example:
One more problem that you might encounter is when using javascript to handle checkboxes and mutiple select, one classic example is for checkbox if you want to add a “Check All” button which selects all checkboxes, remember that you had named the checkboxes “btype[]” in order to define that variable as array, thus retrieving all selected checkboxes on PHP end. But how in the world can you access that name on javascript. Since javascript is also using “[]” to define array the best possible way to access form elements named with “[]” brackets are using:
...
document.forms[0].elements['btype[]'];
...
Summary:
When working on multiple select and checkboxes in PHP name this elements with “[]” to instruct PHP to store the values on array example:
<input type="checkbox" name="btype[]" value="a"> Type A
<input type="checkbox" name="btype[]" value="b"> Type B
<input type="checkbox" name="btype[]" value="o"> Type O
<input type="checkbox" name="btype[]" value="ab"> Type AB
<select name="season[]" multiple>
<option value="spring">Spring</option>
<option value="summer">Summer</option>
<option value="autumn">Autumn</option>
<option value="spring">Winter</option>
</select>
You can access it on PHP as regular arrays, note that in PHP 3, the array form variable usage is limited to single-dimensional arrays. As of PHP 4, no such restriction applies. Accessing named form elements with “[]” on javascript using this code:
I am Filipino Web Developer, focusing on PHP in LAMP framework. As a kid, I spent a lot of my time exploring computers and computer games from Atari to PS, from INTEL 80286 - CoreDuo. I am happily married, with two kids. Currently working in Japan as an IT Engineer.