Today's Question:  What does your personal desk look like?        GIVE A SHOUT

 ALL


  ConcurrentHashMap vs Collections.synchronizedMap()

ConcurrentHashMap and Collections.synchronizedMap() both provide thread-safe operations of collections of data. They are used in multithreaded programs to provide both thread safety and performance improvements. In many cases, we can use either of them.But the realization of thread safety is different for these two implementations. ConcurrentHashMap will create an HashEntry[] array internally to store the elements passed in from a Map, while Collections.synchronizedMap() will return a SynchronizedMap.The main difference between these two is that ConcurrentHashMap will lock only portion of the ...

56,377 1       CONCURRENTHASHMAP COLLECTIONS.SYNCHRONIZEDMAP


  Android socket programming example

Socket is a kind of interface for different sides t communicate, it usually identified by an IP and a port. There are many server side software on a server and they would provide different service. Each server many create some sockets and bind them to some ports so that clients can listen to.Software on the Internet will exchange data though a bidirectional connection established. Each end of the connection has a socket created. In Java, Socket and ServerSocket are in java.net package, ServerSocket is used for server side and Socket is used when establishing connection. Once a successful conne...

55,832 3       JAVA ANDROID SOCKET


  Why no max/min function for integer in GoLang

You may notice that there is no max/min function provided to compare the maximum/minimum of two or more integers if you are a GoLang developer with some experience . In other languages, these functions are provided as part of the core lib functions. Have you wondered why? Indeed GoLang provides max/min function in math package, but they are used for comparing float64 data type. The signature of these two functions aremath.Min(float64, float64) float64math.Max(float64, float64) float64The reason why GoLang provides the max/min function for comparing float64 numbers are that floating n...

55,702 12       GOLANG INT64 MAX INT


  Why does Symbian collapse?

On 24th January, Nokia announces a disappointing news that they would give up Symbian. The 808 PureView released last year will be its last Symbian model. Symbian was born in 1998, it was supported by the then three mobile giants : Sony Ericson, Motorola and Nokia after its birth, later Samsung and LG also joined the Symbian camp. In 2000, the first Symbian model in the world Ericoson R380 was released, in 20006, there were over 100 million Symbian handphones on the market.But in 2007, the release of iPhone totally changed the mobile phone industry. The entry of Android sped up the steps ...

55,439 0       NOKIA ANALYSIS SYMBIAN COLLAPSE


  A possible way to recover deleted files on Linux

Last week I was generating a MD5 sum for an virtual machine image on one OpenNebula server:# ls -l test.img-rw-r--r-- 1 root root 10486808576 Oct 12 02:21 test.img# md5sum test.imgAt the same time I was clearing the files on the server on another terminal and deleted the above image file mistakenly with :# rm test.imgSince this image file is 10GB, it took some time to remove this file from the server, so I used the Ctrl+Z command to suspend the remove command.[1]+ Stopped md5sum test.imgBy doing this, we can recover the deleted image file later. The rationale here is if other ...

55,323 0       LINUX FILE RECOVERY


  Good programmer made bad designers

I got an email request to publish this article a few days ago.I was actually on the verge of moving the email to the trash when I noticed the first name of the author: Rand.For those of you not familiar with the Wheel of Time series, the main character’s name is Rand.I admit that it’s an embarrassing weak reason to respond to a strange email, but reading some 10,000 pages of a fantasy series obviously messes with your mind.Then again, it’s probably no stranger than Rand Mendoza wanting to publish his article on this blog to begin with.Anyways, enjoy…**...

54,934 0       PROGRAMMER DESIGNER COMPARISON


  Ways to check existence of JavaScript object

The design of JavaScript is not so sophisticated. It's very easy for us to make mistakes if we are not very careful when using JavaScript. For example, to check the existence of JavaScript object.Now we want to check whether a global object myObj exists or not, if it doesn't exist, we declare it. The pseudo code for this is :if(myObj not exist){ declare myObj;}You may think it's very easy to write the code. In fact, it is much more difficult than we may think. Juriy Zaytsev says there are more than 50 ways to check whether a JavaScript object exist or not. Only if you are very clear about the ...

54,858 1       JAVASCRIPT OBJECT EXISTENCE


  FTP active mode and passive mode

1. What's active mode and passive modea. FTP has two ports to control:Port 20 is for data transferPort 21 is for control or establish TCP connectionb. The process of active connectionNote: C represents Client and S represents ServerS opens port 20 and 21C connects to port 21 of S with a random port, this port can be between 1024 and 65536, it sends port+x to server at the same time to specify C(X)->S(21)When S receives the command, it will sends back ACK, S(21)->C(X)S will set up a connection between its port 20 and client's X+1, S(20)->C(X+1)C responds with an ACK,C(X+1)->S(20)c. ...

53,113 1       FTP ACTIVE MODE PASSIVE MODE