Techno WeBlog

blogging about tech, the tech, and everything tech, for techno addicts!

Join Techno Google group

Song about MVC…..Yeah, yeah, yeah

Model-view-controller (MVC) is an architectural pattern used in software engineering. In complex computer applications that present a large amount of data to the user, a developer often wishes to separate data (model) and user interface (view) concerns, so that changes to the user interface will not affect data handling, and that the data can be reorganized without changing the user interface.

Click here to read a poem to understand the MVC concept easily.... Cool....






Labels : DiggIt!  |   Del.icio.us


window.open() Method’s Return Value

To handle references to a window properly, you should always assign the result of a window.open() call to a variable. A call to the window.open() method returns a value of the new window’s object if the window opens successfully, or null if it fails (due to low memory, for example). This value is vitally important if your script needs to address elements of that new window. After the new window is open, however, no parent-child relationship exists between the windows.... Read More

Labels : DiggIt!  |   Del.icio.us


Reveal The Contents of Password Fields

If you chose the “Remember” option for logins in webpages, you can reveal it easily. It doesn’t require any software to reveal hidden passwords under asterisks and don’t need to waste your time in cracking master password.... Read the article here

Labels : DiggIt!  |   Del.icio.us


Body Background Color

Avoid the usage of document.bgColor. Use document.body.style.backgroundColor instead.And one more thing, I don’t know how many of us are aware about this [ even me too till today :) ]………………

the following three references are equivalent.

document.body.style.backgroundColor
document.body.style[’backgroundColor’]
document[’body’][’style’][’backgroundColor’]

Labels : DiggIt!  |   Del.icio.us


Need for speed : CSS Compression

A powerful advantage of using PHP is that you can compress your files so that they take up less room on your server. There are multiple ways of achieving this, one method is as follows:

ob_start(”ob_gzhandler”);
?>

Just add that to the very beginning of main.php or global.php or whatever. Right now the file may be very small anyway, but in a real-world situation it would contain much more code. You’ll soon see the speed benefits of this simple file compression method.

You can import your CSS as a PHP file. This offers you a range of options for creating CSS on the fly using arrays and variables and means you can compress your style rules too. Just add this PHP header to the beginning of your CSS:

ob_start (”ob_gzhandler”);
header(”Content-type: text/css”);
header(”Cache-Control: must-revalidate”);
$offset = 60 * 60 ;
$ExpStr = “Expires: ” .
gmdate(”D, d M Y H:i:s”,
time() + $offset) . ” GMT”;
header($ExpStr);
?>

Remember to save your CSS file with the PHP extension and import it properly.You can do this as follows……..

@import url(mycss.php);

The above method, though not as clean, it is just as effective. All you need to do is place the PHP snippet from above into the top of your CSS document. Then, rename your CSS file with a ‘php’ extension, and then refer to that file when linking your css file. Thats all….

Alternative Method
=================
The following method is cleaner and more elegant, as it does not require the addition of any extra code to your CSS file, nor do you have to change the extension of the file. Clean and simple.

Two steps are necessary to implement this method.

Step one:
First, you want to save the snippet provided above in a file called ‘gzip-css.php’ to the directory that contains your CSS files.

Step two:
Here, simply add the following to an .htaccess file and save the file to the same directory as your CSS files:

AddHandler application/x-httpd-php .css
php_value auto_prepend_file gzip-css.php
php_flag zlib.output_compression On

This code does 3 things:

1. The first line tells Apache to send all .css files to the PHP script handler.
2. The second line prepends the code snippet to your CSS file.
3. The third line tells PHP to use its built-in negotiated output compression automatically for every page it parses. This is optional. If you use this method for compression, there is no need for having ob_start (”ob_gzhandler”); in the code snippet.

So in this way you can keep your CSS file as it is without any name change.

Labels : DiggIt!  |   Del.icio.us


Google

Archives

Previous Posts

Links