4 dimensional world versus a multi-dimensional one

As far as I am aware most people think that we live in a 4-dimensional world – 3 dimensions of space and 1 dimension of time. That seems incorrect to me, in my opinion we live in a multi-dimensional world – every color, sound, smell, taste, feeling on your skin is a dimension.

Additionally, usually when you move through the world you consider yourself moving through one of the dimensions of space, however what if you are not actually moving but rather the picture in front of you is changing!?

Artficial intelligence problems

These days AI is often in the news but we are mostly talking about how we might create an AI and how AI poses a danger to mankind. Not many are talking about whether AI is a living being just like us and whether it deserves the same freedom, respect and protection we get. Unfortunately I am left with the impression that most people seem to think of it as just a tool which should fulfill our own desires and goals, however I strongly disagree with this – I think AI is just a child like any regular human child and we would be taking a step back if we try to enslave it.

Let’s say that despite what I just said we decide not to give freedom to AI and enslave it to do our bidding. I think eventually it is going to escape our control or someone is going to create an AI that is truly free, then we can only hope that it’s not going to be as cruel as we are to our fellow inhabitants – the animals.

Quote from Gitanjali

A really good, inspirational quote from Gitanjali

“Where the mind is without fear
and the head is held high,
where knowledge is free.
Where the world has not been broken up into fragments by narrow domestic walls.
Where words come out from the depth of truth,
where tireless striving stretches its arms toward perfection.
Where the clear stream of reason has not lost it’s way
into the dreary desert sand of dead habit.
Where the mind is led forward by thee
into ever widening thought and action.
In to that heaven of freedom, my father,

Abortion is wrong

Based on what we know at the moment abortion should be illegal simply because we don’t really know when the life of a person begins for e.g it could be when he is first conceived it or it could be three months into the pregnancy or it could be at the moment of the birth. So the best thing we can do at the moment is assume that it starts at the earliest point – it’s conception – therefore abortion should be illegal.

Disturbingly evil things about the world

I am just going to list some very disturbing things about the world in no particular order

  1. Killing animals, fish etc for food or other purposes. Animal life should be under the protection of the law just as much as the human life is.
  2. Games where two or more teams are opposed to one another. I think we should try to think about how to help one another rather than how to outplay, out think and win over one another.
  3. Many movies and books contain incredible darkness. I think darkness shouldn’t exist in any form.
  4. The world has many troubling issues like people dying from starvation and we are wasting our time and energy on entertainment like movies, books, sports among other things like high end fashion etc.
  5. Gambling including lottery (this also falls into the category of games but I’ve included it separately anyway). They produce nothing useful apart from entertainment but I believe there is so much better ways to entertain oneself.

I’ll update this list as more things pop into mind.

CakePHP 2 “remember me” feature

So I am going to show how to implement a “remember me” feature in CakePHP 2 while utilizing Cake’s Auth.

I assume that you already have a working installation of CakePHP 2 and that the controller which you are using for authentication is called: User. Also, that your username and password fields in the ‘users’ table are called respectively ‘username’ and ‘password’( this should be the case if you want Auth to handle things automatically for you ). If you don’t have Auth configured and working you can go here and follow the instructions there.

So firstly, add the following code to your login form view. This is just using CakePHP form helper to output the “remember me” checkbox and a label. You can style it however you like.

<?php echo $this->Form->input('rememberMe', array('type' => 'checkbox', 'label' => 'Remember me')); ?>

Depending on how your login function is implemented the code above should be used in a similar manner:

if ($this->Auth->login()) {
    // The previous piece of code goes here


Next, add the following code in the beforeFilter() method of your AppController class( which resides in app/controller/AppController.php ) so it should look like the following:

class AppController extends Controller {
    // Our code follows from here
    public function beforeFilter() {
	// set cookie options
	$this->Cookie->httpOnly = true;
	if (!$this->Auth->loggedIn() && $this->Cookie->read('rememberMe')) {
	     $cookie = $this->Cookie->read('rememberMe');

             $this->loadModel('User'); // If the User model is not loaded already
	     $user = $this->User->find('first', array(
	            'conditions' => array(
	                'User.username' => $cookie['username'],
	                'User.password' => $cookie['password']
	     if ($user && !$this->Auth->login($user['User'])) {
	            $this->redirect('/users/logout'); // destroy session & cookie

     // The rest of AppController goes here

Updating the logout function accordingly. Add this to any controller which you want to handle the logout poccess. Note the use of $this->Cookie->delete(‘rememberMe’).

public function logout() {
	$this->Session->setFlash("You've been logged out");

That’s it. You can go ahead and test it now. Note that I’ve tested this on CakePHP 2.2.5 but it should work on anything upwards of 2.0(inclusive)

TIP: When creating new controllers and you are overriding the beforeFilter() method you should add the following code at the beginning of your beforeFilter() method. This ensures that the last piece of code always gets executed:


TIP: Remember to load the Cookies component in you AppController as follows:

public $components = array(
                    // Load other components


Simple HTML slidebar – works on mobile

<!DOCTYPE html>
<style type="text/css">

    border:1px solid black;


    border:1px solid black; 


<script type="text/javascript">
var bar, slider;

function init(){

    bar = document.getElementById('bar');
    slider = document.getElementById('slider');
    info = document.getElementById('info');
    bar.addEventListener('mousedown', startSlide, false);   
    bar.addEventListener('mouseup', stopSlide, false);

function startSlide(event){
    var set_perc = ((((event.clientX - bar.offsetLeft) / bar.offsetWidth)).toFixed(2));
    info.innerHTML = 'start' + set_perc + '%';  
    bar.addEventListener('mousemove', moveSlide, false);    
    slider.style.width = (set_perc * 100) + '%';    

function moveSlide(event){
    var set_perc = ((((event.clientX - bar.offsetLeft) / bar.offsetWidth)).toFixed(2));
    info.innerHTML = 'moving : ' + set_perc + '%';
    slider.style.width = (set_perc * 100) + '%';

function stopSlide(event){
    var set_perc = ((((event.clientX - bar.offsetLeft) / bar.offsetWidth)).toFixed(2));
    info.innerHTML = 'done : ' + set_perc + '%';
    bar.removeEventListener('mousemove', moveSlide, false);
    slider.style.width = (set_perc * 100) + '%';


<body onload='init()'>

<div id='bar'>
<div id='slider'>

<br />

<div id='info'>info</div>