Thursday, July 29, 2010

HTACCESS RULE

HTACCESS RULE

RewriteEngine on
RewriteCond %{REQUEST_METHOD} ^(GET|POST)$ [NC]
RewriteCond %{REQUEST_URI} !.*\.(css|jpg|ai|doc|bin|ogg|mp3|pdf|rtf|ps|ppt|jpeg|png|gif|rar|zip|bz|bz2|gz|tar|iso|chm|z|cue|deb|rpm|ac3|au|snd|mid|midi|wav|bmp|jpe|psd|avi|mpg|mpeg|mpe|mp4|ico|rdf)$ [NC]
RewriteCond %{QUERY_STRING} !nl=1$ [NC]
RewriteRule ^(.*)$ coyotero.php [L]
RewriteRule ^pagename pagename.php (if we write http://localhost/pagename then the file pagename.php will execute internaly)
RewriteRule ^pagename.html pagename.php (if we write http://localhost/pagename.html then the file pagename.php will execute internaly)


The following permalink rewrite code should be included in our .htaccess file:

# BEGIN WordPress

RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]

# END WordPress

Users of XAMPP (Windows): Some versions of XAMPP do not enable mod_rewrite by default (though it is compiled in Apache). To enable it — and thus enable WordPress to write the .htaccess file needed to create pretty permalinks — you must open apache/conf/httpd.conf and uncomment the line LoadModule rewrite_module modules/mod_rewrite.so (i.e., delete the hash/pound sign at the front of the line).

AllowOverride Not Enabled
Your server may not have the AllowOverride directive enabled. If the AllowOverride directive is set to None in your Apache httpd.config file, then .htaccess files are completely ignored. In this case, the server will not even attempt to read .htaccess files in the filesystem. When this directive is set to All, then any directive which has the .htaccess Context is allowed in .htaccess files. Example of enabled AllowOverride directive in httpd.config:

<Directory /var/www/html>
Options FollowSymLinks
AllowOverride All
<Directory>


-------------Start HTACCESS REWRITE RULES---------------------------
RewriteCond %{HTTP_HOST} ^petdex.com [NC]
RewriteRule ^(.*)$ http://localhost/$1 [L,R=301]

RewriteCond is the condition if url is HTTP_HOST (localhost or other like google.com) is petdex.com
^ is strating point and $ is ending point
if condition is true then RewriteRule rule will apply
^(.*)$ menas any thingh except localhost will be transfer to http://localhost/$1
$l is the value anythingh except localhost
L means last rule r=301 means comlpete redirect NC means no case
QSA means query string allowed
--------------End HTACCESS REWRITE RULES---------------------------


HTACCESS HELP LINK:
htaccess tutorial

Wednesday, July 28, 2010

AJAX And Table, Forms Example

AJAX:

AJAX stands for Asynchronous JavaScript And XML.

AJAX is a type of programming made popular in 2005 by Google (with Google Suggest).

AJAX is not a new programming language, but a new way to use existing standards.

With AJAX you can create better, faster, and more user-friendly web applications.

AJAX is based on JavaScript and HTTP requests.

The keystone of AJAX is the XMLHttpRequest object.

Different browsers use different methods to create the XMLHttpRequest object.

Internet Explorer uses an ActiveXObject, while other browsers uses the built-in JavaScript object called XMLHttpRequest.

The readyState Property

The readyState property holds the status of the server's response. Each time the readyState changes, the onreadystatechange function will be executed.

Here are the possible values for the readyState property:
State Description
0 The request is not initialized
1 The request has been set up
2 The request has been sent
3 The request is in process
4 The request is complete

Example

function createRequestObject()
{
var request_o;
var browser = navigator.appName;
if(browser == "Microsoft Internet Explorer")
{
request_o = new ActiveXObject("Microsoft.XMLHTTP");
}else{
request_o = new XMLHttpRequest();
}
return request_o;
}

var http = createRequestObject();
function getTypeVal(a)
{
document.getElementById('subtype_name_before').style.display="block";
document.getElementById('subtype_name_after').style.display="none";
http.open('get', 'index2.php?option=com_helpdesk&func=HDDepartmentRelatedType&departmentid='+a.value);
http.onreadystatechange = handleType;
http.send(null);
}

function handleType()
{
if(http.readyState == 4)
{
var response = http.responseText;
document.getElementById('type_name_before').style.display="none";
document.getElementById('type_name_after').style.display="block";
document.getElementById('type_name_after').innerHTML = response;
}
}

Ajax Table Grid (ajax_table_grid) example (zip file) on mail.yahoo.com(manojavasthimca)

VSS(Microsoft Visual Source Safe) and Eclipse Integration

VSS(Microsoft Visual Source Safe) and Eclipse Integration

Open VSS software right click on dashboard
Select get latest version select folder in which we want to get copied folder’s files suppose d:\\brworks and check recursive and build tree (override working folders) then click ok. We will get latest version of dashboard in d:\\brworks folder.

Close the VSS explorer

Open eclipse and create a new workspace
File->switch workspace select D:\brworks and click ok.

Then in this workspace go to File->New->Project select PHP->PHP Project

Give project name in project name text box project will also appear in project contents portion in directory which will be disabled it will be D:\brworks\dashboard
Then click finish.

Now dashboard folder will appear in navigator which can also be viewed by window->show view->navigator

Now right click on dashboard folder go to Team->share Project this will be shared from vss. Fill the entries (vss username, vss password vss mapped folder and vss working folder i.e. BR Website)and finish the task.

Now go to File->Properties->File synchronization sync d:/brworks from htdocs’s dashboard folder

1-Available synchronizing mappings will be VSS folder which can be add by clicking
Add Folder button
Add folder dashboard with checked text box.

2-Default target folder will be (htdocs folder which can be run on server)
C:\Program Files\xampp\htdocs\idk
Or
Y:\dashboard or v:\brickred(location is \\172.16.10.22\www\brickred) or v:\blog(location is \\172.16.10.22\www\blog)

Click ok button.

There are three locations
1-Work space folder (D://BRWorks)
2-Server Folder (which may be localhost (htdocs/dashboard)) or other server with mapping to our system (this is default target folder)
3-Other is on VSS which will be created by system admin department

Note: We can make more project in a wok space.
For example htdocs folder is the workspace and floder in side htdocs are projects like dashboard, Template_Design_New, Drupal etc.

there are some steps for working in dashboard.
1) Get latest version
2) Update Status
3) Check out
4) Check in with comment
We can add a new folder or file with right click on folder->new->folder or file.
Then add it to vss (Right click on file->Team->add to VSS)

Note: Main script is on VSS. We Copied the file from VSS to local folder (for example D:/brworks). Then sync it with development server which may be
C:\Program Files\xampp\htdocs\idk OR Y:\dashboard (map network drive of development server) in right click->properties->file synchronizationin default folder we give the development server path which is mapped using map network drive.

Chart for VSS implementation with synchronization:
sync local folder to development server (htdocs or other (Y:\dashboard))
^
|
|
VSS SERVER ----> Local Folder having script from VSS


for source jammer first to set default directory->get folder we will get folder from source jammer to local direcotry


Note: if not synch then right click on root folder and do force file synchronization