Today's Question:  What are you most afraid of as a programmer?        GIVE A SHOUT



  Using MemoryMappedBuffer to handle large file in Java

When handling large files, it will largely affect the process speed while using traditional FileInputStream, FileOutputStream or RandomAccessFile since they trigger lots of read and write operations. In Java NIO, a new way of handling large file is introduced which is to use MmeoryMappedBuffer to create memory mapped file. Memory-mapped I/O uses the filesystem to establish a virtual memory mapping from user space directly to the applicable filesystem pages. With a memory-mapped file, you can pre...

2,621 0 0          JAVA IO NIO

  Java Interview Questions

Currently there are many articles online which summarize the list of Java interview questions. Some cover lots of basic questions and some cover some specific questions in specific area such as multithreading. In this post, we will not cover the really basic questions, we will cover something different. For basic question, you can read Java Interview Questions。 Basic What is primitive data type? How many primitive data types in Java? What are they? -- A primitive type is predefined...


  Use Java ThreadLocal with caution

According to Oracle documentation, ThreadLocal is a class provides thread-local variables. These variables differ from their normal counterparts in that each thread that accesses one (via its get or set method) has its own, independently initialized copy of the variable. ThreadLocal instances are typically private static fields in classes that wish to associate state with a thread. In short, ThreadLocal variables are variables belong to a thread, not a class or an instance of a class. One common...


  Algorithm : Reverse singly linked list

Questions about singly linked list are the lovers of interviewers during interviews given the characteristic that singly linked list is one-directional list and it's difficult to get the previous node of one node without some buffering tricks.  In this post, we will demonstrate one of the most frequently asked question about singly linked list -- Reversing the singly list. Given the first node of a singly linked list, reverse the singly linked list. For example : A->B->C->D After ...

1,048 0 0          C ALGORITHM INTERVIEW

  Algorithm : Delete middle node from singly linked list

Questions about singly linked list are frequently asked during technical interviews. Today we will share with you one algorithm question about singly linked list. Here is the problem description. Assuming the only information you are giving is there is a pointer to a middle node of a singly linked list, no other information about the linked list is given. Please delete this node and don't affect the structure of the linked list. Initially you may think this question is easy if you know the hea...

1,926 0 0          C ALGORITHM LINKED LIST

  A HTTPS client and HTTPS server demo in Java

In this post, I will create a HTTPS server and HTTPS client demo which can establish HTTPS communication between a server and a client using Java. This should be very useful when we want to test our understanding about SSL communication. We will use both a detailed SSL client and a simple HttpsURLConnection as the HTTPS client. Before creating the actual HTTPS server and HTTPS client, we first need to generate the keystore and truststore to be used by the server and client. To generate the keyst...

14,221 0 2          JAVA SSL DEMO HTTPS

  The Greatest Regex Trick Ever (Simplified)

There is a post which is really hot recently which showcased a best ever regular expression trick. In this post, it provides a trick which can be adapted to situations where one wants to match some patterns desired and exclude the patterns undesired. In simple, the trick is : Pattern not desired | (Pattern desired) Then taking the group 1 match of the capturing group of matched. This group will contain the strings matching the desired patterns. Have to say this trick is really neat and brilliant...


  How Java Application Developers Can Build Secure Internet Based Apps?

There are few compiled solution tested by experts to guide Java application development and maintenance team how they can start safe journey on Internet. Strong encryption, wise passwords, secure hardware are few of the tech tools that should be used by Java app development team to secure their Internet based apps.   The Internet is most amazing yet most risky platform where nobody knows either they are doing safe transaction on Internet or there is some dog watching out for data packets t...