Yair's Tweaks & Tricks

Mainly software


Leave a comment

Cool Guava API for filtering and transforming collections

If you are not lucky enough to use Scala, this may be the closest you get:

Filtering and Transforming Collections in Guava

Advertisements

principles of high performance programs

I’ve found this article extremely interesting. Although some of the tips here are not so relevant to Java – it’s still a good read for Java developers.

One point I personally want to emphasize is the ContextSwitch cost. Read more about it in the article.


2 Comments

Intellij Tips

As I am using Intellij for my daily software development work, I thought I’d share some useful tips.

Tip #1 – SCM Shortcut

quick access to SCM (Source Control commands) – Alt + `

 

Tip #2 – Branch management

If you want to hold multiple modules in the same project that have the same maven artifact id – you don’t have to open a new project.

Make sure the branch modules have a unique fie system folder name. I.e. module ‘foo’ is in ‘foo’ folder in trunk, but in branch the folder name is ‘foo-branch’. In this case you can import the branch module and have it side by side with the trunk module.

Note: you may want to update the ‘name’ in the pom.xml so you can easily distinguish between trunk and branch modules in the ‘Maven Project’ tab.

 

Tip #3 – module grouping

In case you want to group some modules together (very useful when managing trunk and branch together) you can right click on a module and choose ‘Move module to group’.

 

Tip#4 – Setting Module Dir as default working directory

Go to ‘edit configurations’ and under defaults define ‘$MODULE_DIR$’ as the working directory:

intellij default configurations

Naturally repeat this for Junit and and any other run type you wish.

 

Tip#5 – Dependencies Tree

Although dependencies graph exist only in the commercial edition you don’t really need them. You can see the full tree in the ‘Maven Project’ tab. If you want to understand how the maven resolution was done and why (maybe) you see the “wrong” version – you should install the “Maven Helper” plugin (just search for it the plugin repositories within Intellij) that will add another tab when you open your pom.xml file and you will see which version was omitted because of conflict (similar to the maven plugin supported in Eclipse).
Thanks to Izek Greenfield for this tip.

 

Tip #6 – Expand Tree Node

Know those times you need to expand all but only under the context you are currently focused (i.e. in ‘Maven Project’ expand all dependencies)?

Well, Ctrl + ‘+’ expands the whole tree and not only the specific node. BUT – use the numpad ‘*’ and there you have it. 🙂