Tuesday, February 5, 2013
comparing ebay and amazon home pages using 3D layout structures
amazon.com view:
ebay: category section floats outside of the view area and rest of the layout area looks perfectly fine.
amazon: no floating elements found except the layout width is uneven.
Wednesday, January 30, 2013
Facebook Graph Search - some interesting queries
I played with it a bit and found it very useful in exploring the unknown/unexplored.
here are few of them:
1. Friends of friends who like to dance

2. Friends of my friends who live in San Francisco, California and work at Google
3. This time, I'm looking for anyone who love playing cricket but is from my city. (I'm big fan of cricket so need to find more players)
"People who like Cricket and live in San Jose, California"
4. looking for job and willing to apply to company 'A'? you need to explore 1st, 2nd degree of connections to work in that company
"Friends of my friends who work at Google "
5. Facebook doesn't understand what is what - they seems to be missing natural language processing and I hope they know it and are working to improve it.

Graph Search if used cleverly, it could provide lots of insite into what we need.
that's all folks!
Amazing Page Architecture - Measuring the thickness of the web pages
I believe that browsers render web pages in x,y co-ordinates (width, height) however they also keep the z-index. The z-index is somewhat controlled by css code. The performance of the page rendering is also controlled by how deep the content is i.e. depth of the displayable html element. Performance degrades as we move the elements deep inside the container elements. e.g.
<div><div><div><h3>hello world!</h3></div></div></div>
Some javascript operations (which operates on DOM structure internally, e.g. getelementbyid), also get affected by how deep the target element lies as it needs to traverse through the DOM tree.
Figuring out the depth of the element in the static html is easy however when it comes to browser, it all depends on how we generate final html code, using javascript,css as Dynamic Html. In this case the final view of the html codebase can be viewed only by the browser's internal memory.
I tried to play with the browser ('Firefox') tool and found very interesting web page architectures (because they look like amazing colorful physical designs) of google and HN home pages.
feel free to explore the gallery below:
[gallery link="file"]
Friday, November 30, 2012
mutex Vs read-write lock
what is the diff between mutex and readwrite lock?
Mutex:
A Mutex is an OS object which supports a state of ‘locked’ or ‘available’. What it means is that if multiple threads attempt to lock the Mutex, only one will ‘own’ that lock while others will be waiting in the queue behind each other.
The waiting threads will block the function call from where they are initiated until Mutext is unlocked ‘available’ and a thread gets chance to claim it.
There are two types of Mutex, ‘named’ and ‘unnamed’. A named Mutext can be accessed from different processes running on the system whereas unnamed Mutex can only be used from inside a single process. On Windows OS, the Mutex is replaced with Critical Section which is faster, unnamed and can be used from a single process only.
Read-Write Lock:
It is a file system construct that works over peer-to-peer file sharing or any other file sharing schemes.
They are similar to Mutex with the difference that once the file is locked, other threads are denied the lock request and are not being put in the waiting queue.
File locking supports ‘shared-read’ request. What it means is threads requesting for reading the file, get the lock and can read the file however there can be only one file write access.
Monday, November 7, 2011
How to turn your laptop into Hotspot WiFi
Today I came across a site connectify.me. At first I was surprised on how they have programmed the creation of personal hotspot capability which latest Windows OS provide.
Here is how it looks when the laptop acts as hotspot wifi…
The way Windows supports natively. Sometimes this process could be cumbersome for newbies.
Here comes the Connectify.me which just automates the process…
hope this is a useful information for some of my readers.
Thursday, October 20, 2011
comparison of Java Map vs HashMap vs HashTable vs HashSet
Map
. it is an interface
. An object that maps keys to values
. A map cannot contain duplicate keys; each key can map to at most one value.
. This interface takes the place of the Dictionary class, which was a totally abstract class rather than an interface.
.example
[java]
Map<String, Integer> m = new HashMap<String, Integer>();
[/java]
HashMap
. not an interface
. it is unsynchronized. So come up with better performance
. Permits nulls
. allows null values as key and value
. does not guarantee that the order of the map will remain constant over time.
.example
[java]
HashMap<Integer,String> productMap = new HashMap<Integer,String>();
productMap.put(1, "Keys");
productMap.put(2, null);
[/java]
HashTable
. doesn’t allows null values as key and value. You will get NullPointerException if you add null value.
. is synchronized. So it comes with its cost. Only one thread can access in one time
.example:
[java]
Hashtable<Integer,String>; cityTable = new Hashtable<Integer,String>();
cityTable.put(1, "New York");
cityTable.put(2, "San Franscisco");
cityTable.put(3, null); /* NullPointerEcxeption at runtime*/
System.out.println(cityTable.get(1));
System.out.println(cityTable.get(2));
System.out.println(cityTable.get(3));
[/java]
HashSet
. does not allow duplicate values.
. It provides add method rather put method.
. it can be used where you want to maintain a unique list.
. example
[java]
HashSet<String> stateSet = new HashSet<String>();
stateSet.add ("CA");
stateSet.add ("WI");
stateSet.add ("NY");
if (stateSet.contains("PB")) /* if CA, it will not add but shows following message*/
System.out.println("Already found");
else
stateSet.add("PB");
[/java]
put your comments/feedback in the comment box.
Saturday, October 8, 2011
comparing Kindle Fire vs. iPad 2 vs. Nook Color
In our previous post we compared “Apple iPad2 vs Amazon Kindle Fire”. In this post we are
trying to show how Kindle Fire, Nook and iPad2 are compared for Specification and Features.
via. pcmag.com
Wednesday, September 7, 2011
Difference between Java Vector and ArrayList
Vector is an analog to the ArrayList. So, from an API perspective, the two classes are very similar. They both use java Array internally to store the elements. There are still some major differences between these two classes and we will be going through them now...Synchronization:
Vectors are synchronized. This means that all of its methods are thread safe.
ArrayList on the other hand, is unsynchronized, making them, therefore, not thread safe.
Using synchronization will incur a performance hit. What it means is that all the threads accessing the same Vector object are blocked until the first thread completes its operation on the object. Due to this no two threads are using the object at the same time. Hence this enforces the data consistency.
Tips: use the Vector only where it is really necessary.
Capacity and Data growth:
As we discussed above, Vector and ArrayList both hold their data in Java Array object. However when size of the Array goes beyond its allocated space, there needs to be resizing to accommodate the new elements in the Array. The expansion of the Array object is done differently for Vector and ArrayList:
Vector defaults to doubling the size of its array.
ArrayList increases its array size by 50 percent.
Tips: There is a cost involved in adding new elements to these containers. By carefully setting the capacity, you can avoid paying the penalty needed to resize the internal array later.
It is advisable to initialize the capacity of these containers at the time of object creation.
e.g. Vector v = new Vector(initialCapacity);
Depending on the application, choose right value for initialCapacity.
Usage patterns
These containers perform Add/Remove/Get in constant time i.e. O(1) when Add/Remove is done either at the start or end of the list. However the cost increases when Add/Remove is done inside the list. Because in this case, the iterator has to identify the position in linear time i.e. O(n).
Tips: use plain old Array in place of these containers for the performance critical applications.
Speed
ArrayList is faster than Vector. Since Vector is synchronized it pays price of synchronization which makes it little slow.
Default Size
ArrayList in Java has no default size but Vector in Java has default size of 10.
that's all folks!!!

