spring grandiose jargons

service — is basically a CLASS (B) used by your class (A). In Spring, this service becomes an interafce.

service — is often an instance field in your class.

dependency — is basically an instance field. If class A has a B field and A uses some B functionality/service then A functionally depends on B.

^^^^ now we have seen the worst jargon overdose. A regular instance field is now designated a “service” and a “dependency”. And the 2 new terms have different usage contexts. Sometimes you call that field a “dependency”; sometimes you call that same field (or its class) a “service”; but you never call it a “field”

wiring — a serious app need to wire up hundreds of classes — HAS-A. Spring uses an xml config file, lots of interfaces, and an injector for this wiring.

trinity — for dependency injection, you need minimum 3 classes, the service, the client (your app) and the injector. Spring wants a third party to inject the dependency into the client.

In the extreme implementation,
* just about every field is declared an interface type
* every such field has a setter
* you seldom see new ..(). Bean Instantiation happens at appCx start-up time, by “Hollywood”


applet test@PC

Applets that are loaded from the local file system (from a directory
in the user's CLASSPATH) have none of the restrictions that applets
loaded over the network do.

left join == left outer join

“The ANSI outer-join syntax begins an outer join with the LEFT JOIN, LEFT OUTER JOIN, RIGHT JOIN, or RIGHT OUTER JOIN keywords. The OUTER keyword is optional.”  ==> LEFT implies LEFT-OUTER

“ANSI join syntax also allows the dominant or subordinate part of an outer join to be the result set of another join, when you begin the join with a left parenthesis.”
right join is lg2


Hi Raymand,

You mentioned documentation. Documentation is not only important for users, but also important for you to get a complete understanding of the entire project. After writing the documentation, hopefully you will be able to better describe the system to a new person such as your next client or a new interviewer.

I think in US and Singapore, many interviewers respect job candidates who understand past projects in-depth.

How stable is your job? Are you learning some new technologies such as java, dotnet, SQL? I recently improved my understanding of SQL joins, correlated queries, java OO, java exceptions, java threads, jsp/javabeans, servlet sessions… Now I feel like a stronger survivor.

a couple of realistic sorting challenges

Update: [[algo in a nutshell]] written by professors, has practical problem-solving suggestions.
Q: what if the storage system holding the long list doesn’t support random access, such as tape?
%%A: read into memory first, by chunk, then merge sort?

Q: what if there are too many items to hold in a computer’s RAM available within our budget? merge sort, but the bucket idea below is better.

Q: what if data is still arriving when we need to start sorting?
%%A: standard merge sort
%%A: if you know data is string and distribution is fairly uniform, you may want to create 26 (or 26+10) trees for A – Z, 0-9 and put incoming data therein. If data rate is too high, you can build 26 queues/circular arrays as the buffer in a producer/consumer pattern.
%%A: even with numeric input, you can do the same provided you know the distribution. In real system, use histogram to estimate the distribution.

I feel this is one case that needs real world experience. Designing a sorter without any idea of distribution is too academic and a waste of time.

what i can do to reduce the pain of adjusting to U.S.

Hi LT,

You asked how to reduce the pain and stress.

  1. keep healthy. Lving in such a difficult place, every little effort makes me feel good about myself.
    1. Remember that many advertised fast food is less healthy than we eat in S'pore
    2. avoid too much unhealthy snacks esp. during long office hours. tough for some people. I try to bring fruits and “healthy” biscuits
    3. regular exercise. tough for most people.
    4. take breaks during long work hours
  2. help my wife who is under more pain than me
    1. find some full-time activity to occupy her time
    2. spend quality time together
    3. try to get her to make new friends
    4. try to get her to become interested in learning English
    5. try to get her to find some new hobbies
    6. live around Chinatowns, where she can find Chinese food
  3. work long hours and feel good about it. This helps my adjustment.
  4. make new friends. I didn't find any time for this, since i was so busy with job and a million other “important” things.
  5. call home regularly
  6. increase income
    1. a mobile phone that can receive Chinese SMS from our families in China. We can't afford it now.
    2. better accommodation
    3. less time wasted on commuting. Extremely important to me.
    4. my wife will afford many foods that are simply priced beyond us
    5. more sight-seeing. important for my wife. There are so many places to see in this vast country.
    6. perhaps a more suitable training course for my wife. Right now many of them are just too expensive
    7. some new clothes for her

hash search again, briefly

Q: how can hash search be O(1) when the separate chaining gets longer and longer as input size grows?
A: hash table length grows in proportional to input size. I guess expected separate-chaining length doesn’t get longer but is independent of input size.

Most hash functions assume positive integer keys. If u have some other inputs, convert them to natural numbers.

Java probably uses MAD (multiply-add-divide) compression after hashing.