static method ^ free-func-in-namespace

I see no diff. boost thread doc says static yield() is very similar to this_thread::yield(). The this_thread thing is a namespace.

I feel the static method sleep() is very similar to this_thread::sleep().


sybase bcp and identity column

bcp and identity columns are reliable, proven features, but together they surprised me — if I bcp out a table to a file, wipe out the table, then bcp in, occasionally, i see the identity values completely changed. I think it’s because bcp-in ignored identity.

Solution1: use a tool like aqua studio to generate the inserts statements (hopefully not 200,000,000 rows), then enable identity-insert

Solution2: Sybase site says — By default, when you bulk copy data into a table with an IDENTITY column, bcp assigns each row a temporary IDENTITY column value of 0. As it inserts each row into the table, the server assigns it a unique, sequential IDENTITY column value, beginning with the next available value. To enter an explicit IDENTITY column value for each row, specify the -E (UNIX) flag. Refer to the Utility Guide for your platform for more information on bcp options that affect IDENTITY columns.

tibRV transport^connection^session

In JMS, session represents (roughly) a connection, or a socket. More precisely, one or more sessions are created from a single live connection. In JMS, sessions are single-threaded.

In RV, transport is the terminology. Means the same as a session, a socket, a connection to the “network”, to the daemon… Transport is a real object in memory.

In hibernate, session represents a connection to the DB. More precisely, a hibernate session HAS-A real connection object in memory

private/public void run()

What if you want to wrap some existing logic in a public void run() method in your class so you can pass its instance to “new Thread(instance)”, but you don’t like the “public” access to that method? One solution is to wrap that logic in a privateRun() method. When you need to construct a new Thread(instance), you do a

new Thread(){
public void run(){
instance.privateRun(); // anon inner class calling enclosing class's private method

I think in threading, you end up with lots of nested classes

nested class has special capabilities ] C++^java

Q: Can nested class (NN) methods access a private member of the enclosing class EE? See c++nested class accessing host private member

Can EE methods access NN’s private members? Yes. Tested. See below.

Below is based on P186 ARM, perhaps outdated.
Q: in terms of syntax, how does Inner class methods refer to Outer class’s non-static[1] field?
A: no special access. Unlike java, there’s no hidden “this” field pointing to the Outer _i n s t a n c e_
A: yes if the Inner method has a pointer, reference or a nonref variable of an Outer class _i n s t a n c e_,

Java’s nested class N1 is in the same “private club” along with E2() an Enclose class private method.
– N1 methods can access private members of E2
– E2 methods can access private members of N1
–> Not in C++

Q: So what special capabilities does a nested class has? Why make a class nested at all?
A: to mention the “Inner” type name, you need to prefix it as “Outer::Inner”
A: another specialness — inner class methods can access outer private members. As pointed out on
— in the original C++98 the inner class has no special privileges accessing the outer class.With C++98 compiler you’d either have to give the inner class the necessary privileges (friendship) or expose
the outer members x and y as public. However, this situation was classified as a defect in C++98, and it was decided that inner classes should have full access to outer class members (even private ones).

[1] static is fine — Outer::f

uninitialized local var and fields – C++/java

C++ variables with static “storage” or global “scope” have default initial value zero, or null for pointers.

c++ fields of primitive types are truly _uninitialized_. C++ need special compiler/debuggers to detect these.

C++ local int objects are truly _uninitialized_ — random initial state. Fixed in java —

java Local variables must be definitely assigned to before they are accessed, or it is a _compile_error_.

java Fields are 0-initialized by _default_. Not in c/c++ .

Note c++ class-type objects are always initialized via one of the (default) constructors. No such thing as an uninitialized MyClass instance.

bond yield — precise definition && example

* yield for a given bond (with a given maturity) is used to discount payout(s) and derive a fair price, aka present value or PV.

* it’s easy to derive price or yield from each other

* yield looks like an annual return, semi-compounded. eg 10% pa, but a coupon rate often looks like $102 pa.

* yield is about the only usable metric to compare bonds across maturities, coupon rates and face values.

* See the posts on discount factor, and how it discounts cash flows. Now, for math-challenged bond traders ;-), we simply assume the discount factor is consistent for every duration. So we discount every income using the same formula —
** cashflow[1] is discounted by 1/(1+10%/2)(1+10%/2) ie twice
** cashflow[1.5] is discounted by 1/(1+10%/2)(1+10%/2)(1+10%/2) ie 3 times
** see link