Do you want to know how to develop your skillset to become a Java Rockstar?

Subscribe to our newsletter to start Rocking right now!

To get you started we give you our best selling eBooks for FREE!

1. JPA Mini Book

2. JVM Troubleshooting Guide

3. JUnit Tutorial for Unit Testing

4. Java Annotations Tutorial

5. Java Interview Questions

and many more ....

Featured FREE Whitepapers

What's New Here?


Hot tips on using Eclipse effectively

Following are some tips that shall help you in avoiding potential issues and for being a little more productive while working with eclipse.Avoid installation problems Never install a new version of Eclipse on top of an older version. Rename the old one first to move it out of the way, and let the new version be unpacked in a clean directory.   Recovering your messed up workspace Corrupted workspace is a common occurrence and troublemaker for many developers. So If your Eclipse installation has startup errors or a corrupted configuration, it might be time to get a fresh start. Start Eclipse with the –clean option, and all cached framework and runtime data will be cleared out. This often helps fix plug-in issues and improve general stability. Increase the memory allocation With new plugins getting added to the core eclipse functionality and the need to use additional third party plugins, the memory requirements for your eclipse workspace increases. The default memory allocation configured in eclipse is not enough for most J2ee development projects and that causes a sluggish response from you eclipse. If you get Out of Memory errors or sluggish response, you may have to increase the defaults that are set in eclipse.ini file in the Eclipse installation directory. In particular, if you get an error about “PermGen” memory (permanent generation), add this line at the end and restart Eclipse: – XX:MaxPermSize=256m Use the lowest memory settings that work and perform well for your mix of projects.   Side by side editing By dragging editors, you can show two files side by side. You can also edit two portions of the same file by using the Window > New Editor command.Automatic code improvements Set up Eclipse to automatically format source code and organize imports on every save. Select Window > Preferences > Java Editor > Save Actions to enable these actions. This dialog also lets you configure actions like removing unnecessary casts or adding missing annotations. Configuring your eclipse with optimized Compiler, Formatter and CheckStyle settings is described in detail in the post Using Eclipse Effectively Keyboard shortcuts It is productive and convenient to use keyboard shortcuts for performing certain tasks in eclipse rather than looking for options to do the same in various navigation menus. For example looking up references of a variable, method or a class can be quickly achieved via shortcut Ctrl+Shift+g. For your reference I have included a list of the most important keyboard shortcuts in my post Eclipse Keyboard Shortcuts Reference: Hot tips on using Eclipse effectively from our JCG partner Sanjeev Kumar at the Architect’s Diary blog....

Debate Breakdown – Advice From A JUG Leader

It’s been a week since I posted “Advice From A JUG Leader – Learn a Different Language” and it seems to have ruffled at least a few feathers in the Java community. As the article has been re-posted and bounced around on Twitter, I have had some opportunity to interact with some members of the Java community who have strong feelings about the content. None have called for my death, and the debate has been almost entirely polite thus far.I think and sincerely hope that the Java community understands that the impetus for writing this article was an observation that many in the Java community are simply not aware of the trends in the industry, and by the time those trends become standards it is too late. These are the people that, if the train does come, never heard it approaching. My purpose is not to predict or encourage the demise of Java, as that should not and will not happen. The Java community is deeply loyal to Java, perhaps even to a fault, and I hope these articles serve as a wake-up call that the most important loyalty should be to your career as a software professional and to neither an employer or language.I have noticed from these mini-debates is that defenders of Java, at least in my interactions so far, seem to primarily be highly experienced developers that perhaps have the most invested in Java. As I mentioned in my original article, I don’t expect known Java experts to feel any changes. At least a few of the comments seem to come off as rants against youth (“go play your Xbox“?) and start-up culture and not a defense of the language’s health itself. I haven’t seen the younger generation of Java pros, but I know they are out there. I don’t seem to see Java enthusiasts attacking faults in the alternative languages or praising Java for a superior feature set.Some comments seem to admit that Java has some shortcomings just like other languages, but it’s what we have for now. That is good enough for some people – particularly those that have been in Java for a long time – but not good enough for many developers who want to work with the best available. The arguments so far have been, in no particular order:  Argument #1 – Don’t Use Alternative Languages Because The Languages are Unproven, and/or Only Start-ups Use Alternative Languages“And, don’t forget, 70% of startups will fail within the first ten years. So, I’m not inclined to base my decisions on the faulty and unproven ability of start-ups to make sound business decisions for themselves.” – Comment from TSS reader, click for full contextSome of the languages are more proven than others obviously, but we can’t ignore the fairly regular news regarding established firms transitioning to alternative languages and platforms or taking a polyglot approach. I would hardly call companies like Twitter, YouTube, foursquare, LinkedIn and Google immature start-ups at this point. If you are going to argue that there are plenty of other shops that use Java, we all know that. The point is some start-ups (those most apt to use these alternative languages) have made bad decisions (as have large firms), but to call the languages themselves ‘unproven’ at this point would not be accurate. No guilt by association here.Businesses don’t make decisions, people do. I don’t think we should fall into the trap of lumping together the decisions made inside of some start-ups as any proof of language relevance at this point. When a host of start-ups fail due to their language choice alone, that conversation can be had.  If you were around back in the late nineties there were a lot of technology start-ups with funny sounding dot-com names. Many of these companies were using a three or four year-old programming language called Java. They could not have predicted that Java would grow to be as popular as it is today.Note: Python is older and Ruby is about the same age as Java, Scala has been around for 9 years, Clojure for 5 years.  Argument #2 – If You’re Bored With Java, That Is No Reason To Branch Out“Becoming “bored or frustrated with Java” is a pretty poor excuse for branching out. As a professional, I’m not paid to feel entertained and broadened in my horizons. I’m paid to get things done as efficiently and as well as I possibly can… Go home and play your Xbox to relieve boredom. Don’t make your employer pay for yet another language learning curve so that you feel less bored and frustrated.” – Comment from TSS reader, click for full contextSimply being bored with Java could be enough for someone to look for other alternatives. I think the bigger issue is that technologists who pay attention to developments in other languages are envious of the features that other languages provide. Today, I feel that a smaller percentage of the Java community explore alternative languages based either on less curiosity or less opportunity. As the Java community at large is exposed to these other languages more and more, I would expect you will see many more defectors. The early adopters of Java were the most curious C++ or C developers who were looking for something different and stumbled on Java, and the most curious of Java pros stumbled on these other languages over the past few years.  Argument #3 – The Assumption That Most or All Of These Alternative Languages Will Be Dead In 5-10 Years“If I’m off learning optional languages, I’m falling short of what I get paid to do. What’s more, I may have decided to do some development in one of the latest and greatest languages that, in a few years, will fall by the wayside, and now I’ve left my employer with a bunch of projects that will have to be re-written into a language that is currently active and supported.” – Comment from TSS reader, click for full contextMany of the early adopters of Java, as I mentioned in my article, have already been exploring some of these alternative languages for some time now. Often they were not initially paid to do so. Could some of these languages be dead in 5-10 years? Sure. Most of the languages I’m thinking of when I talk about alternative languages are already 5 years old, and some much older. Even the young Ruby/Rails combo has been around for over 5 years.Did people make the same assumption about Java back in the late nineties?  Argument #4 – Look At The Evidence That These Alternative Languages Are Not Being Adopted/Used/Sought AfterSome defenders of Java have been pointing me to various statistics as proof that these alternative languages are not being used, not being sought after by employers, or not being adopted. I would cede that none of the current crop are even close to Java in terms of popularity today. I was sent to this link from that says Java developers are the “most difficult tech pros to land, followed by mobile developers“. I wonder where the demand for mobile developers was three years ago? Would mobile development be a valuable skill to learn at this point?As a recruiter, I’m also having a bit of a harder time finding Java developers now. One of the main reasons for that is pretty simple – a lot of the people that I know that used to do Java work aren’t interested in doing Java work any more. Over the years I’ve met a fair amount of experienced Java developers that were dying to get a job doing mobile work, Ruby work, Scala work, etc., but I’m not finding too many Ruby or Scala programmers with five years out of school looking for their first Java job. Maybe it’s just me, but I don’t see that…ever.Another link was given to the Tiobe Index, which is pretty widely used to highlight trends of language popularity. It is based on search engine hits. All indexes like this have some obvious flaws. If you read Tiobe’s Definition, the phrase “Java programming is dead” will actually improve Java’s position in the rankings. So absorb these ratings with that in mind. They measure chatter, which could be positive or negative. Tiobe Programming Community Index for July 2012Well, the takeaway from this graphic, for me anyway, would be that Java dropped significantly and Objective-C seems to be gaining popularity dramatically. But this could be some anomaly in a given month.Tiobe PCI 10 Year Trend“Java has slid only recently and barely while the much touted JVM languages aren’t even on the radar” – Comment from reader, click for full contextThe green line that is Java seems to be trending downward on a fairly regular basis since ’02. I’m not sure I’d refer to a 10 year decline as ‘recent’ in the technology industry. Again, I don’t think the Tiobe index is the ultimate indicator, but I wouldn’t point someone to this statistic to support an argument that Java is healthy.Objective-C wasn’t listed in 1997, was ranked #46 in 2007, and now stands at #3 on the index. If you had picked up Objective-C a few years ago, say in ’07 when it was not entirely popular, you would probably be doing well today as the demand for iOS work is quite high and the supply of developers is quite low. In ’97, Java was #5 – one spot behind VB and two spots behind COBOL.  ConclusionThe arguments against learning a new language or using a new language in production were probably the same back in the late nineties when Java was still new. People surely came to the defense of C and C++ saying that we didn’t need a new language then. It’s progress and subsequent resistance to change, and in the technology industry change can sneak up on you pretty quickly if you aren’t paying attention.I feel that many in the Java community may not be paying close attention.If you were a C++ programmer messing around with applets back in ’96, you’ve already been through this transition once. What I’m hearing now from experienced folks is that these alternative languages are for start-ups, “Trix are for kids!“. I know quite a few gray haired former Java developers that are getting paid to write code in other languages now, and I think they would tell you that the alternative language market isn’t just for kids. Were you using Java in a start-up back in the day – were you one of the kids?My purpose in writing these posts is to make a certain element of the Java community aware of what is out there, and that in my opinion now is an opportune time based on external market forces to explore other languages. This is not an attack on Java as a language or on the people that choose to write in Java. I’ve dedicated much of the past 12 years to the Java community and I don’t intend to change that now. I expect that I will be involved with Java professionals for several years, helping them to find jobs and scheduling great events for my JUG. I chose to change the focus of my business beyond Java, and my suggestion to Java professionals would be to at least consider and research doing the same.Reference: Advice From A JUG Leader II – Debate Breakdown from our JCG partner Dave Fecak at the Job Tips For Geeks blog....

Project Lambda: To Multicore and Beyond

The presentation “Project Lambda: To Multicore and Beyond” (Session 27400 and not to be confused with Brian Goetz’s presentation of the same name) was given in the Hilton San Francisco Grand Ballroom B in the early afternoon on Monday at JavaOne 2011. Even with Grand Ballroom A closed off, this is an extremely large venue for a non-keynote session and there is a large camera (with camera operator) poised to film the presentation. This can probably be construed to mean that the conference organizers anticipated huge interest in coverage of Java SE 8 (JSR 337) and Project Lambda. Alex Buckley (Specification Lead for Java Language and Virtual Machine) and Daniel Smith (Project Lambda Specification Lead) were the presenters and their abstract for this presentation is shown next.This session covers the primary new language features for Java SE 8 – lambda expressions, method references, and extension methods – and explores how existing as well as future libraries will be able to take advantage of them to make client code simultaneously more performant and less error-prone.A functional interface is “an interface with one method.” A lambda expression is “a way to create an implementation of a functional interface.” Lambda expression allows “meat” of functionality to be simply and concisely expressed, especially when compared to the bloat of an anonymous class. Several slides included code examples showing how we’d do it today versus the more succinct representation supported by lambda expressions.Lambda expressions “can refer to any effectively final variables in the enclosing scope.” This means that the final keyword is not required, but rather than it needed to be treated as final (reference not assigned) in the method to be referenced by lambda expression. Some more rules of lambda expressions were announced: the this pointer references enclosing object rather than lambda expression. There is “no need for parameter types in a lambda expression” because they are “inferred based on the functional interface’s method signature” (no dynamic typing necessary). Method references support the “reuse” of “a method as a lambda expression.”Buckley talked about external iteration as the current predominate approach in Java libraries. In this idiom, the “client determines iteration” and is “not thread-safe.” He talked about disadvantages of introduction of a parallel for loop for solving this issue, but extracted some concepts from the parallel for approach: a “filter” and a “reducer.” Buckley introduced the idea that “internal iteration facilitates parallel idioms” because it does not need to be performed serially and is thread-safe.One of the issues Java 8 faces is the need to retrofit libraries to use lambda expressions, but they already have defined interfaces heavily used in the libraries and collections. One approach that might be used to deal with this issue is the use of static extension methods in Java similar to those available in C#. There are numerous advantages to this approach, but there are also some major disadvantages such as not being able to use reflection. The decision was made to revisit the “rule” that one “can’t add an operation to an interface.” Based on thism the subsequent decision was made to add virtual extension methods which provide default implementation in the interface that is used only when the receiver class does not override the method with a default implementation.The slide titled “Are you adding multiple inheritance to Java?!” stated that “Java always had multiple inheritance of types” and “now has multiple inheritance of behavior,” but still does not support “multiple inheritance of state, which causes most problems.” The slide added that “multiple inheritance of behavior is fairly benign” and is really a problem only when compilation occurs in multiple steps. It was emphasized in this presentation that extension methods are a language feature and a virtual machine feature (“everything else about inheritance and invocation is a VM feature!”). As part of this, a bullet stated, “invokeinterface will disambiguate multiple behaviors if necessary.” The non-Java JVM languages can “share the wealth” of extension methods and there was a slide providing three examples of this.Daniel Smith took over the presentation with the topic of parallel libraries. He showed a slide “Behold the New Iterable” which showed an Iterable interface with methods such as isEmpty(), forEach, filter, map, reduce, and into. He also showed a slide on a Parallelterable interface available from Iterable via extension method parallel().Smith provided references to JSR 335, JSR 166, and Project Lambda as part of his slide on community contributions. He also cited four additional sessions at JavaOne 2011 regarding lambda expressions and closely related topics. Smith ended with a quote from Brian Goetz on Project Lambda: …we believe the best thing we can do for Java developers is to give them a gentle push towards a more functional style of programming. We’re not going to turn Java into Haskell, nor even into Scala. But the direction is clear.  ConclusionSmith’s examples made it clear that lambda expressions will provide tremendous benefits to Java developers in their daily tasks. He showed the types of loops we’ve all had to write many hundreds or thousands of times and the cleaner, more concise syntax that lambda expressions make possible. This presentation has made it clear that, with the introduction of lambda expressions, Java will gain many of the benefits enjoyed by dynamically typed languages in terms of fluency and conciseness.Reference: JavaOne 2011: Project Lambda: To Multicore and Beyond from our JCG partner Dustin Marx at the Inspired by Actual Events blog....

Immediate gratification v/s delayed gratification in context of Software

This topic cuts across many different disciplines. But here I want to discuss it in context of software development and its process. Its a proven fact that when an individual focuses his efforts on long term goals he is laying down a foundation for quality life for far and near future. Actions that give immediate returns can hardly give any benefits in the long run. Few examples to put this in context of software process – 1. When an individual starts learning a new tool/process/method which is better than current one he/she faces slump in productivity (for e.g. TDD). This leads to an environment where managers starts thinking that change is not helping. Or simply they don’t have courage to face the initial loss of productivity for the sake of increased long term quality benefits. 2. Focus on process rather than product – Its not unusual that supervisor of a development team will over-emphasize on the product delivered rather than question the quality of process by which product is produced. What they are (un)conciously doing is, focusing on short term goal – they want to see a piece of functionality in action – immediately. If they delay the gratification and say, allow technical team to enforce processes/tools then that will ensure that all future deliverables are indeed quality deliverables. Because they are investing in something which will improve the process – which is responsible for the product. 3. Similar but one which has more drastic implications – before requirements can “sink” in, start the development/design. Today’s software methods and RAD tools allow requirements to change constantly during the project, but its important that requirements “sink” in the psyche of the technical team. I believe there is always a motive for coming up with a particular software requirement. That motive hardly changes, if developers are able to study and interact enough with requirements or producers of that requirements(client ?) they will catch the motive which is alway hidden and never communicated. If design/development happens focusing on that motive, the deliverables will be able to better accommodate requirement changes. Obviously the catch lies in deciding in when to stop being invested and take the yield. But unfortunately software teams today try to take the yield way before they have invested enough and hence they don’t get good enough yield. Reference: Immediate gratification v/s delayed gratification in context of Software from our JCG partner Advait Trivedi at the CoolCode blog....

Introduction to Puppet For Vagrant Users

I couldn’t find any good, brief, practical introduction into Puppet that gives you basic working knowledge in minimal time, so here it is. You will learn how to do the elementary things with Puppet – install packages, copy files, start services, execute commands. I won’t go into Puppet installation, nodes, etc. as this introduction focuses on the users of Vagrant, which comes with Puppet pre-installed and working in the serverless configuration. What is Puppet? Puppet is a provisioner – a cross-OS software that sets up operating systems by installing and configuring software etc., based on some form of instructions. Here as an example of such instructions – a manifest – for Puppet: # my_sample_manifest.pp class my_development_env { package {'vim': ensure => 'present' } }# Apply it include my_development_env Running it with puppet apply --verbose --debug my_sample_manifest.pp would install vim on the system. Notice that while Puppet can be run only once, it is generally intended to be run repeatedly to fetch and apply the latest configuration (usually from some source code management system such as Git). Therefore all its operations must be idempotent – they can be performed safely multiple times. The Puppet Configuration File a.k.a. Manifest Puppet manifests are written in a Ruby-like syntax and are composed of the declaration of “resources” (packages, files, etc.), grouped optionally into one or more classes (i.e. templates that can be applied to a system). Each concrete resource has a title (e.g. ‘vim’) followed by a colon and comma-separated pairs of property => value. You may have multiple resources of the same type (e.g. package) as long as they have different titles. The property values are most often strings, enclosed by ‘single quotes’ or alternatively with “double quotes” if you want variables within them replaced with their values. (A variable starts with the dollar sign.) Instead of a name or a value you can also use an array of titles/values, enclosed with [ ]. (Note: It is a common practice to leave a trailing comma behind the last property => value pair.) You can group resources within classes (class my_class_name { … }) and then apply the class with either include (include my_class_name) or with the more complex class (class { ‘my_class_name’: }). You can also include a class in another class like this. Doing Things With Puppet Installing Software With Package The most used way to install software packages is with this simple usage of package: package {['vim', 'apache2']: ensure => 'present' } Puppet supports various package providers and by default picks the system one (such as apt at Ubuntu or rpm at RedHat). You can explicitly state another supported package provider such as Ruby’s gem or Python’s pip. You can also request a particular version of the package (if supported) with ensure => ‘<version>’ or to the latest one with ensure => ‘latest’ (this will also reinstall it whenever a new version is released and Puppet runs). In the case of ensure => ‘present’ (also called ‘installed’): if the package already is installed then nothing happens otherwise the latest version is installed. Copying and creating Files With File Create a file with content specified in-line: file {'/etc/myfile.example': ensure => 'file', content => 'line1\nline2\n', } Copy a directory including its content, set ownership etc.: file {'/etc/apache2': ensure => 'directory', source => '/vagrant/files/etc/apache2', recurse => 'remote', owner => 'root', group => 'root', mode => '0755', } This requires that the directory /vagrant/files/etc/apache2 exists. (Vagrant automatically shares the directory with the Vagrantfile as /vagrant in the VM so this actually copies files from the host machine.With the master-agent setup of Puppet you can also get files remotely, from the master, using the puppet:// protocol in the source.) You can also create files based on ERB templates (with source => template(‘relative/path/to/it’)) but we won’t discuss that here. You can also create symlinks (with ensure => link, target => ‘path/to/it’) and do other stuff, reader more in the file resource documentation. (Re)Starting Daemons with Service When you’ve installed the necessary packages and copied their configuration files, you’ll likely want to start the software, which is done with service: service { 'apache2':· ensure => running,· require => Package['apache2'], }(We will talk about require later; it makes sure that we don’t try to start Apache before it’s installed.) On Linux, Puppet makes sure that the service is registered with the system to be started after OS restart and starts it. Puppet reuses the OS’ support for services, such as the service startup scripts in /etc/init.d/ (where service = script’s name) or Ubuntu’s upstart. You can also declare your own start/stop/status commands with the properties of the same names, f.ex. start => ‘/bin/myapp start’. When Everything Fails: Executing Commands You can also execute any shell command with exec: exec { 'install hive': command => 'wget -O - | tar -xzC /tmp', creates => '/tmp/hive-0.8.1-bin', path => '/bin:/usr/bin', user => 'root', } Programs must have fully qualified paths or you must specify where to look for them with path. It is critical that all such commands can be run multiple times without harm, i.e., they are idempotent. To achieve that you can instruct Puppet to skip the command if a file exists with creates => … or if a command succeeds or fails with unless/onlyif. You can also run a command in reaction to a change to a dependent object by combining refreshonly and subscribe. Other Things to Do You can create users and groups, register authorized ssh keys, define cron entries, mount disks and much more – check out Puppet Type Reference. Enforcing Execution Order With Require, Before, Notify etc. Puppet processes the resources specified in a random order, not in the order of specification. So if you need a particular order – such as installing a package first, copying config files second, starting a service third – then you must tell Puppet about these dependencies. There are multiple ways to express dependencies and several types of dependencies:Before and require – simple execution order dependency Notify and subscribe – an enhanced version of before/require which also notifies the dependent resource whenever the resource it depends on changes, used with refreshable resources such as services; typically used between a service and its configuration file (Puppet will refresh it by restarting it)Ex.: service { 'apache2': ensure => running, subscribe => File['/etc/apache2'], require => [ Package['apache2'], File['some/other/file'] ], } Notice that contrary to resource declaration the resource reference has the resource name uppercased and the resource title is within []. Puppet is clever enough to derive the “require” dependency between some resource that it manages such as a file and its parent folder or an exec and its user – this is well documented for each resource in the Puppet Type Reference in the paragraphs titled “Autorequires:”. You can also express dependencies between individual classes by defining stages, assigning selected classes to them, and declaring the ordering of the stages using before & require. Hopefully you won’t need that. Bonus Advanced Topic: Using Puppet Modules Modules are self-contained pieces of Puppet configuration (manifests, templates, files) that you can easily include in your configuration by placing them into Puppet’s manifest directory. Puppet automatically find them and makes their classes available to you for use in your manifest(s). You can download modules from the Puppet Forge. See the examples on the puppetlabs/mysql module page about how such a module would be used in your manifest. With Vagrant you would instruct Vagrant to provide modules from a particular directory available to Puppet with config.vm.provision :puppet, :module_path => 'my_modules' do |puppet| puppet.manifest_file = 'my_manifest.pp' end (in this case you’d need manifest/ next to your Vagrantfile) and then in your Puppet manifest you could have class { ‘mysql’: } etc. Where to Go Next? There are some things I haven’t covered that you’re likely to encounter such as variables and conditionals, built-in functions such as template(..), parametrized classes, class inheritance. I have also skipped all master-agent related things such as nodes and facts. It’s perhaps best to learn them when you encounter them. In each case you should have a look at the Puppet Type Reference and if you have plenty of time, you can start reading the Language Guide. In the on-line Puppet CookBook you can find many useful snippets. You may also want to download the Learning Puppet VM to experiment with Puppet (or just try Vagrant). Reference: Minimalistic Practical Introduction to Puppet (Not Only) For Vagrant Users from our JCG partner Jakub Holy at the The Holy Java blog....

Blind Dating for Geeks: Questions Candidates Should Ask During Interviews

After a few ‘Questions Candidates Ask In Interviews’ themed articles appeared in my Twitter stream, I was reminded of an article I wrote two years ago called ‘Best Questions To Ask The Interviewer, And When To Ask Them‘. I think one key element missing in the new articles is the ‘when to ask them’ detail that I feel is incredibly important. Also, being that JobTipsForGeeks is aimed at technology professionals, there are some nuances that do not apply to other industries. Why is the timing of when the questions are asked important? An interview is nothing more than a blind date, with the goal on both sides being to find out if you want to start seeing each other in a somewhat committed fashion. You want to discover as much as you can about the other party, but first you have to set a positive tone and build trust. We surely would want to find out if our blind date is, say, a serial killer – but leading off with the ‘Are you a serial killer?’ question would seem rude, and we probably wouldn’t get an honest answer anyway. Below is a list of the best questions to ask in chronological order. Please keep in mind that you would need to restart from the beginning for every new person that you meet in situations where you meet with multiple participants individually. You may not be afforded the opportunity to ask all the questions based on time constraints, so use at least one question from the first section for each person and try to use all the questions at least once at some point in the process.Setting a positive interview tone OR Cocktails and light conversation Question: “What is your background and how did you come to work for COMPANY?” Reason to ask it: Most people genuinely like to talk about themselves (those that do not share this trait will probably not be in the interview), so give them a chance to do so. Don’t be afraid to toss in some remarks and perhaps a follow-up question regarding their background if appropriate. You may learn that you have some shared history with this person that could give you a potential ‘in’. Question: “What do you like best about your job and about working for COMPANY?” Reason to ask it: This question serves two purposes. First, it gives the employee the opportunity to speak well of the company, which again will give an initial positive vibe to your dialogue. Secondly, what the employee chooses to say they like best can be quite telling. If their answer is ‘environment’, ‘work/life balance’ or ‘the people’, that is a universal positive. If the response is ‘the money’ or ‘vacation time’, you may want to dig deeper to find out why. BONUS Question: (If possible, find a fairly recent newsworthy item about the company that is both appropriate and positive, and ask an insightful question about it) Reason to ask it: This shows that you have done your homework before the interview and that you want to be taken seriously as a candidate. This is something that you want to fully research to prevent making a huge mistake that would make recovery impossible.Discovery OR Gentle interrogation of your date during dinner Question: What are the biggest challenges you face? Reason to ask it: The reason for using the word ‘challenges’ is that it does not have a negative connotation, whereas asking someone for the ‘worst’ element of their job will not give a positive impression. The answer here will start to create an image of what this company is going through today and what the landscape is for tomorrow. At a start-up, you may hear answers about financial challenges, limited resources and a fast pace. Some industries are known for heavy regulation getting in the way of progress. This is all valuable information. Question: What would the typical day be like for me at COMPANY? Reason to ask it: You may get an answer that gives you tangible insight into work/life balance (‘I usually get home in time to watch Jimmy Fallon’), how much of your day may be spent coding or doing other duties, how many meetings you may be pulled into, etc. Question: What was your career path here and what is a typical career path for my role at COMPANY? Reason to ask it: Find out if they promote from within and if there are separate technical and non-technical/pure management tracks. Will you be forced into a management role? Question: How would you describe the environment? Reason to ask it: Asking an open-ended question like this could lead in several directions. You should be able to ascertain if it is cut-throat or cooperative, how much support is given to technologists, and whether you will be expected to work with teams or as a solo entity. Question: Management styles? Development processes and methodologies in place? Reason to ask it: Engineers preferences for structure vary greatly. Be sure to drill down to get the best understanding of whether their practices are aligned with your views. Question: Tech stack? Reason to ask it: If their answer is a list of products and technologies that are severely dated, it could mean the company doesn’t invest in or even investigate the latest and greatest. Conversely, if they seem overly concerned with bleeding-edge, perhaps they are making tech decisions based on cool factor more than quality. Be sure to listen for what can be telling patterns, such as an abundance of tools from a particular vendor or a wide variety of open source tools. This question also gives you an opening to discuss your experience (and preferences) relevant to their stack. Question: Why is this position open? Reason to ask it: Growth or promotion are the two most desirable answers. Perhaps this position is a launching board into higher level positions, or maybe it is a dead-end that will burn you out. Closing the deal OR Last call and the drive home)… Question: What qualities/background do you think would be key to making someone successful in this position? Reason to ask it: During that last set of questions, some negative topics could have surfaced. This gets things back on the positive side before the end, as well as giving you more info on whether you would be hitting the ground running or may require some learning curve. (NOTE: This question could also be used as an ice breaker early on) Question: What projects are just getting ramped up or are on the horizon? Reason to ask it: Interviewers will enjoy discussing new endeavors that they think you will find most interesting. If they talk about fixing bugs and maintenance, chances are that is what you will be doing in this job for the foreseeable future. Ideally, the interviewer’s excitement should be palpable. Question: Where do you see yourself in five years here at COMPANY? Reason to ask it: This question is generally asked of candidates, so turning that around should provide insight into how he/she really feels about the firm and their prospects. Again, it lets the interviewer talk about himself/herself again in a positive fashion, and if the interviewer has a sense of humor expect an attempt to use it on this question. The Conclusion OR Goodnight Question: Is there anything else I can answer for you or any more information I can provide to help you in your decision? Reason to ask it: It shows you are forthcoming and trying to be helpful. Question: I am very interested in this opportunity (or similar sentiment). When do you expect COMPANY might be making a decision? Reason to ask it: Showing interest is vital, and asking about their timing could lead to information on other candidates. It also may prompt them to ask about your availability to start, which is an obvious buying sign. You want to do this is with as little pressure as possible. Close by thanking the interviewer for taking the time to speak with you and tell him/her that you look forward to the next steps. Good luck. Reference: Blind Dating for Geeks: Questions Candidates Should Ask (and when to ask them) During Interviews from our JCG partner Dave Fecak at the Job Tips For Geeks blog....

Measure execution time in Java – Spring StopWatch Example

There are two ways to measure elapsed execution time in Java either by using System.currentTimeinMillis() or by using System.nanoTime() . These two methods can be used to measure elapsed or execution time between two method calls or event in Java. Calculating elapsed time is one of the first thing Java programmer do to find out how many seconds or millisecond a method is taking to execute or how much time a particular code block is taking. Most of Java programmer are familiar with System.currentTimeInMillis() which is there from beginning while a new version of more precise time measurement utility System.nanoTime is introduced in Java 1.5, along with several new features in language like Generics, Enum types, auto boxing and variable arguments or varargs. You can use any of them to measure execution time of method in Java. Though its better to use System.nanoTime() for more precise measurement of time intervals. In this Java programming tutorial we will see a simple Java program to measure execution time by using System.nanoTime() and Spring framework’s StopWatch utility class. This article is in continuation of my post on covering fundamental Java concepts like How to compare String in Java, How to write equals method in Java correctly and 4 ways to loop HashMap in Java. If you haven’t read them already you may find them useful.  Java Program example to measure execution time in Java  Here is a code example for measuring elapsed time between two code blocks using System.nanoTime, M any open source Java libraries like Apache commons lang, Google commons and Spring also provides StopWatch utility class which can be used to measure elapsed time in Java. StopWatch improves readability to minimize calculation error while calculating elapsed execution time but beware that StopWatch is not thread safe and should not be shared in multi-threading environment and its documentation clearly says that this is more suitable in development and test environment for basic performance measurement rather performing time calculation in production environment. import org.springframework.util.StopWatch;/** * Simple Java Program to measure elapsed execution time in Java * This Java Program shows two ways for measuring time in Java, by using System.nanoTime() which was * added in Java 5 and StopWatch which is a utility class from Spring Framework. */ public class MeasureTimeExampleJava {public static void main(String args[]) { //measuring elapsed time using System.nanoTime long startTime = System.nanoTime(); for(int i=0; i < 1000000; i++){ Object obj = new Object(); } long elapsedTime = System.nanoTime() - startTime; System.out.println("Total execution time to create 1000K objects in Java in millis: " + elapsedTime/1000000); //measuring elapsed time using Spring StopWatch StopWatch watch = new StopWatch(); watch.start(); for(int i=0; i < 1000000; i++){ Object obj = new Object(); } watch.stop(); System.out.println("Total execution time to create 1000K objects in Java using StopWatch in millis: " + watch.getTotalTimeMillis()); } }Output: Total execution time to create 1000K objects in Java in millis: 18 Total execution time to create 1000K objects in Java using StopWatch in millis: 15Which one should you use for measuring execution time in Java It depends which options are available to you, if you are working in below JDK 1.5 version than System.currentTimeInMillis() is the best option in terms of availability while after JDK 1.5 System.nanoTime is great for measuring elapsed time as it is more accurate and uses accurate system clock and can measure upto nano second precision. while if you are using any of Java open source library mentioned above, mostly Spring than StopWatch is also a better option but as I said earlier StopWatch is not thread-safe and should only be used in development and test environment. Just like SimpleDateFormat is not thread-safe and you can use ThreadLocal to create per thread SimpleDateFormat you can do the same thing with StopWatch as well. But I don’t think StopWatch is heavy object like SimpleDateFormat . That’s all on how to measure elapsed time or execution time in Java. Get yourself in habit of measuring performance and execution time of important piece of codes specially methods or loops which executes most of the time. Those are the places where an small optimization in code result in bigger performance gain. Reference: How to measure elapsed execution time in Java – StopWatch Example from our JCG partner Javin Paul at the Javarevisited blog....

Cross Site Scripting (XSS) and prevention

Variants of Cross site scripting (XSS) attacks are almost limitless as mentioned on the OWASP site ( Here I propose to use a Servlet Filter based solution for sanitization of HTTP Request.The attackLets see how an XSS attack manifests itself. Attached is an over simplified portlet which shows a scenario which is very common in social and collaboration based systems like forums. See below psuedo-sequence diagram.      Here, 1. There is a form available where user can enter his comments with a submit button and textbox named “mytext”. User A renders this form. 2. User A enters a java script into input text box and submits the form (this is the step where evil enters your app). Just to make you see the problem; imagine that the script entered by user sends cookies stored by the app to an attacker’s site. 3. User B logs into the system and he wants to see the comments provided by User A. So he goes to respective page where system renders value of “mytext” provided by A. 4. Browser renders value of “mytext”, which is a java script that fetches all the cookies of current site stored for User B and sends it to the Attackers system.The prevention (better than cure, always) We will see how cleansing of HTTP parameters help in thwarting off this kind of attack. For this attack to be successful what kind of response was sent to browser when B rendered A’s comments? Something like - <div>A's Comments</div> <div> <script> <!-- This script will get all cookies and will send them to attacker's site. --> </script> </div>As you can see, the attack was possible due to the fact that, for a browser, an HTML document is mix of markup & executable code. The ability to mix executable code with markup is deadly combination which attackers can exploit. Using a Servlet Filter we can cleans all the input parameters and remove all special characters that can denote executable instructions for browser. This way no evil enters the system. Here is a very simple Servlet Filter that does this. A wrapper over HttpServletRequest is used and methods are override to return request parameter values after escaping. For escaping I suggest using StringEscapeUtils of Apache Commons project instead of doing some custom coding.Another way is to let the users enter whatever they want but while rendering convert <,>,&,’,” to their corresponding character entity codes. Typically this can be done as using JSTL - <div>A's comments</div> <div> <c:out value="${comments}" escapeXml="true" /> </div>This approach is especially useful where users can share code snippets with each other.Based on interaction between user and the system many other clever ways of launching an XSS attacks can be devised. But having absolute control over system input will can surely guard agains such attacks.   Reference: XSS and prevention from our JCG partner Advait Trivedi at the CoolCode blog....

JBoss BRMS with JasperReports for Reporting

Introduction Jasperreports is a free downloadable library that can be used for generating rich reports for Java EE applications. This guide also provides the steps to generate report templates using Jasper iReport designer. Software requirementsJBoss BRMS 5.3 (from customer portal, JasperReports 4.6.0 Jasper iReports Maven (for building report server) Ant (for building JasperReports)  Adding on JasperReports Just follow these steps to get it up and running.install JBoss BRMS 5.3 standalone. create the following directories in in BRMS install$JBOSS_HOME/server/default/data/Jasper $JBOSS_HOME/server/default/data/Jasper/OutputDownload (latest) Jasperreports 4.6.0 from the following location the contents of the downloaded folder in a local directory. Goto jasperreports-4.6.0-project\jasperreports-4.6.0 directory where the build.xml file resides and do an ant build. This will create the distribution jars at the following location $path_to_jasper\jasperreports-4.6.0-project\jasperreports-4.6.0\distJasperreports-applet-4.6.0 Jasperreports 4.6.0.jar Jasperreports-fonts-4.6.0 Jasperreports-javaflow-4.6.0Copy the above jars to the following location$JBOSS_HOME\server\default\deploy\gwt-console-server.war\WEB-INF\libGet report server code from github repository from the following location to the root directory of the downloaded code and do a maven build: mvn clean install. This will generate the distribution jars; reports-core-1.3.0.jar, report-shared-1.3.0.jar Copy the two previous jar folders from the dist directory to the $JBOSS_HOME\server\default\deploy\gwt-console-server.war\WEB-INF\lib Delete the existing reports-core-final-1.4.0 and reports-shared-final-1.4.0 in the $JBOSS_HOME\server\default\deploy\gwt-console-server.war\WEB-INF\lib Download jasper report templates overall_activity.jasper and overall_activity.jrxml from the following link and copy into $JBOSS_HOME/server/default/data/Jasper the following library jars from $path_to_jasper\jasperreports-4.6.0-project\jasperreports-4.6.0\lib to the following location $JBOSS_HOME\server\default\deploy\gwt-console- server.war\WEB-INF\libcommons-digester-2.1 jfreechart-1.0.12 jcommon-1.0.15  Customization and editing .jrxml fileFollow the document JasperReports-Ultimate-Guide-3.0 in docs folder at $path_to_jasper/jasperreports-4.6.0-project\jasperreports-4.6.0\docs Download and install Jasper iReports designer from the following location the overall_activity.jrxml file in the iReports and edit. Save the .jrxml file and compile by clicking on the preview tab. Copy both the .jrxml (only for future reference) and .jasper file to the $JBOSS_HOME/server/default/data/JasperReference: JBoss BRMS 5.3 – Adding on JasperReports for Reporting from our JCG partner Eric D. Schabell at the Thoughts on Middleware, Linux, software, cycling and other news… blog....

What can you get out of Kanban?

I’ve spent the last year or so learning more about Kanban, how to use it in software development and IT operations. It’s definitely getting a lot of attention, and I want to see if it can help our development and operations teams work better. What to Read, What to Read? There’s a lot to read on Kanban – but not all of it is useful. You can be safe in ignoring anything that tries to draw parallels between Japanese manufacturing and software development. Anyone who does this doesn’t understand Lean manufacturing or software development. Kanban (big K) isn’t kanban (little k) and software development isn’t manufacturing. Kanban in software development starts with David Anderson’s book. It’s heavy on selling the ideas behind Kanban, but unfortunately light on facts and examples – mostly because there wasn’t a lot of experience and data to draw on at the time the book was written. Everything is built up from two case studies in small maintenance organizations. The first case study (which you can read here online) goes back to 2005, at a small offshore sustaining engineering team in Microsoft. This team couldn’t come close to keeping up with demand, because of the insanely heavyweight practice framework that they were following (CMMI and TSP/PSP) and all of the paperwork and wasted planning effort that they were forced to do. They were spending almost half of their time on estimating and planning, and half of this work would never end up being delivered because more work was always coming in. Anderson and another Microsoft manager radically simplified the team’s planning, prioritization and estimation approach, cutting out a lot of the bullshit so that the team could focus instead on actually delivering what was important to the customers. You can skip over the theory – the importance of Drum-Buffer-Rope – Anderson changed his mind later on the theory behind the work anyways. As he says: “This is a case study about implementing common sense changes where they were needed”. The second case study is about Anderson doing something similar with another ad hoc maintenance team at Corbis a couple of years later. The approach and lessons were similar, in this case focusing more on visual tracking of work and moving away from time boxing for maintenance and break/fix work, using explicit WIP limits instead as the forcing function to control the team’s work. The rest of the book goes into the details of tracking work on task boards, setting and adjusting limits, and just-in-time planning. There’s also some discussion of effecting organizational change and continuous improvement, which you can get from any other Agile/Lean source. Corey Ladas’ book Scrumban is a short collection of essays on Kanban and combining Scrum and Kanban. The book is essentially built around one essay, which, taking a Lean approach to save time and money, I suggest that you read here instead. You don’t need to bother with the rest of the book unless you want to try and follow along as Ladas works his ideas out in detail. The basic ideas are the same as Anderson (not surprising, since they worked together at Corbis): Don’t build features that nobody needs right now. Don’t write more code than you can test. Don’t test more code than you can deploy. David Anderson has a new book on Kanban coming out soon Unfortunately it looks like a rehash of some of his blog posts with updated commentary. I was hoping for something with more case studies and data, and follow-ups on the existing case studies to see if they were able to sustain their success over time. There is other writing on Kanban, by excited people who are trying out (often in startups or small teams), or by consultants who have added Kanban to the portfolio of what they are selling – after all, “Kanban is the New Scrum”. You can keep up with most of this through the Kanban weekly Roundup, which provides a weekly summary of links and discussion forums and news groups and presentations and training in Kanban and Lean stuff. And there’s a discussion group on Kanban development which is also worth checking out. But so far I haven’t found anything, on a consistent basis anyways, that adds much beyond what you will learn from reading Anderson’s first Kanban book.Where does Kanban work best? Kanban was created to help break/fix maintenance and sustaining engineering teams. Kanban’s pull-based task-and-queue work management matches the unpredictable, interrupt-driven and specialized work that these teams do. Kanban puts names and a well-defined structure around common sense ideas that most successful maintenance and support and operations teams already follow, which should help inexperienced teams succeed. It makes much more sense to use Kanban than to try to bend Scrum to fit maintenance and support, or following a heavyweight model like IEE 1219 or whatever it is being replaced by. I can also see why Kanban has become popular with technology startups, especially web / SaaS startups following Continuous Deployment and a Lean Startup model. Kanban is about execution and continuous optimization, removing bottlenecks and reducing cycle time and reacting to immediate feedback. This is exactly what a startup needs to do once they have come up with their brilliant idea. But getting control over work isn’t enough, especially over the longer-term. Kanban’s focus is mostly tactical, on the work immediately in front of the team, on identifying and resolving problems at a micro-level. There’s nothing that gets people to put their heads up and look at what they can and should do to make things better on a larger-scale – before problems manifest themselves as delays. You still need a layer of product management and risk management over Kanban, and you’ll also need a technical software development practice framework like XP. I also don’t see how – or why – Kanban makes much of a difference in large-scale development projects, where flow and tactical optimization aren’t as important as managing and coordinating all of the different moving pieces. Kanban won’t help you scale work across an enterprise or manage large programs with lots of interdependencies. You still have to do project and program and portfolio management and risk management above Kanban’s micro-structure for managing day-to-day work, and you still need a SDLC.Do you need Kanban? Kanban is a tool to solve problems in how people get their work done. Anderson makes it clear that Kanban is not enough in itself to manage software development regardless of the size of the organization – it’s just a way for teams to get their work done better: “Kanban is not a software development life cycle or a project management methodology…You apply a Kanban system to an existing software development process…” Kanban can help teams that are being crushed under a heavy workload, especially support and maintenance teams. Combining Kanban with a triage approach to prioritization would be a good way to get through a crisis. But I don’t see any advantage in using Kanban for an experienced development team that is working effectively. Limiting Work in Progress? Time boxing already puts limits around the work that development teams do at one time, giving the team a chance to focus and get things done. Although some people argue that iterations add too much overhead and slow teams down, you can strip overheads down so that time boxing doesn’t get in the way – so that you really are sprinting. Getting the team to understand the flow of work, making delays and blockers visible and explicit is an important part of Kanban. But Microsoft’s Eric Brechner (er, I mean, “I. M. Wright”) explains that you don’t need Kanban and taskboards to see delays and bottlenecks or to balance throughput in an experienced development team: “Good teams do this intuitively to avoid wasted effort. They ‘right-size’ their teams and work collaboratively to succeed together.” And anybody who is working iteratively and incrementally is already doing or should be doing just-in-time planning and prioritization. So for us, Kanban doesn’t seem to be worth it, at least for now. If your development team is inexperienced and can’t deliver (or don’t know what they need to deliver), or you’re in a small maintenance or firefighting group, Kanban is worth trying. If Kanban can help operations and maintenance teams survive, and help some online startups launch faster, if that’s all that people ever do with Kanban, the world will still be a better place. Reference: What can you get out of Kanban? from our JCG partner Jim Bird at the Building Real Software blog....
Java Code Geeks and all content copyright © 2010-2015, Exelixis Media Ltd | Terms of Use | Privacy Policy | Contact
All trademarks and registered trademarks appearing on Java Code Geeks are the property of their respective owners.
Java is a trademark or registered trademark of Oracle Corporation in the United States and other countries.
Java Code Geeks is not connected to Oracle Corporation and is not sponsored by Oracle Corporation.
Do you want to know how to develop your skillset and become a ...
Java Rockstar?

Subscribe to our newsletter to start Rocking right now!

To get you started we give you two of our best selling eBooks for FREE!

Get ready to Rock!
You can download the complementary eBooks using the links below: