Books are very important to learn something new and despite being in the electronic age, where books have lost some shine to internet and blogs, I still read and recommend them to get a complete and authoritative knowledge on any topic e.g. concurrent programming. In this article, I will share five best books to learn concurrent programming in Java. These books cover basics, starting from how to create and start a thread, parallel programming, concurrency design patterns, an advantage of concurrency and of course pitfalls, issues, and problems introduced due to multithreading. learning concurrent programming is a difficult task, not even in Java but also on other languages like C++ or modern days JVM languages like Groovy, Scala, Closure, and JRuby.
Read more »
Wednesday, 15 June 2016
Monday, 13 June 2016
How to add Primary key into a new or existing table in SQL Server
Since a primary key is nothing but a constraint you can use ALTER clause of SQL to add a primary key into existing table. Though it's an SQL and database best practice to always have a primary key in a table, many times you will find tables which don't have a primary key. Sometimes, this is due to lack of a column which is both NOT NULL and UNIQUE (constraint require to be a primary key) but other times purely due to lack of knowledge or lack of energy. If you don't have a column which can serve as primary key you can use identity columns for that purpose. Alternatively, you can also combine multiple columns to create a composite primary keys e.g. you can combine firstname and lastname to create a primary key name etc.
Read more »
Saturday, 11 June 2016
2 Books to Prepare Java EE 6 Web Component Developer Certified Expert 1Z0-899 Exam (OCEJWCD)
Oracle launched "Java EE 6 Web Component Developer Certified Expert 1Z0-899 Exam" in 2011 to replace "Java Platform, Enterprise Edition 6 Java Server Pages and Servlet Developer Certified Expert Exam" and the "Oracle Certified Expert, Java Platform, Enterprise Edition 6 Java Server Pages and Servlet Developer" certification. They are equivalent of plain old SCWCD exam of Sun Microsystems era. Frankly speaking, I always found sun naming less confusing and clearer than Oracle's e.g. SCJP was much better than OCAJP and OCPJP. Though this exam is based on your knowledge of Servlet and JSP as per Java EE 6 specification, any book which covers this two technology e.g. "Head First Servlet and JSP" is highly recommended because Servlets and JSP are not changed much except Servlet 3.0 specification, which you can prepare separately. Oracle also provides training and preparation material and you can also take help from commercial mock exam providers like Whizlabs and Enthuware.
Read more »
Thursday, 9 June 2016
How to Remove Duplicate Characters from String in Java
This week's coding exercise is to remove duplicate characters from String in Java. For example, if given String is "aaaaaa" then output should be "a", because rest of the "a" are duplicates. Similarly, if the input is "abcd" then output should also be "abcd" because there is no duplicate character in this String. By the way, you can not use any third-party library or Java API method to solve this problem, you need to develop your own logic or algorithm and then write code to implement that algorithm. This is one of the interesting problems from Java coding interviews and you can use this program to weed out Java programmers who cannot write code. This problem is much better than Fizzbuzz because it requires more logic and coding than solving Fizzbuzz.
Read more »
Tuesday, 7 June 2016
Java Object Oriented Analysis and Design Problem - Vending Machine Part 2
This is the second part of Java tutorial to show how to create Vending Machine in Java. In the first part, we have discussed problem statement and the solution itself, but unit testing and design document was still pending, which we'll see in this article. As I said, there are multiple ways to implement Vending machine in Java e.g. you could have easily used state design pattern to implement a vending machine, in fact, it's one of the best examples of State design pattern. Vending machine behaves differently on different states e.g. return a product if the machine is not empty, otherwise, it just returns coins, so it ideally fits in state design pattern. Though, In our solution, I have not used the state design pattern but have just coded the solution with an if else block. This is easier because of a limited number of state and not many state transition but in more real world scenario, state design pattern is better as it uses Polymorphism and removes the logic we have put inside the if-else block.
Read more »
Saturday, 4 June 2016
Design a Vending Machine in Java - Interview Question
How do you design a Vending Machine in Java? is one of the good Java interview questions mostly asked at Senior level Java developer Interviews. In a typical coding interview, you will be given a problem statement to develop a vending machine and within a limited time, usually, 2 to 3 hours you need to produce design document, working code and unit test in Java. One of the key advantages of such Java interviews is that you can test many essential skills or a candidate in one go. In order to complete the design, coding, and unit testing of a Vending machine, a candidate needs to be really good in all three departments. By the way, this kind of real world problem is also a good exercise to improve your object-oriented analysis and design skills (see here), which is very important if you want to become a good application developer.
Read more »
Thursday, 2 June 2016
10 Example of lsof commands in UNIX and Linux
It's been a long time I have written anything on UNIX or Linux, but today I'll talk about the lsof command, a utility command every system admin and developer love. The lsof command stands for list open file descriptors and as the name suggest, it is used to find open files by process. Since almost everything in UNIX are file, you can use lsof command to find an open regular file, a directory, a symbolic link, a block special file, a NFS mounted file, a socket stream, a shared library, a character special file, a regular pipe, a named pipe, an internet socket, a UNIX domain socket and many others. It's an incredibly useful tool to do debugging and troubleshooting in UNIX and Linux environment. Since most of the production system runs on the UNIX-based operating system, knowledge of this tool become even more important.
Read more »
Subscribe to:
Posts (Atom)