Monday, February 4, 2008

Temp

All temp posts go here!

Compress/uncompress in PHP
Original Post from Jslabs.com
function uncompress($srcName, $dstName) {
$string = implode(”", gzfile($srcName));
$fp = fopen($dstName, “w”);
fwrite($fp, $string, strlen($string));
fclose($fp);
}

function compress($srcName, $dstName)
{
$fp = fopen($srcName, “r”);
$data = fread ($fp, filesize($srcName));
fclose($fp);

$zp = gzopen($dstName, “w9″);
gzwrite($zp, $data);
gzclose($zp);
}

compress(”test.php”,”test.gz”);
uncompress(”test.gz”,”test2.php”);

Sunday, January 13, 2008

IE AlphaImageLoader, Transparent PNGs & Links

http://www.hrunting.org/csstests/iealpha.html

Tuesday, November 13, 2007

Call to undefined function curl_init() on windows

Reason: Curl is not enabled by default.

Steps:
1. uncomment the following line from your php.ini (remove the ';')
;extension=php_curl.dll

location of php.in
apache\bin

program: xampplite.

ps: there's another one under /php/folder BUT THAT IS PHP5.ini
/php/php5.ini

Call to undefined function curl_init() on windows

Reason: Curl is not enabled by default.

Steps:
1. uncomment the following line from your php.ini (remove the ';')
;extension=php_curl.dll

location of php.in
apache\bin

program: xampplite.

ps: there's another one under /php/folder
/php/php5.ini

Friday, November 2, 2007

Creating a Virtual Host in Apache (Windows)

1. Open file 'httpd-vhosts.conf' file
\apache\conf\extra\httpd-vhosts.conf

2. Uncomment/add the following line:
NameVirtualHost *:80

3. Add the following code:
<virtualhost *:80>
ServerName www.example.com
DocumentRoot "E:/XAMPP/htdocs/mysitefolder"
</virtualhost>


note: replace the path in red with your path

4. Configure 'hosts' file
\system32\drivers\etc\hosts

127.0.0.1 www.example.com

4. Restart xammp.

5. Try typing "www.example.com" in your browser!! :) ?

Friday, October 26, 2007

Unable to use 'Desc < table name >' ERROR 1 (HY000): Can't create/write to file 'C:\WINDOWS\TEMP\#sql_16cc_0.MYD' (Errcode: 17)

This issue happens (mostly) if you have McAfee :(

http://bugs.mysql.com/bug.php?id=9551
(last paragraph...)

Simple method (not-recommended):
- Disable On Access Scan

A good solution
-
..to move MySQL's temp folder (by adding/changing the "tempdir" directive in my.ini) to an arbitrary directory OTHER THAN C:\WINDOWS\TEMP, and then exclude that directory from within McAfee's On-Access Scanner options.
..................................................

Steps Taken:
1. What is errcode: 17 ?

use the perror command.

c:\>perror 17
OS error code 17: File exists

it means.. the file exists in the temp dir..

2. deleted the file..
#sql_16cc_0.MYD

3. Resolved.

Information regarding this error on MySQL's site

Monday, October 22, 2007

Yet another deadly PNG transparency hack - No Javascript

<html>
<head>
<!--[if IE]>
<style type="text/css">
#test{
filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src="title.png");
}
</style>
<![endif]-->
</head>
<body>
<!--[if IE]>
<img id="test" src="#" width="1" height="1">
<![endif]-->
<!--[if !IE]><!-->
<img id="test" src="title.png" width="360"
height="116">
<!--<![endif]-->
</body>
</html>