2010-01-09

Any Languages in Dot Net Framework

The beauty in Dot Net Framework is that, you can use whatever language you like to develop your application. For example, if you're a VB people, you can use VB.Net or you can use J# if you're a Java people (Even though the syntax is not exactly the same, but you can catch up faster). Below are some language that Dot Net Framework supports:

  • C#: this should be the genuine language in Dot Net Framework
  • VB.Net: influenced by Visual Basic
  • J#: influenced by Java
  • F#: influenced by Lambda Expression
  • Boo: influenced by Python
  • IronPython: influenced by Python also
  • IronRuby: influenced by Ruby
Dot Net Framework can do this by using the Common Language Runtime (CLR). Whatever language you compiled will convert into Common Intermediate Language (CIL) and executed by CLR.

If you have installed Dot Net Framework SDK, you can find a tools called Microsoft Intermediate Language Disassembler (MSIL Disassembler ). Using this tool allow you to read the CIL in all Dot Net compiled assemblies (either it is an executable file or library).

2009-11-01

Difference between Linux and Windows (and similarity)

Linux, Mac, Solaris, BSD and some other OS share the same origin, grandfather UNIX, which make them having similar command and file structure. While Windows stands as its owned, has its owned unique command and structure that different from the UNIX bloodline. However all the OS are actually serve the same purpose, just that in different methods:

  1. File System Type: this is the type of method on how to format the hard disk. Currently Windows cannot browse hard disk (or partition) of Linux file system, however newer Linux can browse (or even modify) Windows file system.
    1. Windows: FAT and NTFS
    2. Linux: EXT2, EXT3 and EXT4
  2. File Structure: this is another thing that make Windows user confuse on Linux. In Windows, the file structure is based on hard disk, and then each hard disk can have more than 1 partition. For example C:\ is the hard disk and D:\ may be the second partition of the hard disk. However Linux treats hard disk and partition separately, which the structure will base on partition like /, /home, /etc and others.
    1. Linux /home is equivalent to Windows c:\document and settings
    2. Linux /bin and /sbin is equivalent to Windows c:\windows\system32
    3. Linux /opt is equivalent to Windows c:\program files
  3. Command: of course the commands between Linux and Windows are vary, but you can always find the equivalent command.
    1. List files: ls and dir
    2. Ping: ping (same for both OS)
    3. Change directory: cd (same for both OS)
    4. Make directory: mkdir (same for both OS)
    5. Copy: cp and copy
    6. Move: mv and move
    7. Delete: rm and del

2009-09-26

Tomcat configuration file - web.xml

Tomcat configuration file (web.xml) is using XML pattern, which the global configuration file is within tomcat\conf directory, and individual configuration file is within tomcat\wepapps\webdir\WEB-INF directory. User can always refer to the global configuration file as a sample to set the individual configuration file. The parent node of web.xml is <web-app> and below is the common nodes that can be used:

  1. Description for the web application.
    <description>
    Description for Web Application
    </description>
  2. Map the servlet to associate class and URL pattern.
    <servlet>
    <servlet-name>servlet name</servlet-name>
    <servlet-class>class name</servlet-class>
    </servlet>
    <servlet-mapping>
    <servlet-name>servlet name</servlet-name>
    <url-pattern>url pattern</url-pattern>
    </servlet-mapping>

  3. Map the taglib to associate TLD files.
    <taglib>
    <taglib-uri>
    http://www.gnokproject.com/taglibs/taglib-v1.0
    </taglib-uri>
    <taglib-location>
    /WEB-INF/jsp/taglib.tld
    </taglib-location>
    </taglib>
  4. Map extension to associate mime type.
    <mime-mapping>
    <extension>html</extension>
    <mime-type>text/html</mime-type>
    </mime-mapping>

  5. Session timeout.
    <session-config>
    <session-timeout>30</session-timeout>
    </session-config>
  6. First file to be accessed.
    <welcome-file-list>
    <welcome-file>index.jsp</welcome-file>
    <welcome-file>index.html</welcome-file>
    </welcome-file-list>

2009-09-25

WEBAPPS directory structure

WEPAPPS is the directory that keep all the JSP files and JAVA files, and the place where people will get into when they are accessing Apache Tomcat. Inside WEBAPPS directory, each sub directory represents a sub directory in the URL, for example a sub directory named subdir represents www.gnokproject.com/subdir. Except for one directory called ROOT which represents the root directory www.gnokproject.com.

Inside each sub directory will have a directory called WEB-INF which contain:

  1. classes directory: keep the JAVA source files which will be auto compiled by Tomcat when the classes are needed.
  2. jsp directory: keep the TLD files or the tag library files.
  3. lib directory: keep the JAR files.
  4. web.xml: configuration files of that particular directory.

2009-09-23

Apache Tomcat directory structure

Tomcat's directory structure:

bin
Keep all execution files, for example startup.bat and shutdown.bat.
conf
Keep all the common configuration files, such as server.xml.
lib (in 6.0, or common, server, shared in 5.5)
Keep all the common classes and jar files that will be shared by all JAVA and JSP files in webapp.
logs
Keep all the log files.
webapps
Keep all the JSP files, where you normally spend most of the time here.
temp
Temporary directory.
work
Keep the caches compiled from JSP and JAVA files from wepapp.

Change Tomcat port from 8080 to 80

To change Apache Tomcat port from 8080 to 80 (so that developer or user doesn't need to type :8080 at the back of the URL):

  1. Edit TOMCAT_DIR\conf\server.xml.
  2. Look for line similar to below (the keyword is connector and 8080):
    <connector connectiontimeout="20000" port="8080" protocol="HTTP/1.1" redirectport="8443"></connector>
  3. Just change 8080 to 80 and restart Tomcat.

Setup Apache Tomcat to host JSP

JSP (Java Server Page) is Java based web programming language. Similar to ASP and ASPX (and different from PHP), JSP can be compiled into classes before used in the pages. To start coding in JSP, we need to setup Apache Tomcat first. Follow the steps below:

  1. Download JDK (Java Development Kit) from Java Website. Any version will do, but if you don't have any idea, just download and install the newest version.
  2. Download Apache Tomcat from Apache Tomcat Website. Currently there are versions 4.1, 5.5 and 6.0. Either version will do, or just pick the newest version.
  3. There are 2 types of Tomcat installation file, zip and windows installer. Either type is fine, or just download the zip version. Extract the zip file to any directory.
  4. Go to the Tomcat directory that you extracted (or installed), go to bin folder and edit the startup.bat file.
  5. Add the JAVA_HOME environment variable at the beginning of the startup.bat file (after @echo off)
    set java_home=C:\Program Files\Java\jdk1.6.0_16

  6. Then you may double click the startup.bat to start Tomcat. If a command terminal is shown without disappearing, it properly means OK.
  7. To test it out, open a browser and go to localhost:8080. If something come out (not the error message of course), that means you have setup Tomcat successfully.