Effervescent

This is just my temporary blog till I create my own on my site, one that actually counts statistics (posts, profile views, etc) correctly.

Name:
Location: Colombo, Sri Lanka

There's way too much to type.

2005-07-11

Navigation menu in PHP

this is the basic concept of how i handle navigation in PHP.
it's not commented but it's very basic but if there is something you want to ask, just ask on this blog :)




<?php
$prefix = '/path/to/file/myPrefix.';
$postfix = '.inc.php';
$defaultPage = 'home';
$errorPage = '404';

$incFile = $prefix . $_GET['page'] . $postfix;
$default = $prefix . $defaultPage . $postfix;
$error = $prefix . $errorPage . $postfix;
if(file_exists($incFile))
{
switch($_GET['page'])
{
case 'home':
case 'about':
case 'contact':
include_once $incFile;
break;

case '':
@include_once $default;
break;

default:
@include_once $error;
break;
}
}
else
{
echo '<h1>Page Not Found: 404</h1>';
}
?>


2005-06-26

Evolving OOP

words like 'quasi' (example), it's one word that explains something thats is hard to explain in one word, just like methods in an extended class can do specific things.
little words like that can be constructed into a sentence in many ways to mean and say different things.


so if OOP does evolve like any language does and if we can leap tall buildings in a single bound and dodge tusnami's, then we should be in for some crazy flexibility :)



See: OOP from the Wikipedia

Overview

The idea behind object-oriented programming is that a computer program is composed of a collection of individual units, or objects, as opposed to a traditional view in which a program is little more than a list of instructions to the computer.


2005-02-18

Function naming convention

If you work with functions, then, this is for you!

Consider this case:


Your name is P.H.P. McCoder and you work as a web scripter in the year 2004 and your web scripting language of choice is PHP4.
Here's a snippet of a class that you wrote for project-X


class Koobi
{
function Koobi($parameter)
{
}

function clone($value)
{
return $this->doClone($value);
}
}


It works fine with PHP4.







It's now the year 2005. Your host decides to upgrade to PHP5 and (this is all hypothetical) PHP5 has a new function added to it. And guess what? The new function is named clone().
What happens when your class method is called? You recieve parse errors!







The people over at PEAR have a nice suggestion for a naming convention for functions.
I suggest you take a look, otherwise, like me, your users might end up using the "search and replace" function.

2005-02-01

Untitled

Everybody wants to make more money (ok, so most people do). If you're a person who manufactures and sells a product, you're always looking to make a higher profit so you try and get as much as you can from a customer. You make more demands even though they maybe unreasonable because you want the maximum marginal utility, customer complies and so there's an uneven balance. There's more getting than giving and that's not good because everything has to be in balance or things wont remain as they are, they become unpredictable.
Maybe that's why the human mind came up with Opensource software. Since that is on the other extreme of the spectrum (i.e. it's free under certain conditions), it probably brings the imbalance back to normal again.
And most opensource projcets are done out of passion for the tools used to create that product (eg: PHP, ASP, etc) or as a labour of love....so an act that's a labour of love can bring balance to this messed up equilibrium?

On the other end it's that desire for more that makes us think of ways to get the maximum we can out of clients.

So, desire for more leads to demanding more of a client which messes up the equilibirum...so what if we just control these desires? Even if we want more success and money, we don't accumulate so much. We donate to charity or something that could really use it instead of wanting more and going past the saturation point.

So it's our own desire to succeed that leads us to disturb the balance which makes us have to work harder so we can reset the balance once again and that leads to the mess we live in today, this insanity.

Things must have been really laid back and peaceful about a century ago.






Thaaaaaat's what you get if you're looking out the bus window for over an hour while on a long journey.

2005-01-27

Whoa! That was random.

I was having one of my random thoughts again...then I read through this blog of mine and realized it can't get anymore random than it already is.
Soooooo, I was by this nice place the other day. There was this nice stream that was flowing by and I was just thinking, life must be feeling really good as a rock in a stream. With all that sparkling water all around you...what would be better is being that rock in that stream while having State of emergency by Björk constantly playing in your ears. heh heh yeah, I will stop now.

I have a deadline on friday. Unpleasant week :/

2005-01-14

Why I wouldn't want to leave this place.

That sunrise, that sunset. That area of glowing crimson over the sea. Those crimson spears making holes in the already tattered clouds. Streaks of stray threads of clouds blowing in the sky. The sand by the sea glinting, only temporarily made beautiful by the sunrise/sunset. Borrowed beauty.
A hut made of wood stands by the ocean, by a tree. An object created by man so small, so unworthy of the ocean, a most imperfect creation, stands so defiantly with pride in its faults, against the vast ocean.
Without the ugly, you cannot appreciate the beautiful. Imperfection is beauty without limits.

Seeing dim yellow street lights whizz by while you're in the car which is dark inside, except for the dashboard. The yellow only hits your face below your eyes because the portion above that is shadowed by the car roof. The air conditioner maybe on or off, you don't care. It doesn't matter. You don't feel. What exists in this space and time, is you and what is ahead of you...no, not the road, the journey.

You are walking and you look down only for a moment but in that moment, you spend an eternity. In that moment, you live your life. In that moment, everyting is clear. Your goals, your wishes, your thoughts, your hopes, your plans, your allegiances, your beliefs.
Nothing else exists in that moment. You are a soul in the universe, trapped in a body among other souls trapped in other bodies. There is more to achieve than what this vessel has the potential to. This is our test.
If you look at your hand hard enough, you don't see your hand. You see the vessel you are in. You are your mind.


wow...that was a trip.
Some of the above mentioned are reasons I wouldn't want to leave this country. But, in my line of work, Sri Lanka isn't the best place so I have no choice but to migrate one day. Maybe when I'm older and I'm a billionnaire ;), I can come to Sri Lanka and live by the sea, on the coast. A Tsunami can take me away if it wants, I just want to live by the sea...of course my private jet would be close by, just in case I feel like I need a temporary change ;)

2005-01-12

Google and Clusty

Google is biiiiiig.
Google is so big that the only way to balance a basketball game where Google is on one side, is to have Big Mama on the other.
In a couple of years, phone books will morph into electronic devices just so that they can use a Google Search Bar within the phonebook.
Within the next year, the Amish will start using the word google as a part of their vocabulary.
Heck, this site is run by Google!

But, Grasshopper, is your Clusty Kung-Fu strong?

Frankly, I prefer searching using Clusty.
Clusty is a clustering engine, actually.


I'll let the guys over at Clusty do the talking:
The specially-developed Vivísimo clustering algorithm puts search results together (clusters them) based on textual and linguistic similarity. This raw similarity is augmented with heuristics (i.e., human knowledge)

And this is what a search for the word tsunami showed. (check out the categorized links on the left)

Clusty used to be Vivisimo a while back. I used to visit that site a lot...but they have a new image now and a name that's a lot easier to remember.
TNL Radio (good radio station, though, they mostly play rock) once had this show (Haze was the DJ if I'm not mistaken) where they were discussing Search Engines. Being the true geek that I am, I called them up and Haze put me on air and I did mention Vivisimo (Clusty was still being created at the time) while using web-savy terms to describe things just so that I could scare anyone listening (aren't we supposed to do that?)


Well, anyway, I would consider using Clusty more often, for research, if I was you :)

Clusty logo

The Towel: A tool used to expose the workings of the mind

I believe you can tell a lot about the way a persons mind works by the way they dry their body after a shower.

I mean...think about it, it's almost a subconscious act...you come out of the shower thinking you want to get dry, so, you take the towel and start wiping. This is where it gets interesting; different people have different approaches to drying themselves.

I can think of three types...

  1. The methodical ones who dry part by part ("first I will dry my hair, followed by the ears - nicely, behind them and inside, then face, now under my chin blah blah blah")
  2. The random ones ("er there's some water here, let's wipe there first...")
  3. The I don't care type ("wipe here, wipe there, and there....wait, I'm dry enough already")
There probably are a million more!
Now, I just can't wait to get older and maybe become a scientist who studies this sort of thing...Peta Wilson would be someone I would consider observing for this experiment.
Bane Smiley