April 2008
Monthly Archive
Tue 29 Apr 2008
ATG has two JSP tag libraries, DSP and DSPEL. Both have similar syntax but DSPEL allows you to use JSTL.
Here’s a simple comparison of how you would use DSP versue how you would use DSPEL to do a simple RQL query.
DSPEL
<dspel:droplet name="/atg/dynamo/droplet/RQLQueryForEach">
<dspel:param name="repository" bean="/betweengo/Repository"/>
<dspel:param name="itemDescriptor" value="Merchant"/>
<dspel:param name="queryRQL"
value="name EQUALS \"${requestScope['nm']}\""/>
<dspel:oparam name="empty">
No merchant with the name "<c:out value="${requestScope['nm']}"/>".
</dspel:oparam>
<dspel:oparam name="output">
Name: <dspel:valueof param="element.name"/>
</dspel:oparam>
</dspel:droplet>
DSP
<% String query = "name EQUALS \"" + request.getAttribute("nm") + "\"";%>
<dsp:droplet name="/atg/dynamo/droplet/RQLQueryForEach">
<dsp:param name="repository" bean="/betweengo/Repository"/>
<dsp:param name="itemDescriptor" value="Merchant"/>
<dsp:param name="queryRQL" value="<%= query %>"/>
<dsp:oparam name="empty">
No merchant with the name "<%= request.getAttribute("nm") %>".
</dsp:oparam>
<dsp:oparam name="output">
Name: <dsp:valueof param="element.name"/>
</dsp:oparam>
</dsp:droplet>
Wed 23 Apr 2008
Posted by Frank Kim under
OracleNo Comments
Thanks to this article, Oracle/PLSQL: Change a user’s password in Oracle, it was quite simple to change a user’s password.
SQL> alter user frank identified by password;
Tue 22 Apr 2008
Posted by Frank Kim under
Eclipse ,
MavenNo Comments
Eclipse was complaining in its Java Build Path panel that it did not know what MAVEN2_CLASSPATH_CONTAINER was. Searching around I realized that it was because I had not installed the Maven plugin.
After installing and restarting I went to Project > Update All Maven Dependencies to pull down all the dependencies.
Fri 18 Apr 2008
Posted by Frank Kim under
OracleNo Comments
Whenever I tried to start my local TNS Listener service, OracleOraDb10g_home1TNSListener, I would get an error like this.
The OracleOraDb10g_home1TNSListener service on Local Computer started and then stopped. Some services stop automatically if they have no work to do, for example, the Performance Logs and Alerts service.
This forum thread, Can’t start Oracle service, suggested I do the following to diagnose the problem.
- cmd
- lsnrctl
- start
This worked and I saw the following error which showed my Oracle install had not been properly done, the listener was pointing to the wrong server.
LSNRCTL> start
System parameter file is
C:\oracle\product\10.2.0\db_1\network\admin\listener.ora
Error listening on:
(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=bad.betweengo.com)(PORT=1521)))
TNS-12545: Connect failed because target host or object does not exist
TNS-12560: TNS:protocol adapter error
TNS-00515: Connect failed because target host or object does not exist
32-bit Windows Error: 1004: Unknown error
In C:\oracle\product\10.2.0\db_1\network\admin\listener.ora the listener is improperly configured for bad.betweengo.com.
LISTENER =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = bad.betweengo.com)(PORT = 1521))
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC0))
)
)
I ran Oracle’s Net Configuration Assistant and updated the Listener configuration which fixed the above listener to point to my server. Now C:\oracle\product\10.2.0\db_1\network\admin\listener.ora points correctly to good.betweengo.com.
LISTENER =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = good.betweengo.com)(PORT = 1521))
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC0))
)
)
Fri 18 Apr 2008
Posted by Frank Kim under
Windows1 Comment
Sometimes I will start up a server process and get an error about a port already in use. This problem always bedeviled me before as I randomly stopped processes until that port was freed up.
But today a colleague pointed out a great Microsoft tool called TcpView.
TCPView is a Windows program that will show you detailed listings of all TCP and UDP endpoints on your system, including the local and remote addresses and state of TCP connections. On Windows Server 2008, Vista, NT, 2000 and XP TCPView also reports the name of the process that owns the endpoint. TCPView provides a more informative and conveniently presented subset of the Netstat program that ships with Windows. The TCPView download includes Tcpvcon, a command-line version with the same functionality.
With TCPView I discovered and stopped the anti-virus program which was taking up one of the ports that the server needed. This is much nicer than netstat. 
Thu 17 Apr 2008
Posted by Frank Kim under
MiscellaneousNo Comments
In my .emacs I was loading the subversion plugin.
(require 'psvn)
Unfortunately on systems that don’t have the subversion plugin Emacs would barf on this line and stop loading the rest of the .emacs file.
Fortunately someone else had asked a similar question, alternative to (require …), on gnu.emacs.help.
Based on that thread I updated my .emacs with this code.
(condition-case nil
(require 'psvn)
(error (message "Subversion plugin unavailable, skipping load ...")))
Wed 16 Apr 2008
Posted by Frank Kim under
CygwinNo Comments
Whenever I start my bash shell I get this annoying message.
Your group is currently “mkgroup”. This indicates that
the /etc/group (and possibly /etc/passwd) files should be rebuilt.
See the man pages for mkpasswd and mkgroup then, for example, run
mkpasswd -l [-d] > /etc/passwd
mkgroup -l [-d] > /etc/group
Note that the -d switch is necessary for domain users.
I tried doing what the documentation but I still kept getting that message. I then tried one of the suggestions in the comments of this post, Cygwin users and groups « sinewalker.
$ mkpasswd -l -p /home/ -c > /etc/passwd
$ mkgroup -l -c> /etc/group
I then got this message.
Copying skeleton files.
These files are for the user to personalise
their cygwin experience.
These will never be overwritten.
`./.bashrc’ -> `/home/fkim//.bashrc’
`./.bash_profile’ -> `/home/fkim//.bash_profile’
`./.inputrc’ -> `/home/fkim//.inputrc’
Your group name is currently “mkgroup_l_d”. This indicates that not
all domain users and groups are listed in the /etc/passwd and
/etc/group files.
See the man pages for mkpasswd and mkgroup then, for example, run
mkpasswd -l -d > /etc/passwd
mkgroup -l -d > /etc/group
This message is only displayed once (unless you recreate /etc/group)
and can be safely ignored.
I am not sure what it means but it was only displayed once. Now that I am not seeing it anymore I’m happy. 
Mon 7 Apr 2008
Posted by Frank Kim under
Ruby on RailsNo Comments
Today I took the plunge and installed Rails 2.0.2. Notes on the Rails 2.0 release can be found here.
Here are the steps I took.
- Upgrade Ruby Gems to the latest version (in this case 1.0.1).
gem update --system
- Install Ruby on Rails 2.0.2.
gem install rails -v 2.0.2
- Install MySQL gem (as of March 5, 2008, it is version 2.7.3) and add MySQL executable to path.
gem install mysql
- Create prayer application.
rails prayer -d mysql
- Install Restful Authentication plugin.
cd prayer
ruby script/plugin install http://svn.techno-weenie.net/projects/plugins/restful_authentication/
- Create scaffold for prayer model.
ruby script/generate scaffold Prayer title:string body:text
The first thing I noticed different about Rails 2.0 is that the scaffold now also generates the model and data migration file with title and body as columns in the prayer table. Also the format of the data migration file is slightly more compact.
- Create user model with authentication. The
--include-activation flag is to create the mailers for activation and signup notification.
ruby script/generate authenticated user sessions --include-activation
- Configure config/database.yml and then create prayer and user tables in DB.
rake db:migrate
- Configure SMTP settings.
- Modify
app/models/user_mailer.rb, replacing the place holders with constants which you can configure with different values for different environments using config/environments/development.rb, config/environments/production.rb.
- Modify user_observer.rb to incorporate the reset and forgotten password features.
- Create scaffold for role model. Add an admin user.
ruby script/generate scaffold Role rolename:string
- Create permission model. Modify role and permission models to know about each other.
ruby script/generate model Permission
- Modify user model to use permissions.
Much of this post is based on this excellent post, Restful Authentication with all the bells and whistles. At this point I did not continue with much of the tutorial, especially with parts like password forgotten, separate account controller, etc.
Thu 3 Apr 2008
When I run rake db:migrate I get this error at the end.
Error in my_thread_global_end(): 1 threads didn't exit
I pinned it down to this code in one of my migration files.
# create admin user
user = User.new
user.login = 'admin'
user.password = 'password'
user.save(false)
If I don’t run user.save(false) I don’t get the error. I am not sure why, the user does get saved properly to the database.
I saw this post on the MySQL forums that seemed to indicate it was an issue with libmySQL.dll. So I upgraded my MySQL instance from 5.0.27 to 5.0.51a. Of course this did not go smoothly, I got this error when trying to reconfigure the MySQL server instance “MySQL service could not be started error 0″. Fortunately another post on the MySQL forums, Could not start service : Error 2003, solved this problem for me. I just had to remove the following files from the mysql/data directory.
- ib_logfile0
- ib_logfile1
- ibdata1
Unfortunately when I then did a rake db:migrate I saw this error.
Mysql::Error: Table 'prayer.schema_info' doesn't exist:
SELECT version FROM schema_info
After deleting and recreating the database I was finally able to run rake db:migrate. Unfortunately I still got the same error that inspired this post.
Googling some more I saw a MySQL bug report, MySQL Bugs: #25621: Error in my_thread_global_end(): 1 threads didn’t exit. Apparently this is a client side issue and I think I can safely ignore it though it is quite annoying.
Strictly speaking, this is not MySQL bug. This is a client bug - a client application (PHP, probably) linked with libmysqlclient calls my_thread_init() but does not call my_thread_end() as appropriate (doesn’t call at all or calls too late). MySQL client library detects this and issues a warning.
On the other hand, we can just remove the check and let buggy applications to fail some other way. Not calling my_thread_end() is a guaranteed memory leak. Calling it too late could easily crash the application.
Wed 2 Apr 2008
Posted by Frank Kim under
MiscellaneousNo Comments
This site, FreeConference, allows you to do free conference calling. I just did a conference call with a client and it worked well. I haven’t tried setting one up but free is free. 
Next Page »