Yesterday I switched to 2017 version of Intellij from the good old 16.3. I didn’t read about all new features yet, but the first thing that hits me was new look of “Find in Path” window. It’s now completely redesigned and I couldn’t get used to it for the first couple hours. Now I don’t need to click to another tab to change search filters – it’s all in the results view already! Thanks JetBrains!
After running Intellij for the longer period of time without restarting, I noticed some lags. The Java editor was freezing for a second or two and it was really annoying! I couldn’t work 🙁 After looking for some “magic” tweaks in the internet, I found that maybe I should just double the Xmx setting. Original value was 750MB, so I have changed it to 1500MB. I enabled “Memory indicator” and after running some unit tests it exceeded the original value. Hope it helps in a long run!
It is longer than three weeks since I was attending that software craftsmanship conference in Wrocław. The seven-hour train journey was exhausting, but worth that amazing experience of meeting a lot of great people and learning something new about my job. Here I just want to share some thoughts with hope, that someone gets inspired.
Moore’s law of our times – Tomasz Kaczmarzyk (opening speak)
- “The software craftsmanship manifest” was reminded. I think that every programmer aspiring to be a professional should recall it more often than on the conference. I would say at least once a month! The thing is to keep the focusing on “raising the bar”.
- The next fun thing was a prediction of Uncle Bob, that “every 5 years the number of programmers doubles”. And here is my tweet about it:
— Rafał Garbowski (@rafal_rg9) February 28, 2017
- There was nice explanation what “10x programmer” really means in the context of software craftsmanship: maybe 1 senior programmer cannot be as much productive as 10 junior programmers, but he can improve them by teaching and helping. So senior guys step up and don’t hesitate to be mentors! I believe that teaching is a natural way to become an expert.
After changing my IDE from Eclipse to IntelliJ, I suffered from lack of really helpful functionality of auto-completing method call arguments (topic on Stackoverflow).
The standard auto-completition wasn’t enough and “Ctrl+P” shortcut doesn’t satisfy me either.
Hopefully I found this issue: IDEABKL-5496 – Auto-filling the actual Java call arguments, where the last comment written just couple days ago has a great news for me!
Making long story short: some German developer made pretty cool plugin, that fix this problem!
Usage is very simple – you don’t need to know new shortcut, just press “Alt+Enter” and select “Fill …” from suggestions menu. It rocks!
First run some process in terminal, e.g. “git-cola” tool:
Then in terminal press “Ctrl+Z” and you should see following console output:
Then type “bg”:
Typically it’s bad to have test depended to each other. However in case of some integration testing, it can really help.
Example from JavaDoc:
Preconditions should be ideal for situations, where there is no specific business exceptions for checking arguments and performance is not an issue.
Here is more about checking conditions:
Getting started guide:
- cool way to verify throwing exceptions:
- instead of writing, “when-then”, just use “except”:
- to parameterize test with different data, use “where” syntax:
- in helper method use “assert” keyword:
I found this article with filter implementation:
However in comment someone point that we can simply extend “LoginUrlAuthenticationEntryPoint”.
My solution sets only status 401 and doesn’t write anything to response body:
When our application server user proxy, that doesn’t set “X-Forwarded” headers with original request port, then we can use some hack in our application. Just ignore port when it is equal 80 or 443, cause it is default. For example instead of
"http://localhost:80/app", we will get
"https://localhost:443/app" will output
Inspired by Mat Banik strackoverflow answer – http://stackoverflow.com/a/5212336/5770135.