Sunday, April 27, 2008

Configuring PHP in Apache 2 in Windows


Install php and crate a dir in c:\php

and copy the unzipped file there

Copy all the dll's under php to c:\windows\system32

reanme php.ini-dist to php.ini and put it in path c:\windows for example

Also in php.ini add support to mysql

"As with enabling any PHP extension (such as php_mysql.dll), the PHP directive extension_dir should be set to the directory where the PHP extensions are located. See also the Manual Windows Installation Instructions. An example extension_dir value for PHP 5 is c:\php\ext"

In the Apache httpd.conf

#ExtendedStatus On


LoadModule rewrite_module modules/
LoadModule php5_module "c:/php/php5apache2.dll"
AddType application/x-httpd-php .php
AddType application/x-httpd-php .php3
AddType application/x-httpd-php .php4

Then set permission to
# This should be changed to whatever you set DocumentRoot to.

Options Indexes Includes FollowSymLinks MultiViews ExecCGI

AllowOverride All

Note - check the security risk here

Also note remove .php from AddHandler, otherwise you get errors from apache saying error 403 Forbidden

ScriptAlias /cgi-bin/ "D:/Program Files/Apache Group/Apache2/cgi-bin/"
AddHandler cgi-script .cgi .pl

Thursday, April 24, 2008

Periodic refresh with AJAX

Hint use - timerID = window.setInterval("ajaxFunction()",5000);

Below is the AJAX script

And in the HTML body

< body onload="ajaxFunction()">

Deploying under tomcat

Deploying under tomcat


Class inmcservlet.class is under the package


Directory strcture of tomcat depolyment

D:\Program Files\Apache Group\apache-tomcat-6.0.16\apache-tomcat-6.0.16\webapps\inmc\WEB-INF\classes\proto\inmc\fm\servlet

Under servlet

3. The web Xml





4 . The url string


Sunday, March 23, 2008

Java Log4j

Code snippet

### direct log messages to stdout ###
#log4j.appender.stdout.layout.ConversionPattern=%d{ABSOLUTE} %5p %c{1}:%L - %m%n
#log4j.rootLogger=debug, stdout

### direct log messages to a file ###
log4j.appender.file.File = mylog.txt
log4j.appender.file.layout.ConversionPattern=%d{ABSOLUTE} %5p %c{1}:%L - %m%n

Tuesday, February 19, 2008

Checking Memory Corruption using Gflags and NTSD debugger

>gflags /p /enable mmladc.exe
path: SOFTWARE\Microsoft\Windows NT\CurrentVersion\Image File Execution Options mmladc.exe: page heap enabled
>gflags /p
path: SOFTWARE\Microsoft\Windows NT\CurrentVersion\Image File Execution Options mmladc.exe: page heap enabled with flags (traces )
>ntsd -g -x -pn mmladc.exe
If there is a heap corruption you will see something like this
VERIFIER STOP 00000006: pid 0x3634: corrupted heap pointer or using wrong heap
01421000 : Heap used in the call
0152C100 : Heap block
00000000 : Block size
70F0F0F0 : Heap owning the block
Line number information will be loaded

Install/Upgrade NVIDI Driver in Ubuntu for CUDA SDK

Most linux distribution comes with the Nouveau display driver configured. If you need to use NVIDIA...