Saturday, November 7, 2009

Regression

Types of regression
  1. Simple Linear Regression
    y=b_0+b_1x
    y=b_0+b_1x^2
  2. Multiple Linear Regression
    y=b_0+b_1x_1+b_2x_2+b_3x_3+.........+b_nx_n
    y=b_0+b_1x_1+b_2x_2^2+b_3x_3^3+.........+b_nx_n^n
  3. Simple Non-Linear Regression
    y=b_0+b_1^2x
    y=b_0+b_1^2x^2
  4. Multiple Non-Linear Regression
    y=b_0+b_1x_1+b_2^2x_2+b_3^3x_3+.........+b_n^nx_n
    y=b_0+b_1x_1+b_2^2x_2^2+b_3^3x_3^3+.........+b_n^nx_n^n
b_0, b_1, b_2, b_3, ........., b_n=Parameters/Regression\ Coefficients
x_1, x_2, x_3, .........,x_n=Independent\ Variable
y=Dependent\ Variable

Thursday, October 8, 2009

Web Hosting From Home Using Your Own Computer As The Server

Requirements:
  1. DSL/Cable/Dial-Up any form of home internet connection (which by default has dynamic IP)
  2. TOMCAT Server installed on the computer that you wish to make the server (we will call it Computer#1 henceforth)
  3. Account at http://www.zoneedit.com
  4. A domain name that you would have bought/registered (mydomain.com)
Next do the following:-
  1. Configure TOMCAT to use port 80 on Computer#1. (Optional). For details see HERE. Note: If not configured for port 80 or configured it for any other port, see Step #10 HERE
  2. Configure Computer#1 to have local static IP. For details see HERE
  3. Configure your router to port forward 80 from the IP of Computer#1 (Optional)
  4. Change the routers access port from default (80) to any other port (Optional. This step is needed to prevent conflict, to be on safer side)
  5. Add and configure your domain at http://www.zoneedit.com. For details see HERE
  6. Download and install the IP updater client from http://www.zoneedit.com on Computer#1. Get it from HERE. Use srvany to run it as a Windows service. Get it from HERE
Now you can access your website from outside your network by typing www.mydomain.com in your browser

Ways to include a file in another file

  1. SSI
    Enable SSI in your sever. Then use the following to include one file
    • <!--#include virtual="filename" -->
    • <!--#include file="filename" -->

  2. Include Directive
    <%@ include file="filename" %>

  3. jsp:include Element
    <jsp:include page="filename" />

  4. iframe
    <iframe src="filename" style="height:100%;width:100%;frameborder:0;scrolling:no"> </iframe>


NB: "filename" includes the relative path of the file (with respect to the file that contains include statement) & the filename with its extension (ex. /incl/header.html).

SSIs are a workable solution for including different types of content in your Web site or Web application, but they're not the best choice for Java developers. Not only does JavaServer Pages technology provide an all-Java alternative to SSIs, but the two technologies aren't easily combined. JSP pages end in the extension .jsp, which means that for SSI directives to work you have to either change your SSI configuration to also parse JSP files (adding overhead to every JSP page parse), or change your JSP configuration to treat the .shtml extension as a JSP page (which is a bad idea). JSP technology is the best content management solution for Java developers, and fortunately its include mechanism is a snap to learn.

How to enable SSI in TOMCAT

To enable SSI in TOMCAT do the following:-
  1. Copy manager.xml or host-manager.xml from within C:\Program Files\Apache Software Foundation\Tomcat 6.0\conf\Catalina\localhost and paste it in the same folder. Now rename it to MYAPPLICATION.xml MYAPPLICATION should be exaclty same as the application folder name and it should be put inside webapps folder.
    Essentially you want to create an application xml with Context having privileged="true".

  2. opy manager.xml or host-manager.xml from within C:\Program Files\Apache Software Foundation\Tomcat 6.0\conf\Catalina\localhost and paste it in the same folder. Now rename it to ROOT.xml. If you don't do this step you will not be able to view/load the default TOMCAT page by using the URL http://localhost:8080/

  3. Open web.xml from C:\Program Files\Apache Software Foundation\Tomcat 6.0\conf and remove the XML comments from around the following:-

    <servlet>
    <servlet-name>ssi</servlet-name>
    <servlet-class>
    org.apache.catalina.ssi.SSIServlet
    </servlet-class>
    <init-param>
    <param-name>buffered</param-name>
    <param-value>1</param-value>
    </init-param>
    <init-param>
    <param-name>debug</param-name>
    <param-value>0</param-value>
    </init-param>
    <init-param>
    <param-name>expires</param-name>
    <param-value>666</param-value>
    </init-param>
    <init-param>
    <param-name>isVirtualWebappRelative</param-name>
    <param-value>0</param-value>
    </init-param>
    <load-on-startup>4</load-on-startup>
    </servlet>

    <servlet-mapping>
    <servlet-name>ssi</servlet-name>
    <url-pattern>*.shtml</url-pattern>
    </servlet-mapping>

  4. Change the file extension which has the include statement to the appropiate extension as per in the line

    <url-pattern>*.shtml</url-pattern>

    You can change it to any extension you want, provided you make tha same change in url-pattern above.

Sunday, October 4, 2009

Change default port (8080) in TOMCAT

To change the the default port (8080) in TOMCAT do the following:-

Open the file server.xml present in C:\Program Files\Apache Software Foundation\Tomcat 6.0\conf

Look for

<Connector port="8080" protocol="HTTP/1.1"
connectionTimeout="20000"
redirectPort="8443" />

Change port="8080" to port="80"

<Connector port="80" protocol="HTTP/1.1"
connectionTimeout="20000"
redirectPort="8443" />

You can now access your application by http://localhost/MYAPPLICATION instead of http://localhost:8080/MYAPPLICATION

NB: http://localhost:80/MYAPPLICATION is equivalent to http://localhost/MYAPPLICATION since the default port for http is 80.

Saturday, October 3, 2009

Change default ROOT folder in TOMCAT

When you type http://localhost:8080/ you load the default index.html which is present in C:\Program Files\Apache Software Foundation\Tomcat 6.0\webapps\ROOT. To change this behavior you need to change the redirection to ROOT folder. In order to do that you can implement either of the four options:-
  1. Html redirection from C:\Program Files\Apache Software Foundation\Tomcat 6.0\webapps\ROOT\index.html to C:\Program Files\Apache Software Foundation\Tomcat 6.0\webapps\MYAPPLICATION\index.html
    Modify index.html in C:\Program Files\Apache Software Foundation\Tomcat 6.0\webapps\ROOT as follws:-

    <html>
    <head>
    <title>Redirecting to /MYAPPLICATION</title>
    </head>
    <body onLoad="javascript:window.location='MYAPPLICATION';">
    </body>
    </html>

    Or

    <html>
    <head>
    <title>Redirecting to /MYAPPLICATION</title>
    <meta http-equiv="refresh" content="0;url=MYAPPLICATION" />
    </head>
    <body>
    </body>
    </html>

    NB: MYAPPLICATION is in webapps folder

  2. Add/change context in C:\Program Files\Apache Software Foundation\Tomcat 6.0\conf\server.xml inside <Host> tag as follows:-

    <Context path="" docBase="{relative path of MYAPPLICATION folder (relative to webapps folder)} OR {absolute path of MYAPPLICATION folder with backslash or frontslash}" debug="0" >
    </Context>

    NB: Can keep MYAPPLICATION folder anywhere in the computer
    NB: Can leave ROOT folder as it is

  3. Create ROOT.xml in C:\Program Files\Apache Software Foundation\Tomcat 6.0\conf\Catalina\localhost as follows:-

    <Context path="" docBase="{relative path of MYAPPLICATION folder (relative to webapps folder)} OR {absolute path of MYAPPLICATION folder with backslash or frontslash}" debug="0" >
    </Context>

    NB: Should keep MYAPPLICATION folder outside webapps folder anywhere in the computer
    NB: ROOT.xml (should be UPPERCASE)
    NB: Can leave ROOT folder as it is

  4. Delete ROOT folder under C:\Program Files\Apache Software Foundation\Tomcat 6.0\webapps and rename MYAPPLICATION to ROOT

Friday, September 11, 2009

Import NULL values into MYSQL via "Import CSV"

Try the following in a csv and import it in MYSQL.

NUMERICSTRINGDATE/TIME
"NULL""NULL""NULL"
NULLNULLNULL
/N/N/N
\N\N\N
"/N""/N""/N"
"\N""\N""\N"

The corresponding values that get imported in MYSQL are as follows:



Hence to import NULL values in to MYSQL using import csv method make sure to have entries in CSV file as follows (irrespective of data type) (make sure to make them UPPER CASE):

\N
NULL (Not Recommended)
"\N" (Not Recommended)

Sunday, September 6, 2009

Javascript event.keycode

Enter some text with uppercase and lowercase letters:


Keyboard Event Properties
Datakeydownkeypresskeyup
keyCode
charCode
Character

Tuesday, September 1, 2009

HTML basic structure

One HTML page can have the following tags only once
  1. <html>
  2. <head>
  3. <title>
  4. <body>
All the rest of tags could be in multiple numbers.

When you include files using either by SSI (<!--#include virtual="filename" --> or <!--#include file="filename" -->) include directive (<%@ include file="filename" %>) or jsp:include element (<jsp:include page="filename" />), make sure that you don't put the above four tags in the file to be included, otherwise they will create a conflicting situation with multiple tags.

W3C compliance tools

W3C Markup Validation Service: http://validator.w3.org/
W3C Link Checker: http://validator.w3.org/checklink
W3C CSS Validation Service: http://jigsaw.w3.org/css-validator/

All W3C Validation links:
http://www.w3.org/QA/Tools/
http://www.anybrowser.org/campaign/abdesign3.html#validation
http://watson.addy.com/
http://webdesign.about.com/od/htmlvalidators/a/aa092799.htm

Browser Compliance
Acid1 Test: http://acid1.acidtests.org/
Acid2 Test: http://acid2.acidtests.org/
Acid3 Test: http://acid3.acidtests.org/

web.xml explained

web.xml explained

Relative paths explained

Relative paths explained

Embed jfreechart in a jsp

Embed jfreechart in a jsp

Compile servlets (java files) to classes (class files)

Compile servlets (java files) to classes (class files)

JMOL load file parameter as a variable

JMOL load file parameter as a variable

Monday, August 31, 2009

Use special characters, superscript, subscript in HTML button

To use special characters, superscript, subscript in HTML button use the <button> tag instead of <input type="button"> tag.
To use special character you can use their corresponding ASCII codes

Ex.
<button>a<sup>3</sup></button> which gives

Instances where TOMCAT server needs restart

1. Change/Addition/Deletion of web.xml file
2. Change/Addition/Deletion of jar files

Restart not required in
1. Change/Addition/Deletion of jsp file
2. Change/Addition/Deletion of html file
3. Change/Addition/Deletion of css file
4. Change/Addition/Deletion of js file
5. Change/Addition/Deletion of serlvlet (java files)??
6. Change/Addition/Deletion of class (class files)??
7. Change/Addition/Deletion of images (image files)

How to run an individual JSP

Without creating an application directory structure how would you run an individual jsp file?

Using TOMCAT
Create a folder "myapplication" within C:\Program Files\Apache Software Foundation\Tomcat 6.0\webapps\ and place your jsp file in it.
This is how the file path looks C:\Program Files\Apache Software Foundation\Tomcat 6.0\webapps\myfile.jsp

Now start the TOMCAT server.
Use the following url in your browser to run the jsp file.
http://localhost:8080/myapplication/myfile.jsp

Standard Directory Layout in TOMCAT

/Apache Software Foundation/Tomcat 6.0/webapps/myapplication/
Place the dynamic content namely html, jsp and images. You can create separate images folder (webapps/myapplication/images) to keep all the images.
/Apache Software Foundation/Tomcat 6.0/webapps/myapplication/WEB-INF/
Place the web.xml file
/Apache Software Foundation/Tomcat 6.0/webapps/myapplication/WEB-INF/lib/
Place all the jar files used by the application
/Apache Software Foundation/Tomcat 6.0/webapps/myapplication/WEB-INF/classes/
Place the dynamic content namely your servlets (java & class files)

In case of servlets any relative reference will always refer to the root directory. Hence the html code "<body background="images/bg.gif" bgcolor="#FFFFFF">" will look for the image in "/images/" folder.

You should map the servlet URL to your servlet using a mapping in the web.xml. This is a virtual mapping, no physical directories need to exist. Tomcat knows that the files it wants will be in WEB-INF/classes or WEB-INF/lib

More information could be obtained HERE & HERE

. Sample application war could be obtained HERE.

Sunday, August 2, 2009

EMI Calculator

Enter the Principal amount (the amount of loan to be taken), Rate of Interest per annum/year and the number of Months for which the loan is to be taken. The EMI would be calculated dynamically.



PrincipalRate of InterestMonths
 
  EMI  




EMI Formula = p*r*(1+r)n/{(1+r)n-1}

where
p = principal amount
r = interest rate per month (ex: if interest rate per annum is 10% then r = (10/12)/100
n = tenure in months

Monday, February 16, 2009

Convert Wired/Wireless Router to a Switch/Access Point

  1. Connect your computer directly to the Modem/Router
  2. Log onto your Modem/Router's web based configuration page
  3. Navigate to the page that says "LAN" and then "DHCP Setup"
  4. Make a note of "IP Pool Starting Address" and "Pool Size"
  5. Disconnect the Modem/Router
  6. Connect your computer directly to the Router/Wireless Router from a LAN port in the Router/Wireless Router. (Warning! Never connect to the WAN port)
  7. Log onto your Router/Wireless Router's web based configuration page
  8. Goto the page where it says "LAN"
  9. Change the IP address to the one that you noted in Step #4, but outside the DHCP range. DHCP Range = ("IP Pool Starting Address") - ("IP Pool Starting Address" + "Pool Size")
  10. Leave the entry of "Subnet Mask" as it is
  11. Delete the entries under "Gateway" & " DNS Server". They don't matter now
  12. Untick "DHCP Server". This turns off DHCP in the Router/Wireless Router, so now the Modem/Router will be the one acting solely as the DHCP server
  13. Click Save
  14. Connect the Modem/Router to a LAN port of the Router/Wireless Router
  15. To make things working perfectly, you can do a repair of the "Local Area Connection" by right clicking the LAN icon in taskbar and select "Repair". If the "Local Area Connection" is missing from the taskbar, you can bring back it by right clicking "My Network Places" on Desktop and then selecting "Properties" OR by going to Start Menu → Settings → Control Panel → Network Connections. Then right click "Local Area Connection" and select "Properties". Then tick "Show icon in notification area when connected". You can also do a repair by right clicking "Local Area Connection" and selecting "Repair"
Done.

Smitfraud Virus

When this attacks you get the following



Solution

Download Smitfraudfix.exe from http://siri.geekstogo.com/SmitfraudFix.php

Optoma MovieTime DV10 Region Free

Below are the steps to make the Optoma MovieTime DV10 Projector region free.

1. Get a hold of "dvdrom.zip" file
2. Create a folder named "OptomaDV10" anyhwhere in your computer
3. Unzip the file "dvdrom.zip" to "OptomaDV10" folder. (There is a file "dvdrom.bin" inside "dvdrom.zip", but this is not an image file)
4. Burn the folder "OptomaDV10" to a CD-R or CD-RW as "Data" and "Finalize" (Do not burn it to a DVD. Do not burn as an "Image" or make it bootable)
5. Place the CD-R or CD-RW inside Optoma MovieTime DV10 Projector when it is turned OFF and leave it
6. Plug in the power cord of the Optoma MovieTime DV10 Projector and Power it ON with the remote
7. You will get a blue colored screen with the following "Smart Update - Upgrade to v2.06CTX-010" with a countdown of 20 (DO NOT DISCONNECT FROM MAINS SOCKET OR TOUCH ANY CONTROLS WHILST THIS SCREEN IS SHOWING!)



8. Wait till it countdowns to 0
9. Next you will get "Upgrading" (Do not do anything)



10. Next the screen will go away and you will see the regular Optoma MovieTime DV10 Projector screen with "READ" on the upper left corner
11. Stop playing the CD-R or CD-RW from your remote twice
12. Take out the CD-R or CD-RW

Your Optoma MovieTime DV10 Projector is now region free. Put in a DVD to test it. (No need to re-start the Optoma MovieTime DV10 Projector)

NB: If you do not stop playing the CD-R or CD-RW in step #11, then it will cycle through step #7 to step #11.

Saturday, February 7, 2009

Indian ADs voiceover artists

1. ???????













2. ???????



3. Harish Bhimani