an obj ref = a remote control

each rcontrol is programmed to a target.
u can program your rcontrol to an Animal, or a Mammal, or a Dog, or erase all programming.

When your rcontrol is programmed for an Animal, bark() method is not available — the “bark” button is in a detachable extension and removed from the rcontrol. You need to cast.

Q: objects are passed by…?
A: well, u duplicate the rcontrol. A method receiving an arg need to duplicate the rcontrol and can’t reprogram the original rcontrol

Q: FINAL var (of a ref type) means?
A: non-reprogramable

[07] interviewers’ favorite topics

See also “halo”.
xp: These areas have received disproportional attention from interviewers. ranked.

* threading
* collections
Study iterator, comparator, hashCode()
Study load factor and capacity — asked by multiple financial giants

* outer join@@ not much depth
study join order, subquery

* interface, abstract@@ not much depth
* GC including finalize()
study generational GC, mem leak and jvm profilers

* deadlock
* servlet life cycle
* singleton, mvc, dao,
* vector ^ arraylist, or hashtable^hashmap
* list 1.5 features

ROTI [[oracle sql tun`]]

cost-based optimizer vs rule-based optimizer
optimizer modes — choose, rule, first_rows, all_rows
diminishing return, most significant queries to target
4 areas of ora tuning — instance, norm/denorm(with triggers), OS, SQL
self-join examples
oracle implementations of joining, in relation with subqueries
function-based index
what can disable an index
optimizer hints
sql cache
hash storage for often-joined tables
essential table-access methods
essential index-access methods
reading execution plans

java ServerSocket.accept()

I think this should be one of the first important yet tricky socket methods to study and /internalize/. Memorize it’s extended signature and you will understand how it relates to other things.

See P221 [[ java threads ]].

A real server jvm always creates and uses 2 *types* of sockets — a single well-known listening socket, which on demand creates a “private socket” (aka data socket) for each incoming client request.

The new socket manufactured by accept() has the remote address:port set to the client’s address:port and is already connected to it.

I think the new socket initiates the connection, therefore this socket is considered a “socket” and not a ServerSocket. Nothing found online to confirm this.

NY iview — meetup

q: with and without sub queries, write sql to show employees not assigned any project, given employee (id, name), employee_project (eid, pid)
%%A: outer join with count() = 0 ? Yes see post on payment history contains actors not casted

select count(name) from actor left outer join casting on where casting.actorid is null

Based on IBM webpage: “The following query returns only rows in which customers have not made any calls

SELECT c.customer_num, c.lname,,, u.call_dtime, u.call_descr
FROM customer c LEFT OUTER JOIN cust_calls u
ON c.customer_num = u.customer_num
WHERE u.customer_num IS NULL “

This is a case of a normal “unmatched prikey”. No referential integrity violation.

q: xp with mysql replication? (programmers need to know mysql replication.)

q: describe an xq java web project

q: difference btw spring mvc vs struts

q: java 5 features? generic, enum

q: describe a personal pet project (“side project”)

q: why do u say smarty is cleaner separation of presentation and logic than jsp or asp?

q: name a technology that excites u now and name one feature

q: php caching

q: php connection pool

q: unit testing?

q: ajax xp?

q: web services xp?

q: state sync between 2 instances of php?

%%q: important technical skills for this job
a: mysql cluster, fast sql queries, core java, junit,

hurix IV – web java + JMS

q: can an interface define member variables?
q: spring: how do u configure a spring mvc system?
q: struts: did u use validator, struts tags or tiles? How do u configure your struts app to use tiles?
q: if an abstract class defines a constructor, does the derived class constructor need to make an explicit call to it?
q: how does a web app in 1.war forward to a web app in 2.war? Is requestDispatcher used across web apps?
q: what’s the significance of hash value of an object
q: how do u implement a customized hash value based on the data encapsulated?
q: how do u make an arrayList of person objects sortable by birth date? How Can I sort this ArrayList?
q: what’s the traditional solution to the problem enum is designed to solve?
q: from the definition of home and remote interface, can u tell the difference between a slsb and a sfsb?
q: for a mdb, which method must u write? which interface/base-class is it part of?
q: if a jms requester sends requests about person 1, 2 and 3 to a queue, and need the server to reply on the same person 1, 2 and 3, how does JMS support it? (I think the reply must specify “this is for Person X”)

feel good despite insensitivity ]office

) Not a moral issue, even when you hurt someone’s feelings.
) xp: less of a problem in a cross-cultural team. Look at 2006 and later
) Hopefully Americans are more direct
) much less insensitive in writing.
) saving grace — pure heart, fairness, equality, integrity
) saving grace — am sensitive to most essential needs of a corporate worker, universal themes, well-understood
) habit @ reflection, which has caught countless “mismatched” and lost signals between colleagues and me
) constantly learning and paying conscious attention to this area
) This is one of the areas I’m likely to get better, not worse. Once you trip over a stumbling block, you will spot it next time.

java ServerSocket HAS-A queue

Default queue of 50 waiting “patrons” to our restaurant. If a patron arrives when the queue is full, the connection is refused.

Each “successful” patron would be allocated a dining table ie an address:port on the server-side.

The operating system stores incoming connection requests addressed to a particular port in a first-in, first-out queue. The default length of the queue is normally 50, though this can vary from operating system to operating system. Some operating systems (though not Solaris) have a maximum queue length, typically five. On these systems, the queue length will be the largest possible value less than or equal to 50. After the queue fills to capacity with unprocessed connections, the host refuses additional connections on that port until slots in the queue open up. Many (though not all) clients will try to make a connection multiple times if their initial attempt is refused. Managing incoming connections and the queue is a service provided by the operating system; your program does not need to worry about it. Several ServerSocket constructors allow you to change the length of the queue if its default length isn’t large enough; however, you won’t be able to increase the queue beyond the maximum size that the operating system supports.

feel good +! gr8humor ]ff

) First off, jokes don’t cross cultures
) Some colleagues found me laughable. In contrast, Some workers are widely considered no-fun, too serious …. Clinically “sick”
) I have always felt like a simple, almost naive person on most teams
) sometimes I can feel and look relaxed
) xp: with some colleagues I could enjoy great, hearty jokes — Philippe, Tom Wei, Sreeni, Ansari, Guru, Sashi, Teck Wei, Andrew, tanko, Zhang Jun, Zhang Jiong

Can a bright rookie join the project you own@@

One GS interviewer (Mark deMunk?) asked me to imagine myself as a team lead. A bright C programmer wants to join a java project and learn java. What are the key factors beside timeframe, criticality, monetary cost/profit?

I mentioned “viability” ie Can he contribute at all? Even with quite a bit of time and non-mission-critical, sometimes a bright rookie just can’t. Maybe it’s too difficult. Maybe it’s not well-modularized so a newcomer must quickly absorb lots of things. Maybe …

Interviewer suggested “complexity”. I decided to defend myself.

* A Complex project may still be open to a rookie is it’s well-modularized and/or there’s someone to guide him so he can take a small bite and chew it slowly. I think usually complexity comes from business requirements.

* On the other hand, a ten-table DB design is perhaps low-complexity. Further assume it’s not critical. A rookie could try 5 times and still fail to get it right, if he doesn’t know the normalization/denorm practices and what key questions to ask the DB users. I think it takes a rookie a few hours of research and consultation to get it right. My point is, do you want to trust a rookie for that?

css selector clearly explained

Q: what's a “selector”, in one sentence of plain english?
A: bit of a CSS definition that says what the styles are applied to

Q: 3 basic types of selectors?
* HTML Elements, such as

tags, tags etc.
* Elements with a specific class, for example an element with the
class “mystyle” (

* Elements with a specific ID, for example an element with the ID
“myparagraph” (


Q: pseudo selectors's signature, purpose, eg?
A: Examples of this are link states (unused, visited, active) and
first lines and letters. The selector has a colon after it with the
state before the definition. An example of this is the CSS definition
for changing the colours of link colours:

A:link {color:blue;}
A:visited {color:green;}
A:active {color:gold;}

Q: nested selector example?

synchronized protects against inconsistency@@

Not always, unfortunately. After throwing exceptions, the synchronized method may leave the data in a /bizarre/, illogical, impossible state, but JVM always releases the lock automatically, and permits other threads to read/write this wierd data! For more on inconsistency, read other blog posts.

This exception issue is Arguably the Achilles’ heel of “synchronized” — perhaps the only weakness in its promised protection against inconsistency.

Luckily, Lock interface comes to the rescue. It doesn’t release the lock after an exception. However, this can create deadlocks, since the lock held is never automatically released. You need finally{}.

Conclusion: Lock interface with finally{} protects against the twin evils of inconsistency && deadlock, in the event of exceptions.

In fact, exceptions, consistency and deadlock are right at the heart of a major design challenge in JVM thread implementation. See P 123 [[ java threads ]].

vmware iview — group-by count obscure behaviour

q: benefit of IoC

q: if my logger class has a init() and a cleanup(), to be called at tomcat start and shutdown. how to make them run at the right time.

Q: what if someone tries to call myclass implements Runnable.
A: no problem. in my EMS app, my main() calls it.

Q: if myclass run() is private, if we don’t need to worry about the Thread start() calling it, what other problems will u get?

(key question) q: in or outside java, how do u implement a hash map class? What if u already have a reasonably good hashcode() method?

q: explain mvc and struts

q: explain deadlock and prevention

(key question) q:
table Employee (e_id, e_name, d_id)
table Department (d_id, d_name)
we put in
1000 records for Engineering department
300 for testing department
2 for finance
0 for abc department (new department)

Write a query to output

engineering 100
testing 300
finance 2
abc 0

/* select groupId=0, item=null into #tmp
insert #tmp select 1, 7
insert #tmp select 1, null
insert #tmp select 1, 8 */

select * from #tmp
select groupId, count(item), count(*) from #tmp group by groupId — count(item) only counts non-null values;

What areas should I improve? His answer: his 2 focuses for this interview: sql + data structure

perl q[use strict vars] — tips

A one-sentence summary — somehow “mentioned” as a variable, before you can use it under strict

Longer summary — For a variable to be acceptable, either it is package-qualified or pre-declared like —
– my, our but not “local”
– mentioned in “use”, i.e. imported from a module [1]

This is a pretty good start if you can’t remember every detail about use strict ‘vars’.

[1] ok to export/import subs but beware of exporting/importing vars. P409 [[ perl best practices ]]

read` DB execution plan


1st step — get an overview. To reduce the confusion, always remove line wrap and reveal the indentation (Oracle). Like Python(?), indentation indicates flow including nested flow constructs.

2nd step — get a basic idea of the different table/index access methods. These are the basic vocab of “explain”

q: do u read inside out or sequentially?

q2: what’s the most obvious thing to look for in an execution plan?

q: Beside the most obvious, what else can u look for? no simple answer yet