Archive for August, 2008
Microsoft Office 2008 update 12.1.0 will not install
by Frank Kim on Aug.29, 2008, under Mac
I tried many times to install the Microsoft Office 2008 update 12.1.0 but each time it would hang.
Finally I found this forum thread about the exact same problem, Msi Wind Forums • View topic – Microsoft Office 2008 update 12.1.0 will not install.
This is how to get the update to install.
Should have an option to edit……thing is it’s to late because your forced quit. Run the installer again and when the installer hangs move the installer window to one side…the error window noted above should be directly behind the installer and thats why you missed it in the first place…the installer has halted (and appears hung) as the error window is awaiting a response from you…..but you dont see it. All you have to do is click the edit button on the error window and then installer will continue…thats it. You can close the error window and the installer will continue.
Trim White Space from JSP
by Frank Kim on Aug.22, 2008, under JSP, Page Development
Sometimes the resultant HTML from JSP files has too much white space. This is because a lot of JSP logic will end up in only a few lines of actual HTML code and the rest is white space.
One efficient way to get rid of white space is to add this configuration to your web.xml on Tomcat/JBoss as described in this article, Trim Spaces in your JSP’s HTML.
<init-param>
<param-name>trimSpaces</param-name>
<param-value>true</param-value>
</init-param>
However this sometimes has undesired side-effects. For example this DSP:
<div class="foo"> <dspel:valueof param="displayName" /> </div>
causes this undesired result:
<div class="foo"/> Frank Kim
The work around is to do this.
<dspel:getvalueof var="displayName" param="displayName" />
<div class="foo"><c:out value="${displayName}"/></div>
The above problem might have been happening because we are running with a version of ATG that is for Servlet 2.3 but we are running with a version of JBoss that runs with Servlet 2.4.
There is another tip on removing white space in this JSP FAQ: Why I am getting extra whitespace in the output of my JSP? In our code we had one file which included a bunch of tag libraries. It originally looked like this.
<%/** Taglibs.jsp: include to pull in all taglibs */%>
<%@ taglib uri="/dspELTaglib" prefix="dspel" %> <%@ taglib uri="/jstlCoreTaglib" prefix="c" %> <%@ taglib uri="/struts-bean" prefix="bean" %> <%@ taglib uri="/struts-tiles" prefix="tiles" %
When we changed it to this we saved about 5% in terms of page size in bytes.
<%@ taglib uri="/dspELTaglib" prefix="dspel" %><%@ taglib uri="/jstlCoreTaglib" prefix="c" %><%@ taglib uri="/struts-bean" prefix="bean" %><%@ taglib uri="/struts-tiles" prefix="tiles" %>
You can use this tip with a DSP page and maintain indentation.
<dspel:page ><dspel:droplet name="/betweengo/droplet/Foo" ><dspel:oparam name="output" >Name: <dspel:valueof param="name" /></dspel:oparam ></dspel:droplet ></dspel:page>
Turning off JSP access
by Frank Kim on Aug.15, 2008, under HTTP Server
To turn off JSP access in your JBoss or other favorite application server add this to your web.xml.
<!-- Restrict direct access to jsps -->
<security-constraint>
<web-resource-collection>
<web-resource-name>you_cant_touch_this</web-resource-name>
<url-pattern>*.jsp</url-pattern>
</web-resource-collection>
<auth-constraint/>
</security-constraint>
To prevent Apache from sending JSP requests to JBoss add the following to your configuration.
## DISALLOW FROM REACHING JBOSS (security-related filter): !/*.jsp=name_of_your_app !/*.xml=name_of_your_app
Display formatted HTML text
by Frank Kim on Aug.12, 2008, under JSTL, Page Development
In DSP to display formatted HTML text you use the valueishtml converter attribute. For example:
<dspel:valueof param="displayName" valueishtml="true"/>
For example “foo & bar” becomes “foo & bar”.
In JSTL to do this you tell JSTL not to escape the XML. For example:
<c:out value="${displayName}" escapeXml="false" />
Cygwin Bash Scripts and Java
by Frank Kim on Aug.08, 2008, under Bash, Cygwin, Java
Running Java scripts in Cygwin bash scripts becomes a little tricky because you want to treat most paths in Cygwin as normal UNIX paths but Java expects DOS paths. Therefore to get around this you can use the mixed option for cygpath.
For example:
if [ -e /usr/bin/cygpath ] || [ -e /bin/cygpath ] then export FOO=`cygpath --mixed "e:\work\betweengo/target/foo"` else export FOO="e:\work\betweengo/target/foo" fi
The result on Cygwin is that FOO will be set to “e:/work/betweengo/target/foo” which will work both in DOS and UNIX.
List users
by Frank Kim on Aug.08, 2008, under Oracle
To list all the users in a database log in as the sysadmin and query the dba_users table.
$ sqlplus sysman/123456@dev01 SQL> select username from dba_users where username like 'Frank%';
Sets cannot be used as property types
by Frank Kim on Aug.06, 2008, under Nucleus
I create a JavaBean with a Set property because I wanted to enforce that there were only unique values in that Set. However when I tried to use this JavaBean with a properties file, Nucleus complained it could not resolve the elements of the Set property. When I changed the property to be a List or a String [] Nucleus had no problem.
Here is the properties file.
$class=com.betweengo.droplet.VerifyImages $scope=request # supported image dimensions supportedImageDimensions=75x90,88x31,120x90
ATG Support pointed me to the Property Types subsection of the Using Nucleus
section of the ATG Programming Guide. Specifically only these simple types are supported. I am not sure why Set was excluded.
boolean
byte
char
short
int
long
float
double
java.lang.Boolean
java.lang.Byte
java.lang.Character
java.lang.Short
java.lang.Integer
java.lang.Long
java.lang.Float
java.lang.Double
java.lang.String
java.util.List
java.util.Map
java.util.Locale
Best Practices for Creating Tables
by Frank Kim on Aug.01, 2008, under Oracle
Recently our DBA recommended the following for creating tables.
- All constraints (primary keys, unique keys, foreign keys, etc….) should be declared outside of the CREATE TABLE …. statements, and instead done as ALTER TABLE statements.
- All tables must have table and column comments to provide information for the data dictionary/schema metadata.
Not Best Practice:
CREATE TABLE items ( id VARCHAR2(40) NOT NULL, type NUMBER(5) NOT NULL, PRIMARY KEY (id) );
Best Practice:
CREATE TABLE items ( id VARCHAR2(40) NOT NULL, type NUMBER(5) NOT NULL ); ALTER TABLE items ADD CONSTRAINT items_pk PRIMARY KEY (id); COMMENT ON TABLE items IS 'repository items'; COMMENT ON COLUMN items.id IS 'primary key (repository id)'; COMMENT ON COLUMN items.type IS 'item type';
I asked the DBA why this is considered best practice and this is what he said.
The DBA’s put indexes into a different tablespace than the table itself for storage, admin, and somewhat performance reasons (NetApp spreads out the I/O so does not quite apply to Upromise environment).
If the PK is part of the table create statement, they have to break out the statement in order to put the PK into a different tablespace or different storage parameters than the table. Having the statements separate from the start makes things smoother.
- Jeff Janousek, Upromise DBA
Repository creating tables automatically
by Frank Kim on Aug.01, 2008, under Hibernate, Repository
Recently we noticed while running some ATG unit tests that tables were being created by the ATG repository if they had not already been created by our SQL scripts. This was a functionality that I was unaware of but apparently it is not unique, Hibernate does this too. I could not find any documentation about this nor could I determine how to turn it off.
The ATG repository creates these tables using the repository definition and the defaults for column width and data type. It does not seem to warn that it is creating these tables.
Spaces, not Tabs
by Frank Kim on Aug.01, 2008, under Eclipse
The holy war about spaces or tabs continues and you can see all sorts of arguments for each side raging around the internet.
I prefer spaces because it’s a consistent format that remains the same no matter what you are using. With tabs things appear differently depending on how your editor or other program is configured. Plus the worst thing is when spaces and tabs get intermixed.
Arguments for tabs such as they take up less room or it’s easier to move around are in my mind weak. In this day of terabyte disk drive, file size differences between tabs and spaces are trivial and most of your disk space is taken up by images and binary files anyway. And being able to move around and format quickly is not an issue either with modern editors.
The two editors I use most are XEmacs and Eclipse. Below I describe how to use spaces for indents for each program.
In Emacs:
(setq-default indent-tabs-mode nil) ; Use spaces for indents except
; in buffers that already have
; their own local values for the
; variable.
In Eclipse:
