##some of the worst technology churns#le2tanko


Here’s my expanded list of “worst” tech domains in terms of technology churn. Nothing but personal bias. For every IT professional, it’s his or her personal responsibility to identify these domains, and perhaps avoid investing (too much) into them.

Windowing GUI technologies – X-windows, PowerBuilder, Delphi, Borland c++, …
Web client GUI development — including Angular, Google Web Toolkit…
Windows administration – there seem to be many new utilities added every 5 years, replacing the old
scripting? My favorite — Perl — is now falling out of favor. Powershell seems to challenge vbscript.
ORM — too many new products. Hope to see a clear winner
Javascript libraries like node.js, angular, jquery, GWT
messaging — too many new products, spurred by web2.0

anything to do with big data —
* In-memory DB — too many new products

* Map reduce — I hope hadoop remains the standard

Web app development in general —
* java web development including struts
* Microsoft web development
* PHP? I hope this is a bit more stable, but there are definitely new packages gaining popularity

–churn-resistant domains
Oracle DBA
C++ key libraries — STL, boost
Unix admin (relative to Windows admin)
core java ie. at the core layer
SQL complex queries

What else do you think can be added?

c++advanced IV questions – contributed by real interviewers


These authors are real interviewers. They really do care about the topics I mentioned to you Monday night. They are seeking c++ specialists who understand the low level details. They don't care about the high level, architecture, design, picking the right framework or library etc.

Fwd: difficult phone screen with Credit Suisse

Hi Bin,
I just finished a frustrating interview with Credit Suisse.
It's just a phone screen, but many questions I cannot answer. When you have time, please add some comments to below questions.
And because I work from home for the interview, so I can record the whole call. It's shared to you in another email. Please give me some comments about how I behaved, just assume if you were the interviewer, what's your feeling about this candidate?
It's not that urgent, so just do it only when you can find time. I know you have a lot of work to do, so don't waste too much of you time.
1. describe one of your best coding challenges in 2 to 3 years, that can show off your coding abilities and your object oriented skills.
Rong: I mentioned NIO server I had hands on experience.
Interrupted by him, he said: the key thing I'm asking for is the specific coding that you personally did.
Rong: I should not mention I lead a team, because maybe that's the reason he suspect I describe other developers' work as mine. I feel for developer role, management experience is a downside factor.
2. Describe how did the single threaded application avoid blocking IO.
Rong: I cannot articulate how NIO works. I actually indeed created a NIO server. That's true, but I don't know how to explain well in phone screen, and I cannot recall some details such as the class, methods.
3. He continued to asked some details about NIO, and I cannot recall details.
4. Now he start normal quiz procedure. I only list difficult ones here, but I attached the full list FYI.
Would you want to implement a maximum queue depth?(I didn't know what's maximum queue depth mean)
What happens if your queue backsup?(I don't known what's that mean)
Would you want a maximum length? Why?
What happens if your producer hit the maximum length?
Do you know what's the completion services?
There is an alternative that you can implement producer/consumer without a queue?
What are the 3 different ways of creating a thread?(implement Runnable, extend thread, what's the third?)
Different between Runnable and Callable? (Callable return result, Callable throw Exception)
Any other differences or advantages for one over the other?
Let's say we have a process that receives request to do work. And each request has no dependency on each other.
And the request queue backs up. How would you solve this? 
(I don't know what's backs up mean. So I assume it means the queue is full. So requesters are blocked and processor will process one by one.)
When you want to use a timer of some kind, what are the different way you can do it in your code?
(I said there is a scheduler class?? not sure if there is)
How would you shut down the multi-threaded system? let's assume you write your own multi-threaded system.
(use countdownlatch?)
What if the thread is blocked?
(call thread.interrupt())
That's it?
What's the exception chaining? (I don't know)
Apart from try-catch block, how can you ensure all exceptions in thread pool are caught by our code?
What's meant by safe publication and the context thread safty shared object retrieval?
fail-fast vs fail-safe?
How would you use the future task? Which method would you use? How would you retrieve the result later?
Do you know the method, what's that called?
Difference between semophore and mutex?

Fwd: java threading questions {xr

Since vector is synchronized, is below code thread safe? If 2 threads are running below code, what will happen?
if(!vector.contains(element)) {
Rong answer: not thread safe, because another thread could add element in between vector.contains(element) and vector.add(element);
(my own question, not from interview, but just my own thought: What does “Vector is synchronized” mean?
my own answer: It means all methods that can update data are synchronized. So calling each single method is thread safe, 
but a transaction involving 2 synchronized methods is not thread safe. Only if a transaction is atomic, we can say it’s thread safe.
synchronize(obj) {
if 2 threads are running above code the same time, what will happen?
Rong answer: one thread acquire lock, then release lock, another thread acquire lock and then release lock, both wait forever.
follow up question: if a third thread call obj.notifyAll(), what will happen?
Rong answer: both waiting threads will be woken up, then one thread acquire lock and finish, then another thread acquire lock and finish.
synchronize(obj) {
what will happen if 2 threads are running above code?
Rong answer: both print “A” then wait; if notified by a third thread, then will sleep for a long time.

Fwd: vague question { xr – production troubleshoot

This is another vague question I couldn’t handle well.
He said that if the production application is hung, how do you find out what caused the problem?
Rong: I check CPU, if CPU is busy… (He interrupted: “suppose CPU is not busy.”)
Rong: I will check memory usage, if …(He interrupted: “suppose not memory used up.”)
Rong: I will check if there is I/O blocking …(He interrupted “suppose not because of I/O blocking.”)
Rong: That’s my way to analyse issue, I will rule out something to … 
(He interrupted “ok, let’s suppose it’s I/O issue, but it’s million line code application, 
and could be thousands of part involves I/O, how do you solve the problem?)
Rong: For this huge application, troubleshooting needs deep understanding of the codes.
(He said: suppose you know the code very well, and suppose you wrote the code yourself.)
I thought for a while and cannot answer. (I guess he has a specific answer, but I just cannot spot it.)
He: it’s ok, let’s move on to next question.
Do you have any idea about what he want? And this is also a Indian. I tend to conclude that either Indian think in a way different from mine, or he intended to mess up the interview, because all interviewers who throw me a vague question and refuse to give further hints are Indians.

Fwd: MS IV 20141211

Question 1:
void transfer(Account accA, Account accB, double amount) {
synch(accA) {
sync(accB) {
There is a deadlock issue, e.g Thread1 transfer from accA to accB, and Thread2 transfer from accB to accA. How to fix this bug?
Question 2: 
class Trade
OptionTrade extends Trade
BondTrade extends Trade
SwapTrade extends Trade
double getPV(OptionTrade trade)
double getPV(BondTrade trade)
double getPV(SwapTrade trade)
Trade trade = …//you got a trade instance
Pricer pricer = …//you got a pricer instance
//how to get price value of the trade
if(trade instanceOf OptionTrade) {
} else if(… instanceOf …) {
} else if (… instanceOf …){
He siad, this works, but looks he is not satisfied with this solution. He asked : “Is there a better way to do that?”
I cannot think of another way…, He followed with a question “what's polymorphism?”, so maybe the solution should be related to polymorphism.

Fwd: Bloomberg interview questions 2/13/2015 {XR

String getRegularExpression(String str1, String str2);
Base on input 2 strings, return a regex String that can cover 2 input strings.
e.g “Bloomberg”, “BloomingDale” should output “Bloom.*g.*”

I proposed a solution:
step 1: find out common segments of the 2 strings
step 2: insert “.*” in between the common segments to form a string

He asked: how to find the common segments?
also he let me think of below examples, but I really couldn’t find any
clue from his example.
“Bloomberg”, “BloomingDale”
“StarBucksCoffee”, “RedCoffee”

In the end, he said my proposed solution is not technically optimized.
Obviously, he has better solution, but he didn’t give me the hint.
So I still have no idea at all.

Can you think of a solution?

beware of creating reference to dereferenced pointer

In one sample code (p190 [[c++in24hour]]), we see that once you delete a pointer, the reference to the object becomes a dangling reference. More common when multi-threaded.

I guess sometimes we do create a reference to a dereferenced pointer, but we have standard guards to avoid dangling references. What are these guards? Not sure.

Reference param is best practice in c++. What if caller passes an unwrapped pointer into a function’s ref param? How do you ensure the underlying heap/stack thingy doesn’t get deallocated?
– Single-threaded — if the pointee is accessible only on this thread, it can’t possibly “vaporize” beneath my feet. The caller won’t (technically impossible) delete the ptr before the func returns.
– multi-threaded — all hells break lose. We need guards.

There are many similar multi-threading “delete” issues to be solved with ownership control. Only one function on one thread should delete.

memory leak in GUI event handlers – swing^c#

Here’s a common java swing memory leak as described on stack overflow — Essentially, because you register an object as a listener and forget to unregister, the notifier ends up holding onto the reference of the object, and leaks a bit of memory.

Same problem with c# events. [[effective c#]] refers to it as “runtime coupling despite compile-time loose coupling”. Recall an event
is a pseudo field in a class, and the fields’ type is a delegate, which is a list of 2-pointer constructs. First pointer usually points to a listener object. Imagine a bunch of large listener objects are added to the delegate’s inv list (registered for event), and one of them is no longer needed. You want its memory freed, but the event source object still holds a reference via the delegate instance. See [[effective c#]] item 23. One tip is to unregister in the listener’s Dispose()

I feel the dotnet event/delegate language construct has no exact java counterpart at the language level, but at runtime, swing event
paradigm == c# event paradigm. Fundamentally the same paradigm. Part of the paradigm is that the event source object holds a
collection of subscriber Objects. If the GUI stays up for 22 hours then the subscriber Objects are held “hostage” for that long, and
cannot be garbage collected.

haunted by negative relations#let2YH

Hi YH,

I too get haunted by criticism, failed relationships (but not those sexual types;) with past coworkers, or my poor  judgement and decisions in past projects.

Q: Was I really as bad as accused?
Q: Did I make such an embarrassing mistake?
Q: Was I more than 50% responsible or there’s another person equally responsible? It takes 2 hard objects to have a clash.
In many cases, I find it tricky to answer these questions objectively, and identify where and how much of blame I deserve. I’m lucky to have a simplistic view —
      “I have always enjoyed good relationships with all my team members under the same manager. Everyone is friendly, nice or at least OK with me. Similarly, all my users liked me. Some colleagues and users even treat me as the best guy in my team.
In reality, if I examine every relationship maybe this is not 100% true, but i’m too lazy, so I never challenge this view. I keep repeating this view to myself and to everyone who asks. This loose view is a rather powerful protection when I feel “haunted”. This view may be naive but it’s an example of a healthy self-image IMO.
Note in this view I don’t single out my boss.  I don’t have such a perfect thing to say about relationships with my past bosses. Still I have another simplistic view that
         “Those managers I had problem with is an unpopular guy. Each has lost more than 1 team member due to the harsh mistreatment he gives. Each is hated by some team members and not respected by many. Basically, each is a difficult boss, but I actually managed to survive and adapt to them for longer than many fellow sufferers.
These simplistic views tend to protect my self-image. It’s important to me. They are like Guardian Angles. I hope they could work for you as well.