Tanveer’s Weblog

Entries categorized as ‘Fun’

[HotFixer] Transparent PNG support into IE6 using TwinHelix

July 29, 2008 · 2 Comments

Couple of days ago one of my colleague asked my why ie6 couldn’t be able to show a trasparent png image ! He was so rock n roll mood about this matter ! :D n asked me is there any solution to fix this crap!! Unfortunatly i dont have any thing to say. So i googled for a while n got the answer. Here is the key things we can do to fix this bug.

1. Download TwinHelix iepngfix.zip v1.0 (37kb) under GNU LGPL, version 2.1 or later. After that you can open “iepngfix.html” in a browser; to find the step by step instructions.

2. Copy and paste iepngfix.htc and blank.gif into your website folder.

3. Copy and paste this into your website’s CSS or HTML:

<style type="text/css">
img, div { behavior: url(iepngfix.htc) }
</style>

That CSS selector must include the tags/elements on which you want PNG support — basically, give it a comma-separated list of tags you use. It must also include the correct path to the .HTC relative to the HTML document location (not relative to the CSS document!). For instance, yours may look like this:

<style type="text/css">
img, div, a, input { behavior: url(/css/resources/iepngfix.htc) }
</style>

4. If your site uses subfolders, open the .HTC file in a text editor like Windows Notepad and change the blankImg variable to include a correct path to blank.gif like so:

var blankImg = '/images/blank.gif';

Again the path is relative to the HTML file. Otherwise, you will see a “broken image” graphic!

Now if you would like to use this behavior in your defined css class just use something like

<style type="text/css">
.myimg{ behavior: url(/css/resources/iepngfix.htc);padding-left:5px ... }
</style>

That’s it ! You are done. Now you can enjoy any transparent png image file any where in your web derictory

;)

Ref: twinhelix

Categories: Fun · Tips' n Tricks'
Tagged: , , ,

[CakePHP] Unit Testing

July 10, 2008 · 2 Comments

What a fun !! :D
Today i test one of my Country Model using cakephp component. That why i write down this notes to make sure that i can use several times.

1. Download Simple Test unit testing suite.
2. Uncompress it in my app/vendors directory.
3. Change DEBUG level of 1 in my app/config/core.php file
4. Create a new database connection in app/config/database.php for only testing purpose like;

var $test = array(
‘driver’ => ‘mysql’,
‘persistent’ => true,
‘host’ => ‘localhost’,
‘login’ => ‘root’,
‘password’ => ”,
‘database’ => ‘db_name’,
‘prefix’ => ”,
‘encoding’ => ‘utf8′
);

5. Fixture : Create a file named country_test_fixture.php in your app/tests/fixtures directory, with the following content

<?php
class CountryTestFixture extends CakeTestFixture {

var $name = ‘CountryTest’;

var $import = array(‘model’ => ‘Country’, ‘records’ => true , ‘connection’ => ‘test’);

}
?>

6. Test Case : Create a file named country.test.php in your app/tests/cases/models directory, with the following contents:

<?php

loadModel(‘Country’);

class CountryTest extends Country {
var $name = ‘Country’;
//var $useDbConfig = ‘test_suite’;
}

class CountryTestCase extends CakeTestCase {

var $fixtures = array( ‘Country_test’ );

function testFindAll() {

$this->CountryTest =& new CountryTest();

$result = $this->CountryTest->findAll(“Country.country_id=1″);

$expected = array(

array (
‘Country’ => array( ‘country_id’ => 1, ‘region_id’ => 2 , ‘country’ => ‘Bangladesh’ ),

)

);

$this->assertEqual($result, $expected);

}

}
?>

7. Running My Test Case: Point my browser to http://tanveer-noman/myProject/test.php. Click on App Test Cases and find the link to your models/country.test.php. Click on that link.
Waoow!! I got a nice green screen saying that your test succeded.
;)

To know more

cake bake

Categories: Fun · Tips' n Tricks' · cakePHP
Tagged:

Gears@WordPress

July 3, 2008 · Leave a Comment

I have just installed this wordpress staff. Looks really cool to me… :)

Gears? It is a browser extension like Flash or QuickTime/Media Player. However Gears works with the browser to enhance web based applications. It can create local database and file storage, and run JavaScript in the background to update them without slowing down the browser.

Gears has been in the making for over a year and is well known among the web developers. Currently it supports Firefox versions 2 & 3 and Internet Explorer versions 6 & 7. Safari 3 support is coming soon.

On WordPress.com it is used to store all images and other web page components from the admin area to the user’s PC, speeding up access and reducing unnecessary web traffic.

The speed increase is most noticeable when Internet is slow or on high latency and makes everybody’s blogging experience more enjoyable.

The main thing is it really does the gear thing. It loads my wordpress pages faster then before. Hope people will enjoy..

To install click Gears

To know more about Gears visit code.google.

Categories: Fun · Tips' n Tricks'

Firefox 3 brock the record

June 20, 2008 · Leave a Comment

“there were 8.3 million downloads of Firefox 3 within 24 hours of the launch, and they’ve asked the Guinness Book of Records to put them in the book along with all those strange types who hold their breath underwater for 15 minutes or sit in a tub of baked beans for days”
Rory Cellan-Jones
19 Jun 08, 16:34 GMT

WoooW!!!! What a record !!
Three cheers for Firefox
:)

Categories: Firefox · Fun

mktime() First Day of the Last Week

May 7, 2008 · Leave a Comment

The mktime() function returns the Unix timestamp for a date.
This timestamp contains the number of seconds between the Unix Epoch (January 1 1970 00:00:00 GMT) and the time specified.

Assumed Moday is the firstday of the week.

<?php

//YESTERDAY
$yesterday = date("Y-m-d H:i:s",mktime(0, 0, 0, date("m")  , date("d")-1, date("Y")));

//THIS WEEK
$fromDate = date("Y-m-d H:i:s",mktime(0, 0, 0, date("n"), date("j"), date("Y")) - ((date("N")-1)*3600*24));
$toDate = CURRENT_TIMESTAMP;
//LAST WEEK
$fromDate = date("Y-m-d H:i:s",mktime(0, 0, 0, date("n"), date("j")-6, date("Y")) - ((date("N"))*3600*24));
$toDate = date("Y-m-d H:i:s",mktime(23, 59, 59, date("n"), date("j"), date("Y")) - ((date("N"))*3600*24));

//THIS MONTH
$fromDate = date("Y-m-d H:i:s",mktime(0, 0, 0, date("m")  , 1, date("Y")));
$toDate = CURRENT_TIMESTAMP;

//LAST MONTH
$fromDate = date("Y-m-d H:i:s",mktime(0, 0, 0, date("m")-1  , 1 , date("Y")));
$toDate = date("Y-m-d H:i:s",mktime(23, 59, 59, date("m"), date("d")-date("j"), date("Y")));

//THIS YEAR
$fromDate = date("Y-m-d H:i:s",mktime(0, 0, 0, date(1)  , date(1), date("Y")));
$toDate = CURRENT_TIMESTAMP;

//LAST YEAR
$fromDate = date("Y-m-d H:i:s",mktime(0, 0, 0, 1  , 1, date("Y")-1));
$toDate = date("Y-m-d H:i:s",mktime(23, 59, 59, 12, 31, date("Y")-1));

?>

Categories: Fun · cakePHP

Speed Up Firefox web browser

April 13, 2008 · 1 Comment

Mozilla Firefox is a graphical web browser developed by the Mozilla Corporation. Started as a fork of the browser component (Navigator) of the Mozilla Application Suite, Firefox has replaced the Mozilla Suite as the flagship product of the Mozilla project, stewarded by the Mozilla Foundation and a large community of external contributors.

So Mozilla lovers :D can easily boost up the speed with the following tips:

In your location bar, type about:config and press enter.
Once it Opens You should see Filter bar and list of Preference by name, status and so on. Now, let’s have play with fire-fox:

Tip1
In the filter bar type network.http.pipelining
Normally it says ” false ” under value field , Double click it so it becomes ” true “.

Tip2
In the filter bar again and type network.http.pipelining.maxrequests
Default it says 4 under value field and you need to change it to 8

Tip3
Go to the filter bar again and type network.http.proxy.pipelining
Normally it says ” false ” under value field , Double click it so it becomes ” true “.

Tip4
Go to the filter bar again and type network.dns.disableIPv6
Normally it says ” false ” under value field , Double click it so it becomes ” true “.

Tip5
Go to the filter bar again and type plugin.expose_full_path
Normally it says ” false ” under value field , Double click it so it becomes ” true “.

Tip6
Now you need to Create new Preference name with interger value for this got to Right click -> New -> Integer
Here you need to type nglayout.initialpaint.delay and click ok
Now you need to enter 0 in value filed and click ok

Tip7
Now you need to Create one more Preference name with interger value for this got to Right click -> New -> Integer

Here you need to type content.notify.backoffcount and click ok
Now you need to enter 5 in value filed and click ok

Tip8
Now you need to Create one more Preference name with interger value for this got to Right click -> New -> Integer
Here you need to type ui.submenuDelay and click ok
Now you need to enter 0 in value filed and click ok

Some more Tweaks
Enable the spellchecker for inputfields and textareas (default is textareas only)
layout.spellcheckDefault=2
Open lastfm://-links directly in amarok
network.protocol-handler.app.lastfm=amarok
network.protocol-handler.external.lastfm=true

Firefox Memory Leak Fix
Open a new tab. Type “about:config” without quotes into the address bar and hit enter/click Go.
Right-click anywhere, select New, then Integer. In the dialog prompt that appears, type:

browser.cache.memory.capacity

Click OK. Another dialog prompt will appear. This is where you decide how much memory to allocate to Firefox. This depends on how much RAM your computer has, but generally you don’t want to allocate too little (under 8MB), but if you allocate too much, you might as well not do this. A good recommended setting is 16MB. If you want 16MB, enter this value into the dialog prompt:16384

(Why 16384 instead of 16000? Because computers use base-12 counting. Thus 16 megabytes = 16384 bytes. Likewise, if you want to double that and allocate 32MB, you’d enter 32768.)

Click OK to close the dialog box, then close all instances of Firefox and restart. If your Firefox still uses the same amount of memory, give it a few minutes and it should slowly clear up. If that fails, try a system reboot.

Now your Firefox will now be 3 – 30 times faster in loading pages.

Enjoy ;)

{ref:lifehack.com, ubuntugeek.com, codebetter.com}

Categories: Firefox · Fun · General · Mu-ha-ha-ha · Tips' n Tricks'