Saturday, November 07, 2009

Simplest RFC?

Which is the simplest RFC? Maybe this one: http://tools.ietf.org/html/rfc863

DISCARD: the server just discards all received messages.

Friday, November 06, 2009

Windows7 7 Sins

An interesting web site: http://en.windows7sins.org

Saturday, September 26, 2009

Classloaders, shared directory and endorsed directory of Tomcat 5.5 and 6.0

Tomcat 5.5 Class Loader: http://tomcat.apache.org/tomcat-5.5-doc/class-loader-howto.html
Tomcat 6.0 Class Loader: http://tomcat.apache.org/tomcat-6.0-doc/class-loader-howto.html

Tomcat 5.5

Class loader hierarchy
image  (from tomcat 5.5 document)

Class loaders:

  • Boostrap, System
  • Common:
    visible to both Tomcat internal classes and to all web applications.
    Related directories
    • classes and resources in: $CATALINA_HOME/common/classes
    • jar files in: $CATALINA_HOME/commons/endorsed, $CATALINA_HOME/commons/i18n and $CATALINA_HOME/common/lib
  • Catalina
    include all classes and resources required to implement Tomcat 5 itself. These classes and resources are TOTALLY invisible to web applications.
    Related directories:
    • classes and resources in: $CATALINA_HOME/server/classes
    • jars in: $CATALINA_HOME/server/lib
  • Shared
    Shared resources are shared across all web applications. (They are not used by Tomcat internal classes).
    Related directories
    • classes and resources in: $CATALINA_BASE/shared/classes
    • jars in: $CATALINA_BASE/shared/lib
  • WebappX
    Load web app specific resources and jars.
    Related directories
    • classes and resources: <web-app-dir>/WEB-INF/classes
    • jars: <web-app-dir>/WEB-INF/lib

Note: $CATALINA_BASE (not $CATALINA_HOME) is used class loader “Shared”.

#   CATALINA_HOME   May point at your Catalina "build" directory.
#
#   CATALINA_BASE   (Optional) Base directory for resolving dynamic portions
#                   of a Catalina installation.  If not present, resolves to
#                   the same directory that CATALINA_HOME points to.

Tomcat 6.0

Class loader hierarchy
image   (from tomcat 6.6 document)
Similar to the hierarchy in tomcat 5.5. 
The difference is that class loaders Catalina and Shared are not present in tomcat 6.6.
For Class loader Common, the related directories are different. In tomcat 6, classes, resources and jars under directory $CATALINA_HOME/lib (in tomcat 5.5, the directory is $CATALINA_HOME/common/classes, $CATALINA_HOME/common/lib, etc) are loaded by class loader Common.

These directories under which classes and resources are searched for can be changed by modifying configuration file $CATALINA_HOME/conf/catalina.properties.
Default values for class loader search directories are:

common.loader=${catalina.home}/lib,${catalina.home}/lib/*.jar
server.loader=
:shared.loader=

If you still want to use shared directory in the way specified in tomcat 5.5, you can change value of property shared.loader.
For example: shared.loader=${catalina.base}/shared/classes,${catalina.base}/shared/lib/*.jar

Endorsed directory

Tomcat 5.5

“Tomcat utilizes this mechanism by including the system property setting
-Djava.endorsed.dirs=$CATALINA_HOME/common/endorsed in the command line that starts the container. Therefore, you can replace the parser that is installed in this directory, and it will get used even on a JDK 1.4 system.”

Tomcat 6.0

Tomcat utilizes this mechanism by including the system property setting
-Djava.endorsed.dirs=$JAVA_ENDORSED_DIRS in the command line that starts the container.

Variable JAVA_ENDORSED_DIRS is specified in file setclasspath.sh: 
    JAVA_ENDORSED_DIRS="$BASEDIR"/endorsed

Variable BASEDIR is specified in file catalina.sh:
    BASEDIR="$CATALINA_HOME"

In other words,
    in tomcat 5.5, the default endorsed directory is $CATALINA_HOME/common/endorsed
    in tomcat 6.0, the default endorsed directory is $CATALINA_HOME/endorsed

Thursday, September 24, 2009

Apache ten years

Some really nice articles/interviews about Apache Software Foundation:
http://dev.day.com/microsling/content/blogs/main/apachebirthday.html
ASF highlights: 1999-2009 http://www.apache.org/press/highlights.html
Details about how ASF works: http://www.apache.org/foundation/how-it-works.html
eWeek: 11 Apache Technologies that Have Changed Computing in the Last 10 Years
http://www.eweek.com/c/a/Application-Development/11-Apache-Technologies-that-Have-Changed-Computing-in-the-Last-10-Years-469693/

Saturday, September 12, 2009

SVN: exclude some files out of version control (using svn:ignore)

Sometimes, you don’t want SVN to include all you files in the source code directory because they may be temporary files generated by developers or tools (vimcreates .swp file when a file is opened in vim).
SVN book: http://svnbook.red-bean.com/en/1.5/svn.advanced.props.special.ignore.html

Two ways

o   Global change: it is applied to all svn operations performed using the runtime configuration. In other words, it changes the configuration of svn application (not a specific directory/file under control of svn)

o   Bind configuration to a specific version tree using svn:ignore property.

o   The ignore pattern checking is applied only during adding of unversioned directories/files to svn control.
Once an object is under Subversion's control, the ignore pattern mechanisms no longer apply to it. In other words, don't expect Subversion to avoid committing changes you've made to a versioned file”

o   Its value contains a list of NEWLINE-delimited file pattern

o   They don’t override global global-ignores configuration, but append to the list

o   “the patterns found in the svn:ignore  property apply only to the directory on which that property is set, and not to any of its subdirectories.”
Use switch –R if you want to apply it recursively.

o   Usage
svn propset svn:ignore -F file-contains-ignore-patterns path-ignore-to-be-applied
Examples:
    svn propset svn:ignore -F .svn-ignore .
    #recursive. If you change the direcotry tree after this command is run,
    #you need to return following command to make the newly created directories/files controlled also by ignore pattern.
    svn -R propset svn:ignore -F .svn-ignore .   
    # edit a property

    svn propedit svn:ignore .     #edit the ignore patterns using the preconfigured editor.
Note:
  *)  If you use a file to specify ignore patterns, you must rerun the command
              "svn propset svn:ignore -F your-patter-file ."
    to make svn reread the file after the pattern file is changed.
  *)  One alternative is to use
              "svn propedit svn:ignore ."
       to edit the property configuration. Then the change you made immediately takes effect. However, the new property value will not be written back to the original pattern file. You can use command
    "svn propget svn:ignore . >  pattern-file"
to export the new value to your pattern file.

o   File Pattern
*: match any sequence of characters
?: match single character
[char-set]: match the specified char set.

o   Command “svn add”
When you use wildcards, you should be careful because it may make svn bypass the ignores check.
See http://svnbook.red-bean.com/trac/ticket/115.
Basically, “svn add * bypasses the ignores system. However, it has been fixed. So if you are using a latest svn version, it should not be a problem.
Anyway, use “svn add --force . when you can (it makes svn check the whole specified directory tree).

o   Command “svn status” won’t list ignored directories/files.
Use “svn status --no-ignore” to list status of all files including ignored ones.

Tuesday, September 08, 2009

test

Hello, worl

Thursday, August 20, 2009

test post from linux using blogtk 1.1

Thursday, July 09, 2009

Install local .deb packages

Ususally, apt-get is used to install/update/remove packages. It is preferred because it can automatically resolve package dependency.

However, sometimes you must download a .deb package file and install it from local disk. dpkg can do this task.
dpkg -i package_name_here
However, dpkg does NOT resolve package dependency. So it is likely that the installed program won't work.
You can fix it by using command
apt-get -f install

Another solution is documented here:
http://www.debian.org/doc/manuals/apt-howto/ch-basico.en.html#s-dpkg-scanpackages.
The idea is to build a tarball (Packages.gz) that can be recognized by apt tools. Then you can install the program by using apt-get command. (In other words, .deb does not contain enough information which is required by apt tools).

Resources
APT HOWTO: http://www.debian.org/doc/manuals/apt-howto/

Some linux notes about hardware inspection

PCI (Peripheral Component Interconnec)

PCI is the dominant bus standard. In linux, its device files are located at /proc/bus/pci.
Command lspci can be used to list your PCI devices. It can display <[domain id]:bus id:device id.function number> in addition to device type. You can use -v switch to get verbose information. Switch -k is useful to get corresponding kernel modules.
Resource: http://tldp.org/LDP/tlk/dd/pci.html

DMI (Desktop Management Interface)

From wiki

"Essentially, to the user, it is a table provided by the personal computer BIOS which can be parsed and which gives information about the BIOS and the computer system in a standardized way."

dmidecode is a tool on linux that can be used to get computer information (motherboard, BIOS, ...)via DMI.
DMI is part of SMBIOS.
Resources: http://en.wikipedia.org/wiki/Desktop_Management_Interface

USB

Command lsusb can be used to list your USB devices.

Resources

TLDP (The linux document project: http://en.tldp.org/)
This web site contains a lots of useful HOWTO articles. Also it has in-depth articiles to introduce internal knowledge of linux kernel. Almost every aspect of linux is included.
A great PCI article: http://tldp.org/LDP/tlk/dd/pci.html
RedHat enterprise linux 5 Release Notes
http://www.redhat.com/docs/en-US/Red_Hat_Enterprise_Linux/5.2/html/Release_Notes/singles/relnotesU2-x86.html
RedHat linux deployment guide
http://www.redhat.com/docs/manuals/enterprise/RHEL-5-manual/Deployment_Guide-en-US/index.html
Although it contains some RedHat linux specific stuff, you still can find lots of common knowledge that is shared by other linux distros.
Linux devide list
http://www.lanana.org/docs/device-list/
Linux Foundation
Its publication includes some interesting papers which can be accessed http://www.linuxfoundation.org/collaborate/publications/.

Synergy bugs - left and down keys don't repeat

I am using Synergy to share keyboard and mouse between two machines.

However, the left and down keys don't repeat. Here is the reported bug:
https://bugs.launchpad.net/ubuntu/+source/synergy/+bug/281546
Also a workaround is given (https://bugs.launchpad.net/ubuntu/+source/synergy/+bug/281546/comments/5).
The idea is basically to set the two keys 'autorepeat' using following commands:

xset r 116 #for down key
xset r 113 #for left key

You should replace with keycodes of your keyboard.
Some information about this bug is included in http://ubuntuforums.org/showthread.php?t=965393.