Add Virtual Host In Apache In Windows

Currently I am using XAMPP application to test my websites.

Why Virtual Host?
It will gives you freedom to use your domain-name instead sub directory of 'localhost'  in URL.
Ex.
http://project-name/  instead of http://localhost/project-name

To setup Virtual Host (multisite) using xampp in windows,
Step 1:
Locate 'httpd-vhosts.conf' file in xampp-apache installation. Mostly in "C:\xampp\apache\conf\extra"
Edit above file (using notepad) by appending,

<VirtualHost *:80>
    DocumentRoot "C:/xampp/htdocs"
    ServerName localhost
</VirtualHost>
#Above code will make sure your access 
#to default 'htdocs' directory for 'localhost'.

<VirtualHost *:80>
    DocumentRoot "C:/xampp/htdocs/project-name"
    ServerName project-name.local
    ServerAlias project-name.local
    ErrorLog "logs/project-name.local-error.log"
    CustomLog "logs/project-name.local-access.log" common
    <Directory "C:/xampp/htdocs/project-name">
        Order allow,deny
        Allow from all
    </Directory>
</VirtualHost>
#Change 'project-name' with your domain-name

Step 2:
Locate 'host' file in "C:\Windows\System32\drivers\etc"
Append below lines,

127.0.0.1      localhost
127.0.0.1      project-name.local

Step 3:
Restart Apache Server.

Note:
>It's not mandatory to use '.local' extension. But do not use TLD's in local domain-name.
>Sometimes you may need to restart Windows to host take effect.



How To Set Environment Variable in Windows

Environment Variable helps us to use many commands without specifying full path for its executable file.
Example,
>javac MyClass.java
instead of
C:\Program Files\Java\jdkx.x.x_xx\bin>javac MyClass.java

Why to Set Environment Variable?
Sometimes it becomes very uneasy to use application with absolute path, like in above example each time you will need to copy "MyClass.java" file in bin directory or specify full path for same file.

Alternate Solution
set path="C:\Program Files\Java\jdkx.x.x_xx\bin" 

But this is temporary solution.

Permanently set Environment Variable

Step 1
Right click on My Computer , go for
> Properties > Advance system settings > Environment Variable

Step 2
In System Variables search for "PATH"Select and click "Edit"

Step 3
Put full path of .exe directory at the current value. Include ; (semi-colon) before your new full path each time.





Note: Same for,
"ruby.exe"' is not recognized as an internal or external command,TA: operable program or batch file.
"php.exe"' is not recognized as an internal or external command

How to Generate Documentation in NetBeans (PHP Application)

To Generate Documentation in NetBeans you require few things,
1)  API documentation generator for PHPApiGen )
2) PHP Interpreter ( WAMP, XAMP )

Step 1
Extract ApiGen-x.x.x-standalone.zip file at secure location. (or inside Netbeans installation directory).

Step 2
Start NetBeans (7.4 or later) and click on Tools=>Options. Then click on "ApiGen" tab.

Step 3
Inside "ApiGen Script" input box locate your ApiGen directory extracted previously and select "apigen.php" file.

Step 4
Now go to "General" tab's Command Line Section.
Inside PHP Interpreter input box browse for WAMP or XAMP directory (hope you have installed it!) and Select "php.exe" inside "bin\php\phpx.x.x".
Click "Apply".

Step 5
Done!
Now right-click any PHP Project you are working on and click "Generate Documentation" (It may ask for "Target Directory").

Note:
If you decided to use "apigen.bat" instead of "apigen.php" you may fall in error
"php.exe"' is not recognized as an internal or external command,TA:
operable program or batch file.
You need to set Environment Variable for 'php.exe'
Check How To Set Environment Variable

How to use SASS with Netbeans in Windows

Its really easy to install SASS in Netbeans

Things you required,
1) Ruby Installer
2) SASS Editor Plugin

Step 1
Download and Install Ruby Installer, check for "gem.bat" file in "c:\Ruby200\bin\" directory

Step 2
Star Command Prompt and go for 'bin' directoy
Install SASS gem using gem install sass command






After install you can see "scss.bat" and "scss" files in same "c:\Ruby200\bin\" directory.

Step 3
Go to Tools > Options > Miscellaneous > Sass path  and add "scss.bat" path in CSS Preprocessors input box

Step 4 Optional if you already have sass editor in Netbeans
Goto Netbeans "Plugin" option and install downloaded SASS Editor Plugin


"ruby.exe is not recognized as an internal or external command"????
Check How To Set Environment Variable

'Revert Deleted' saved my a**


Today, While working on website project in NetBeans I accidentally deleted one of my important package containing more than 15 files in .....damn ...single...click!!!

I was totally shocked to hell !


But then after few unsuccessful tries I got History > Revert Deleted option and I recovered my work back. YIPPEE!!!!

Thanks To NeatBeans and Whoever added 'Revert' option in it.

You think this is not a big deal? Then ask any programmer who lost his code in HDD crash. 

To Recover Files,
Just right click on folder > History >> Revert Deleted 

To Recover Complete Folder,
Create new folder with same name >  Right click on folder > History >> Revert Deleted 




HTTP Status Codes

1xx : Informational
100 Continue
101 Switching Protocols

2xx : Successful
200 OK
201 Created
202 Accepted
203 Non-Authorized Information
204 No Content
205 Reset Content
206 Partial Content

3xx : Redirection
300 Multiple Choices
301 Moved Permanently
302 Moved Temporarily
303 See Other
304 Not Modified
305 Use Proxy

4xx : Client Error
400 Bad Request
401 Unauthorized
402 Payment Required
403 Forbidden
404 Not Found
405 Method Not Allowed
406 Not Accepted
407 Proxy Authentication Required
408 Requested Timeout
409 Conflict
410 Gone
411 Length Required
412 Precondition Failed
413 Request Entity Too Large
415 Unsupported Media Type

5xx : Server Error
500 Internal Server Error
501 Not Implemented
502 Bad Gateway
503 Service Unavailable
504 Gateway Timeout
505 HTTP Version Not Supported


How To Set Environment Variables In UNIX And Linux


UNIX

How Environment Variables are set and used varies with the shell.

# env 
List all environment variables and their values

# env $HOME
/root

HOME is an environment and variable /root is value

# setenv VAR_NAME value
Set new environment variable.

# unsetenv VAR_NUM
Undefine existing environment variable.


Linux

# set
List all environment variables and their value.

# echo $HOME
Get value of environment variable.

# export NEW_VARIABLE=value
Set new variable with its value

# export PATH=${PATH}:/usr/app/application-x.x.x/bin
OR
# export MY_DIR=/local/dir
# export PATH=${PATH}:${MY_DIR}
(Add) Append new value in existing variable

All above settings are temporary or for opened terminal only.


To make Changes Permenant

Edit file .bash_profile using,
# vi ~/.bash_profile 

.bash_profile file already contains few script lines for setting PATH variable. 
If you wish to add new PATH value just append it to existing line using " : " (colon).
PATH=$PATH:$HOME/bin:/my/new/app/path 

OR If you wish to set new environment variable just add following lines at the end of file. NEW_VARIABLE=/my/app/path
export NEW_VARIABLE
 

Save and close the file.

Note:
.bash_profile file is get executed at the time of system startup or user logged in. So to watch your environment variable running (or removed) restrt or re-logging your system.