Today I finally found the solution - install latest motherboard drivers. I don't know why it takes me that long to think of that. Stupidity, I suppose.
Sunday, August 01, 2010
Thursday, July 29, 2010
Sunday, February 01, 2009
One popular advice offered to small investors like you and me is buying mutual funds in small amount and never touch it till retirement. The theory is that stock prices go up in long term and market timing doesn't work out in long run.
This advice clearly does not work to our advantage at a time like now. Take Vanguard 500 Index (VFINX) for example, its value dropped more than 30% between 2008-09-19 and 2009-01-30. In other words, if you sold it in mid September last year and kept the money in a checking account, you would come out 30% richer than if you had not.
It is a big difference between not sweat over normal market fluctuation and seeing a disaster coming and not get out of its way.
The best gadget I bought in 2008 is ooma.
Ooma is a VoIP phone that doesn't charge monthly subscription fees. I used to pay $27.95 a month for a local only land line + caller id + other government fees and taxes. Now I pay zero and get unlimited domestic calls within US. I am looking to recoupe the cost in about 9 months.
If you need to make oversea calls, you can purchase credit from ooma. The cost is comparable to skype.
If 911 support is important to you. According to http://www.ooma.com/learn/ooma_faq.php#q8, ooma supports e911.
I am very happy with ooma. Setup is straightforward; sound quality is great; and virtual voice mail allows me to listen to voice mails remotely.
Friday, March 23, 2007
If caller can not do anything to resolve the problem when exception happens, make the exception unchecked.
Technorati Tags: Java
Wednesday, January 24, 2007
No entry for past two days. http://www.javablogs.com/ViewDaysBlogs.action?date=23&month=0&year=2007 and http://www.javablogs.com/ViewDaysBlogs.action?date=24&month=0&year=2007 turn up empty.
Friday, December 15, 2006
Saturday, May 06, 2006
Exception breakpoint and Field Watchpoint are great timesavers when troubleshooting bugs that result in exception. No more staring at the code; sprinkling line breakpoints everywhere. Simply set up the exception breakpoint, reproduce the exception according to the bug description. Volia, Intellij suspends the program when it hits the exception and now it is easy to go through the stack and pinpoint what the problem is.
Technorati Tags: intellij
Monday, February 20, 2006
In the past, I did not get what is the big deal about the whole TDD (Test Driven Development) thing. When I previously skimmed Kent Beck's "Test Driven Development book, I found the example in the book to be ridiculously simple or even dumb sometimes.
That is until I had chance to pair with Edward and watch the TDD in action.
We had a bug to fix and Edward had a hunch about where the bug is. But instead of going straight to fix it, he insisted on writing a test to reproduce the bug first. Unexpectedly, the first version of bug reproducing test didn't turn red. This lead us to fire up debugger and started tracing the code. Along the way, we discovered that our hunch was in fact wrong. When the test finally turn red, we knew exactly how to fix the bug. And sure enough, it took us no time to make the test green and we were confident that we indeed fixed the bug.
It is truly an "Aha!" moment for me.
So I revisited Kent Beck's TDD book afterwards. The book's example still read as ridiculous. But as I can relate to my personal TDD experience, the messages in the book begin to resonate with me.
Since I started to practice TDD couple weeks ago, the most important change is that I no longer try to "over-apply" patterns up front. I am able to delay that decision till the needs arise knowing comfortably that I can always refactor to pattern without fear of breaking anything. A big plus in my book.
Technorati Tags: programming
Sunday, January 08, 2006
My wrist starts to bother me. To avoid RSI, I researched on ergonomic keyboard and narrowed my choices down to:
I ordered both keyboards to try out and hope they will save my wrist.
Thursday, January 05, 2006
Friday, November 25, 2005
Friday, November 18, 2005
Saturday, October 08, 2005
Friday, October 07, 2005
Tuesday, October 04, 2005
Saturday, October 01, 2005
To do redirect, server sends back a HTTP response status 302. Upon receiving such response, browser is obligated to request page from the new location, hence redirect happens.
HTTP/1.1 302 Object moved Location: somewhere/newlocation.jsp
Forward, on the other hand, happens internally on the server, and browser is not aware of it at all.
That explains why we need to encodeURL before redirect but not before forward; why states are kept when forward but not when redirect; why redirect method is on Response object but forward is on RequestDispatcher object.
Technorati Tags: Java
Friday, August 26, 2005
java.io.IOException: Bad file descriptor at java.io.RandomAccessFile.seek(Native Method) at org.apache.lucene.store.FSInputStream.readInternal(FSDirectory.java:415) at org.apache.lucene.store.InputStream.refill(InputStream.java:158) at org.apache.lucene.store.InputStream.readByte(InputStream.java:43) at org.apache.lucene.store.InputStream.readBytes(InputStream.java:57) at org.apache.lucene.index.CompoundFileReader$CSInputStream.readInternal(CompoundFileReader.java:220) at org.apache.lucene.store.InputStream.refill(InputStream.java:158) at org.apache.lucene.store.InputStream.readByte(InputStream.java:43) at org.apache.lucene.store.InputStream.readInt(InputStream.java:73) at org.apache.lucene.store.InputStream.readLong(InputStream.java:96) at org.apache.lucene.index.FieldsReader.doc(FieldsReader.java:59) at org.apache.lucene.index.SegmentReader.document(SegmentReader.java:237) at org.apache.lucene.search.IndexSearcher.doc(IndexSearcher.java:74) at org.apache.lucene.search.Hits.doc(Hits.java:101)
The Hits should only be accessed when its corresponding IndexSearcher is open. Attempting to access the Hits after the searcher is closed may result in above exception.
The most disturbing thing is that this is not mentioned in the Lucene Javadoc, nor in the "Lucene In Action" book. Thus guarantee any newcomer will be hit by the hits issue! (pun intended)
Wednesday, August 24, 2005
The intention of my previous entry is not to advocate the usage of Boolean to represent ternary state but to document a usage I found while reading some open source code.
Use NULL to represent state is technically valid and common practice. Nullable column is often used in database design and many APIs return NULL.
However, people seem to really hate this idea. Why?
I believe the reason is that the usage violates the "least surprise" principle. As programmers, we are hardwired to think of boolean as binary state. The usage in this case, although valid, is against human psychology.
Monday, August 22, 2005
In my current project, some queries share a pattern of "where category.id in (:categoryids)". To be "DRY", I implemented a routine to extract a set of category ids; then use Hibernate's setParameterList(). Nice and clean... and WRONG.
The problem is that database has limited buffer for parsing sql query so that there is a limitation on the length of the "IN" clause. The above approach works with small set of data but bombs out when data gets larger.
The solution is to place the query for extracting category ids directly in the "IN" clause as subquery. The result is messy with lots of string concatenation, special case handling. But CORRECT.
An example of leaky abstraction and a reminder to test with large data set early on.
Technorati Tags: sql
Wednesday, August 17, 2005
com.octo.captcha.service.CaptchaServiceException: no captcha for specified id is found at com.octo.captcha.service.EhcacheManageableCaptchaService$EhcacheStore.getCaptcha( EhcacheManageableCaptchaService.java:909) at com.octo.captcha.service.AbstractCaptchaService.getChallengeForID( AbstractCaptchaService.java:534) at com.octo.captcha.service.image.EhcacheManageableImageCaptchaService.getImageChallengeForID( EhcacheManageableImageCaptchaService.java:505)
To spend 1 hour to get Maven running so that I can build from source to fix a bug known since June is not exactly fun for me at midnight running in "death march" mode.
Sunday, August 07, 2005
I went to NFJS at Phoenix last weekend. Just as expected, the conference is well organized and speakers are great.
What I did not expect is the kind of comradeship I felt strongly towards fellow conference attendees whom I have never met before. When Larry pulled out the "Core Mac Osx And Unix Programming" from his bag and raved about the bignerdranch.com, I felt connected as I was planning to start learning Cocoa programming and the "Cocoa(R) Programming for Mac(R) OS X" by the same author is on my Amazon wish list. When I noticed Tim uses fisher pen and Moleskine Notebook , I knew instantly that he is a fellow Hipster PDA user for I have the same setup myself.
Although we are strangers, we are alike. We are all "geeks".
Saturday, August 06, 2005
JBoss : A Developer's Notebook is a little book that packs a surprisingly good amount of information.
I find the last chapter on how to harden the JBoss instance alone worth the book's price. Do you know that an out-of-box JBoss installation exposes
- the jmx console and web console without protection so that anybody can remotely shutdown the JBoss server?
- the remote class downloading service so that anybody can remotely download any file?
If the answer is "No", you probably own it to yourself and your client to check out the book. Flipping it through for 10 minutes at your local bookstore might save you from having to deal with a security break in.
Technorati Tags: book
Wednesday, August 03, 2005
org.jboss.mq.SpyJMSException: Could not store message: 2 msg=1 hard NOT_STORED PERSISTENT queue=QUEUE.teema_email_queue priority=4 lateClone=false hashCode=28390332; - nested throwable: (java.sql.SQLException: Io exception: Connection reset)
Above exception is thrown when trying to enqueue object into a JBoss JMS queue that is backed by a Oracle database.
The cryptic error message is not much help. Neither does Google. Not able to find stock anwser, I started to lay down facts in order to piece together the puzzle. The first clue is that the error appears only in a particular use case, but not in others. What is the difference, I wonder. One noticeable difference is that the object to be enqueued in the failed use case is quite large compare to those in other use cases. May be size of the object is the deciding factor here. A quick testcase confirmed my suspicion.
As I know JBoss saves JMS message as blob, this looks like a problem in handling blob data. Googling "oracle blob size" turns out both explanation and solution. Apparently the older Oracle thin JDBC drivers Upgrade to Oracle driver for 10g, which is compatible with Oracle 9 database, fixes the problem.
Tuesday, July 26, 2005
The Desert Southwest Software Symposium changed the presentation schedule. Two sessions I am most interested in, "Herding Racehorses and Racing Sheep" by Dave Thomas and "Advanced Object-Relational Mapping with Hibernate", are running side by side.
Now, that is a real bummer.
Saturday, July 23, 2005
Hibernate provides createSQLQuery() method on the Session for native SQL. However, this method must return a persistent class and can be costly at times.
When raw power is needed, get a JDBC connection by calling connection() method on the Session.
Technorati Tags: Hibernate
Monday, July 18, 2005
Let me take back my words.
JDeveloper on OSX is useless for PL/SQL programming. Attempt to compile a simple procedure will crash the JDeveloper. Now I am back to using SQLPlus. Is there any tool, preferably free, that works well on OSX for PL/SQL?
After posting, I remembered that I am using Apple's JDK 1.5. Maybe JDeveloper doesn't work so well with 1.5, I thought. So I switched to JDK 1.4.2_08 from Apple and sure enough, it crashes no more.
Now if you excuse me, I have got some triggers to write.
Wednesday, July 13, 2005
This gotcha me today. The Collections.sublist() method returns an instance of java.util.RandomAccessSubList, which is obviously not serializable. Solution is easy - just add all contents to an serialziable list implemenation such as ArrayList.
Technorati Tags: Java
Went to my first LAJUG meeting tonight. Si Chen @ Open Source Strategies, Inc presented Open For Business In A Nutshell. I have to confess that I almost passed the meeting for mistaken it as some talk on open source business model. Turns out it is about ofbiz open source project and I am glad that I didn't miss the presentation.
Si is not only a commiter on the ofbiz project but also build his own online shopping site using ofbiz. The fact that he eats his own dog food makes him much creditable to me.
I briefly checked out ofbiz workflow about two years ago. My major reservation at the time was its map based API. I was worried about the loss of compile time check, refactoring support in IDE etc. When I raised the question tonight at the meeting, Si responded that he does not find this to be a problem in his experience. In fact he actually finds the map based API is easy to work with than traditional type based API. I didn't get a chance to ask him what kind of team he had to work with. My current take on the issue is that such a approach may be more suitable for a small and competent team, but probably not in a large team consists of programmers with various experience level.
Technorati Tags: Java
Thursday, July 07, 2005
Monday, June 20, 2005
Saturday, June 11, 2005
Note to myself: set up Oracle user.
renegade:~ oracle$ sqlplus "/ as sysdba" SQL*Plus: Release 10.1.0.3.0 - Production on Sat Jun 11 07:29:50 2005 Copyright (c) 1982, 2004, Oracle. All rights reserved. Connected to: Oracle Database 10g Enterprise Edition Release 10.1.0.3.0 - Production With the Partitioning, OLAP and Data Mining options SQL> DROP USER user1 CASCADE; User dropped. SQL> CREATE TABLESPACE user1 2 DATAFILE '/Volumes/u02/oradata/test1/user1.dbf' 3 SIZE 100M 4 AUTOEXTEND ON NEXT 10M 5 MAXSIZE 2000M; Tablespace created. SQL> CREATE USER user1 2 IDENTIFIED BY user1 3 DEFAULT TABLESPACE user1 4 TEMPORARY TABLESPACE temp; User created. SQL> GRANT CONNECT, RESOURCE TO user1; Grant succeeded. SQL> ALTER USER user1 QUOTA UNLIMITED ON user1; User altered.
Technorati Tags: oracle
Friday, June 10, 2005
This describes how I set up Oracle 10g on OSX Tiger for development use.
Sergio has an excellent instruction on how to install Oracle 10g on Panther. However because the Oracle requires gcc 3.3 and Tiger uses gcc 4 by default. Some hacks are in order.
Following Sergio's instruction to prepare Oracle installation environment. Issue the following commands before launch installer.
sudo nicl . -append /groups/admin users oracle sudo gcc_select 3.3Then launch the Oracle installer. The installation will fail towards the end when running database creation wizard. Simply abort and do following extra steps.
Step 1: Firstly, set up $ORACLE_HOME and $PATH in your .bash_profile. By default, the ORACLE_HOME is at "/Volumes/u01/app/oracle/product/10.1.0/db_1" if you follow Sergio's instruction. While logged in as oracle, add following two lines to .bash_profile, adjust the ORACLE_HOME value as necessary.
export ORACLE_HOME="/Volumes/u01/app/oracle/product/10.1.0/db_1" export PATH=$PATH:~/bin:$ORACLE_HOME/binIssue following command to activate new settings.
cd . .bash_profile
Step 2: Relink Oracle libraries.
cd $ORACLE_HOME/lib mv libnnz10.dylib libnnz10.dylib.ori relink all mv libnnz10.dylib.ori libnnz10.dylib
Step 3: Run 'dbca' to create a database.
Step 4: Run '$ORACLE_HOME/root.sh'. This script will appear hang at end and displaying a message "Expecting the CRS daemons to be up within 600 seconds." The CRS is only available on OSX Server so simply Ctrl-C terminate the process.
Step 5: Download Oracle startup and stop script and extract it to 'oracle' user home. Now you can start and stop Oracle instance by running 'startup.sh' and 'stop.sh' respectively.
Step 6: If your machine has a fixed IP, you probably don't need to perform this step. Since I run Oracle on my powerbook and I am only going to use this Oracle for development purpose, I change listener.ora and tnsnames.ora under $ORACLE_HOME/network/admin to make it work with dynamic ip like 192.168.0.1 and only connectable from localhost.
My listener.ora looks like:
SID_LIST_LISTENER = (SID_LIST = (SID_DESC = (SID_NAME = test1) (ORACLE_HOME = /Volumes/u01/app/oracle/product/10.1.0/db_1) ) ) LISTENER = (DESCRIPTION_LIST = (DESCRIPTION = (ADDRESS_LIST = (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC)) ) (ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP)(HOST = localhost)(PORT = 1521)) ) ) )
And my tnsnames.ora looks like:
TEST1 = (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = localhost)(PORT = 1521)) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = test1) ) ) EXTPROC_CONNECTION_DATA = (DESCRIPTION = (ADDRESS_LIST = (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC)) ) (CONNECT_DATA = (SID = PLSExtProc) (PRESENTATION = RO) ) )
One final point, Oracle 10g has its own JDBC driver. Drivers for Oracle 9 won't work with 10g.
Thursday, June 02, 2005
JBoss uses so called "Dead Letter Queue" to handle undeliverable JMS message. It can be configured with "conf/standardjboss.xml".
In times though, you may want finer control over JMS retry strategy. By setting JBoss specific properties before sending message, you can pragmatically override how undeliverable JMS message is handled.
- JMS_JBOSS_SCHEDULED_DELIVERY : scheduled time for message delivery
- JMS_JBOSS_REDELIVERY_DELAY : delay between retry in milli-seconds
- JMS_JBOSS_REDELIVERY_COUNT : count of retry
- JMS_JBOSS_REDELIVERY_LIMIT : max number of retry attempt
TextMessage outMessage= topicSession.createTextMessage(outString); outMessage.setLongProperty("JMS_JBOSS_REDELIVERY_DELAY", 10000); outMessage.setLongProperty("JMS_JBOSS_SCHEDULED_DELIVERY", deliveryDate.getTime()); topicPublisher.publish(outMessage);
Technorati Tags: Java
Friday, May 27, 2005
I noticed that there is nothing from JavaBlogs since late last night. So I did a little investigation. Turns out that the RSS feed is invalid. Instead of a valid XML document, the RSS is wrapped inside HTML mark up and this chokes any RSS parser. In addition, the "title" element is missing.
Updated my javablogs preprocess script to handle this unexpected scenario.
Monday, May 16, 2005
Monday, May 09, 2005
Tuesday, April 19, 2005
The difference between a software engineer and a computer programmer as similar to the difference between a civil engineer and a carpenter. -- T. Scott Ankrum on comp.software-eng
Only recently, I found out some Universities offer such programs as Master in Software Engineering. The curriculum is definitely interesting I only wish I had time and money to attend such a program.
Technorati Tags: software engineer
Friday, April 15, 2005
Thursday, April 14, 2005
While porting our application to Websphere 6.0 Express, we see following error message.
TRAS0014I: the following exception was logged java.lang.SecurityException: Attempted commit in subordinate at com.ibm.ws.Transaction.JTA.UserTransactionImpl.commit(UserTransactionImpl.java:251) at net.sf.hibernate.transaction.JTATransaction.commit(JTATransaction.java:55)If you know what this error message means, please drop me a note. Thanks!
Update (04/14/2005 23:02:10): it looks like the Hibernate version we use doesn't play nicely with Websphere 6.0.
Thursday, March 24, 2005
Dan, are you referring to two phrase locking or two phrase commit? If my memory is not failing me, the two phrase locking refers to the database locking model which ensures serializable transaction. While the two phrase commit is referring to how distributed system can collectively make a decision. It can be used for distributed transaction, but not limited to that.
Technorati Tags: computer science
Sunday, March 20, 2005
If I were interviewed by SKI_BUM and given days to think it through, my answer would be as following.
Pick one or more Java API's/Class libraries and critize them (both good and bad). I don't know about you. I can never remember the appropriate IO classes to use to read/write a file. Granted, the use of decorator pattern in the Java IO libraries makes it very flexible and powerful and all that. But for mundane tasks, such as reading text file, it is awkward to use and too complicated to remember. A set of routines handling common tasks in one liner fashion as in Ruby and Python would make developers' life easier and save everybody's trouble to write his own FileUtil.
How do you participate in a team? A productive team doesn't automatically appear when you throw bunch of people together. It only grows as a result of conscious effort by management and an encouraging environment. It takes two to make up a team. So I will make you a deal. I promise I will be a good team player if you work hard to grow it.
If you have a problem in the team, for example a design problem that you can't agree on, how do you usually solve the problem? I used to believe naively that design problem should be argued purely on technical merit and reasoned with rational. That is why my view did not go through even if it was later proved to be right.
Now I am wiser. When dealing with people, even if they are tech people or even geek, we can never ignore the politics at play, or the sociology as said in the Peopleware. I am working on my HTWFIP skills.
When you design a system, what are your objectives (for instance do you care most about performance, the users, etc.)? Simple to use, good default, and easily extensible.
What books on software or programming have you read lately? In the last month, I read Programming Ruby: The Pragmatic Programmers' Guide, Second Edition, Peopleware : Productive Projects and Teams, 2nd Ed. and Advanced Bash-Scripting Guide.
Ruby is the language I plan to learn this year. Bash is something I found myself in need at work. I read Peopleware because I realized, only recently, that tech skills alone is not enough to be a good developer.
Refactoring: Improving the Design of Existing Code, The Pragmatic Programmer: From Journeyman to Master and Design Patterns are the first three books I read when I first started my programmer career 4 years ago and they are on the top of my reading list. But did not read those lately.
How do you keep up with what's going on in the industry? Following Pragmatic Programmer's advice, I try to read a book every month and learn a new language every year. In addition, I read blogs to keep on top of industry news.
What's your experience with design patterns, refactoring and test-first development? There was a period right after I finished Design Patterns book, I could not help myself to refer to a design pattern when discussing code. Now however, after it sinks in, I find myself seldom talk about it anymore. It just blends in.
Although Refactoring is about improving the existing code, I tend to use it as my coding guideline and strive to write good structured code in the first place. With more and more tools supporting automatic refactoring, it is not as important to know how to do a particular refactoring by hand as to understand why a particular refactoring is needed.
I spent last year working on a Swing application and I find it is really hard to write unit testing for it.
How do you design in UML? Do you design everything in details and the code mechanically afterwards? I don't design in UML. I use UML as sketching, as Martin Fowler suggested. I cringe whenever people suggest detailed design in UML. Firstly, I don't believe you can thought of every design detail without actually writing the code. So detailed design upfront means surprise and more surprise when actual coding starts. Secondly, unlike programing language, UML is ambiguous, people tend to interpret differently.
What's your attitude towards code standards, best practices, etc? I think every team should follow a minimum set of code standards, one page at max, so that team can easily review others' code. I have my preference in coding standard but I am not religious about it. I think code standards is a mutual agreement grow out of team members rather than imposed by management.
How do you feel about learning new API's? It is the nature of our business that one has to keep oneself updated. If a new library or framework improves my team's productivity, I am certainly all for it. However I also learnt over the years to be caution of marketing propaganda. That means I will evaluate a library on my terms rather than market hype.
I skipped two questions regarding to what I am working on as my boss won't be too happy to find it here.