Sep
16
2008
0

Free Pattern/Stripe background tile image generator

Ever searched google for some nice background stripe tile images only to be stuck at god awful pattern sites with patterns like dead wood and rusty steel to pink flowers. I DID!! like a gazillion times.

Finally someone to the rescue.

http://www.stripgenrator.com/

Pick choose create and download your own stripes all for FREE. Pretty much on the lines of ajaxload.info. These guys are cool, they make the web a better place and web development an interesting job, with discoveries to be made every day.

And don’t forget to click on ‘Your Stripes‘ to get inspired.

Just go there and check out for your self.

Written by Kishore in: web development | Tags: ,
Jul
17
2008
0

Retrieve items from Browser Cache (Firefox, Opera, IE)

Have you ever had to work on a live site and while uploading the changes something goes bad with whatever and your live copy gets deleted and that’s the only copy you have at the moment. (This can happen easily if you are using those file manager tools provided by hosting accounts which edit files in browser)

Anyway the quickest solution would be to get the files from the browser cache. If you have been testing the site simultaneously. I had to do this recently and it saved me lot of time and embarrassment. So here is how you can do it ….

On Firefox 3 (My favourite browser)

Type about:cache in address bar and voila you get access to all the cache. The view is functional and easy to use.


On Opera 9.5(Increasingly competing for my favourite browser spot, can even do that with one plugin like Firebug)

Type opera:cache in address bar and voila you go.. the best cache browser in the industry. Opera has some more cool features like SpeedDial.. anyway you can discover all that yourself by downloading it.

On IE 7. This takes just a bit longer. Click on Tools>Internet Options>Browsing History>Settings>View Files.. pretty logical huh!

Anyway it does the job…

Written by Kishore in: browsers, web development | Tags: , , , , ,
Jul
13
2008
0

A particular session variable’s value disappearing from $_SESSION in PHP

A particular session variable’s value disappearing from $_SESSION in PHP… ??

Just check to make sure you DON’T have register_globals turned On. This took me a few hour’s to figure out..

Example scenario..
Form Bean class

class FormBean
{
public $email;
public $name;
}

page1.php

$form = new FormBean();
$form->email = "someone@something.com.au";
$_SESSION['form'] = serialize($form);
header("location:page2.php");

page2.php

$form =NULL;
if(isset($_SESSION['form']))
{
$form = unserialize($_SESSION['form']);
}
echo $form->email;

Expected to print “someone@something.com.au” right. Usually it does. If it doesn’t and you see that all other session variables are intact except ‘form’, then it’s time to look at your ‘register_globals’ setting. One of my client uses this pretty lax hosting which had this on what it has done is ….

page2.php

$form =NULL; //This sets the form bean to NULL.. wherever it is stored. Throughout the entire website. (Even IN $_SESSION)

if(isset($_SESSION['form']))
{
$form = unserialize($_SESSION['form']);
}
echo $form->email;

So the lesson learnt for me was… Just check to make sure register_globals is Off whenever you switch to new hosting.. coz that is pure EVIL.

How you can turn it off.. There are two different ways.

  1. ini_set
  2. .htaccess

This also makes me feel that PHP’s OOP implementation is either misleading , buggy or at least fundamentally different to other OOP languages like Java or C#.

Consider this in Java:
FormBean.java

class FormBean
{
public String email;
}

TestFormBean.java

class TestFormBean
{
public static void main(String[] args)
{
FormBean form1 = new FormBean(); //Create new form bean
form1.email = "someone@something.com.au"; //populate form bean

FormBean form2 = form1; //Assign created form bean object to another reference variable
form1 = null;

System.out.println(form2.email);

//would still print "someone@something.com.au"
//i.e. Just setting one reference to NULL won't kill its object instance.

}
}

I have tested similar code with PHP though… I have only realised register_globals seems to affect the ways objects and their references are handled. Like setting one reference of an object to NULL killing the object instance, which essentially renders all my other references useless.

Written by Kishore in: php, web development | Tags: , ,

Powered by WordPress. Theme: TheBuckmaker