If you have worked in Oracle database ever, you would definitely have seen ORA-00904: invalid identifier error. Doesn't matter which version you are working 10g, 11g or 12g, this is one of the most common error comes while doing CRUD (Create, Read, Update, and Delete) operations in Oracle. By the way, if you are beginner, SELECT, INSERT, UPDATE and DELETE are used to perform CRUD operation in Oracle database. What do you do if you get this error while running in SQL script? Like any error, you should first pay attention to error message, what is Oracle trying to say here. Invalid identifier means the column name entered is either missing or invalid, this is one of the most common cause of this error but not the only one. Some time it come if you use names, which happened to be reserved word in Oracle database. Now how do you resolve it? We will learn in this article, by following series of examples which first reproduce this error and later suggest how to fix it.
Today one of my readers asked about what is the latest OCPJP or SCJP exams available, which prompted me to browse through Oracle's certification website. During my casual browsing, I noticed this new Java 8 certification. I said great, within six months of Java 8 release we now have Java SE 8 certification available, programmer still digesting changes from Java 8 now have a chance to be certified on latest Java 8. The certification is called, "Oracle Certified Associate, Java SE 8 Programmer - 1Z1-808" and has written for the Java SE 8 release. The format of the exam is similar to the previous certification e.g. Java SE 7 Associate and Professional exams (1Z1-803 and 1Z1-804). The exam is in beta and as per their website, exam score reports will be available in CertView approximately 11 weeks after the close of the beta Exam. You will receive an email with instructions on how to access your beta exam results. A number of question is very high (150-225), comparing to old SCJP days, and you will get 2.5-3.5 hours to answer all questions. Given this exam is available, I am sure programmers will start getting confused that whether should they go for Java SE 7 or go for this beta exam, or wait for some time to get certified in Java SE 8. My suggestion to all of them is that it depends on, if you are a fresh graduate from college and looking for a job, do Java SE 7 as soon as possible, it will help you to lend a Job faster. If you already got a job and settling there, you can wait for some time until Java SE 8 exam come out of Beta or try this one because it doesn't cost you much. If you are still not sure, then read this article about why you should do Java certification. If I read correctly, it will cost you around 60 USD. Considering the cost of Oracle Certified Associate, Java SE 7 Programmer, which is around 350$, this is much cheaper, but remember it's still in beta.
Writing multi-threaded and concurrent programs is not easy, not even in Java. Even senior developers, including myself, make mistakes while writing concurrent Java applications. This is also one of the trickiest area of Java programming language, where misconceptions outnumbers concepts. Considering amount of misconception an average Java programmers has about multi-threading and concurrency, I thought to start a new series about common multi-threading mistakes done by Java programmers; what is better way to learn from common real word mistakes. Learning from mistakes has another name Experience, but if you only learn from your mistakes then there is only limited things you can learn, but if you learn from other peoples mistake, you can learn much more in short span of time. Have you ever thought, Why writing multi-threaded code is difficult? IMHO, primarily reason for this is that it multi-threading makes it hard for a code to speak for itself. Programmer read code sequentially to understand how it's executed, but it is only correct if one and only one thread is executing it. That's why Single threaded code are easy to read and debug. As soon as two threads comes into picture, It become very difficult to make prediction about how your code behave, especially in the absent of any synchronization rules e.g. rules enforced by Java Memory Model. Without JMM you can not make correct prediction about your code in a multi-threaded environment, because it's possible for one thread to stop at arbitrary point and another thread at different point. Situation becomes even more tricky if those threads are sharing data between them e.g. in form of objects, a poorly written multi-threaded program can cause deadlock, race condition and responsiveness issues, which will prevent a Java application to fulfil it's promise. I hope, in this series we can learn from each other's mistake and take a step forward on writing correct multi-threaded application in Java.
One of the most common task in any Linux is creating directories, and most of us spend a lot of time creating complex directory structure in UNIX. I am sure you know about mkdir command, we have been using this command in almost every operating system e..g DOS, Windows, Linux, OS/2, Solaris or many other *NIX operating system. It is one of the basic command but as important as find, grep or chmod. mkdir stands for "make directory" and this command is literally used to create directories. Suppose, you need to create a directory tree like /opt/software/java/app/config, how are you going to create these directories? One by one right? Well, yes you can use mkdir and command to create these directories one by one as shown in below example :
Conducting Interview is not cheap and costs both time and money to a company. It take a lot of time to find the right candidate for a job from 100s resume you receive from consultants and agents. They will always tell you that this guy is a Java Guru, this one is SQL Expert and next one is the full stack developer you are looking for. If you have trust them blindly and invite all of them for face-to-face interview, you are going to be disappointed. One of the first thing you should do is to filter candidates who claims to have certain skills e.g. SQL but doesn't have them, the faster you can weed out those candidates the cheaper will be the hiring process. A phone screening interview is just for that purpose, it doesn't cost you much and also suitable for candidate, as they don't have to take off and come down to your office. It's flexible for both the parties. When I phone interview someone, I spent fist few minutes to listen them and then I go for my list of weed out programming question to see if candidate is good enough to spend another 30 to 40 minutes. They have saved a lot of time, where I found out that candidate having words like "Strong knowledge of Java", "Exceptional in SQL" and "Programming gurus" fail to answer these simple questions. If you are a candidate and gone through couple of interviews, you might have noticed that almost all interviewers make up their minds in the first 10 minutes. The rest of the interview gives them reasons supporting said decision, but not all is lost. If you ever feel that you have messed up with your chance, try coming of some really good answers on rest of questions, if you can impress interviewer to an extent that encourage you to go deep, you may be able to change his initial decision. To get some feedback and improve upon my method, I have decided to share my list of weed out programming questions (don't bother about sharing questions, I have many similar questions on my secret question bank and you can create them easily as well). I have chosen one or two question from common programming skill set e.g. Java, SQL, XML, Programming, Coding, OOPS, Multi-threading and UNIX. I am looking forward to know what you guys do, what do you ask to check same skill set before calling candidates for face to face interviews. Comment if you agree or disagree.
Coding is an integral part of programming and we all somehow learn to code by following examples here and there. What is more difficult is to write good code. You can easily find programmers in Java, C++, Ruby or Python, but finding programmers, who are also a good coder is very difficult. Some universities have a good curriculum and practical classes to teach coding better than others, but most of these great codes are self-taught. The point is self-learning is VERY important in the field of Programming and Coding, you just cannot rely on your college and university to make you an expert programmer, you have to make that extra effort to distinguish yourself from the group. What could be best by learning coding and wisdom of programming from those who have gone through the same path?
Recently I face an strange issue while using Maven in Eclipse via M2Eclipse plugin. I have created a Maven Java project in Eclipse and subsequently tried to add Spring framework as dependency, to my surprise, nothing was happening. Eclipse was not able to search dependency in Maven central repository. I was surprised because I have never faced this issue while I was using M2Eclipse plugin from long time. After some trial and error, I realized that this is my brand new workspace and I am running with Eclipse Luna, newest version of Eclipse which I had just downloaded couple days of back. My first hunch was that Eclipse might not able to connect to Internet, and to verify that I tried connecting Eclipse market place, and boom it was working fine. Then I quickly checked Maven settings in Eclipse and found that the option which is required to download and build the index was not turned on. The check box was unchecked there. To give you some background about how Eclipse search dependency on Maven remote repository, be it default Maven central or internal Nexus repository. Eclipse search artifact dependency on repository's index file. If that file is not download or not exist due to any reason, Maven's dependency search will not work in Eclipse. That's why you need to check the option "Download repository Index updates on startup". If this option is enabled then Eclipse will download repository index from configured location e.g. Maven central or Nexus and every time Eclipse will start it will just do update. You should also check the option "Do not automatically update dependencies from remote repositories", because that will download latest build every time they were pushed into Maven central repository. By the way, this error has nothing to do with Eclipse Luna. I received emails from my readers that some of them not able to add dependency in Maven project even in older versions of Eclipse e.g. Kepler and Indigo version. It is totally due to absent of artifact index file. One you enable "Download repository Index updates on startup" option and restart Eclipse, you will see that Eclipse is updating index at the bottom right corner, once this update this finish, you would be able to add dependency using Eclipse Maven GUI. In worst case, if your problem doesn't resolve even after enabling and restarting Eclipse, try re-building Index from Maven repository view in Eclipse, as shown in images attached here.
One of the important aspect of software development is maintenance, and it's proven by experience that a software which keeps visibility of its component low is more maintainable than the one who exposes its component more. You won't realize it upfront, but you will miss it badly, while redesigning your application. Since maintaining backward compatibility is must have requirement for many app, you end up patching and repeating same mistakes. You can not do much because lots of other applications are tightly integrated with your class and interfaces. Java has always put encapsulation on priority, provided support of access modifiers from very beginning. It provides three ways to control visibility of any Type e.g. class or interface, by making them public, package-private or private. What happened to protected, can't we use protected with class or interface. No you can't, you can only use two access modifier with types, protected is not a legal modifier for class and interface. Also a top level class (a class whose name is same as of Java source file which contains it) can be either public or package private (without any access modifier), it can not be private. Only a nested class can be private, public or package-private. A public class is accessible to everyone, and it is most visible, try to keep only key interfaces public, never let your implementation go public until you think it's complete and mature. On the other hand private Type is least visible, and only nested class or interface can be private in Java. Since it's least visible, you have full control of this class to alter its behaviour with experiences, new technologies, tools and redesign. A clever midway is package-private visibility, which is also default visibility, there is no such keyword as package-private, instead if you don't provide any access modifier than Java assumes that it package-private, and subsequently make it visible only on same package. If your classes and interfaces are shared only between other class in same package, make them package-private. Since client cannot access them, they are also relative safe to change.