Posts

Showing posts from 2008

Configuring PHP in Apache 2 in Windows

1. 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" 2. In the Apache httpd.conf After #ExtendedStatus On Add LoadModule rewrite_module modules/mod_rewrite.so 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

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 1 Class inmcservlet.class is under the package proto.inmc.fm.servlet. 2 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 inmcservlet.class 3. The web Xml Web.xml xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" version="2.5"> inmcservlet proto.inmc.fm.servlet.inmcservlet inmcservlet /servlet/inmcservlet2 4 . The url string http://localhost:8080/inmc/servlet/inmcservlet2

Java Log4j

Code snippet log4j.properties ### direct log messages to stdout ### #log4j.appender.stdout=org.apache.log4j.ConsoleAppender #log4j.appender.stdout.Target=System.out #log4j.appender.stdout.layout=org.apache.log4j.PatternLayout #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=org.apache.log4j.FileAppender log4j.appender.file.File = mylog.txt log4j.appender.file.layout=org.apache.log4j.PatternLayout log4j.appender.file.layout.ConversionPattern=%d{ABSOLUTE} %5p %c{1}:%L - %m%n log4j.rootLogger=debug,file

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 =========================================================== >.lines Line number information will be loaded >kb