Recent Notes
Displaying notes 91 - 100
Created by Dr. Xi on March 31, 2010 19:32:42
Last update: March 31, 2010 19:41:14
The dev database keeps locking up because of failed login attempts. For a dev database, we really don't need such security measure. This is how to remove the limit. Log in as sysdba sqlplus sys@xe as sysdba Find out the profile for the user. SQL> select profile from dba_users where username = 'HIBERNATE'; PROFILE ------------------------------ DEFAULT Look at the current limits SQL> select resource_name, limit from dba_profiles where profile = 'DEFAULT'; RESOURCE_NAME LIMIT -------------------------------- ---------------------------------------- COMPOSITE_LIMIT UNLIMITED SESSIONS_PER_USER UNLIMITED CPU_PER_SESSION UNLIMITED CPU_PER_CALL UNLIMITED LOGICAL_READS_PER_SESSION UNLIMITED LOGICAL_READS_PER_CALL UNLIMITED IDLE_TIME UNLIMITED CONNECT_TIME UNLIMITED PRIVATE_SGA UNLIMITED FAILED_LOGIN_ATTEMPTS 10 PASSWORD_LIFE_TIME UNLIMITED RESOURCE_NAME LIMIT -------------------------------- ---------------------------------------- PASSWORD_REUSE_TIME UNLIMITED PASSWORD_REUSE_MAX UNLIMITED PASSWORD_VERIFY_FUNCTION NULL PASSWORD_LOCK_TIME UNLIMITED PASSWORD_GRACE_TIME UNLIMITED 16 rows selected. Increase the value for failed login attempts SQL> alter profile default ...
Created by Dr. Xi on March 31, 2010 19:18:33
Query the dba_users view to find locked accounts. SQL> select username, account_status, lock_date from dba_users order by username; USERNAME ACCOUNT_STATUS LOCK_DATE ------------------------------ -------------------------------- --------- ANONYMOUS OPEN CTXSYS EXPIRED & LOCKED 20-NOV-06 DBSNMP EXPIRED & LOCKED 07-FEB-06 DIP EXPIRED & LOCKED 07-FEB-06 FLOWS_020100 EXPIRED & LOCKED 07-FEB-06 FLOWS_FILES EXPIRED & LOCKED 07-FEB-06 HIBERNATE OPEN HR EXPIRED & LOCKED 20-NOV-06 JEMUSER OPEN JPA OPEN MDSYS EXPIRED & LOCKED 07-FEB-06 USERNAME ACCOUNT_STATUS LOCK_DATE ------------------------------ -------------------------------- --------- OUTLN EXPIRED & LOCKED 20-NOV-06 SRDEMO OPEN SYS OPEN SYSTEM OPEN TSMSYS EXPIRED & LOCKED 07-FEB-06 XDB EXPIRED & LOCKED 07-FEB-06 17 rows selected. SQL> alter user hibernate account lock; User altered. SQL> select username, account_status, lock_date from dba_users where username = 'HIBERNATE'; USERNAME ACCOUNT_STATUS LOCK_DATE ------------------------------ -------------------------------- --------- HIBERNATE LOCKED 31-MAR-10
Created by Dr. Xi on March 31, 2010 15:35:53
DBA_BLOCKERS displays a session if it is not waiting for a locked object but is holding a lock on an object for which another session is waiting. Column Datatype Description HOLDING_SESSION NUMBER Session holding a lock SQL> select * from dba_blockers; HOLDING_SESSION --------------- 364 SQL> select * from v$lock where sid = 364; ADDR KADDR SID TY ID1 ID2 LMODE REQUEST CTIME BLOCK -------- -------- ---------- -- ---------- ---------- ---------- ---------- ---------- ---------- 978B3CBC 978B3CE8 364 AE 99 0 4 0 2531 0 00502BC4 00502BF4 364 TM 73541 0 3 0 2531 0 96CF4888 96CF48C8 364 TX 196617 151100 6 0 2531 1 SQL> -- find the session that's blocked SQL> select v1.* 2 from v$lock v1, v$lock v2 3 where v1.id1 = v2.id1 and ...
Created by Dr. Xi on March 31, 2010 15:14:39
Last update: March 31, 2010 15:17:46
DBA_WAITERS shows all the sessions that are waiting for a lock. Column Datatype Description WAITING_SESSION NUMBER The waiting session HOLDING_SESSION NUMBER The holding session LOCK_TYPE VARCHAR2(26) The lock type MODE_HELD VARCHAR2(40) The mode held MODE_REQUESTED VARCHAR2(40) The mode requested LOCK_ID1 VARCHAR2(40) Lock ID 1 LOCK_ID2 VARCHAR2(40) Lock ID 2 SQL> set lin 120 SQL> select * from dba_waiters; WAITING_SESSION HOLDING_SESSION LOCK_TYPE MODE_HELD --------------- --------------- -------------------------- ---------------------------------------- MODE_REQUESTED LOCK_ID1 LOCK_ID2 ---------------------------------------- ---------- ---------- 235 364 Transaction Exclusive Exclusive 196617 151100 SQL> Or join the v$session view to find out who it is: select w.waiting_session, w.mode_requested, s.username, s.machine, s.osuser from v$session s, dba_waiters w where s.sid = w.holding_session;
Created by James on March 29, 2010 03:11:38
Last update: March 31, 2010 16:27:58
This is an age old problem. Since it comes up time and time again, I'm writing this down for future reference. Let's start with a two-column layout generated by the 2 Column Layout Generator : <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title>2 Column CSS Layout - concise design</title> <style type='text/css'> .mask{ position: relative; overflow: hidden; margin: 0px auto; width: 100%; background-color: #f4f4f4 } .header{ float: left; color: white; width: 100%; background-color: #5474f4 } .colleft{ position: relative; width: 100%; right: 32%; background-color: #f4f4f4 } .col1{ position: relative; overflow: hidden; float: left; width: 30%; left: 101%; background-color: #e6e6e6 } .col2{ position: relative; overflow: hidden; float: left; width: 66%; left: 3%; background-color: #e6e6e6 } .footer{ float: left; width: 100%; background-color: #b4caf7 } body ...
Created by James on March 28, 2010 22:09:34
Last update: March 29, 2010 15:01:23
This CSS behavior looks weird to me and I don't know if it's by the spec. It doesn't make sense to me at all. Using this markup: <!doctype html> <html> <body style="width:250px;"> <div style="float:left;background:#ddd;padding:5px;margin:5px;"> The Float </div> <div id="contents"> Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. </div> </body> </html> the page is rendered like this: i.e., the text of the non-floating div wraps ...
Created by Fang on March 23, 2010 03:50:11
Last update: April 02, 2010 19:07:14
This is a simple web application with a single servlet and a single JSP page. It is intended to be a test bed for JSTL tags. You may want to store all syntaxes, rules, and exceptions in your head, but in my opinion nothing beats a simple test program that allows you play with it all you want. So here it is (build with Maven ). The directory layout ./pom.xml ./src ./src/main ./src/main/java ./src/main/java/jstl ./src/main/java/jstl/demo ./src/main/java/jstl/demo/JSTLDemoServlet.java ./src/main/resources ./src/main/webapp ./src/main/webapp/home.jsp ./src/main/webapp/index.jsp ./src/main/webapp/WEB-INF ./src/main/webapp/WEB-INF/web.xml Contents of pom.xml <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> <modelVersion>4.0.0</modelVersion> <groupId>jstl-demo</groupId> <artifactId>jstl-demo</artifactId> <packaging>war</packaging> <version>1.0-SNAPSHOT</version> <name>jstl-demo Maven Webapp</name> <url>http://maven.apache.org</url> <repositories> <repository> <id>maven2-repository.dev.java.net</id> <name>Java.net Repository for Maven</name> <url>http://download.java.net/maven/2/</url> <layout>default</layout> </repository> </repositories> <dependencies> <dependency> <groupId>javax</groupId> <artifactId>javaee-api</artifactId> <version>6.0-SNAPSHOT</version> <scope>provided</scope> </dependency> <dependency> <groupId>javax.servlet</groupId> <artifactId>jstl</artifactId> <version>1.2</version> <scope>compile</scope> </dependency> </dependencies> <build> ...
Created by Fang on March 23, 2010 02:33:54
Last update: March 31, 2010 04:16:40
Expression Language (EL) was introduced since JSTL 1.0, it is part of the JSP spec since JSP 2.0/JSTL 1.1. There's no JSTL without EL. But don't let the name scare you, EL is not another programming language. It's just a simple construct: ${expr} , which means that instead of taking expr literally, it should be evaluated in the page using any page/request/session/application variables exposed to that page. For example, if you put Hello ${world}! in your JSP, world will be evaluated in the page context. If you had set a value for world before, for example, request.setAttribute("world", "John Doe"); in your Struts action class or a servlet, the JSP page would show: Hello John Doe! There were confusions about EL support in various servlet/JSP/JSTL version ...
Created by Fang on March 22, 2010 03:56:32
The Maven dependency:tree goal displays the dependency tree for the current project: C:\Users\fang\work\maven\javaee-app>mvn dependency:tree [INFO] Scanning for projects... [INFO] Reactor build order: [INFO] Java EE pom [INFO] Java EE ejb [INFO] Java EE webapp [INFO] Java EE ear [INFO] Searching repository for plugin with prefix: 'dependency'. [INFO] ------------------------------------------------------------------------ [INFO] Building Java EE pom [INFO] task-segment: [dependency:tree] [INFO] ------------------------------------------------------------------------ [INFO] [dependency:tree {execution: default-cli}] [INFO] maven-tutorial:java-ee:pom:1.0 [INFO] \- javax:javaee-api:jar:6.0-SNAPSHOT:provided [INFO] ------------------------------------------------------------------------ [INFO] Building Java EE ejb [INFO] task-segment: [dependency:tree] [INFO] ------------------------------------------------------------------------ [INFO] [dependency:tree {execution: default-cli}] [INFO] maven-tutorial.java-ee:ejb:ejb:1.0 [INFO] \- javax:javaee-api:jar:6.0-SNAPSHOT:provided [INFO] ------------------------------------------------------------------------ [INFO] Building Java EE webapp [INFO] task-segment: [dependency:tree] [INFO] ------------------------------------------------------------------------ [INFO] [dependency:tree {execution: default-cli}] [INFO] maven-tutorial.java-ee:webapp:war:1.0 [INFO] +- maven-tutorial.java-ee:ejb:ejb-client:client:1.0:provided [INFO] +- struts:struts:jar:1.2.9:compile [INFO] | +- commons-beanutils:commons-beanutils:jar:1.7.0:compile [INFO] | +- commons-digester:commons-digester:jar:1.6:compile [INFO] | | +- commons-collections:commons-collections:jar:2.1:compile ...
Created by Fang on March 22, 2010 02:55:04
Last update: March 22, 2010 03:48:55
If you followed the steps in Start a Java EE application with Maven , you'll arrive at an EAR file that's ready to be deployed. However, if you look carefully, you'll find that the ejb-1.0.jar file is included in the EAR file twice : once as the ejb module of the EAR, another time under the WEB-INF/lib folder of webapp-1.0.war . The second is brought about by specifying the ejb project as a dependency in the webapp POM. Actually, the webapp project is dependent on the ejb project as an EJB client. So we should have been more accurate by specifying the type of dependency as ejb-client , not ejb : Edit webapp/pom.xml , change the ejb dependency to ejb-client : <project> <modelVersion>4.0.0</modelVersion> <groupId>maven-tutorial.java-ee</groupId> <artifactId>webapp</artifactId> ...