Sunday, November 7, 2010

Simple-Smarty! Installation

Quick install
-------------
Pre-requisite:
1. XAMPP installed in c:\xampp
=========
Steps:
--------
1. download smarty.zip
2. unzip as c:\smarty
3. add path "include_path=c:\smarty\libs" in c:\xampp\php.ini
4. create folders:
    (a) c:\smarty\templates_c (for templates compile)
    (b) c:\smarty\cache (for templates cache)
    (c) c:\xampp\htdocs\smarty\templates (for templates)
    (d) c:\xampp\htdocs\smarty\config (for smarty configuration)
5. Save as c:\smarty\libs\smarty_connect.php

<?php



 



// load Smarty library



require('Smarty.class.php');



 



class smarty_connect extends Smarty 



{



   function smarty_connect()



   {



        // Class Constructor. 



        // These automatically get set with each new instance.



 



        $this->Smarty();



 



        $this->template_dir = 'c:/xampp/htdocs/smarty/templates';



        $this->config_dir = 'c:/xampp/htdocs/smarty/config';



        $this->compile_dir = 'c:/smarty/templates_c';



        $this->cache_dir = 'c:/smarty/cache';



 



        $this->assign('app_name', 'Intranet');



   }



}



?>




6. Testing installation:

    (a) Save as 'c:\xampp\htdocs\smarty\templates\test.tpl':






<html>



<body>



<p>{$msg} </p>



</body>



</html>        





    (b) Save as 'c:\xampp\htdocs\test.php':





<?php



require("smarty_connect.php");



$smarty = new smarty_connect;



$smarty->assign("msg","Hello Smarty!");



$smarty->display("test.tpl");



?>





7. Run, 'http://localhost/test.php' z


    smarty-1

Sunday, May 31, 2009

PHP-Eclipse PDT Debugging with Xdebug and Zend

Debugging with Xdebug and Zend
------------------------------
1. It's one of longest learning exercise almost took two full days to understand the very concept of debugging Eclipse based IDE applications.

2. Debugging in PHP is Clint/Server based. Extension of xdebug, zend debuggers added as module with PHP. These debuggers has the ability to stop, start and control the process flow in PHP execution...! and acts as debug server.

3. Clients could be any front end IDE such as Eclipse PDT which can listen for debuggers in port 9000 (Xdebug), port 10000 (Zend) for incoming debug initiation communication from remote Debug servers.

4. Debug communication in Xdebug as per DBGp protocol.

5. Pre-Requisites
(a) Download XAMPP from http://www.apachefriends.org/en/xampp.html for Apache, PHP, MySQL, PHPMyAdmin
(b) Download Eclipse PDT from http://www.eclipse.org/pdt/downloads/
(c) Install XAMPP in "c:\xampp" location
(d) Add Apache virtual directories for my outside working directories
(i)
Alias /working "C:/EclipsePulse/Working"

Order allow,deny
Allow from all



6. Xdebug
(a) Edit PHP.INI file
(i) Comment all in [zend] configuration
(ii) uncomment in [xdebug] configuration
- xdebug.remote_enable=true
- xdebug.remote_host="localhost"
- xdebug.remote_port=9000
- xdebug.remote_handler=dbgp
- zend_extension_ts="C:\xampp\php\ext\php_xdebug.dll"
(b) Restart Apache
(c) Start Eclipse PDT
(d) Configure and create new "Debug Configurations" from Run->Debug Configurations..->PHP WebPage and select Xdebugger option.
(d) After writing simple PHP script, run the webpage using "Debug As..." menu.
(e) Debug run brings PHP Debug perspective views and debug starts....!!!!!

7. I am not able to exactly understand Zend debugger required components.

8. Finally, downloaded 'Zend Server Community Edition' from www.zend.com/community. It contains Apache, PHP preconfigured to run Zend debugger. Zend Server Community Edition is roughly equivalent to XAMPP package.

9. Setting similar to Xdebug except, i started Zend Server. Steps as following:
(a) Start Apache
(b) Start Eclipse PDT
(c) Configure and create new "Debug Configurations" from Run->Debug Configurations..->PHP WebPage and select Xdebugger option.
(d) After writing simple PHP script, run the webpage using "Debug As..." menu.
(e) Debug run brings PHP Debug perspective views and debug starts....!!!!!

10. Disabled Apache-Zend services to enable Xdebug using c:\xampp\eclipse\eclipse.exe

11. Above notes are not exhaustive, but gives rough idea about installation of Eclipse PDT setup.

Thursday, February 19, 2009

Simple Popup in ASP.NET for lookup dataentry

Simple Popup in ASP.NET for lookup dataentry

Showing Popup form for data entry is most common in GUI. Many methods are available to achieve this, and the more common is using AJAX Popup Control.

However, without AJAX it can be achieved. The key functions are:
1. Me.Button1.Attributes.Add("onclick", "javascript:return OpenPopup(TextBox1)")
2. window.open("Popup.aspx?name=" + val.value,"List","scrollbars=no,resizable=no,width=400,height=280");;
3. window.opener.document.getElementById("TextBox1").value










Sorry, Blog doesn't accept posting ASPX code and still i don't know how to post actual code...??


Happy Coding
natrajv, new delhi-96

Sunday, January 11, 2009

Audit Process Tracking-Windows XP

Tracking process for audit purpose in the event of suspected virus activity

1. Enable Audit Process Tracking
start:run->gpedit.msc->computer configuration->windows settings->security settings->local policies->audit policy->audit process tracking (set security setting to success)

2. Show Event Viewer
start:run->eventvwr->security

3. Disable Audit Process Tracking
Disable audit process tracking

Labels: , ,

NETSH utility

NETSH utility used in Windows XP for network configuration

Frequently used configurations

1. Reset TCP/IP?
netsh interface ip reset c:\resetlog.txt

2. Enable DHCP?
netsh interface ip set address name="Local Area Connection" source=dhcp
(OR)
netsh interface ip set address local dhcp

3. Manual IP/Gateway?
netsh interface ip set address name="Local Area Connection" source=static addr=192.168.1.2 mask=255.255.255.0 gateway=192.168.1.1 gwmetric=0
(OR)
netsh interface ip set address local static 192.168.1.2 255.255.255.0 192.168.1.1 0

4. Manual DNS?
netsh interface ip set dns name="Local Area Connection" source=static addr=192.168.1.1
(OR)
netsh interface ip set dns local static 192.168.1.1

5. Automatic settings
netsh interface ip set address local dhcp

6. Manual settings
netsh interface ip set address local static 192.168.1.2 255.255.255.0 192.168.1.1 0
netsh interface ip set dns local static 192.168.1.1

7. View TCP/IP setting?
netsh interface ip show config

8. Backup?
netsh -c interface dump > c:\net-backup.cfg

9. Restore?
netsh -f c:\net-backup.cfg

10. Test?
netsh diag show test

Labels:

Sunday, October 12, 2008

How to identify the classes from use cases

Nice explanation by -Ramzi Ben Yahia- in his forum reply:

The most important is to start with a domain model which describe the "real" world ,

1-Try to build a kind of glossary from the use cases sentences

2-Extract the entities that seem important for you

3-Mke a domain diagram containing this entities this would be the domain class digram , where all the classes contain only attributes and no methods yet;

4-Then you have to add the relationships between the classes

5-Finally you have to translate this to a Software Class Digram (some of the domain classes will probably disappear and some others related to software will appear)
-- you have to think of making sequenece digrams to retrieve the methods

now get into coding this, test it
and reiterate the whole thing to make the necessary changes

Find more discussion on forum:
http://www.artima.com/forums/flat.jsp?forum=17&thread=1322

Labels: , ,