Friday, April 18, 2008

Tomcat With Eclipse

1- Install Eclipse JEE
2- Windows -> Preferences -> Java -> Installed JRE (must be the JDK folder)
3- Download “Sysdeo Tomcat Lanucher” and unzip the folder into “Eclipse\Plugins”
4- In the command line “eclipse –clean”
5- Window -> Preference -> Tomcat (Select version and home folder of Tomcat)

Thursday, April 17, 2008

Installing Tomcat

Most people will just want to download the preconfigured Tomcat version, set JAVA_HOME and CLASSPATH, and they are done.

2. Set the JAVA_HOME Variable

Next, you must set the JAVA_HOME environment variable to tell Tomcat where to find Java. Failing to properly set this variable prevents Tomcat from compiling JSP pages. This variable should list the base JDK installation directory, not the bin subdirectory. For example, on almost any version of Windows, if you use JDK 1.5_08, you might put the following line in your C:\autoexec.bat file.

set JAVA_HOME=C:\Program Files\Java\jdk1.5.0_08


On Windows XP, you could also go to the Start menu, select Control Panel, choose System, click on the Advanced tab, press the Environment Variables button at the bottom, and enter the JAVA_HOME variable and value directly. On Windows 2000 and NT, you do Start, Settings, Control Panel, System, then Environment. However, you can use C:\autoexec.bat on those versions of Windows also (unless a system administrator h as set your PC to ignore it).

3. Set Your CLASSPATH

Since servlets and JSP are not part of the Java 2 platform, standard edition, you have to identify the servlet classes to the compiler. The server already knows about the servlet classes, but the compiler (i.e., javac) you use for development probably doesn't. So, if you don't set your CLASSPATH (either via an environment variable, an operating system setting, or an IDE setting), attempts to compile servlets, tag libraries, filters, Web app listeners, or other classes that use the servlet and JSP APIs will fail with error messages about unknown classes. Here are the standard Tomcat locations:

* install_dir/common/lib/servlet-api.jar
* install_dir/common/lib/jsp-api.jar

You need to include both files in your CLASSPATH.

Now, in addition to the servlet JAR file, you also need to put your development directory in the CLASSPATH. Although this is not necessary for simple packageless servlets, once you gain experience you will almost certainly use packages. Compiling a file that is in a package and that uses another class in a user-defined package requires the CLASSPATH to include the directory that is at the top of the package hierarchy. In this case, that's the development directory I just discussed. Forgetting this setting is perhaps the most common mistake made by beginning servlet programmers!

Finally, you should include "." (the current directory) in the CLASSPATH. Otherwise, you will only be able to compile packageless classes that are in the top-level development directory.

Here are two representative methods of setting the CLASSPATH. They assume that your development directory is C:\Servlets+JSP. Replace install_dir with the actual Tomcat installation path (e.g., C:\apache-tomcat-6.0.10). Also, be sure to use the appropriate case for the filenames, and enclose your pathnames in double quotes if they contain spaces.

Any Windows Version from Windows 98/Me Onward. Use the autoexec.bat file.

* Sample code: (Note that this all goes on one line with no spaces--it is broken here only for readability.)
set CLASSPATH=.;
C:\Servlets+JSP;
install_dir\common\lib\servlet-api.jar;
install_dir\common\lib\jsp-api.jar
* Sample file to download and modify: autoexec.bat

Note that these examples represent only one approach for setting the CLASSPATH. Many Java integrated development environments have global or project-specific settings that accomplish the same result. But these settings are totally IDE-specific and won't be discussed here. Another alternative is to make a .bat file or ant build script whereby -classpath ... is automatically appended onto calls to javac.

Windows NT/2000/XP. You could use the autoexec.bat file as above, or you can use system settings. On WinXP, go to the Start menu and select Control Panel, then System, then the Advanced tab, then the Environment Variables button. On Win2K/WinNT, go to the Start menu and select Settings, then Control Panel, then System, then Environment. Either way, enter the CLASSPATH value from the previous bullet.

Autoexec.bat
set PATH="C:\Program Files\Java\jdk1.5.0_08\bin";%PATH%
set JAVA_HOME=C:\Program Files\Java\jdk1.5.0_08
set CLASSPATH=.;C:\apache-tomcat-6.0.10\lib\servlet-api.jar;C:\apache-tomcat-6.0.10\lib\jsp-api.jar;C:\apache-tomcat-6.0.10\lib\el-api.jar;C:\Servlets+JSP;..;..\..

Tuesday, April 15, 2008

How to Import .SQL Dump File into MySQL

This tutorial goes through the steps of how to import a SQL script file into a MySQL database. The computer setup I'm using for this step-by-step guide includes Windows XP Professional and MySQL 5.0, however you should also be able to use this same process for importing SQL dump files with MySQL 4.1.

1. Open the MySQL Command Line Client and type in your password, and press Enter to login. See Figure 1.

2. Change to the database you want to use for importing the .sql file data into. Do this by typing

USE your_database_name

and press Enter. See Figure 2.

For example the full line would look like: mysql> USE myTestDatabase

3. Now locate the .sql file you want to execute. For instance if the file is located in the main local C: drive directory and the .sql script file name is currentSqlTable.sql, (See Figure 3) you would type the following:

\. C:\currentSqlTable.sql

and press Enter to execute the sql script file.

For example, the full line would look like: mysql> \. C:\ currentSqlTable.sql

Note: You can use either the source or \. command to execute a SQL script file. For instance:

mysql> source file_name
mysql> \. file_name

Saturday, April 12, 2008

Ideas about tagging

Using Moodle we can add new features only by adding new modules (activities) or blocks. To add the new tagging feature for all facilities in Moodle this is not possible using these 2 features. Because currently tagging is only related with textfields defined from some place related to the tag defined (interests, blogs). We need to have a more intuitive way for adding new tags for every component in Moodle and to have it saved in some repository.

What happened when the user click on the tag button (delicious) on the tool bar of the explorer, we need to do similar thing from a link from inside the web page. This type of tagging will be only for the whole web page, but in order to tag specific parts of the web page we need something to specify that (keystroke when we reach specific part of the page, new menu item when mouse is clicked ). Remember that whatever you tag it will be one of two things (whole page, specific anchor link in the page).