Y K on T2000 vs E10k

Q: processing power?
A: E10k is old. About 400Mhz cpu. T2000 has more processing power.
Q: form factor?
A: E10k takes a full rack, with up to 16 boards, each holding up to 4 processors
Q: any special skill required to administer e10k or above?
A: not much different from mid-range sparc systems

accumulated domain xp fetching salary premium@@

Update: Sanjay in Stirt felt his domain xp should be protective but no. GTD was key in that team.

DaShan: Prior Domain experience may not translate into higher code quality or productivity on the next job, due to restrictions and important differences between systems.

salary depends on many factors like

– budget and company size
– relationship with the site owner
– urgency
– domain experience

When I first met DaShan, I felt he has some invisible upper hand as a developer with that domain experience. I felt that way because of the ignorance or “lack of domain knowledge”. Now I know that other people also see me with that Halo.

How about the high math of MSFM?

1st steps in java design: file naming

Consider choosing package names for your objects that reflect how your application is layered. For example, the domain objects in the sample application can be located in the com.meagle.bo package. More specialized domain objects would be located in subpackages under the com.meagle.bo package. The business logic begins in the com.meagle.service package and DAO objects are located in the com.meagle.service.dao.hibernate package. The presentation classes for forms and actions reside in com.meagle.action and com.meagle.forms, respectively. Accurate package naming provides a clear separation for the functionality that your classes provide, allows for easier maintenance when troubleshooting, and provides consistency when adding new classes or packages to the application.

java clientside inet-sockets — briefly

Look at Socket.java constructor signatures. As a client side internet socket (not UD-socket), the most basic address:port pair needed is the REMOTE address:port.

Q: so how about the local address:port?
A: Usually, only after a socket is created with the remote address:port, does the socket need to bind() to a local address:port.

Q: Can a Socket object can be on server side or client side.
A: I think both. See ServerSocket.accept() javadoc. accept() manufactures a socket object in the server jvm.

Q: Can a java Socket object be associated to 2 connections? The output data would broadcast into both channels?

y i don’t focus on 1 vendor’s product

By age 30, many peers have decided to focus on Cisco, on Oracle, on Microsoft dotnet, on IBM, on SAP, on Powerbuilder. Other choose to focus on a domain like online gaming, financials …

(By “focus”, i mean 50%-100% of their tech experience is related to the chosen field.)

I always feel what if one day you discover you don’t like your role in that particular ecosystem, or the vendor starts making questionable moves, or you don’t like the vendor’s tech support, or u notice their discrimination policy .. you would feel locked in, cos you have invested too much into it, putting all your eggs in a single basket.

In my case, i have several years experience in each of
– solaris, linux, hpux, freebsd
– Oracle, mysql
– java, C, perl, php
– weblogic, tomcat, sunone

public^private methods invoked by..

Background: We see many method names that confuse some readers as to what objects would invoke them.

Q: which object will call “my” public methods?
A: Client objects. Public methods in myClass.java constitute the expected services presented to “consumers/customers”. Quintessential examples are accessors and constructors. Another instance of myClass often call them too, in some designs.

Q: who will call “my” private methods?
A: only the /hosting/ class or a nested class. This case is simpler than the “public” case.

a perl package is a namespace

I don’t agree that a package, a module and a class mean roughly the same. Yes 1-to-1 mapping among the trio. In perl, the package construct is all about namespaces, while modules are more complex.

Some say a package represents a namespace; others say a package is primarily a symbol table. In simplistic terms, a package is a common prefix (or tag) you attach to a bunch of identifiers like variables, subroutines… A module is vastly different. A module is often a library of subroutines. A module can also become a class if you add some features.

@myPackage::myArray_withoutAt is a typical usage of a package.

A Namespace consists of variables, subroutines …

In Python, i’d say such a “namespace” is a idic i.e. internal-dict

an early Morgan Stanley java IV

q: yield() vs sleep()
%%A: “sleep() won’t yield to other threads but will hog(??) the cpu.” I now think that was wrong. Any thread is subject to scheduling and queuing in the Eligible Club.
A: (forum) Both are Thread.java static members. Sleep will stop the current thread even if there are no others ready to run. Without guarantee (“heuristic”), JVM may stop the yeilding thread if there is another one that’s ready.

q: explain why recursive quicksort need log n additional space

q: pros and cons of vector vs arraylist, hashtable ^ hashmap

q: path to root

q: what objects will never be garbabe collected

q: baseclass of Exception?

q: name 2 subclasses of Throwable
A: Error and Exception. ( A prominent subclass of Exception is RuntimeException.)

q: can u add member variables to an interface
A: Yes. “member” can be static.

q: can you add constructors to an abstract class?
%% A *WRONG* : yes but they won’t run
A: yes they run upon subclass instantiation

q: when would u use a Runable?

prepare/execute/fetch(Perl DBI

1) the first “catch-phrase” to memorize is the most common

– – – > prepare/execute/fetch

All 3 methods are specified in DBI but implemented (vendor-specific) in DBD modules ie DBD drivers.

2) For non-select, prepare/execute will do.
3) The simplest: do() alone can replace prepare/execute.
4) prepare/bind/bind/bind/bind/bind/bind/bind/../execute/fetch
5) stored procedure with 3 result sets ie 3 selects[1]: prepare/execute /fetch/more_results/fetch/more_results/fetch

Beware that most of these methods belong to $statement_handle like

– – – – > $statement_handle -> method1

whereas a few belong to $db_handle.

[1] excluding select-into. I think a select-into always returns one(???) row and saves it into variables and does not produce a result set.

IV: what are java "class objects"

One of the wall street interviews asked “what are class objects” and I said objects are instances of a class, so class object is imprecise phrase.

Now I think “class object” refer that special object instantiated when a class is loaded by a java classloader. 2 classloaders can instantiate 2 such objects for the same myClass.java? Yes.

One possible reason for this iview question might be mem-leak. See posts on [[ root objects ]].

java interview questions — technical

Q: experience with workload management?
q: experience with jdbc services for clusters
q: experience with uml for system design
q: how do u load balance EJB’s
q: describe the objects needed for a servlet to access a db
q: what security solutions do u use in your j2ee designs
q: experience with container-managed-relationships?
Q: experience with java generics?

q: what are the 2 basic interfaces/classes for multi-threading? runnable and …?

ldap names

In LDAP, the situation is slightly more complicated. Names are built from components that are separated by commas (“,”). Like DNS names, they read from right to left. However, components in an LDAP name must be specified as name/value pairs. The name “cn=Todd Sundsted, o=ComFrame, c=US” names the person “cn=Todd Sundsted” in the organization “o=ComFrame, c=US.” Likewise, the name “o=ComFrame, c=US” names the organization “o=ComFrame” in the country “c=US.”

JGC root objects #intern

Conceptually, think of the GC daemon waking up and scanning all threads and all static fields.

1) call stacks [3] — Most obvious category of root objects are “objects of unfinished method CALLs”. For each unfinished CALL on each call stack, root objects include:
– every argument of reference type
– every local var (except primitives)
– that class object /hosting/ the static method
– that instance hosting the instance method

[3] I prefer “call stacks”. A “thread” is more than a call-stack — see blog post on call stack.

2) static fields — 2nd most obvious type of root objects are “static fields[1] of loaded classes” . Technically, static fields are 2nd-level nodes whose parent nodes are “class-objects”[2]. However, static fields are a more tangible thing to programmers.

[1] except primitive static fields (these aren’t objects per se, even if on heap)
[2] Every loaded class has a class-object which persists in memory forever => class loaders can introduce mem leaks. Not sure about class-unloading(???)
eg: System.out
eg: Math.PI
eg: most if not all constants defined as “public final static”
eg: D.seen in my debugger. On demand [1], D.java class [2] is loaded by JVM. During class loading, every single static vars must be initialized. D.seen is a HashMap, so the default initial value of D.seen is null, but in a subsequent method, we call new HashMap(). This HashMap becomes a root object.

[1] If you don’t use it, the D class is not loaded.
[2] (By the way, no D() constructor call needed.)

Q: Why is Math.PI always reachable after class loading?
A: Anyone can access PI any time.

Q: what if D.seen is not public?
A: D.d() is a public static method that relies on D.seen. Anyone can call D.d() any time. D.seen must remain in memory forever.

3) jni. It’s good to know how jni relates to other java technologies

other groups of root objects?

Now, some non-root objects that can linger forever:

  1. interned strings — see https://www.infoq.com/articles/Java-PERMGEN-Removed by a GC expert
  2. event listeners + observers. Persistent collections. We need to remember to unregister/unsubscribe listeners or observers. Swing is particular prone to memory leak.
  3. static collections such as a cache

open/fetch/close cursor ] pl/sql, part 2

Lesson 1: open / fetch..into / close
Lesson 2: open / fetch..into / %NOTFOUND / close

  open cursor3;
fetch cursor3 into record_var2;
exit when cursor3%NOTFOUND
-- do something with record_var2
end loop;
close cursor3;

Lesson 99:
declare/ %ROWTYPE / open / fetch..into/ %NOTFOUND / close

For a simple yet complete sample code, combine the last sample in this post and the previous post.

open/fetch/close cursor ] pl/sql, part 1

Lesson 1: open/fetch/close
Lesson 2: declare / open / fetch /close
declare the cursor

Lesson 3: open / fetch..into / close

  open cursor3;
fetch cursor3 into record_var2;
-- do something with record_var2
close cursor3;

Lesson 4: declare / %ROWTYPE / open / fetch..into / close
After declaring the cursor, you declare a record-var to hold one row of data

CURSOR cursor3 IS SELECT ....
record_var2 cursor3%ROWTYPE ;

%% pl/sql iview quiz #7 — jargons

jargons: For each, interviewer can ask for examples(eg), suitable(j4)/unsuitable(n4) uses, or interviewer may mention them in a question, assuming your knowledge. Ranked roughly in order of likelihood

–sqlcode, sqlerrm
–“instead of” triggers
eg: I actually created many for-each-row triggers in zed.
— deterministic
j4: perf? questionable — “If Oracle did attempt to buffer rows from a deterministic table function that returned many thousands of rows, it could result in performance issues due to excessive memory consumption. ” — http://www.dba-oracle.com/plsql/t_plsql_deterministic.htm

eg: (in function definition)

–“when other”
–anonymous block
A regular stored program has a name — for invoke-by-name
j4: no need to invoke-by-name later. Just run once and throw-away

layered OO design: testing, modular code reuse..

From experts to novice, everyone uses the “layer” jargon in the context of testing, code reuse, modular design,

For starters, i have a blog post on “DB entity object HAS-A DAO”.
* import — Ideally, a upper-layer class imports lower-layer classes. Shared-layer classes can be imported by all.
* compile-time dependency — Ideally, low-layer classes should be compilable without upper-layer classes.
* reusable components — therefore, lower-layer classes should be reusable in other projects in the absence of upper-layer classes.
* testing — To test a upper-layer method (we didn’t say “class”), you often need to instantiate (or mock) the lower-layer objects. Even if you use interfaces, you still need to instantiate these lower objects to run their methods.

(Suggestion: reduce cross-layer inter-dependencies.)

* use-a, has-a — upper-layer classes could use-a or has-a lower-layer class, but not vice versa.
* separation of concern — lower-layer objects should not need to know about upper-layer. If my class uses xstream (or a mailer, a scheduler, a serializer, a parser, a timer…), then xstream should be oblivious of my class.

view ^ stored-proc

A) you can create a table and revoke access of PUBLIC to it; then you can grant limited access privileges to the table through views. — http://publib.boulder.ibm.com/infocenter/idshelp/v10/index.jsp?topic=/com.ibm.ddi.doc/ddi132.htm

B) Same for a stored procedure. You can remove read/write access to a table, but provide controlled read/write access to the table via stored procedures. Benefit? Better control. See post on [[ j4stored procedures — a sybase perspective ]]

A and B are related. Both can hide a group of “internal, raw tables” and present a “better” facade, better in some sense. Both use basic SQL and nothing else. Both provide access control. Difference? The 2 facades
– A View’s facade looks and feels like a table, to be used in FROM.
– A stored proc’s facade looks like …. an alien to SQL.

j4 (motivation for) persistence frameworks

Andrew Yap asked “Why Hibernate?” My answers:

j4: hide details of database interactions
* increasing ROI as “domain models” complexity increases
* diminishing benefit for simple DB interactions.

j4: java programmers are comfortable with java objects than database entities. Without a persistence framework, “relationship mapping” is non-trvial.
* cost: hard to tune sql

J4: portability across databases

pl/sql function — in-DB ^ in-anon

Every function[1] exists either (X) in an anon or (y) permanently in the databse.

This longevity view is a different view from anon-vs-named. “Named” is irrelevant in this view, since functions are always named.


– as part of the declaration in an “anonymous-block”, X creates a short-lived, throw-away function, to be used in the enclosing anon only. A case of “nested block”. You will see 2 pairs of BEGIN/END.

– Y would save the function in the DB

See also [[ anon ^ named ]] for a wider discussion. This post focuses on how to create a function.

loose coupling in OO++

See also posts on
[[ facade: loose coupling && fewer dependencies ]]

— examples
synchronous ^ mq
mvc — loose coupling between M, V and C
javascript + java + stored proc

web service client and server rely on RMI/RPC and are more coupled (than http client/server), but both agree on an xml format to reduce coupling.

— keywords (and synonyms)
easy edits — not possible in an entangled system. Edits to source code should not break other (battle tested, production quality) classes. [[ declarative control — enterprise design pattern ]]

change isolation — “changes” to one system component had better be isolated from the other components. I think isolation is shown between javascript, java and stored proc

“runtime change” — to object behaviour, without breaking other classes [[ runtime change to object behaviour ]], [[ create functionality without jvm restart]strategy ]]

“expected services” — [[ de-couple – using abstract^concrete class ]]

knowledge — “Object A must know everything about Object B” means tight-coupling. Loose-coupling means A only need to know the expected services of the interface B implements. The interface specifies/constitutes often a very loose contract between A and B. “So long as you support the expected service, i don’t care how you implement it internally.” Consider SSH client/server.


transparency ] j2ee AR

warning: “transparent” has 2 unrelated meanings in java.

[[better, lighter faster java]]

Key concept: coupling. The tighter, the less transparent
Key concept: put “peripherals SERVICES” out of the DOMAIN MODEL
– persistence service
– messaging service
– tx service
– sec service,
– serialization service
– printing service
– email service

For example, Tight coupling between a serialization service and the domain model means “the service is CUSTOMIZED for this biz”. Changes to domain
model requires changes to the service.

For example, Look at persistence. a transparent persistent SERVICE
persists any, yes any, object.

For example, look at serialization SERVICE, which serializes any, yes
any, object

Most imp technique –> reflection <–

Q: what u already understand (LJ) transparency@@
A: see-through. readable logic. an extra layer or functionality should not
impede overall AR readability

rare non-tech qualities in developers

An informal list of attractive characteristics in developers. Rare and non-trivial qualities.

— top 10
* willing to take up unpopular or unattractive tasks like …
* documentation — willing, thorough
* unit test — habit of creating and maintaining his own unit tests
* miminize personal favoritism, esp. as a leader. Impossible to be 100%
* unbiased — against race/gender, languages, technologies
* willing to listen && think hard about opposing views when he need not
* communicate in the language of management and users. Many feel this is rare; many disagree.
* technical pdl && “vision” ie long term.
* “Composite capability” is dependant on many factors.

— not so rare
* cooperative — follow agreed but tedious team standards
* Think like the business owners. Many feel this is are; many disagree.
* patience — with novice colleagues
* accurate estimation. set realistic targets to help supervisor’s planning
* no entrenched positions on …
* willing to abandon his own design when appropriate
* publications and open source contributions
* thorough — attention to details …
* articulate — with technical discussions
* quick assessment, even though imperfect
* lifelong learning — fearless
* self-examination before checking others; lead by example. (Experienced developers have many dislikes.)
* ownership — of own code from beginning to end
* flesixible — with OT,
* troubleshooting — systematic, reasoning, Sherlock Holmes. Very few jobs need exceptional troubleshooting; usually a competent technie will do.

* fast learner — some jobs need unusually fast learners. Perhaps #2 asset. Another “Composite skill”
* brank
* proven leadership@@ I think you can be a pretty good leader if you score well on this list. U need not be a motivator. Fairness is much more important