Ipad or No Ipad ?


Ipad !! is buzz of today, tomorrow may be a month and at most a year.

For me as a software programmer Ipad is just like an multimedia device where i can enjoy watching videos, listening music and playing games at the max.

But how often will i do it .. not much.

So, lets believe i buy it for my entertainment but still I dont understand

Why is flash not supported ?

I guess its a strategy to show their dominance:  All Apples(product/technology) in a  “Apple” .

App Store

Although it has been confirmed that the iPad will work with the App Store, it’s not guaranteed that all apps will work on the firmware. This could be a real issue, and has the potential for disaster with up scaling.

No camera

Another common multimedia feature not available. I guess they forgot to put it. 😉

No multitasking

21st century is all about multitasking .. Ipad wont allow the user to open multiple applications at a time.

Support or no support of 3G. It is unclear?

Lets see some good points about it

Nah !! nothing extraordinary features come to my mind. Its just again reinventing the wheel. Again with so much hype of the Ipad, it has been below my expectation.

Uninformed Search – BFS and DFS


Breadth first search is a strategy in which root node is expanded first and then all successors are expanded. It means that all the nodes at a given depth are expanded before any other node at the next depth level can be expanded. While expanding the nodes the information of the successors needs to be stored in the memory so that in the next iteration those particular nodes can be expanded.

Binary tree, BFS and DFS traversal

For the given tree the BFS expansion will be :

1 2 3 4 5 6 7 8 9 10 11 12

BFS guarantees to find a path in a tree/graph except for the following conditions:

  • The graph or tree is not cyclic i.e it doesn’t have a curve.
  • A give child node should not have infinite successors. If this happens then the algorithm will be expanding the child node forever.
  • Breadth-first search is complete. This means that if there is a solution breadth-first search will find it regardless of the kind of graph.

DFS(Dept First Search) always continue to expand the deepest node of a first successor till it reaches a leaf node. DFS needs to store only a single path from the root to a leaf node, along with remaining unexpanded sibling nodes for each node on the path. DFS doesn’t guarantee to find a shortest path , because it may happen that it has found a path by expanding the first child but there is an optimal path for some other child of a same parent.

For the given tree the DFS expansion will be:

1 2 5 9 10 6 3 7 11 12 8

Note: left node is given a priority to expand first.

DFS guarantees to find a path ina tree/graph except for the following conditions:

  • The graph or tree is not cyclic i.e it doesn’t have a curve.
  • A give child node should not have infinite successors. If this happens then the algorithm will be expanding the child node forever.

BFS and DFS are called uninformed search which means that it knows only the goal state and start state, to achieve or find the path it simply generates the successors only and doesn’t consider other information like at given time what is the current state, how far is the goal state and what  is the heuristic for the goal state.

Advantage of BFS over DFS is :

  • BFS guarantee’s to give an optimal path for a given tree.
  • BFS generally proves faster than DFS

Advantage of DFS over BFS is :

  • The major advantage DFS has that it take less memory for finding a path than BFS.
BFS DFS
Time O(b^(d+1)) O(b^m)
Space O(b^(d+1)) O(bm)
Optimal Yes No
Complete Yes No

Spurious wakeup in Java


If a waiting thread wakes up without notify being called it is called Spurious wakeup.
synchronized (obj) {
while (<condition does not hold>)
obj.wait();
… // Perform action appropriate to condition

}

}

This is the standard idiom to use wait() method.  In above scenario if a notify() is sent by any other thread then the condition will not hold and wait() will be skipped. Consider if there is no while loop and some other thread calls notify before wait() is called by this thread, then it may happen that it could wait forever or till next notify is called.

The javadoc of wait method in JDK 5 has also been updated

A thread can also wake up without being notified, interrupted, or timing out, a so-called spurious wakeup. While this will rarely occur in practice, applications must guard against it by testing for the condition that should have caused the thread to be awakened, and continuing to wait if the condition is not satisfied. In other words, waits should always occur in loops

Src : Effective Java By Joshua Bloch

768-bit RSA cracked, 1024-bit safe (for now)


With the increasing computing power available to even casual users, the security-conscious have had to move on to increasingly robust encryption, lest they find their information vulnerable to brute-force attacks. The latest milestone to fall is 768-bit RSA; in a paper posted on a cryptography preprint server, academic researchers have now announced that they factored one of these keys in early December

Full story