This article is meant for advanced programmers who is interested to know more about Tomcat; or using Tomcat for production. For novices, read "How to Install and Get Started with Tomcat".
The authoritative source of information on Tomcat is the Tomcat's documentation, available under Tomcat's "webapps\docs
" directory. You may also refer to the Java Servlet, JSP and JSF specifications, as Tomcat is the Reference Implementation for these technologies.
I shall assume that Tomcat is installed in d:\myproject\tomcat
, and shall denote this directory as <TOMCAT_HOME>
or <CATALINA_HOME>
- "Catalina" is the codename for Tomcat 5 and above.
Tomcat Architecture and Configuration
Tomcat's Installed Directory Structure
Tomcat installation provides these directories:
- bin: for Tomcat's binaries and startup scripts.
- conf: global configuration applicable to all the webapps. The default installation provides:
- One Policy File:
catalina.policy
for specifying security policy. - Two Properties Files:
catalina.properties
andlogging.properties
, - Four Configuration XML Files:
server.xml
(Tomcat main configuration file),web.xml
(global web application deployment descriptors),context.xml
(global Tomcat-specific configuration options) andtomcat-users.xml
(a database of user, password and role for authentication and access control).
conf
also contain a sub-directory for each engine, e.g.,Catalina
, which in turn contains a sub-sub-directory for each of its hosts, e.g.,localhost
. You can place the host-specific context information (similar tocontext.xml
, but named aswebapp
.xml
for each webapp under the host). - One Policy File:
- lib: Keeps the JAR-file that are available to all webapps. The default installation include
servlet-api.jar
(Servlet),jasper.jar
(JSP) andjasper-el.jar
(EL). You may also keep the JAR files of external package here, such as MySQL JDBC driver (mysql-connector-java-5.1.{xx}-bin.jar
) and JSTL (jstl.jar
andstandard.jar
). - logs: contains the engine logfile
Catalina.{yyyy-mm-dd}.log
, host logfilelocalhost.{yyyy-mm-dd}.log
, and other application logfiles such asmanger
andhost-manager
. The access log (created by theAccessLogValve
) is also kept here. - webapps: the default
appBase
- web applications base directory of the hostlocalhost
. - work: contains the translated servlet source files and classes of JSP/JSF. Organized in hierarchy of engine name (
Catalina
), host name (localhost
), webapp name, followed by the Java classes package structure. - temp: temporary files.
Tomcat Architecture
Tomcat is an HTTP server. Tomcat is also a servlet container that can execute Java Servlet, and converting JavaServer Pages (JSP) and JavaServerFaces (JSF) to Java Servlet. Tomcat employs a hierarchical and modular architecture as illustrated:
Main Configuration File "server.xml"
Tomcat's main configuration file is the "server.xml
", kept under the <CATALINA_HOME>\conf
directory. The default "server.xml
" is reproduced as follows (after removing the comments and minor touch-ups):
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 |
<?xml version='1.0' encoding='utf-8'?> <Server port="8005" shutdown="SHUTDOWN"> <Listener className="org.apache.catalina.core.JasperListener" /> <Listener className="org.apache.catalina.core.AprLifecycleListener" SSLEngine="on" /> <Listener className="org.apache.catalina.core.JreMemoryLeakPreventionListener" /> <Listener className="org.apache.catalina.mbeans.GlobalResourcesLifecycleListener" /> <Listener className="org.apache.catalina.core.ThreadLocalLeakPreventionListener" /> <GlobalNamingResources> <Resource name="UserDatabase" auth="Container" type="org.apache.catalina.UserDatabase" description="User database that can be updated and saved" factory="org.apache.catalina.users.MemoryUserDatabaseFactory" pathname="conf/tomcat-users.xml" /> </GlobalNamingResources> <Service name="Catalina"> <Connector port="8080" protocol="HTTP/1.1" connectionTimeout="20000" redirectPort="8443" /> <Connector port="8009" protocol="AJP/1.3" redirectPort="8443" /> <Engine name="Catalina" defaultHost="localhost"> <Realm className="org.apache.catalina.realm.LockOutRealm"> <Realm className="org.apache.catalina.realm.UserDatabaseRealm" resourceName="UserDatabase"/> </Realm> <Host name="localhost" appBase="webapps" unpackWARs="true" autoDeploy="true"> <Valve className="org.apache.catalina.valves.AccessLogValve" directory="logs" prefix="localhost_access_log." suffix=".txt" pattern="%h %l %u %t "%r" %s %b" /> </Host> </Engine> </Service> </Server> |
Server
Server
(Line 2) is top component, representing an instance of Tomcat.It can contains one or more Services
, each with its own Engines
and Connectors
.
<Server port="8005" shutdown="SHUTDOWN"> ...... </Server>
Listeners
The Server
contains several Listeners
(Lines 3-7). A Listener
listens and responses to specific events.
- The
JasperListener
enables theJasper
JSP engine, and is responsible for re-compiling the JSP pages that have been updated.<Listener className="org.apache.catalina.core.JasperListener" />
- The
GlobalResourcesLifecycleListener
enables the global resources, and makes possible the use of JNDI for accessing resources such as databases.<Listener className="org.apache.catalina.mbeans.GlobalResourcesLifecycleListener" />
Global Naming Resources
The <GlobalNamingResources>
element (Line 9-15) defines the JNDI (Java Naming and Directory Interface) resources, that allows Java software clients to discover and look up data and objects via a name.
The default configuration defines a JNDI name called UserDatabase
via the <Resource>
element (Line 10-14), which is a memory-based database for user authentication loaded from "conf/tomcat-users.xml
".
<GlobalNamingResources> <Resource name="UserDatabase" auth="Container" type="org.apache.catalina.UserDatabase" description="User database that can be updated and saved" factory="org.apache.catalina.users.MemoryUserDatabaseFactory" pathname="conf/tomcat-users.xml" /> </GlobalNamingResources>
You can define other global resource JNDI such as MySQL database to implement connection pooling.
Services
A Service
associates one or more Connectors
to a Engine
. The default configuration defines a Service
called "Catalina
", and associates two Connectors
: HTTP and AJP to the Engine
.
<Service name="Catalina"> ...... </Service>
Connectors
A Connector
is associated with a TCP port to handle communications between the Service
and the clients. The default configuration defines two Connectors
:
- HTTP/1.1: Handle HTTP communication and enable Tomcat to be an HTTP server. Clients can issue HTTP requests to the server via this
Connector
, and receive the HTTP response messages.<Connector port="8080" protocol="HTTP/1.1" connectionTimeout="20000" redirectPort="8443" />
The default chooses TCP port 8080 to run the Tomcat HTTP server, which is different from the default port number of 80 for HTTP production server. You can choose any number between 1024 to 65535, which is not used by any application, to run your Tomcat server.
TheconnectionTimeout
attribute define the number of milliseconds thisconnector
will wait, after accepting a connection, for the request URI line (request message) to be presented. The default is 20 seconds.
Theredirect
attribute re-directs the SSL requests to TCP port 8443. - AJP/1.3: Apache JServ Protocol
connector
to handle communication between Tomcat server and Apache HTTP server.<Connector port="8009" protocol="AJP/1.3" redirectPort="8443" />
You could run Tomcat and Apache HTTP servers together, and let the Apache HTTP server handles static requests and PHP; while Tomcat server handles the Java Servlet/JSP. Read "How To Configure Tomcat to work with Apache".
Containers
Tomcat refers to Engine
, Host
, Context
, and Cluster
, as container. The highest-level is Engine
; while the lowest-level is Context
. Certain components, such as Realm
and Valve
, can be placed in a container.
Engine
A Engine
is the highest-level of a container. It can contains one or more Hosts
. You could configure a Tomcat server to run on several hostnames, known as virtual host.
<Engine name="Catalina" defaultHost="localhost">
The Catalina Engine
receives HTTP requests from the HTTP connector, and direct them to the correct host based on the hostname/IP address in the request header.
Realm
A Realm
is a database of user, password, and role for authentication (i.e., access control). You can define Realm
for any container, such as Engine
, Host
, and Context
, and Cluster
.
<Realm className="org.apache.catalina.realm.LockOutRealm"> <Realm className="org.apache.catalina.realm.UserDatabaseRealm" resourceName="UserDatabase"/> </Realm>
The default configuration defines a Realm
(UserDatabaseRealm
) for the Catalina Engine
, to perform user authentication for accessing this engine. It uses the JNDI name UserDatabase
defined in the GlobalNamingResources
.
Besides the UserDatabaseRealm
, there are: JDBCRealm
(for authenticating users to connect to a relational database via the JDBC driver); DataSourceRealm
(to connect to a DataSource
via JNDI; JNDIRealm
(to connect to an LDAP directory); and MemoryRealm
(to load an XML file in memory).
Hosts
A Host
defines a virtual host under the Engine
, which can in turn support many Contexts
(webapps).
<Host name="localhost" appBase="webapps" unpackWARs="true" autoDeploy="true">
The default configuration define one host called localhost
. The appBase
attribute defines the base directory of all the webapps, in this case, <CATALINA_HOME>\webapps
. By default, each webapp's URL is the same as its directory name. For example, the default Tomcat installation provides four webapps: docs
, examples
, host-manager
and manager
under the webapps
directory. The only exception is ROOT, which is identified by an empty string. That is, its URL is http://localhost:8080/
.
The unpackWARs
specifies whether WAR-file dropped into the webapps
directory shall be unzipped. For unpackWARs="false"
, Tomcat will run the application from the WAR-file directly, without unpacking, which could mean slower execution.
The autoDeploy
attribute specifies whether to deploy application dropped into the webapps
directory automatically.
Cluster
Tomcat supports server clustering. It can replicate sessions and context attributes across the clustered server. It can also deploy a WAR-file on all the cluster.
Valve
A Valve
can intercept HTTP requests before forwarding them to the applications, for pre-processing the requests. A Valve
can be defined for any container, such as Engine
, Host
, and Context
, and Cluster
.
In the default configuration, the AccessLogValve
intercepts an HTTP request and creates a log entry in the log file, as follows:
<Valve className="org.apache.catalina.valves.AccessLogValve" directory="logs" prefix="localhost_access_log." suffix=".txt" pattern="%h %l %u %t "%r" %s %b" />
Other valves include:
RemoteAddrValve
: which blocks requests from certain IP addresses,RemoteHostValve
: which blocks request based on hostnames,RequestDumperValve
: which logs details of the requests,SingleSignOn
Valve: when placed under a<host>
, allows single sign-on to access all the webapp under the host.
Other Configuration Files: web.xml, context.xml, tomcat-users.xml
[TODO]
They are so many things that you can configured in Tomcat. I describe some of the configurations that I found useful in this section.
Enabling Directory Listing
When the request URL refers to a directory instead of a file, e.g., http://host:port/hello/
, you can configure Tomcat to serve the directory listing, or a welcome file, or issue error "404 Page Not Found". Enabling directory listing is handy for test server but NOT desire for production server (as it reveal the directory structure and expose the entire directory hierarchy).
Enabling Directory Listing for ALL Webapps
To enable directory listing for all the web applications, you could modify the <CATALINA_HOME>\conf\web.xml
, by changing "listings
" from "false
" to "true
" for the "default
" servlet, as follows:
<!-- The default servlet for all web applications, that serves static --> <!-- resources. It processes all requests that are not mapped to other --> <!-- servlets with servlet mappings. --> <servlet> <servlet-name>default</servlet-name> <servlet-class>org.apache.catalina.servlets.DefaultServlet</servlet-class> <init-param> <param-name>debug</param-name> <param-value>0</param-value> </init-param> <init-param> <param-name>listings</param-name> <param-value>true</param-value> </init-param> <load-on-startup>1</load-on-startup> </servlet> <!-- The mapping for the default servlet --> <servlet-mapping> <servlet-name>default</servlet-name> <url-pattern>/</url-pattern> </servlet-mapping> <!-- ==================== Default Welcome File List ===================== --> <!-- When a request URI refers to a directory, the default servlet looks --> <!-- for a "welcome file" within that directory and, if present, --> <!-- to the corresponding resource URI for display. If no welcome file --> <!-- is present, the default servlet either serves a directory listing, --> <!-- or returns a 404 status, depending on how it is configured. --> <welcome-file-list> <welcome-file>index.html</welcome-file> <welcome-file>index.htm</welcome-file> <welcome-file>index.jsp</welcome-file> </welcome-file-list>
The above configuration maps URL "\
" (root directory of the web context) (in <url-pattern>
) to Java class DefaultServlet
(in <servlet-class>
) via the common servlet name of default
(in <servlet-name>
). We enable directory listing by changing the servlet's initialization parameter listings
to true
.
If a user requests for a directory, and the directory listing is enabled and it contains one of the files in the <welcome-file>
list, the welcome file will be served; otherwise, the directory listing will be served. On the other hand, if a directory request is received and the directory listing is not enabled, the server returns an error "404 Page Not Found".
Enabling Directory Listing for a particular Webapp
If you wish to allow directory listing of a particular web application only, you could disable the directory listing in "<CATALINA_HOME>\conf\web.xml
" globally, and define the following <servlet>
and <servlet-mapping>
in your application-specific WEB-INF\web.xml
, as follows. You need to use another <servlet-name>
in place of DefaultServlet
.
<servlet> <servlet-name>DirectoryListing</servlet-name> <servlet-class>org.apache.catalina.servlets.DefaultServlet</servlet-class> <init-param> <param-name>debug</param-name> <param-value>0</param-value> </init-param> <init-param> <param-name>listings</param-name> <param-value>true</param-value> </init-param> </servlet> <servlet-mapping> <servlet-name>DirectoryListing</servlet-name> <url-pattern>/</url-pattern> </servlet-mapping>
Automatic Servlet Reload
To enable automatic servlet reload (whenever a servlet is re-compiled), you need to specify <Context reloadable="true">...</Context>
, in "<CATALINA_HOME>\conf\context.xml
" for all web applications, or the <Context>
element in "<CATALINA_HOME>\conf\server.xml
" for a particular web application.
The following messages appear on the Tomcat's console if you re-compile a servlet:
XXX X, XXXX XX:XX:XX XX org.apache.catalina.core.StandardContext reload INFO: Reloading Context with path [/hello] has started XXX X, XXXX XX:XX:XX XX org.apache.catalina.core.StandardContext reload INFO: Reloading Context with path [/hello] is completed
Enabling automatic servlet reload is handy during application development, but it requires significant runtime overhead to listen to the changes, and is not recommended for production systems. Instead, you could use the "manager
" to trigger reloads on demand.
Setting the Context Root Directory and Request URL of a Webapp
A server could run many web applications. A webapp is also called a web context. The context root (or document base directory) refers to the base directory of a webapp. They are a few ways to configure a context root and its request URL of a webapp:
- (RECOMMENDED) Create a directory under
<CATALINA_HOME>\webapps
for your webapp. A context will be created with request URL set to the name of the directory. For example, if you create a directory called "hello
" under Tomcat's "webapps
". This application can be accessed by web users via URLhttp://host:port/hello
.
To change the request URL of the webapp, create a "context.xml
" configuration file, as follows, and place it under "ContextRoot
\META-INF
":<Context path="/yourURLPath" />
- Alternatively, you can write a
<Context>
element in<CATALINA_HOME>\conf\server.xml
, under the<Host>
element. You can specify both the URL and the base directory. For example,...... ...... <Context path="/ws" docBase="d:/workshop" reloadable="true"> </Context> </Host> </Engine> </Service> </Server>
In the above example, we define a web context with URL "/ws
", with context root (docBase
or document base directory) at "d:\workshop
". This application can be accessed via URLhttp://host:port/ws
.
Take note that:- The configuration creates a mapping from the "URL Path" issued by the web users to the "document base directory" in the server's file system, where you store your webapp resources.
- Place the
<Context>
element before the ending tag of the<Host>
element. - Use Unix-style forward slash
'/'
as the directory separator in the configuration file, instead of Window-style back slash'\'
. - The attribute
reloadable="true"
asks Tomcat to monitor your servlets for changes, and automatically reload the servlets if changes is detected. This is handy for a development system, but inefficient in a production system.
- Write a configuration file with a
<Context>
element and place it under Tomcat's "conf\Catalina\localhost
". For example, suppose we wish to create a webapp with URL "hello
" in base directory "d:\myproject\myHello
", create the following file "hello.xml
":<?xml version="1.0" encoding="UTF-8"?> <Context docBase="D:\myproject\myHello" path="/hello" />
Changing the Default "webapps" Directory
The default directory for deploying web applications is <CATALINA_HOME>\webapps
. You could change the default by modifying the configuration file "conf\server.xml"
<Host>
element's "appBase
" attribute as follows:
<Host name="localhost" appBase="webapps" unpackWARs="true" autoDeploy="true" xmlValidation="false" xmlNamespaceAware="false"> ...... </host>
Deploying Webapps
A web context is a single web application (webapp). It is the lowest-level container, that you can define components such as Realm
and Valve
. By default, all webapps are kept under the <CATALINA_HOME>\webapps
directory (as configured in the <host>
element appBase
attribute.
A Java webapp may contain many types of files, such as HTML, CSS, Scripts, images, JSP, servlet, utility classes, external library jar-files. A Java webapp must follow a strict directory structure as depicted in the Servlet/JSP specifications. This enables deployment in a Java-capable web server (such as Apache Tomcat and Glassfish). The resources must be kept in the correct directories and sub-directories.
The URL of a webapp, by default, is the same as the base directory name (or context root) of the webapp.
Webapp's Directory Structure
The directory structure of a webapp is as follows:
- "
ContextRoot
": contains the resources that are visible and accessible by the web clients, such as HTML, CSS, Scripts and images. These resources will be delivered to the clients as it is. You could create sub-directories such asimages
,css
andscripts
, to further categories the various resources. - "
ContextRoot\WEB-INF
": This directory, although under the context root, is NOT visible to the web users. In other words, it is NOT accessible by the clients directly (for security reason). This is where you keep your application-specific configuration files such as "web.xml
". It's sub-directories contain program classes, source files, and libraries. - "
ContextRoot\WEB-INF\src
": Keeps the Java program source files. It is optional but a good practice to separate the source files and classes to facilitate deployment. - "
ContextRoot\WEB-INF\classes
": Keeps the Java classes (compiled from the source codes). Classes defined in packages must be kept according to the Java package directory structure. - "
ContextRoot\WEB-INF\lib
": Keeps the libraries (jar-files), which are provided by other packages, specific and available to this webapp only. - "
ContextRoot\META-INF\
": This is also a hidden directory, to keep resources and configurations (e.g., "context.xml
") related to the server. In contrast, "WEB-INF
" is for resources related to this web application, independent of the server.
Webapp-Specific Configuration Files
These are the configuration files specific to a webapp: (a) WEB-INF\web.xml
; (b) META-INF\context.xml
.
You can configure a webapp in many ways: (a) Write a <context>
element in server.xml
under <Host>
element, (b) contextRoot\META-INF\context.xml
, and (c) conf\Catalina\localhost\webapp.xml
, and (d) conf\context.xml
. See "Setting the Context Root Directory and Request URL of a Webapp".
Web Application Deployment Descriptors - "web.xml"
The "web.xml
" contains the deployment descriptors. There are two sets of web.xml
:
<CATALINA_HOME>\conf\web.xml
: applicable to ALL webapps.ContextRoot\WEB-INF\web.xml
: applicable to the specific web context. It overrides the global setting, if any.
The complete specification for "web.xml
" can be found in the "Java Servlet Specification" under "Deployment Descriptor".
A sample configuration of a servlet with most of its sub-elements is as follows:
<web-app ......> ...... <servlet> <icon> <small-icon>/images/icon.jpg</small-icon> </icon> <servlet-name>MyServlat</servlet-name> <display-name>My Servlet Display Name</display-name> <description>My Testing Servlet long description</description> <servlet-class>MyServletClassname</servlet-class> <init-param> <param-name>myParmName</param-name> <param-value>myParmValue</param-value> </init-param> <load-on-startup>25</load-on-startup> </servlet> ...... <servlet-mapping> <servlet-name>MyServlat</servlet-name> <url-pattern>/sayhello</url-pattern> </servlet-mapping> ...... </web-app>
Deploying a Web Application in a WAR file
You could use the JDK's jar
utility to "zip" up all the files of a web application to produce a so-called WAR (Web Application Archive) file for deployment, or distribution.
.... Change current directory to the web application's context root contextRoot> jar cvf test.war .
Drop the test.war
into <CATALINA_HOME>\webapps
. A context called test
will be created automatically. You can access the web application via URL http://host:port/test
.
Tomcat actually unpacks the test.war
into a "test
" directory in <CATALINA_HOME>\webapps
. You need to remove this directory, if you reload a new version.
Running Tomcat
Tomcat's Manager
References:
- "Tomcat Web Application Manager How To" @ "webapps/docs/html-manager-howto.html".
- "Tomcat Manager App How-To" @ "webapps/docs/manager-howto.html".
Tomcat "manager
" webapp allows you to deploy a new web application; start, stop, reload or un-deploy an existing one, without having to shut down and restart the server, in a production environment.
To enable Tomcat's manager
, edit "<CATALINA_HOME>\conf\tomcat-users.xml
" to include a role called "manager-gui
" and a user with this role. You may also assign other roles, such as admin-gui
for accessing the Tomcat "Host Manager".
<role rolename="manager-gui" /> <role rolename="manager-status" /> <role rolename="manager-script" /> <role rolename="manager-jmx" /> <role rolename="admin-gui" /> <role rolename="admin-script" /> <user username="mymanager" password="xxxx" roles="manager-gui, admin-gui"/>
To invoke manager web application, use http://localhost:8080/manager/html
. You can use Tomcat's manager to:
- List all webapps.
- Start/Stop/Reload a particular webapp.
- Deploy a new webapp remotely, and undeploy a webapp without restarting the container.
- Terminate (or Invalidate) sessions - a session has a pre-set expiry time (e.g., 30 sec).
- Analyze memory leaks.
- View JVM status and Server status.
Tomcat 7 provides separate manager roles for the GUI (manager-gui
), status (manager-status
), scripting (manager-script
) and JMX proxy (manager-jmx
), defined in "webapps/manager/WEB-INF/web.xml
". This allows for fine-grained access control to management tasks.
manager-gui
- Access to the HTML "web" interface, via:http://{host}:{port}/manager/html
manager-status
- Access to the "Server Status" page only, via:http://{host}:{port}/manager/status
manager-script
- Access to the "plain-text" interface, and to the "Server Status" page, via command in the form of:http://{host}:{port}/manager/text/{command}?{parameters} // Examples http://{host}:{port}/manager/text/list // List all webapps http://{host}:{port}/manager/text/deploy?path=/testapp // Deploy webapp
manager-jmx
- Access to JMX proxy interface and to the "Server Status" page, via:http://{host}:{port}/manager/jmxproxy/?{command}={parameter}
For security reason, a user should NOT be given more than one of the following roles: manager-gui
, manager-script
, and manager-jmx
.
Tomcat's "Administration Tool"
The Tomcat "Adminstrative Tool" (or "Administrator Console") has been removed since Tomcat 6. Use JMX manager instead.
Automatic Startup at Boot-time
(Windows) Running Tomcat as a Windows Service
You need to download the Windows-specific version of Tomcat (from Tomcat's download, choose 32-bit or 64-bit Windows' zip version, e.g., apache-tomcat-7.0.{xx}-windows-x86.zip
).
Read "Windows service How-To" in the Tomcat documentation (<CATALINA_HOME>\webapps\docs\windows-service-howto.html
).
In a production environment, it is more convenient to run Tomcat as a service, so that it can start automatically whenever the system is started (or re-start automatically after an unexpected interruption).
To install Tomcat as a service, start a CMD shell (with administrator right) and run the <CATALINA_HOME>\bin\service.bat
with install
option:
... Change directory to <CATALINA_HOME>\bin ...
<CATALINA_HOME>\bin> service install
Installing the service 'Tomcat7' ...
......
The service 'Tomcat7' has been installed.
The Tomcat service called "Apache Tomcat 7" is installed and will start automatically whenever the system is started. Check the "Services" under "Control Panel" ⇒ "Administrative Tools".
A GUI application called Tomcat7w
is available for monitoring and configuring Tomcat services. Launch Tomcat7w
:
<CATALINA_HOME>\bin> Tomcat7w
You could put the Tomcat icon in the system tray via the MS (Monitor Service) option:
<CATALINA_HOME>\bin> Tomcat7w //MS//
You can start/stop the Tomcat service now via:
Tomcat7w
;- "Control Panel" ⇒ "Administrator Tools" ⇒ "Services" ⇒ "Apache Tomcat 7" ⇒ "Start";
- From CMD shell, Issue "
net
" command:prompt> net start tomcat7 The Apache Tomcat 7 service is starting.. The Apache Tomcat 7 service was started successfully. ...... ...... prompt> net stop tomcat7 The Apache Tomcat 7 service is stopping.. The Apache Tomcat 7 service was stopped successfully.
To uninstall Tomcat Service, run the <CATALINA_HOME>\bin\service.bat
with remove
option:
<CATALINA_HOME>\bin> service remove The service 'Tomcat7' has been removed
You can also use Microsoft Management Console (MMC) to manage the services: Go to "Start" ⇒ ⇒ Run ⇒ enter "services.msc
".
A flip side of running Tomcat as a service is you need to read the error messages from <CATALINA_HOME>\logs
instead of the Tomcat console.
(Linux and Mac OS) Automatic Startup on Reboots
To start Tomcat automatically when the machine boots up, you need to create a init script in /etc/init.d
, e.g., /etc/init.d/tomcat
, as follows:
#!/bin/sh # Tomcat init script for Linux. # JAVA_HOME={path-to-java-installed-directory} CATALINA_HOME={path-to-Tomat-installed-directgory} export JAVA_HOME CATALINA_HOME exec $CATALINA_HOME/bin/catalina.sh $*
Save the script as "tomcat
" in /etc/init.d
.
$ cd /etc/init.d $ sudo chown root.root tomcat // change owner to user root, group root $ sudo chmod 755 tomcat // change mode u+rwx, g+rx, a+rx
You can start|stop|restart Tomcat via:
$ service tomcat start|stop|restart
Tomcat's Startup Script
To start tomcat server, you could invoke the batch file "startup.bat
" (for Windows) or "startup.sh
" (for Linux/Mac) (in directory "<CATALINA_HOME>\bin
", where <CATALINA_HOME>
refers to the Tomcat installed directory). The "startup.bat|startup.sh
" invokes "catalina.bat start|catalina.sh start
".
Alternatively, you could call the "catalina.bat|catalina.sh
" directly, which provides more options of starting Tomcat. Enter "catalina
" to view the options:
<CATALINA_HOME>/bin> catalina Using CATALINA_BASE: D:\xxx\tomcat7.0.{xx} Using CATALINA_HOME: D:\xxx\tomcat7.0.{xx} Using CATALINA_TMPDIR: D:\xxx\tomcat7.0.{xx}\temp Using JRE_HOME: d:\xxx\jdk1.6 Usage: catalina ( commands ... ) commands: debug Start Catalina in a debugger debug -security Debug Catalina with a security manager jpda start Start Catalina under JPDA debugger run Start Catalina in the current window run -security Start in the current window with security manager start Start Catalina in a separate window start -security Start in a separate window with security manager stop Stop Catalina configtest Run a basic syntax check on server.xml version What version of tomcat are you running?
Study the source codes of "catalina.bat|catalina.sh
". Take note that the environment variable JAVA_HOME
is needed in this script.
The other scripts provided are:
shutdown.bat|shutdown.sh
: for shuting down the Tomcat server.configtest.bat|configtest.sh
: for checking the configuration fileserver.xml
, same as"catalina configtest
".version.bat|version.sh
: for displaying the versions, same as "catalina version
".digest.bat|digest.sh
: making password hash and encrypting password.- Internal used:
setclasspath.bat|setclasspath.sh
,cpappend.bat
(classpath append),tool-wrapper.bat|tool-wrapper.sh
,daemon.sh
.
Security
Realm and User Authentication in Tomcat
References:
- "Realm Configuration HOW-TO" (@ "
<CATALINA_HOME>\webapps\docs\realm-howto.html
"). - "Java EE 5 Tutorial", Part IV "Services", Chapters 28-30 on Security.
In Information Security:
- Access control deals with identifying which resources require protection, and which users (roles) are authorized to access the protected resources.
- Authentication deals with verifying users' credential, i.e., ensuring the user is "who he said he is". User's credential is typically provided in the form of username/password and possibly IP address (hostname). Other means include biometrics (finger-print, face recognition, retina) and digital certificates.
- Confidentiality deals with the encryption of the transmitted data over the network. This is often carried out via employing HTTP over SSL (Secure Socket Layer), known as HTTPS.
- Message Integrity ensures that messages are not tempered during transmission. This is done via message digest or hash.
- Non-repudiation: If he/she has sent a message, he/she cannot deny. This is done via digital certificate and public/private keys.
Security can be managed by the webapps themselves (called application-managed security) or via the Tomcat container (called container-managed security). In container-managed security, security is handled by the server. The server-side programs (servlets, JSPs) do not need any security-aware code. That is, the security control is totally transparent to the server-side programs. This section shall deal with container-managed security for access control and authentication.
In Tomcat, a user is identified via username/password. A user is assigned role(s) (e.g., manager, admin, user, etc). Tomcat grants access for webapps to role(s), instead of individual users.
A realm is a collection of usernames/passwords and roles. Tomcat supports the following types of realms:
UserDatabaseRealm
: kept in a XML file "conf\tomcat-users.xml
", accessed via JDNI (Java Naming and Directory Interface).JDBCRealm
: kept in a relational database such as MySQL, accessed via JDBC.- others:
JNDIRealm
(uses LDAP directory),JAASRealm
(Java Authentication and Authorization Service).
You can used the <realm>
element to configure a realm in "conf\server.xml
". <realm>
element can be placed in <engine>
, <host>
, or <context>
, which determines the scope of the realm: all virtual hosts under the engine, a particular host, or a particular web application.
UserDatabaseRealm
UserDatabaseRealm
stores user information in a XML file and accessed via JNDI (Java Naming and Directory Interface). By default, the XML file is "<CATALINA_HOME>\conf\tomcat-users.xml
". UserDatabaseRealm
is loaded into memory from the specified file, and kept in memory until
Tomcat is shut down.
Tomcat provide a JSP example called "FORM Authentication" (@ http://localhost:8080/examples/jsp/security/protected/index.jsp"), which uses UserDatabaseRealm
. Let us study this example. But before we get into the codes, let's look at the Tomcat's configurations.
"conf\server.xml"
You can specify the type of realm to be used via <Realm>
element in server.xml
. In this case, UserDatabaseRealm
. The <Realm>
is defined within the <Engine>
elements, and thus applicable to all the virtual hosts and webapps, under this server.
To specify the file used in UserDatabaseRealm
, a JDNI resource named "UserDatabase
" is defined, which maps to the file "conf\tomcat-users.xml
".
<Server ...... > <!-- Global JNDI resources --> <GlobalNamingResources> <!-- Editable user database that can also be used by UserDatabaseRealm to authenticate users --> <Resource name="UserDatabase" auth="Container" type="org.apache.catalina.UserDatabase" description="User database that can be updated and saved" factory="org.apache.catalina.users.MemoryUserDatabaseFactory" pathname="conf/tomcat-users.xml" /> </GlobalNamingResources> <Service name="Catalina"> <Engine name="Catalina" defaultHost="localhost"> <!-- Use the LockOutRealm to prevent attempts to guess user passwords via a brute-force attack --> <Realm className="org.apache.catalina.realm.LockOutRealm"> <Realm className="org.apache.catalina.realm.UserDatabaseRealm" resourceName="UserDatabase" /> </Realm> <Host name="localhost" ...... ...... </Host> </Engine> </Service> </Server>
"conf\tomcat-users.xml"
Recall that a user is identified via username/password. A user is assigned role(s). Accesses for web applications are granted to role(s) instead of individual users. "Tomcat-users.xml
" contains the following roles and username/password, but commented-out. Uncomment them for testing the example. Two roles, tomcat
and role1
, and three users, tomcat
, role1
and both
are defined.
<?xml version="1.0" encoding="ISO-8859-1" ?> <tomcat-users> <role rolename="tomcat" /> <role rolename="role1" /> <user username="tomcat" password="tomcat" roles="tomcat" /> <user username="both" password="tomcat" roles="tomcat,role1" /> <user username="role1" password="tomcat" roles="role1" /> </tomcat-users>
Take note that the passwords are stored in clear text, which is not really desirable.
"ContextRoot\WEB-INF\web.xml"
For Tomcat's webapp called "examples
", the security roles are defined using <security-constraint>
element in "webapps\examples\WEB-INF\web.xml
" as follows. The URL patterns /jsp/security/protected/*
are accessible by users having roles of tomcat
and role1
only.
<web-app ......> ...... <security-constraint> <display-name>Example Security Constraint</display-name> <web-resource-collection> <web-resource-name>Protected Area</web-resource-name> <!-- Define the context-relative URL(s) to be protected --> <url-pattern>/jsp/security/protected/*</url-pattern> <!-- If you list http methods, only those methods are protected --> <http-method>DELETE</http-method> <http-method>GET</http-method> <http-method>POST</http-method> <http-method>PUT</http-method> </web-resource-collection> <auth-constraint> <!-- Anyone with one of the listed roles may access this area --> <role-name>tomcat</role-name> <role-name>role1</role-name> </auth-constraint> </security-constraint> <!-- Default login configuration uses form-based authentication --> <login-config> <auth-method>FORM</auth-method> <realm-name>Example Form-Based Authentication Area</realm-name> <form-login-config> <form-login-page>/jsp/security/protected/login.jsp</form-login-page> <form-error-page>/jsp/security/protected/error.jsp</form-error-page> </form-login-config> </login-config> <!-- Security roles referenced by this web application --> <security-role> <role-name>role1</role-name> </security-role> <security-role> <role-name>tomcat</role-name> </security-role>
HTML FORM-based Authentication Method
The example uses HTML FORM-based authentication method, defined in element <login-config>
. All accesses to the protected URLs (http://localhost:8080/examples/jsp/security/protected/*
) will be redirected to the login.jsp
page (defined in <form-login-page>
), which prompts user for the credential. For example, if a user requests for http://localhost:8080/examples/jsp/security/protected/index.jsp
, the login.jsp
will be displayed.
The login.jsp
page contain a html <form>
(thus called FORM-based authentication):
<html> <head><title>Login Page for Examples</title></head> <body> <form method="POST" action='<%= response.encodeURL("j_security_check") %>' > Username:<input type="text" name="j_username"> Password:<input type="password" name="j_password"> <input type="submit" value="Log In"> </form> </body> </html>
The login page submits the username and password in parameters j_username
and j_password
to j_security_check
. <input type="password" ...>
is used for password text field, which displays the password as *'s. The response.encodeURL(URL)
encodes the URL j_security_check
by including the session ID if URL-rewriting is used for session tracking; it returns the URL unchanged if cookie is used. For robust session tracking, all URLs emitted by server-side programs (servlet/JSP) should be run through this method.
If login fails, user will be redirected to error.jsp
page, as follows,
<html>
<head><title>Error Page For Examples</title></head>
<body>
Invalid username and/or password, please try again
<a href='<%= response.encodeURL("index.jsp") %>'>again</a>.
</body>
</html>
If login succeeds, the user will get the page he requested for. Study the "examples\jsp\security\protected\index.jsp
" source.
- To logoff, terminate the current session via
session.invalidate()
. - You can use
request.getRemoteUser()
to get the authenticated login username;request.getUserPrincipal()
to get ajava.security.Principal
object containing the name of the current authenticated user;request.isUserInRole(role)
to check if the authenticated user is included in the specifiedrole
.
HTTPS
In FORM-based authentication, the username/password are sent in clear text, and susceptible to eavesdropping. Hence, it is important to encrypt the transport by turning on SSL (HTTPS). Read "Tomcat with SSL" on how to setup Tomcat with SSL.
To enforce user to use secure transport (HTTPS), add a <transport-guarantee>CONFIDENTIAL</transport-guarantee>
, inside the <security-constraint>
, as follows:
<security-constraint> <display-name>Example Security Constraint</display-name> <web-resource-collection> <web-resource-name>Protected Area</web-resource-name> <url-pattern>/jsp/security/protected/*</url-pattern> ...... </web-resource-collection> <auth-constraint> <role-name>tomcat</role-name> ...... </auth-constraint> <!-- must use SSL for secure transport --> <user-data-constraint> <transport-guarantee>CONFIDENTIAL</transport-guarantee> </user-data-constraint> </security-constraint>
All accesses to HTTP at port 8080 (e.g., http://localhost:8080/examples/jsp/security/protected/index.jsp) will be redirected to HTTPS at port 8443 (e.g., https://localhost:8443/examples/jsp/security/protected/index.jsp).
HTTP BASIC Authentication
HTTP defines two access authentication schemes to request for username/password: Basic and Digest. Read "HTTP Authentication".
To use BASIC authentication, change the <login-config>
's <auth-method>
to BASIC
.
<login-config> <auth-method>BASIC</auth-method> <realm-name>Basic Authentication Area</realm-name> <!-- Removed, no applicable for BASIC authentication <form-login-config> <form-login-page>/jsp/security/protected/login.jsp</form-login-page> <form-error-page>/jsp/security/protected/error.jsp</form-error-page> </form-login-config> --> </login-config>
In BASIC authentication, Tomcat uses the HTTP Basic Authentication to ask for username and password. Try http://localhost:8080/examples/jsp/security/protected/index.jsp
, you will be prompted for username/password automatically. There is no redirect to login.jsp
and no need to write the login.jsp
.
Again, the HTTP Basic Authentication sends the username and password in clear text (password is encoded in Base64, but not encrypted). It is totally insecure, unless you use a secure transport (HTTPS) or VPN (Virtual Private Network).
The Tomcat's webapp manager
(under webapps/manager
) uses BASIC authentication.
HTTP DIGEST Authentication
To use DIGEST authentation, change the <login-config>
's <auth-method>
to DIGEST
. In DIGEST authentication, Tomcat uses HTTP Digest Authentication Scheme to ask for username/password. Instead of sending password in clear text, the digest of password is send to the server. Although DIGEST authentication is more secure than BASIC authentication, HTTPS is much more secure.
<login-config>
<auth-method>DIGEST</auth-method>
<realm-name>Digest Authentication Area</realm-name>
</login-config>
JDBCRealm
UserDatabaseRealm
is not meant for serious production environment, as it is hard to maintain. JDBCRealm
is more appropriate.
In JDBCRealm
, user information is kept in a relational database, such as MySQL, accessed via JDBC, instead of an XML file. The information can be secured thruough proper database security.
Setting up Database
We shall set up our user database in MySQL. Read "How to Install MySQL and Get Started" if you are new to MySQL.
The following script can be used to set up the user database. Two tables are required: a users
table containing username and password, and a user_roles
containing username and the role assigned.
create database tomcat_users; use tomcat_users; create table users ( username varchar(15) not null, password varchar(15) not null, primary key (username) ); create table user_roles ( username varchar(15) not null, role varchar(15) not null, primary key (username, role) ); insert into users values ('tomcat', 'tomcat'), ('both', 'tomcat'), ('role1', 'tomcat'); insert into user_roles values ('tomcat', 'tomcat'), ('role1', 'role1'), ('both', 'tomcat'), ('both', 'role1');
JDBC Driver
Next, copy the MySQL's JDBC driver ("mysql-connector-java-5.1.{xx}-bin.jar
") into Tomcat's lib ("<CATALINA_HOME>\lib
"). Read "How to Install MySQL and Get Started"
"conf\server.xml"
Again, the realm is defined in server.xml
via a <Realm>
element. In this case, a JDBCRealm
, with a connectionURL
providing a MySQL database connection.
<Realm className="org.apache.catalina.realm.JDBCRealm" driverName="com.mysql.jdbc.Driver" connectionURL="jdbc:mysql://localhost:{port}/tomcat_users" connectionName="{dbuser}" connectionPassword="{dbpassword}" userTable="users" userNameCol="username" userCredCol="password" userRoleTable="user_roles" roleNameCol="role" />
Replace the {port}
with your MySQL server port number, and {dbuser}
and {dbpass}
with an authorized MySQL username/password.
"ContextRoot\WEB-INF\web.xml"
Same as UserDatabaseRealm
.
Authentication Methods
Same as UserDatabaseRealm
, you can use FORM
, BASIC
or DIGEST
authentication method.
Testing
You need to start MySQL server before starting the Tomcat Server.
Single Login
By default, each protected webapp would request for login during the first access. You can enable single login to all webapps under the host by uncommenting the single-login valve, as follows:
<Host ......> <!-- SingleSignOn valve, share authentication between web applications Documentation at: /docs/config/valve.html --> <Valve className="org.apache.catalina.authenticator.SingleSignOn" /> </Host>
Tomcat with SSL
SSL (Secure Socket Layer), allows web browsers and web servers to communicate over a secured (encrypted) connection. Tomcat provides built-in support for SSL.
Read:
- "SSL Configuration How-to" of Tomcat Documentation @ "
<CATALINA_HOME>\webapps\docs\ssl-howto.html
". - "keytool - Key and Certificate Management Tool" @ JDK documentation.
The steps to turn on SSL support are:
Step 1: Check your JDK version. Tomcat's SSL uses Java Secure Socket Extension (JSSE), which has been integrated into JDK since 1.4.
Step 2: Prepare the Tomcat's server certificate, using the JDK's Key and Certificate Management Tool called "keytool
" (in "<JAVA_HOME>\bin
" ), as follows:
> keytool ... display the help menu ... // Generate a self-signed certificate for Tomcat > keytool -genkey -alias tomcat -keyalg RSA -keystore {TOMCAT_HOME}\conf\.keystore Enter keystore password: xxxxxxxx Re-enter new password: xxxxxxxx What is your first and last name? [Unknown]: What is the name of your organizational unit? [Unknown]: What is the name of your organization? [Unknown]: What is the name of your City or Locality? [Unknown]: What is the name of your State or Province? [Unknown]: What is the two-letter country code for this unit? [Unknown]: Is CN=Unknown, OU=Unknown, O=Unknown, L=Unknown, ST=Unknown, C=Unknown correct? [no]: y Enter key password for <tomcat> (RETURN if same as keystore password):
- The "
-genkey
" option is used to generate a public-private key pair. The public key is wrapped into an X.509 v1 self-signed certificate. The certificate and the private key are stored in a new keystore entry identified by the alias. In our case, the alias name must be "tomcat
". - The "
-keyalg
" option specifies the key generation algorithm. RSA public key algorithm is used in this case. - The "
-keystore
" option specifies the name and location of the key store file. - The password for alias
tomcat
must be the same as the keystore (i.e., hit enter for the last question).
Step 3: Enable SSL support for Tomcat. SSL is built into Tomcat. The Tomcat's configuration file commented out the SSL configuration directive. Uncomment them by removing the <!--
and -->
around the SSL Coyote HTTP/1.1 Connector as follows:
<!-- Define a SSL HTTP/1.1 Connector on port 8443
This connector uses the JSSE configuration, when using APR, the
connector should be using the OpenSSL style configuration
described in the APR documentation -->
<Connector port="8443" protocol="org.apache.coyote.http11.Http11Protocol"
SSLEnabled="true" maxThreads="150" scheme="https" secure="true"
clientAuth="false" sslProtocol="TLS"
keystoreFile="{TOMCAT_HOME}\conf\.keystore"
keystorePass="passwordOfKeyStore" />
Note that the SSL (or HTTPS) is running on port 8443 instead of its default port number 443.
Add in the keystoreFile
and keyStorePass
attributes. The keystoreFile
attribute specified the location of the keystore file. The keyStorePass
provides the password for accessing the keystore file.
Step 4: Start your tomcat (run "<CATALINA_HOME>\bin\startup.bat
"). After that, start a web browser and issue an HTTPS request as follows:
https://localhost:8443
Clustering
[TODO]
Configuring Virtual Hosts
To set up a virtual host called "www.mytest.com" (suppose that you have registered this hostname with at static IP address). Include the following <Host>
element in server.xml
under the Engine Catalina
:
<Engine name="Catalina" >
<Host name="localhost .....>
......
</Host>
<Host name="www.mytest.com" appBase="webapps_mytest.com"
unpackWARs="true" autoDeploy="true" >
<Alias>mytest.com</Alias>
<Valve className="org.apache.catalina.valves.AccessLogValve"
directory="logs"
prefix="mytest.com_access_log." suffix=".log"
pattern="%h %l %u %t "%r" %s %b"
resolveHosts="false" />
</Host>
</Engine>
The above lines configure a virtual host with hostname "www.mytest.com
", with webapps base directory at "<CATALINA_HOME>\webapps_mytest.com
". We also define a alias called "mytest.com
". That is, this host can be accessed via http://www.mytest.com:port
or http://mytest.com:port
. We also define a Valve
, which intercepts the request message to write a log entries (similar to localhost
).
Next:
- Create a directory "
webapps_mytest.com
" under<CATALINA_HOME>
, according to theappBase
. - Create a web application called
ROOT
, by creating a directoryROOT
under the "webapps_mytest.com
". Recall thatROOT
was configured with an empty string URL. In other words,http://www.mytest.com:port/
accesses theROOT
application. - Create a directory "
www.mytest.com
" under "conf\Catalina
". - Write a welcome page called "
index.html
" and save it in "webapps_mytest.com\ROOT
".<html> <head><title>Testing Virtual Host</title></head> <body> <h1>It's work on virtual host</h1> </body> </html>
To test the virtual host, without registering the hostname with an ISP, edit "C:\Windows\System32\drivers\etc\hosts
" to include the following lines (required administrative authority):
<IP_ADDRESS> www.mytest.com <IP_ADDRESS> mytest.com
These lines maps host names www.mytest.com
and mytest.com
to IP address <IP_ADDRESS>, which is the localhost. As the IP software checks the host
file before asking Domain Name Service (DNS) to resolve a host name, you willl be able to test your virtual host.
Now, you are ready to test the virtual hosts. Start the Tomcat server and issue these URL:
http://www.mytest.com:8080 http://mytest.com:8080 http://www.mytest.com:8080/ http://mytest.com:8080/ http://www.mytest.com:8080/index.html http://mytest.com:8080/index.html
Tomcat Host Manager for Clustering and Admin Roles
Reference: "Clustering/Session Replication HOW-TO" @ "webapps/docs/cluster-howto.html
".
The Tomcat "host-manager
" webapp allows you to manage Tomcat clusters. To access host-manager
, you need to define a user with admin
role.
The admin
role has been separated out as admin-gui
and admin-script
, in Tomcat 7, as defined in webapps/host-manager/WEB-INF/web.xml
.
The "Host Manager" web application can be accessed via http://{host}:{port}/host-manager/html
.
Performance Tuning
[TODO]
REFERENCES & RESOURCES
- Tomcat mother site @ http://tomcat.apache.org
- Tomcat's Documentation @ "
<CATALINA_HOME>\webapps\docs
". - Java Servlet, JavaServer Pages (JSP), and JavaServer Faces (JSF) specifications.


We aggregate networks!
- scale interactive models
- matrix plug-and-play e-business
- brand open-source partnerships
- morph leading-edge solutions
- seize efficient users
- implement bricks-and-clicks convergence
- incubate synergistic relationships
- recontextualize out-of-the-box schemas
- scale clicks-and-mortar convergence
- brand open-source e-business
- synthesize clicks-and-mortar interfaces
- cultivate dynamic web-readiness


No. 17 Utah State pulls away to beat NC A&T 81-54
LOGAN, Utah (AP) - Alphonso Anderson had 21 points, six rebounds and three assists and Justin Bean added 18 points, 10 rebounds and three assists to help No. 17 Utah State beat North Carolina A&T; 81-54 on Friday night.
“I thought we did some really good things,” Utah State coach Craig Smith said. “I thought we did a great job on the glass, outrebounding them 44-28, held them to 35% on the game, and 22 assists on 29 made baskets.”
Ronald Jackson led North Carolina A&T; with 15 points.
TOP STORIES
Adam Schiff cracking under 'point of order' pressure
Wisc. county becomes a Second Amendment sanctuary: 'We like our guns'
Nancy Pelosi goes for slam dunk -- and crashes to court
“I thought we went toe-to-toe with a very, very, very good program for maybe 30-31 minutes and then talent started to take over,” North Carolina A&T; coach Jay Joyner said.
With North Carolina A&T; (1-3) rallying in the second half, Utah State (4-0) made a key run to pull away.
After trailing by as much as 15 points, North Carolina A&T; cut it to six points on Fred Cleveland’s 3-pointer with 14:03 left. Utah State regrouped and went on a 9-0 run over the next two minutes to make it 51-36. Utah State took advantage of three North Carolina A&T; turnovers, with Bean scoring five of the Aggies’ nine points.
“In the second half, when we had that lineup of small ball creating mismatches and scoring at will, I think that really helped us to extend our lead,” Bean said.
For the third straight game, Utah State raced to a big lead, getting out to a 12-2 advantage. North Carolina A&T; rallied through the first half to climb within eight points on Tyler Maye’s jumper.
Utah State finished the half on a 10-3 run to take a 38-23 lead.
SCORING DISTRIBUTION
Utah State has had a different leading scorer in every game this season. Merrill scored 28 points in the Aggies’ season-opening win over Montana State, Bean had 18 in a blowout victory over Weber State, and Brock Miller had 27 in the win over Denver.
BIG PICTURE
North Carolina A&T;: North Carolina A&T; hung with Utah State at points in the game and forced 15 Utah State turnovers, getting contributions from Jackson, Maye and Cleveland.
Utah State: Utah State was able to make runs at opportune times to pull away from North Carolina A&T.; Sophomore center Neemias Queta sat out again, rehabbing his knee injury.
UP NEXT
North Carolina A&T;: At North Texas on Tuesday night.
Utah State: Host UTSA on Monday night.
Sign up for Daily Newsletters
Copyright © 2019 The Washington Times, LLC.
Please read our comment policy before commenting.


Enter email address associated with account
Email:
{{if .ErrMessage}} {{.ErrMessage}} {{end}}
If no email is received in a few minutes, please check email address was entered correctly and please try again.
Email recovery emails are valid for 45 minutes.


adpeps.simulation.run_ipeps_gs¶
Main ground-state executable script
Note
The simulations are intended to be used by calling the package
directly via python -m adpeps ...
, as described in
Getting Started
-
class
Objective
(peps)[source]¶ Class containing the objective function for the optimizer
- Parameters
peps (adpeps.ipeps.ipeps.iPEPS) – iPEPS object to be optimized
-
jac
(v)[source]¶ Computes the vector-Jacobian product (gradient) of the iPEPS at the current point
v
in parameter spaceThis function is designed to work with optimizers that make separate calls to the objective function and the gradient, by caching both.
- Parameters
v (jax._src.numpy.lax_numpy.ndarray) – input variational parameters for the site tensors of the iPEPS
- Returns
gradient of the iPEPS with respect to the input parameters
v
- Return type
ndarray
-
out
(v)[source]¶ Computes the objective function (energy) of the iPEPS
Since many optimizers make separate calls to the objective function and the gradient, but usually require both results for any given parameter vector v, this function calls the gradient as well.
- Parameters
v – input variational parameters for the site tensors of the iPEPS
- Returns
energy of the iPEPS at the point
v
in parameter space
-
fun
¶ Objective function - CTM iterations until convergence followed by the evaluation of the energy
-
property
gradnrm
¶ Norm of the gradient
-
peps
¶ iPEPS object


The sql objects API allows for declarative definition of interfaces which will handle the generation of sql statements and queries on your behalf when needed. Take the following interface:
public interface TheBasics
{
{@literal @}SqlUpdate("insert into something (id, name) values (:id, :name)")
int insert({@literal @}BindBean Something something);
{@literal @}SqlQuery("select id, name from something where id = :id")
Something findById({@literal @}Bind("id") long id);
}
You obtain an instance of TheBasics
via one of three means, the first opens a new
handle against a DBI instance, the second attaches the object to an already open handle, and the third
will obtain and release connections on demand against a DBI instance.
DBI dbi = new DBI(dataSource);
Handle handle = dbi.open();
TheBasics via_open = dbi.open(TheBasics.class);
TheBasics attached = handle.attach(TheBasics.class);
TheBasics on_demand = dbi.onDemand(TheBasics.class);
It is important to ensure you close the underlying handle on a sql object if it was opened via the DBI#open in particular.
If the sql object defines a close() method, or includes it via another interface (such as the included CloseMe, or java.lang.AutoCloseable) calling that method will close the handle.
On-demand sql objects should not be explicitly closed.
A number of mixin interfaces are included in the org.skife.jdbi.v2.sqlobject package. These provide additional functionality on your sql object, such as transactions or access to the underlying Handle instance. To make use of them just have your sql object interface extend the mixin interface.


Welcome To PRGS
Public Raise Government Solve
HomePage
Sign Out
Edit ticket
Service ID
Department ID
Description
Level
Status
Select one Option
Closed
Pending
In Progress
Submit


Welcome to {{ category.name }} - here you'll find the latest articles and questions relating to {{ category.name|lower }}
{% for article in articles %}{{ article.excerpt }}
Author: {{ article.first_name }} {{ article.last_name }}
Reading Time: {{ reading_time }} minutes


public interface ResultSetLoader
Many of the methods in this interface verify that the loader is in the proper state. For example, an exception is thrown if the caller attempts to save a row before starting a batch. However, the per-column write methods are checked only through assertions that should enabled during testing, but will be disabled during production.
VectorContainerWriter}, the class which this class
replaces
| Modifier and Type | Field and Description |
|---|---|
static int |
DEFAULT_ROW_COUNT |
| Modifier and Type | Method and Description |
|---|---|
TupleMetadata |
activeSchema()
Returns the active output schema; the schema used by the writers,
minus any unprojected columns.
|
int |
batchCount()
Total number of batches created.
|
void |
close()
Called after all rows are returned, whether because no more data is
available, or the caller wishes to cancel the current row batch
and complete.
|
CustomErrorContext |
errorContext()
Context for error messages.
|
VectorContainer |
harvest()
Harvest the current row batch, and reset the mutator
to the start of the next row batch (which may already contain
an overflow row.
|
boolean |
hasRows()
Report whether the loader currently holds rows.
|
boolean |
isProjectionEmpty()
Reports if this is an empty projection such as occurs in a
SELECT COUNT(*) query.
|
VectorContainer |
outputContainer()
Returns the output container which holds (or will hold) batches
from this loader.
|
TupleMetadata |
outputSchema()
The schema of the harvested batch.
|
int |
schemaVersion()
Current schema version.
|
ResultSetLoader |
setRow(Object... values)
Load a row using column values passed as variable-length arguments.
|
void |
setTargetRowCount(int count)
Adjust the number of rows to produce in the next batch.
|
int |
skipRows(int requestedCount)
Requests to skip the given number of rows.
|
void |
startBatch()
Start a new row batch.
|
int |
targetRowCount()
The number of rows produced by this loader (as configured in the loader
options.)
|
int |
targetVectorSize()
The largest vector size produced by this loader (as specified by
the value vector limit.)
|
int |
totalRowCount()
Total number of rows loaded for all previous batches and the
current batch.
|
ResultVectorCache |
vectorCache()
Peek at the internal vector cache for readers that need a bit of help
resolving types based on what was previously seen.
|
boolean |
writeable()
Reports whether the loader is in a writable state.
|
RowSetLoader |
writer()
Writer for the top-level tuple (the entire row).
|
static final int DEFAULT_ROW_COUNT
CustomErrorContext errorContext()
int schemaVersion()
void setTargetRowCount(int count)
startBatch()
.count
- target batch row countint targetRowCount()
int targetVectorSize()
int batchCount()
int totalRowCount()
boolean hasRows()
void startBatch()
RowSetLoader writer()
boolean writeable()
ResultSetLoader setRow(Object... values)
If the row consists of a single map or list, then the one value will be an Object array, creating an ambiguity. Use writer().set(0, value); in this case.
values
- column values in column index orderint skipRows(int requestedCount)
Used in SELECT COUNT(*) style queries when the downstream operators want just record count, but no actual rows.
Also used to fill in a batch of only null values (such a filling in a set of null vectors for unprojected columns.)
requestedCount
- the number of rows to skipboolean isProjectionEmpty()
skipRows(int)
to skip over the number of rows that would
have been read if any data had been projected.
Note that the empty schema case can also occur if the project list from the SELECT clause is disjoint from the table schema. For example, SELECT a, b from a table with schema (c, d).
TupleMetadata activeSchema()
VectorContainer outputContainer()
harvest()
is called, and is no longer valid once
startBatch()
is called.VectorContainer harvest()
The schema of the returned container is defined as:
TupleMetadata outputSchema()
ResultVectorCache vectorCache()
void close()
Copyright © 2021 The Apache Software Foundation. All rights reserved.


We are here to your rescue
Know about your current jobs. Improves your job tracebility. Set Timer, know the time it took to finish the work
Unlike some other services, there's no limit to the number of quotes you can receive from businesses via ReScrew.
ReScrew has public liability insurance of up to $XX million for third party property damage or personal injury claims. Also, Businesses with the 'Verified' badge have had the validity of their public liability insurance and ABN confirmed.
All taskers will have had their identification verified by ReScrew and all will be qualified, registered and insured. Workers with the ReScrew PRO badge have passed a higher level of verification, which includes an interview with an ReScrew community manager and a Federal security check. In addition to this, "We continuously monitor the customer reviews of each business. By doing so, we are able to quality check our businesses from real experiences, not just licenses and qualifications.
Don't waste your resources
Workplace gender equality is achieved when people are able to access and enjoy the same rewards, resources and opportunities regardless of gender. Australia, along with many countries worldwide, has made significant progress towards gender equality in recent decades, particularly in education, health and female workforce participation.
 Moreover, we promote Green Plumbers


Mrunal Ahire
I am a CS grad from the class of '20. Currently, I work as a Software Engineer at HSBC. My interest lies in the problem solving and the design and analysis of algorithms, apart from that I'm also interested in learning about architecture of large-scale systems.
Work Experience
Trainee Software Engineer Sept 2020 - currently working
HSBC Technology India (HTI)Web-dev Intern Aug 2020 - Aug 2020
Hamsa Overseas, MumbaiWebsite Head Dec 2019 - Jan 2020
VIIT Gandharva'20Research Intern July 2019 - May 2020
C-DAC, PuneIntern Jan 2019 - Feb 2019
InfiIot Technologies, Pune
Education
Computer Engineering Aug 2016 - Sept 2020
VIIT, Pune
GPA: 8.96
Projects
Awards and Achievements
Top Performing Grad 2020 Dec 2020
Tech Academy, HSBC


|
Search
|
Events
These functions are declared in the main Allegro header file:
ALLEGRO_EVENT
An ALLEGRO_EVENT is a union of all builtin event structures, i.e. it is an object large enough to hold the data of any event type. All events have the following fields in common:
By examining the type field you can then access type-specific fields. The any.source field tells you which event source generated that particular event. The any.timestamp field tells you when the event was generated. The time is referenced to the same starting point as al_current_time(). Each event is of one of the following types:
See also: ALLEGRO_EVENT_SOURCE, ALLEGRO_EVENT_TYPE, ALLEGRO_USER_EVENT ALLEGRO_USER_EVENT
An event structure that can be emitted by user event sources. These are the public fields:
See also: al_emit_user_event ALLEGRO_EVENT_QUEUE
An event queue holds events that have been generated by event sources that are registered with the queue. Events are stored in the order they are generated. Access is in a strictly FIFO (first-in-first-out) order. See also: al_create_event_queue, al_destroy_event_queue ALLEGRO_EVENT_SOURCE
An event source is any object which can generate events. For example, an ALLEGRO_DISPLAY can generate events, and you can get the ALLEGRO_EVENT_SOURCE pointer from an ALLEGRO_DISPLAY with al_get_display_event_source. You may create your own "user" event sources that emit custom events. See also: ALLEGRO_EVENT, al_init_user_event_source, al_emit_user_event ALLEGRO_EVENT_TYPE
An integer used to distinguish between different types of events. See also: ALLEGRO_EVENT, ALLEGRO_GET_EVENT_TYPE, ALLEGRO_EVENT_TYPE_IS_USER ALLEGRO_GET_EVENT_TYPE
Make an event type identifier, which is a 32-bit integer. Usually this will be made from four 8-bit character codes, for example:
You should try to make your IDs unique so they don't clash with any 3rd party code you may be using. IDs less than 1024 are reserved for Allegro or its addons. See also: ALLEGRO_EVENT, ALLEGRO_EVENT_TYPE_IS_USER ALLEGRO_EVENT_TYPE_IS_USER
A macro which evaluates to true if the event type is not a builtin event type, i.e. one of those described in ALLEGRO_EVENT_TYPE. al_create_event_queue
Create a new, empty event queue, returning a pointer to object if successful. Returns NULL on error. See also: ALLEGRO_EVENT_QUEUE al_init_user_event_source
Initialise an event source for emitting user events. The space for the event source must already have been allocated. One possible way of creating custom event sources is to derive other structures with ALLEGRO_EVENT_SOURCE at the head, e.g.
The advantage here is that the THING pointer will be the same as the ALLEGRO_EVENT_SOURCE pointer. Events emitted by the event source will have the event source pointer as the However, it is only one technique and you are not obliged to use it. See also: ALLEGRO_EVENT_SOURCE, al_emit_user_event, al_destroy_user_event_source al_destroy_event_queue
Destroy the event queue specified. All event sources currently registered with the queue will be automatically unregistered before the queue is destroyed. See also: ALLEGRO_EVENT_QUEUE al_destroy_user_event_source
Destroy an event source initialised with al_init_user_event_source. See also: ALLEGRO_EVENT_SOURCE al_drop_next_event
Drop the next event from the queue. If the queue is empty, nothing happens. Returns true iff an event was dropped. al_emit_user_event
Emit a user event. The event source must have been initialised with al_init_user_event_source. Some fields of the event being passed in may be modified. Returns Reference counting will be performed on the event if You need to call al_unref_user_event when you are done with a reference counted user event that you have gotten from al_get_next_event, al_peek_next_event, al_wait_for_event, etc. You may, but do not need to, call al_unref_user_event on non-reference counted user events. See also: ALLEGRO_USER_EVENT al_event_queue_is_empty
Return true if the event queue specified is currently empty. al_flush_event_queue
Drops all events, if any, from the queue. al_get_event_source_data
Returns the abstract user data associated with the event source. If no data was previously set, returns NULL. See also: al_set_event_source_data al_get_next_event
Take the next event out of the event queue specified, and copy the contents into See also: ALLEGRO_EVENT al_peek_next_event
Copy the contents of the next event in the event queue specified into See also: ALLEGRO_EVENT al_register_event_source
Register the event source with the event queue specified. An event source may be registered with any number of event queues simultaneously, or none. Trying to register an event source with the same event queue more than once does nothing. See also: ALLEGRO_EVENT_QUEUE, ALLEGRO_EVENT_SOURCE al_set_event_source_data
Assign the abstract user data to the event source. Allegro does not use the data internally for anything; it is simply meant as a convenient way to associate your own data or objects with events. See also: al_get_event_source_data al_unref_user_event
Unreference a user-defined event. This must be called on any user event that you get from al_get_next_event, al_peek_next_event, al_wait_for_event, etc. which is reference counted. This function does nothing if the event is not reference counted. See also: al_emit_user_event. al_unregister_event_source
Unregister an event source with an event queue. If the event source is not actually registered with the event queue, nothing happens. If the queue had any events in it which originated from the event source, they will no longer be in the queue after this call. al_wait_for_event
Wait until the event queue specified is non-empty. If See also: ALLEGRO_EVENT, al_wait_for_event_timed, al_wait_for_event_until al_wait_for_event_timed
Wait until the event queue specified is non-empty. If
See also: ALLEGRO_EVENT, al_wait_for_event, al_wait_for_event_until al_wait_for_event_until
Wait until the event queue specified is non-empty. If
See also: ALLEGRO_EVENT, ALLEGRO_TIMEOUT, al_init_timeout, al_wait_for_event, al_wait_for_event_timed |
Last updated: 2010-04-01 08:44:48 UTC


ThreatConnect App Framework (TcEx)¶
Release 0.8.18.
Overview¶
The ThreatConnect ™ TcEx App Framework provides commonly used Classes and Methods for writing ThreatConnect Exchange Apps. The Framework is intended to speed up the development process and ensure Apps contains the core functionality required.
This documentation provides a detailed level view of the TcEx Framework as well as some App overviews. The Building Apps section is a good place to start when working on your first app. The section overviews are intended to provide details of the core functionality of an App and the code references should provide further information for more in depth questions.
Features¶
- Automatic authorization for HMAC and Token base authentication when using Resources functionality. This allows the App to work seamlessly on both ThreatConnect Exchange Platform and the ThreatConnect Integration Server.
- App logger that supports both filesystem and API logging (Logging).
- Batch add through Jobs job module.
- Common methods for proper App execution: exit codes (Exit); exit messages (Message TC) and more


ORPD Dashboard
Object Recognition Performance Dashboard
Dashboard
(current)
Other
Load images to test the performance of the object recognition model
Make Plots
Image Bin
Clear
Class Frequency Stats
Class Probability Stats


antiviral virus Tilorone control activity vitro cell drug screening tilorone wells Ebola compound test tested viruses


By Submitting this ECE Return, you confirm that all data contained in the return is correct for the week beginning on the {{vm.fields.ecereturn_date | date : 'dd-MM-yyyy'}}


For rotation 8, I had to use the soldering machine and solder a LED wheel. I was also introduced to the basic concepts of OHM's Law, Circuits, Series/ Parallel, and Schematics.
This is my finished product!
All I had to do in order to make the LED wheel was to just simply follow the instructions on the paper. I had to make sure that all the lights and electric chords were in the correct spot. To solder the copper wire onto the board, I had to heat up the soldering machine and mold it with a steel wire.
During the eighth rotation, I was first introduced to soldering electronics. Before this rotation, I had no idea how the process of connecting wires to the motherboard worked. Using wires were effective because they conduct electricity well and is cheap relative to other conductors. Though it was challenging to follow the extremely detailed insturctions, I felt accomplished when I saw my LED wheel light up. The soldering process in general was really fun, since I really enjoy work that invovle concentration and accuraccy.


You can customize the formatting in the exported PDF and Excel files implementing
the interface TypeFormatter.
The formatter has access to the HttpServletRequest object, which can be used,
for example, to get the current locale.
You can find an example of implementation in the webapp demo, search for class DateFormatter.
Formatters must be passed to PagesDialect as a Set. For example, if you are using Spring:
The TypeFormatter will be also used by the SortAttrProcessor if the sorting field does not implement Comparable.


CRIME OF PASSION (director/writer: Gert Oswald; screenwriter: Jo Eisinger; cinematographer: Joseph LaShelle; editor: Marjorie Fowler; cast: Barbara Stanwyck (Kathy Ferguson), Sterling Hayden (Bill Doyle), Raymond Burr (Inspector Tony Pope), Fay Wray (Alice Pope), Royal Dano (Capt. Alidos), Virginia Grey (Sara), Dennis Cross (Detective Jules), Robert Griffin (Detective James), Jay Adler (Nalence), Malcolm Atterbury (Officer Spitz), John S. Launer (Chief of Police), Stuart Whitman (Lab Technician); Runtime: 85; United Artists; 1957)
Reviewed by Dennis Schwartz
A so-so noir melodrama, that can't overcome its limited script and unbelievable premise of a career woman who gives it all up to live a boring life with the husband she's madly in love with. Barbara Stanwyck is too powerful for this role, therefore making it hard to believe that she has suddenly become a vulnerable suburban housewife capable of such outlandish violence to further her policeman husband's career. What keeps this melodrama going is the understated star performances generated by Raymond Burr and Sterling Hayden, bouncing off the fiercely passionate portrayal Stanwyck gives.
As the film opens Kathy Ferguson (Stanwyck) is a lovelorn columnist for the San Francisco Post, who is known for her cynicism about the column while around the other reporters and for her schmaltzy advice she dishes out to her love-sick readers. When she's sent to cover a story about an L.A. woman who killed her husband who is hiding out in San Francisco, she smokes her out by writing sympathetic columns about a woman's plight and convinces her to turn herself over to LAPD homicide cops Capt Charlie Alidos (Dano) and Lt. Bill Doyle (Hayden). For this she gets her big break to become a star columnist for a New York paper, but stops off in L.A. for a dinner date with Bill and in a fast decision marries him and gives up her career.
She regrets her decision when she's taken into the suburban social circle of her husband's colleagues and she can't stand their medocrity, their idolizing of the wormy police captain, their talk of pensions, and the wives echoing the cliché "Behind every successful man is a woman." She only stays because she lusts for Bill, but she decides she wants him to be someone important.
When her car collides with the police inspector's wife, Alice Pope (Wray), she uses this opportunity to know her powerful husband, who happens to be Doyle's boss, Inspector Pope (Burr). Kathy schemes to get her husband promoted to captain and Alidos transferred out, after some poison-pen letters show up accusing her of having an affair with Pope. Alidos' backbiting wife Sara (Grey) is suspected of writing these letters, and the emotionally charged Bill attacks Alidos in the stationhouse. Pope handles the incident by dismissing any charges against Doyle, and his friendship for Alidos sours.
In a moment of passion, Pope tells Kathy he is retiring and they make love with the promise made that he will recommend her husband for that position. But the next day he changes his mind and tells her that the police department comes first and he doesn't think Bill is up to the job. To add insult to injury, he tells her he is recommending her enemy Alidos.
Warning: spoiler to follow.
Kathy confronts Pope and tells him that she can only face herself after their affair if her husband gets the promotion. When Pope states why he can't do it, she shoots him with a gun she stole from the police station. The irony is, that her husband leads the investigation to get Pope's killer and ends up arresting her -- which proves how good a cop he really is.
Kathy gets involved in an outlandish situation, in many ways similar but a lot more deadly than those situations she used to make fun of when she wrote her lovelorn column. The best that can be said about this story, is that it's not bad and it had some sparks in it to keep you awake.
REVIEWED ON 7/23/2001 GRADE: C
Dennis Schwartz: "Ozus' World Movie Reviews"
http://www.sover.net/~ozus
<EMAIL_ADDRESS>© ALL RIGHTS RESERVED DENNIS SCHWARTZ
========== X-RAMR-ID: 28963 X-Language: en X-RT-ReviewID: 240081 X-RT-TitleID: 1044858 X-RT-SourceID: 873 X-RT-AuthorID: 1315 X-RT-RatingText: C
The review above was posted to the
rec.arts.movies.reviews newsgroup (de.rec.film.kritiken for German reviews).
The Internet Movie Database accepts no responsibility for the contents of the
review and has no editorial control. Unless stated otherwise, the copyright
belongs to the author.
Please direct comments/criticisms of the review to relevant newsgroups.
Broken URLs inthe reviews are the responsibility of the author.
The formatting of the review is likely to differ from the original due
to ASCII to HTML conversion.
Related links: index of all rec.arts.movies.reviews reviews


Executive Order 11141, February 12, 1964 (29 FR 2477), states that the Government policy is as follows:
(a) Contractors and subcontractors shall not, in connection with employment, advancement, or discharge of employees, or the terms, conditions, or privileges of their employment, discriminate against persons because of their age except upon the basis of a bona fide occupational qualification, retirement plan, or statutory requirement.
(b) Contractors and subcontractors, or persons acting on their behalf, shall not specify in solicitations or advertisements for employees to work on Government contracts, a maximum age limit for employment unless the specified maximum age limit is based upon a bona fide occupational qualification, retirement plan, or statutory requirement.
(c) Agencies will bring this policy to the attention of contractors. The use of contract clauses is not required.
Agencies shall bring complaints regarding a contractor’s compliance with this policy to that contractor’s attention (in writing, if appropriate), stating the policy, indicating that the contractor’s compliance has been questioned, and requesting that the contractor take any appropriate steps that may be necessary to comply.


Faculty of Arts
Welcome to the Faculty of Arts, the faculty that deals with the Nation Culture and uplist the heritage of the Nation. The faculty is tagged with a slogan "Our Culture, Our Heritage".
The Faculty is filled with Six (6) Departments, listed below.
- Department of Islamic Religion Study (IRS)
- Department of Classics
- Department of Communication Language Art
- Department of Englis Language
- Department of History
- Department of Linguistics and African Languages
Admission Requirement
You can gain admission into any of the Departments in the faculty with either your O-Level/A-Level or DE.
OLevel
- O-Level result include minimum of 5 Credit for single sitting or minimum of 6 Credit for 2 sittings.
- Mathematics, Englis Language, Literature In Englis are compulsory along with minimum of 2 other art subjects done in OLevel stage.
- JAMB Examination for the year of admission
- Passing the School Screening test
A-Level
- A-level Results
- O-Level result include minimum of 5 Credit for single sitting or minimum of 6 Credit for 2 sittings.
- Mathematics, Englis Language, Literature In Englis are compulsory along with minimum of 2 other art subjects done in OLevel stage.
DIrect Entry
- OND Result of a minimum Lower Grade
- NCE Result of a minimum Lower Garde
- O-Level result include minimum of 5 Credit for single sitting or minimum of 6 Credit for 2 sittings.
- Mathematics, Englis Language, Literature In Englis are compulsory along with minimum of 2 other art subjects done in OLevel stage.


Old soldiers never die, they just turn into cliches
Soldier A Film Review By Michael Redman Copyright 1998 By Michael Redman
*1/2 (Out of ****)
The Warrior and the Lover are two personality aspects that find it difficult to exist in the same body. Jungian archetypes, these two opposites need each other to create a whole, but it's difficult to integrate both.
Often we'll encounter Lovers who think everything is just wonderful and, with the help of Jung's Magician, sit around imagining grand schemes. Without the drive to manifest their plans, much less the wisdom to recognize the darkness, all they have are dreams.
Warriors on the other hand, are ready to go to war at the drop of a hat, and will do combat with every last bit of their energy. They don't care enough about anything to know what's worth fighting for: gladiators who live only for the battle.
This dichotomy not only describes individuals that we all know, but can also illustrate societies. America during the late sixties was a conflict between old style Cold Warriors and the new hippie Lovers.
Todd 3465 (Kurt Russell) is a living, breathing archetype. Chosen from birth as a soldier, he is raised by the government to be a killing machine. His childhood is cruelty and competition. He is indoctrinated with the big rules. Never question authority. Winning is everything. Strength beats knowledge.
A veteran of numerous intergalactic wars, Todd is 40 and he's obsolete. A new generation of genetically engineered soldiers are faster and stronger. Left for dead after a test battle with the best of the new killers, Caine 607 (Jason Scott Lee), he's unceremoniously dumped as trash on Arcadia 234, a garbage world.
Obviously our hero is still alive. He finds a group of shipwrecked settlers abandoned on the planet who nurse him back to health. When the peace-loving colonists get a good look at who Todd is, they are afraid of him and he is exiled to live by himself amid the junk on an environmentally hostile world. They are the other good guys.
These Lovers find that they need a Warrior when the military coincidentally chooses this world to conduct exercises for their improved human weapons. Todd finds himself in the role of protector.
What could have been a fascinating look at the roles played in our culture and the fears of an ultra-right wing future is ruined by turning the film into a cartoon. The effects are mostly second-rate explosions or jerky slow motion. The plot is old hat. We don't get even a glimpse at the society that created the soldiers. Hardly anything makes sense.
The film's science fares badly.  After conquering the stars, for some reason we use vast amounts of energy to load up huge space ships with rubbish tote it to a landfill light years away. Even stranger, the garbage barges appear to double as time machines. Virtually all the trash is vintage 1960.
There is nothing in the story that is not predictable. The first thing that Todd sees after coming back to life is Sandra (Connie Nielsen), the woman just a little too beautiful to be living in such harsh conditions who is taking care of him. It doesn't take a genius to foresee that her husband isn't going to be around much longer. Is it a shock to find out that the film's climax is an unarmed battle between Todd and Caine? Who would you guess wins?
Some of the scenes would work if this were a comedy. Todd's first awakening of human emotion comes when he glimpses Connie's nipple poking through her thin blouse. Later as he sits by his lonely campfire, a tear rolls down his dramatically lighted cheek in slow motion. Supposedly this cliché isn't meant to be humorous. Dastardly Col. Mekum (Jason Isaacs) with a pencil-thin mustache is as real as Snidley Whiplash.
Responsible for last year's quirky and visually enticing but problematic "The Fifth Element", director Paul Anderson sees the film as "Shane" in outer space. Maybe, if Shane were played by Sylvester Stallone in Rambo mode. The movie doesn't even work as an action film. There is never a question as to the outcome. Somehow the new superior soldiers don't prove much of a match for Todd.
The acting isn't anything to write home about. Nielsen almost comes across as a real person but is soon relegated to a background victim. Russell is buffed-up and does a credible job but it's not much of a challenge. Uttering around 100 words during the film, mostly what Todd does is hit things and stare grimly into space. Gary Busey as Todd's commanding officer is completely wasted in his low-key role.
Everything blows up and occasionally it looks cool. Sometimes the sets are impressive. Unfortunately "occasionally" and "sometimes" don't make a film.
Most disappointing is that the screenplay is by David Webb Peoples who wrote "Blade Runner", possibly the best science fiction movie ever made. Sharp-eyed viewers will notice a few obscure references to that film. Peoples says that this is not a "Blade Runner" sequel, but a "sidequel" that takes place in the same universe.
Although that may have been the intent in his original script, the result is more like a bad television series that the "Blade Runner" replicants watch to pass time. Perhaps those artificial humans would find this entertaining.
(Michael Redman has written this column for over 23 years and wants to wish everyone an appropriate Halloween...whatever you'd like it to be.)
[This appeared in the 10/29/98 "Bloomington Independent", Bloomington, Indiana. Michael Redman can be contacted at<EMAIL_ADDRESS>--<EMAIL_ADDRESS>This week's film review at http://www.indepen.com/ Film reviews archive at http://us.imdb.com/M/reviews_by?Michael%20Redman
The review above was posted to the
rec.arts.movies.reviews newsgroup (de.rec.film.kritiken for German reviews).
The Internet Movie Database accepts no responsibility for the contents of the
review and has no editorial control. Unless stated otherwise, the copyright
belongs to the author.
Please direct comments/criticisms of the review to relevant newsgroups.
Broken URLs inthe reviews are the responsibility of the author.
The formatting of the review is likely to differ from the original due
to ASCII to HTML conversion.
Related links: index of all rec.arts.movies.reviews reviews


Grading Form
Course
Select an Option
S/N
Student ID
Student Name
Currently Assigned Grade
Change Exam Grade
A+
A
A-
B+
B
B-
C+
C
D+
D
F


Id: 379
Name: Wedding Bartender
Status: unknown
Species: Alien
Type:
Gender: Male
OriginName: unknown
OriginUrl:
LocationName: Planet Squanch
LocationUrl: https://rickandmortyapi.com/api/location/35
Image: https://rickandmortyapi.com/api/character/avatar/379.jpeg
Episode: ['https://rickandmortyapi.com/api/episode/21']
Url: https://rickandmortyapi.com/api/character/379
Created: 2018-01-10T19:37:41.375Z


{{member.memberName}}
{{member.memberEmail}}
Last Active: {{member.memberLastActiveDate | date: 'MM/dd/yyyy'}}


Welcome to your dashboard Name,
List your uploaded files
Statistics of Steps Count
Statistics of Walking and Running


Section 0) Introduction
This article is to go over being Unicode Friendly in WinAPI.
I don't normally encourage programming in WinAPI, since you're typically better off with a crossplatform widgetry lib such as wxWidgets or QT or whatever. But a lot of people still like to use WinAPI directly... so I should at least point them in the right direction. Besides, a lot of the stuff here applies to wx as well (and possibly to QT, though I've never used QT so I can't say for sure).
I didn't put a lot of work into formatting or proofreading this article. So my apologies there. I still think it gets the idea across pretty well, even if my throughts are unorganized.
Unicode forever! Spread the love!
Section 1) The UNICODE macro
The UNICODE macro (and/or _UNICODE macro -- usually both) is scattered throughout all of WinAPI. It redefines some types and functions to use either char* strings (if it's not defined) or wchar_t* Unicode strings (if it is defined).
If you use MSVS, these macros are often automatically defined by the compiler before it begins compiling if you set your project settings to make the program a Unicode program. Otherwise you can do it yourself by #defining them before you include Windows.h:
1 2 3 4 5 6 7 8 9
|
#ifndef UNICODE
#define UNICODE
#endif
#ifndef _UNICODE
#define _UNICODE
#endif
#include <Windows.h>
| |
You don't need to #define either of them to use Unicode in your program. It just changes around some types to make it easier to use the Unicode parts of WinAPI.
Further in this article, "Unicode build" refers to UNICODE and _UNICODE being defined, whereas "ANSI build" refers to neither of them being defined.
Section 2) LPSTR, LPCSTR, LPTSTR, LPCTSTR, LPWTFISALLTHIS
Anybody who's looked at WinAPI has probably seen the above types... but what exactly are they?
An inexperienced C/C++ coder might think they're strings, like std::string. It can certainly look that way from the documentation and examples. And since WinAPI pages doesn't ever really seem to tell you exactly what they are, it's a logical conclusion.
However, this is not the case. All of the above are
macros which #define different types.
Now you might look at "LPCTSTR" and see the "STR" in there, but the rest might look like random letter combinations that make no sense. Rest assured there's a method to the madness.
- The starting 'LP' stands for "Long Pointer". Without getting too much into what a Long Pointer is (or really what it used to be, it doesn't have as much meaning in modern computing), we'll just say that this is basically a pointer. This means that the LP is telling you that this type is not a string by itself, but is a POINTER to a string (or really, a C-style string).
- The 'C' means that the string is constant
- The 'W' means the string is wide (Unicode)
- The 'T' means the string is TCHARs (see section on TCHAR below)
So really, the #defines are the following:
1 2 3 4 5 6 7 8
|
#define LPSTR char*
#define LPCSTR const char*
#define LPWSTR wchar_t*
#define LPWCSTR const wchar_t*
#define LPTSTR TCHAR*
#define LPCTSTR const TCHAR*
| |
Section 3) TCHAR, _T(), T(), TEXT()
TCHAR is #defined as either a char or a wchar_t depending on whether or not the UNICODE macro was defined.
By using TCHARs properly, you can create both ANSI and Unicode builds of your program.
This presents a bit of a problem, though. String literals in C++ can take 2 forms, either char or wchar_t:
1 2
|
const char* a = "Foo";
const wchar_t* b = L"Bar"; // <-- note the L. That makes it wide.
| |
The compiler doesn't auto-detect... so things like this would throw compiler errors:
1 2
|
const char* a = L"Foo"; // <-- error, can't point char* to a wide string
const wchar_t* b = "Bar"; // <-- error, can't point wchar_t* to a non-wide string
| |
So what about this?:
Remember that TCHAR is char or wchar_t depending on Unicode. So the above code will work
only if you are not building Unicode. If you are building Unicode you'll get an error.
Likewise, the following won't work
unless you're building Unicode:
To get around this problem... WinAPI provides some other macros, _T(), T(), and TEXT(), all of which do the same thing. In a Unicode build, they put the L before the string literal to make it wide, and in non-Unicode, they do nothing. Therefore they will always work hand in hand with TCHARs:
|
const TCHAR* d = _T("foo"); // works in both Unicode and ANSI builds
| |
Section 4) Function and Structure Name Aliases
A lot of Windows functions take strings as parameters. But because char and wchar_t strings are two distinctly different types, the same function can't be used for both of them.
Take for example, the WinAPI function "DeleteFile" which takes a single parameter. Let's say you want to delete "myfile.txt":
|
DeleteFile( _T("myfile.txt") ); // notice _T because DeleteFile takes a LPC<b>T</b>STR
| |
The trick here is that the function DeleteFile doesn't really exist! There are actually two different functions:
1 2
|
DeleteFileA( LPCSTR ); // ANSI version, taking a LPCSTR
DeleteFileW( LPCWSTR ); // Unicode version, taking LPCWSTR
| |
DeleteFile is actually a
macro defined as either DeleteFileA or DeleteFileW, depending on whether or not this is a Unicode build.
As such... for WinAPI functions that take a C style string... there are, in a sense, 3 different versions, each taking a different type of C string:
1 2 3
|
DeleteFile <- Takes a TCHAR string (LPCTSTR)
DeleteFileA <- Takes a char string (LPCSTR)
DeleteFileW <- Takes a wchar_t string (LPCWSTR)
| |
This is true of virtually all WinAPI functions that take a C string as a param.
But it doesn't stop there! There are also some structs that have strings in them, as well. For instance, the OPENFILENAME structure contains various C strings for use with the open file dialog box. As you might expect, There are 3 versions of this struct as well:
1 2 3
|
OPENFILENAME <- has TCHAR strings
OPENFILENAMEA <- has char strings
OPENFILENAMEW <- has wchar_t strings
| |
And again... note that OPENFILENAME doesn't
really exist, but is just a #define of one of the other two depending on the build.
Section 5) Being Unicode friendly
So what does it take to be Unicode friendly in WinAPI?
For most programs... not very much. Just stick to the following and you'll be fine:
-) Use TCHAR for characters and C strings instead of char
-) Use std::basic_string<TCHAR> instead of std::string. You can even typedef your own kind of tstring:
typedef std::basic_string<TCHAR> tstring;
-) Don't use std::string, as this is a char string.
-) Put all string literals in
_T()
macros. UNLESS you are dealing with libs other than WinAPI. For example, standard lib functions like fstream ctors take char* strings -- so don't put those strings in _T() macros. Really, though, if you're using WinAPI, you shouldn't be using standard lib file I/O because the standard lib is not Unicode friendly.
-) Don't use standard lib C string functions like strcpy, strcat, sprintf, etc. These all work with char -- they don't work with wchar_t or TCHAR. Alternatively you can use 'tstring' member functions, and Windows specific TCHAR functions like _tcscpy, _tcscat, etc.
-)
Never ever ever C style cast C strings from one type to another. C style casts mask very important compiler errors. Avoid C++ style casts also. Basically if you're getting type errors with your strings -- it's because you're doing something wrong. Don't try to cast around the problem.
-) Switch between ANSI builds and Unicode builds often to make sure that your program will compile in both. If that's too much of a hassle, make Unicode builds all the time and forget about ANSI builds.
For other programs where you do a lot of text manipulation, it gets a little trickier....
-) Be careful when reading or writing text to a file. Don't use TCHAR for this, since its size is variable. Use char if you're reading 8-bit characters from a file, and wchar_t if reading 16-bit characters.
-) Ideally if text is going in an output file, you should use a Unicode encoding, such as UTF-8 or UTF-16. However that is beyond the scope of this article (perhaps another day!)
-) If you need to use char or wchar_t directly (for instance the above situation), be very careful about how you move those strings to a TCHAR string. You'll typically have to copy the string over 1 character at a time or write your own string copy function to do that. I don't think WinAPI has any functions to help with such a case, and I know the standard lib doesn't.
For example:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27
|
// this function copies a char C string to a TCHAR C string:
void ustrcpy(TCHAR* dst, const char* src)
{
while(*src)
{
*dst = *src;
++dst;
++src;
}
*dst = *src;
}
//---------
// then, say you need to read a string from a file and put it in a text box with SetWindowText:
char str[500] = {0}; // note I'm using char because I specifically want 8-bit characers
ifstream myfile("myfile.txt"); // note no _T() macro because I'm dealing with std lib
// ideally you'd open the file with WinAPI's CreateFile and read
// that way because that is Unicode friendly. However I'm trying
// to keep this example simple
myfile >> str; // read the string
TCHAR buffer[500]; // need to copy to a TCHAR buffer in order to give it to SetWindowText
ustrcpy( buffer, str );
// give it to WinAPI
SetWindowText( hMyTextBox, buffer );
| |
A better approach would be to make template functions for ustrcpy and similar so you can convert to/from all sorts of different types and sizes:
1 2 3 4 5
|
template <typename T, typename TT>
void ustrcpy( T* dst, const TT* src )
{
//.. same as above
}
| |
Alternatively... you can avoid the TCHAR version of the WinAPI function and use the ANSI version directly. This let's Windows take care of the conversion:
1 2 3 4 5 6
|
char str[500] = {0};
myfile >> str;
// note here we specifically call SetWindowTextA, not SetWindowText.
// this is because we're giving a char string and not a TCHAR string.
SetWindowTextA( hMyTextBox, str );
| |
More to come? ???


Warning: Failover of this node will trigger internal processing after failover for the following service: Eventing. This processing may take some time to complete.
Note: Failing over this node (which has no data) will remove it from the cluster.
Rebalancing will be required to add the node back into the cluster.


| Large | Medium | Small | Tiny | |
|---|---|---|---|---|
| Without label | ||||
| With label |

| Large | Medium | Small | Tiny | |
|---|---|---|---|---|
| Without label | ||||
| With label |

| Large | Medium | Small | Tiny | |
|---|---|---|---|---|
| Without label | ||||
| With label |

| Large | Medium | Small | Tiny | |
|---|---|---|---|---|
| Without label | ||||
| With label |

| Large | Medium | Small | Tiny | |
|---|---|---|---|---|
| Without label | ||||
| With label |

| Large | Medium | Small | Tiny | |
|---|---|---|---|---|
| Without label | ||||
| With label |

| Without label | |
|---|---|
| Fluid | |
| Large | |
| Medium | |
| Small |
| With label | |
|---|---|
| Fluid | |
| Large | |
| Medium | |
| Small |

| Without label | |
|---|---|
| Fluid | |
| Large | |
| Medium | |
| Small |
| With label | |
|---|---|
| Fluid | |
| Large | |
| Medium | |
| Small |

| Large | Medium | Small | Tiny | |
|---|---|---|---|---|
| Without anything | ||||
| With label | ||||
| With percentage | ||||
| With label and percentage |

| Without anything | |
|---|---|
| Fluid | |
| Large | |
| Medium | |
| Small |
| With label | |
|---|---|
| Fluid | |
| Large | |
| Medium | |
| Small |
| With percentage | |
|---|---|
| Fluid | |
| Large | |
| Medium | |
| Small |
| With label and percentage | |
|---|---|
| Fluid | |
| Large | |
| Medium | |
| Small |

| Without anything | |
|---|---|
| Fluid | |
| Large | |
| Medium | |
| Small |
| With label | |
|---|---|
| Fluid | |
| Large | |
| Medium | |
| Small |
| With percentage | |
|---|---|
| Fluid | |
| Large | |
| Medium | |
| Small |
| With label and percentage | |
|---|---|
| Fluid | |
| Large | |
| Medium | |
| Small |


Machine Translation with a Glossary
Machine translation of Modern Chinese to English with a Glossary
{{.Message}}
Translation Quality
Hints to check and improve translation:
-
{{range .Notes}}
- HB Glossary contains an entry for {{.FoundCN}} open_in_new with English '{{.ExpectedEN}}' {{end}}
- Analyze linguistic structure open_in_new