Pages
Monday, September 24, 2018
Moving to Medium
I'm now planning to blog much more and Blogspot can't satisfy my requirements, hence I'm moving to Medium.
So long, Blogspot, those were fun 10+ years!
Monday, January 15, 2018
The essential tools for software developer
As a software developer I have used a ton of different tools for different purposes. However, it got me thinking, if I really need a lot of tools and what are the essential tools for software developer and what tools are rather “nice to haves”.
Editor
First, we better be able to write code. Hence, the editor is absolutely required. For Java, I’ve used different IDEs, but mostly IntelliJ IDEA. NetBeans IDE is nice. Eclipse-based IDEs shine in one way or another. I usually prefer to install JBoss Developer Studio as it provides a solid support for Java EE projects.
For one-off editing, I still use Vim and can’t get rid of it. I’m not even using the full power of the editor. I’ve tried other awesome editors at different times: Notepad++, Crimson, Atom, Sublime Text, VS Code (which I do have installed on my machine). Still, those editors haven’t got much use by me for some unknown reason.
The cool thing about the editors is that there’s so much choice!
Version Control System
In 2004 I started at one financial company as a Java developer. The first task I was assigned to was something likes this: “We have an application running in production and it has a few bugs. We need to fix those, but we don’t have the source code. Please do something?”. A disaster. They didn’t use source control properly and managed to lose it.
Today, the scenario above is very unlikely. However, I still hear stories how people store the source code in folders with suffixes _1, _2, _3 on the network drive. Argh!
Which version control system would you pick? IMO, today Git is the dominant one. However, the way people often use Git (or any other distributed VCS) by avoiding branching and playing with feature flags, they probably would be just fine by using Subversion instead :)
Issue Tracker
An issue tracker is absolutely needed for the team to plan their work, tasks, issues, etc. Now the question is in the implementation. I’ve seen tasks being tracked in MS Excel, text files, sticky notes, and other modern tools like Jira, Mingle, PivotalTracker, YouTrack, ForBugz, Bugzilla, Mantis, Trello… the list is infinite!
The thing with issue trackers is that they should support the approach you take for running the project. For a product company there are quite a few reasons to track issues. First, obviously, you need to track your work, i.e. tasks. From the project management perspective, it’s nice to have the ability to track the tasks, i.e. have the project management facilities in the task tracker. Lots of teams are happy to have it all in one so it’s easier to get an overview of the progress, especially if the tool provides Kanban style boards.
Second, good products usually have users who are eager to submit questions or bug reports. For that, most of the teams are using some kind of helpdesk software. HelpScout was the one I have used at ZeroTurnaround and can recommend. Plus, some teams make use of forum software that also serves as a channel for communication. Also, some teams expose a public issue tracker so that the users would directly submit issues there.
The above means that the issue tracker you choose is better have the required integrations available if that’s a requirement.
Continuous Integration
You write code in the editor, you test the code on your machine, you push it to Git. Someone pulls the code down, tries to run it, and it doesn’t work. Sounds familiar? Yeah, reminds me the famous “Works on my machine” excuse. Automation is absolutely required for a healthy software project. Automated builds, automated tests, automated code style checks, etc.
Previously at ZeroTurnaround, I’ve seen that the CI server was a very critical piece of project infrastructure. If a source control system want offline, it wasn’t an end of the world to them. But if the build server was down, for many developers the work pretty much stalled. Now at JetBrains, I also see that their own product, TeamCity, is a very important service internally, with many teams relying on it. Dogfooding at its best!
Continuous integration was brought to the masses by eXtrame Programming practices. Today, CI is absolutely essential to any healthy software project. Years ago it all started with automating the test execution, building the artifacts, and providing the feedback quickly. Remember CruiseControl? Or Hudson, when it appeared? CI servers have been evolving the in the past years as the notion of Continuous Delivery appeared. Better visualisation of the process is required to cope with growing complexity. Also scaling the CI server has become an important aspect of the process.
With the latest trends in CI, the build servers are eagerly implementing the notion of build pipelines (build chains in TeamCity) which provide a good overview of the process. And also the trend of 2018, I think, is running the CI tasks in a Kubernetes cluster.
Artifact repository
The build server produces the artifacts. Plenty of them. Either the artifact is a final software package, or a reusable component, or a test execution report, etc. Where would you store those artifacts with all the metadata associated with it? Today, there isn’t much choice, actually.
JFrog’s Artifactory is the dominant solution for storing binaries and managing them. Plus, the final artifacts could be promoted directly to Bintray for distribution. Sonatype’s Nexus was originally the go to solution for Java/Maven projects and added support for some other technologies as well in the recent years. Apache Archiva and ProGet are the other options but that’s pretty much it.
The security aspect of software development becoming more and more critical. I think, automated security checks will become an absolute requirement for any software as well. The trend that has been ongoing for years now and binary repositories, such as Artifactory and Nexus, are actually integrating with the services that provide such vulnerability checks. So, don’t be that guy, use the binary repository!
Summary
I have listed 4 categories of tools that I think are essential to any software project:
- an editor,
- a version control system,
- CI server,
- and an artifact repository
Saturday, January 6, 2018
Setting up JRebel for WebSphere AS in Docker environment
WebSphere Application Server is available for Linux and Windows platforms, but not for MacOS. The good news is that there is a WebSphere Docker image that you can use for development.
The developerWorks' article demonstrates it pretty clearly, what needs to be done in order to get WebSphere running in Docker and deploy a web application. With the help of the article I have assembled a demo project that deploys a Petclinic application on WebSphere running with JRebel in Docker container.
Let me explain some interesting bits of the outcome.
First of all, we need to derive from the base image, package the application archive into the new image, and make sure that WebSphere will deploy the application when it starts:
#Dockerfile
FROM ibmcom/websphere-traditional:profile
COPY target/petclinic.war /tmp/petclinic.war
RUN wsadmin.sh -lang jython -conntype NONE -c "AdminApp.install('/tmp/petclinic.war', \
'[ -appname petclinic -contextroot /petclinic -MapWebModToVH \
[[ petclinic petclinic.war,WEB-INF/web.xml default_host]]]')"
As you’ve noticed, it is not enough just to copy the application archive to some folder. You also need to invoke a script to actually deploy the application: call wsadmin.sh by providing it a snippet of Jython code.
Next, as we want to enable JRebel, we also need to package the agent binary into the image, and also we need to modify JVM arguments of the application server. Hence, the corresponding Dockerfile will get a little more complicated:
#Dockerfile
FROM ibmcom/websphere-traditional:profile
COPY ["jrebel-7.1.2","/tmp/jrebel"]
RUN wsadmin.sh -lang jython -conntype NONE -c "AdminConfig.modify(AdminConfig.list('JavaVirtualMachine', \
AdminConfig.list('Server')), [['genericJvmArguments', \
'-Xshareclasses:none -agentpath:/tmp/jrebel/lib/libjrebel64.so']])"
COPY target/petclinic.war /tmp/petclinic.war
RUN wsadmin.sh -lang jython -conntype NONE -c "AdminApp.install('/tmp/petclinic.war', \
'[ -appname petclinic -contextroot /petclinic -MapWebModToVH \
[[ petclinic petclinic.war,WEB-INF/web.xml default_host]]]')"
The Dockerfile above packages JRebel distribution into the image. That’s an easy part. The hard part was to figure out how to configure JVM arguments. In WebSphere, JVM arguments are set via server.xml configuration which is quite unusual. Normally, a developer would use an administrative user interface to modify the parameters, but in our case we need the arguments to be in the right place right at the start. Hence we need to do some Jython scripting via wsadmin again.
Now that the Dockerfile is ready, we can build and run the new image. In the terminal:
$ docker build -t waspet . $ docker run -d -p 9043:9043 -p 9443:9443 -v `pwd`:/tmp/petclinic -v ~/.jrebel:/home/was/.jrebel waspet
The docker run command above also maps a few directories: a project folder and JRebel’s home folder. We map the project folder because JRebel agent could then see if any resource is updated. JRebel’s home folder (~/.jrebel) includes cached resources, so that if we would have to restart the Docker image then the application will start faster the next time.
Now it is possible to use JRebel to update the application instantly, without restarting the application server or redeploying the application. For the full list of instructions, see the README.md file in GitHub repository.
Monday, August 7, 2017
XRebel for standalone apps with embedded Jetty
Sometimes however, you might want to use XRebel with a standalone Java process that is not using Servlet API. Hence, XRebel cannot display its embedded UI to render the data it collected from the application. What can we do about this? Well, XRebel is tested on Jetty and it works quite well there. Jetty is also often used as an embedded HTTP server. So why don’t we use this trick and embed Jetty into our standalone app to serve XRebel UI.
Here’s our example application:
Just for the demonstration purposes, it executes an HTTP request every 3 seconds and reads the response. Quick and dirty.
To embed Jetty server we need is to add a dependency to Jetty container and initialize the server when the application starts. The required dependencies are jetty-server and jetty-servlet:
Then we can start Jetty by adding the following code snippet into the static initializer of the class:
To enable XRebel agent, you need to start the application with -javaagent VM argument pointing to the location of xrebel.jar. For instance:
-javaagent:/Users/anton/tools/xrebel/xrebel.jar -Dxrebel.traces.all=true
I also added -Dxrebel.traces.all=true VM property to enable tracing of non-HTTP activities by XRebel. Tracing of non-HTTP activities in XRebel is disabled by default, hence I need to add this parameter in order to see profiling data for the periodic tasks (if I wish).
Once I launch the application, it will boot up the embedded Jetty instance on port 8080. The standalone XRebel UI is deployed by the agent to /xrebel context. Hence, if we open http://localhost:8080/xrebel in the browser we will see the following:
As you can see, it is quite easy to use XRebel with the standalone apps with this little trick. Just start an embedded Jetty instance on some port and you will be able to see what is your application doing. Perhaps, you can spot a sneaky bug with it before it gets to production! :)
If you want to play with the example application, I have it at GitHub. Download XRebel and start the application with the appropriate VM arguments to enable the agent. It will be fun! :)
Thursday, June 1, 2017
Conferences I have visited in May'17
Riga DevDays
Riga DevDays - a perfect conference of an Estonian to visit: not too far away (45 minutes flight), nice city, very good event!
There, I have presented a talk about Java class reloading, which covers the different options for reloading Java classes and explains the fundamental differences of those.
GeeCON, Krakow
I have presented at GeeCON before. The vibe of the event is quite energising! :) I have presented a talk about TestContainers which seemed to spark a lot of the interest from the attendees. Almost a full room and a lot of questions after the talk. Looks like integration testing is in demand these days!
JUG.ua & JEEConf, Kiev
The visit to Kiev (Kyiv) was super-productive. I've visited EMAP offices of the on-site presentation as well as a local JUG meetup just before the conference. Very good attendance: 100+ people came to the meetup. Interestingly enough, in Ukraine (as well as in Russia) people ask questions in an interesting way: they usually start the question with "What if ...". They are always curious to find the limitations of the technology, the approach, the method, etc - almost like trying to break things. I think this critical mindset is very helpful when you have to develop software these days.
At the JEEConf I have presented 3 talks: 2 on my own, and 1 with Anton Keks, helping to deliver the Kotlin Puzzlers talk. This was a very well organized conference: super-nice view in the center of Kiev, well crafted schedule with the interesting and useful talks, good athmosphere... I recommend :)
I had a pleasure to deliver a live coding session about Javassist, though I still have the slides just as a reference for those who attended the session. I don't find this talk to be very useful for the developers, however, attendees still find it interesting, so I'm puzzled with this a bit :) Here are the slides:
As for the Java class reloading talk, I had some time to update the content since Riga DevDays -- removed boring parts and added a few other things. Lots of "What if.." questions after the talk -- I love this crowd! :)
Sunday, January 22, 2017
Twitterfeed #4
News, announces and releases
Atlassian aquired Trello. OMG! I mean... happy for Trello founders. I just hope that the product would remain as good as it was.
Docker 1.13 was released. Using compose-files to deploy swarm mode services is really cool! The new monitoring and build improvements are handy. Also Docker is now AWS and Azure-ready, which is awesome!
Kotlin 1.1 beta was published with a number of interesting new features. I have mixed feelings, however. For instance, I really find type aliases an awesome feature, but the definition keyword, "typealias", feels too verbose. Just "alias" would have been much nicer.
Meanwhile, Kotlin support was announced for Spring 5. I think this is great - Kotlin suppot in the major frameworks will definitely help the adoption.
Is there anyone using Eclipse? [trollface] Buildship 2.0 for Eclipse is available, go grab it! :)
Resonating articles
RethinkDB: Why we failed. Probably the best post-mortem that I have ever read. You will notice a strange kvetch at first about the tough market and how noone wants to pay. But then reading forward the author honestly lists what was really wrong. Sad that it didn't take off, it was a great project.
The Dark Path - probably the most contradicting blog post I've read recently. Robert Martin takes his word on Swift and Kotlin. A lot of people, the proponents of strong typing, reacted to this blog post immediately. "Types are tests!", they said. However, I felt like Uncle Bob just wrote this articles to repeat his point about tests: "it doesn't matter if your programming language strongly typed or not, you should write tests". No one would disagree with this statement, I believe. However, the followup article was just strange: "I consider the static typing of Swift and Kotlin to have swung too far in the statically type-checked direction." OMG, really!? Did Robert see Scala or Haskell? Or Idris? IMO, Swift and Kotlin hit the sweet spot in regards to type system that would actually _help_ the developers without getting in the way. Quite a disappointing read, I have to say..
Java 9
JDK 9 is feature complete. Those are great news. Now, it would be nice to see how will the ecosystem survive with all the issues related to reflective access. Workarounds exist, but there should be a proper solution without such hacks. Jigsaw caused a lot of concerns here and there but the bet is that in the long run, the benefits will outweigh the inconveniences.
Misc
The JVM is not that heavy
15 tricks for every web dev
Synchronized decorators
Code review as a gateway
How to build a minimal JVM container with Docker and Alpine Linux
Lagom, the monolith killer
Reactive Streams and the weird case of backpressure
Closures don’t mean mutability.
How do I keep my git fork up to date?
Predictions for 2017
Since it is the beginning of 2017, it is trendy to make predictions for the trends of the upcoming year. Here are some prediction by the industry thought leaders:
Adam Bien’s 2017 predictions
Simon Ritter’s 2017 predictions
Ted Neward’s 2017 predictions
Wednesday, December 28, 2016
Twitterfeed #3
Let's start with something more fundamental than just the news about frameworks and programming languages. "A tale of four memory caches" is a nice explanation of how browser caching works. Awesome read, nice visuals, useful takeaways. Go read it!
Machine Learning seems is becoming more and more popular. So here's a nicely structured knowledge-base at your convenience: "Top-down learning path: Machine Learning for Software Engineers".
Next, let's see what's new about all the reactive buzz. The trend is highly popular so I've collected a few links to the blog posts about RxJava and related.
First, "RxJava for easy concurrency and backpressure" is my own writeup about the beauty of the RxJava for a complex problem like backpressure combined with concurrent task scheduling.
Dávid Karnok published benchmark results for the different reactive libraries.
"Refactoring to Reactive - Anatomy of a JDBC migration" explains how reactive approach can be introduced incrementally into the legacy applications.
The reactive approach is also suitable for the Internet of Things area. So here's the article about Vert.x being used for IoT world.
IoT is actually not only about the devices but also about the cloud. Arun Gupta published a nice write up about using the AWS IoT Button with AWS Lambda and Couchbase. Looks pretty cool!
Now onto the news related to my favourite programming tool, IntelliJ IDEA!
IntelliJ IDEA 2017.1 EAP has started! Nice, but I'm not amused. Who needs those emojis anyway?! I hope IDEA developers will find something more useful in the bug tracker to fix and improve.
Andrey Cheptsov experiments with code folding in IntelliJ IDEA. The Advanced Expressions Folding plugin is available for download - give it a try!
Claus Ibsen announced that the work has started on Apache Camel IntelliJ plugin.
Since we are at the news about IntelliJ IDEA, I think it makes sense to see what's up with Kotlin as well. Kotlin 1.0.6 has been released, which is the new bugfix and tooling update. Seems like Kotlin is getting more popularity and people try to use it in conjunction with popular frameworks like Spring Boot and Vaadin.
Looks like too many links already so I'll stop here. I should start posting those more often :)
Monday, December 5, 2016
Twitterfeed #2
So this is the second issue of my Twitterfeed, the news that I noticed in Twitter. Much more sophisticated compared to the first post, but still no structure and no definite periodicity.
Articles:
Java Annotated Monthly - December 2016. Nice collection of articles about Java 9, Java 8, libraries and frameworks, etc. With this, my Twitterfeed is now officially meta! 😃
RebelLabs published Java Generics cheat sheet. Print it out and put at the wall in your office!
Server side rendering with Spring and React. Interesting approach to UI rendering with React. Some parts of the UI are rendered at the server side, and some data is then rendered at the client side.
One year as a Developer Advocate. Vlad Mihalcea reflects on his achievements from the first year in the role of a Developer Advocate for Hibernate. Well done!
IDEA 2016.2 Icon Pack. IDEA 2016.3 update came with the new icons and some people don’t really like those. There is now a plugin to replace the new icons with the old icons. Enjoy!
Oh, and talking about IntelliJ IDEA, there is another great blog post related to 2016.3 release. Alasdair Nottingham writes about Liberty loos applications support in IDEA: Faster application development with IntelliJ IDEA 2016.3
Reactive programming vs Reactive systems. Jonas Boner and Viktor Klang make it clear, what is the difference between the two. "Messages have a clear (single) destination, while events are facts for others to observe".
Good Programmers Write Bug-Free Code, Don’t They? Yegor Bugayenko has a good point about the relation of good programming to a bug-free code.
Cyclops Java by Example: N-Queens. A coding kata for N-Queens problem using "cyclop's for-comprehensions".
Zero downtime deployment with the database. The name says it all.
RxJava 2.0 interview with David Karnok about the major release. Here comes support for Reactive Streams specification!
Reactor by Example. Reactor is very similar to RxJava, but it is also in the core of Spring Framework’s 5.0 reactive programming model.
An explanation of the different types of performance testing. I think this is quite important to make the difference.
Videos:
Spec-ulation by Rich Hickey. As usual, must watch!
Microservices evolution: how to break your monolithic database. Microservices are becoming mainstream, it seems. So we need best practices for building microservices based systems.
Tuesday, November 22, 2016
Twitterfeed #1
Twitterfeed is the collection of news that I find via Twitter. I have no particular system or a method on how do I pick the news. Neither do I have a predefined period for grouping the news. It is neither daily or weekly or monthly - it is all just random. Enjoy! :)
Java 10 is now officially a project
IntelliJ IDEA 2016.3, my favourite IDE, was released!!! Yay!
CLion 2016.3, a IDE for C/C++ development was released
Rider, a new IDE for .NET is now publicly available via EAP
Akka 2.4.14 was released
Ceylon 1.3.1 was released
Fedora 25 was released
Heinz Kabutz teaches how to implement our own ArrayList in less than 10 minutes
Martin Kleppmann talks about conflict resolution for eventual consistency
Yegor Bugayenko rants about software architects
Roland Kuhn writes about understanding distribution
Wednesday, May 18, 2016
Hello World with JBoss Modules
JBoss Modules is quite an interesting project that powers JBoss application server and some other projects in JBoss ecosystem. However, I was surprised to find out that there isn't much you can find about Modules on the webs. Documentation is...
I was looking for the simplest "Hello World" example and couldn't find it. Well, why not create one myself then?
Downloading JBoss Modules
A surprising fact is that you won't find JBoss Modules in the list of upstream projects at jboss.org. The first option is to download the jboss-modules.jar from Bintray or Maven Central. And the second option is to build it from sources.Oh, ok, one more option (not the best one) is to download the application server that includes jboss-modules.jar, e.g. WildFly.
Hello World
A version slot identifier is an arbitrary string; thus one can use just about any system they wish for organization. If not otherwise specified, the version slot identifier defaults to "main".
Friday, February 12, 2016
HotSwap vs hot deploy
UPD: You can also read about various solutions to the redeployment problem in my Stackoverflow answer.
HotSwap and Hot deploy is not the same thing!
What is HotSwap?
What is hot deploy?
Summary
Make sure you use the terms correctly -- 'HotSwap' and 'hot deploy' is not the same thing! You may other terms, like 'hot update' -- then make sure to ask, what does the person actually means by this, because the devil is in the details.Thursday, December 10, 2015
Another great Java interview question: Singleton
I'm not a big fan to ask to write code at the interviews. But I still find it useful to do some coding exercises at the whiteboard. One of my favourites is the Singleton pattern. Because Singleton is so simple, you can use it as a starter for so many interesting discussions.
it often comes down to the discussions about the Singleton being lazy or eager. And while it leads to the discussion about Java Memory Model, it's not the most interesting one. No one understands Java Memory Model anyway :)
BTW, did you know that a single-element enum type is the best way to implement a Singleton?
Yes! And you can't imagine how many people do fail with this. If you deploy 2 web applications with the same Singleton class, will there be two instances of the same Singleton or one? Of course, there isn't one true answer for this question - you have to ask the details. The the answer depends much on how the class is loaded. If the class is packaged within the WARs, then you get 2 instances of the Singleton.
This is why Singleton is such a great interview question - it opens a lot of topics for further discussion!
Saturday, November 21, 2015
final/finally/finalize
I have been interviewing candidates for Java developer jobs for a full decade at this point. I have tried various approaches for the interviews: various tests about language and the APIs, whiteboard programming, bug hunting, homework assessments, etc. There is no best approach for the interviews - it merely depends on the expectations, candidate background, position, day of the week, weather, whatever else.
Despite all the details, I’ve found one interview question that works like a charm. It is almost the best question to start with. And it is quite efficient in filtering the candidates early enough if have to screen a lot of candidates.
Here’ it is:
What is the different between final, finally & finalize?
How is this even a question, you would ask? Asking about the difference of the things that cannot be compared!? Well, apparently, a lot of developers can't make a clear difference. Those who don’t - you just don’t have to interview them further :)
OK, you asked this and candidate answered this brilliantly, now what? Well, I did tell you that it is a very good question to start with, didn’t I? Next, you can take it to any direction of your choice:
- final - you may take the discussion to Reflection API, for instance. Or you can discuss how the final keyword helps with concurrent programming in Java.
- finally - talk more about the exceptions in Java and discuss some puzzles. Like the one below. What does it print?
- finalize - the discussion about finalize() method is only useful to validate the nerd level of the candidate. Usually you’d check why one shouldn't use finalize() in first place. Maybe some rare candidate can tell about legitimate uses of finalize(). This most likely shows that he or she remembers what is written in Item 7 from Effective Java.
I hope you get my point now, why this strange question is a very good one for the Java interviews. Have fun!
Thursday, July 23, 2015
I will be speaking at JavaOne 2015
I'll be speaking at JavaOne this year again! This time I have 2 talks accepted:
CON3597 - Having Fun with Javassist. This is merely a live coding session where I demonstrate various uses of the Javassist library for Java bytecode manipulation. I've delivered this talk multiple times and every time it is different as it turns out quite interactive and attendees usually ask questions right in the middle of the talk so I have to adjust the content as I go. Usually it's quite fun, so I enjoy presenting this talk.
CON6699 - What's the Best IDE for Java EE? I'm not sure how this one turns out - it's so much to talk about and so little time. I'll be presenting this talk along with Max Rydahl Andersen and Adam Bien. This time we're focusing solely on Java EE. Basically - it's and overview of what's available for Java EE users in Eclipse, NetBeans IDE, and IntelliJ IDEA.
Both the talks can be found in the content catalogue for JavaOne.
Friday, July 10, 2015
GeekOut 2015: CompletableFuture
The talk by Tomasz Nurkiewicz about CompletableFuture was rated the highest at GeekOut this year. This is really interesting API that appeared in Java 8
A Future that may be explicitly completed (setting its value and status), and may be used as a CompletionStage, supporting dependent functions and actions that trigger upon its completion.
Tomasz Nurkiewicz - CompletableFuture in Java 8, asynchronous processing done right. from Official ZeroTurnaround Account on Vimeo.
Some time ago Tomasz published a really nice series of articles at his blog - worth reading!
Java 8: Definitive guide to CompletableFutureJava 8: CompletableFuture in action
And there's more!
Thursday, July 9, 2015
GeekOut 2015 recordings are available
All the videos from GeekOut 2015 are available: http://2015.geekout.ee/videos/
Here are the two talks that seemed the most interesting to me:
Martin Thompson - Practicing at the Cutting Edge from Official ZeroTurnaround Account on Vimeo.
Nitsan Wakart - Lock Free Queues from Official ZeroTurnaround Account on Vimeo.
Wednesday, April 8, 2015
XRebel 2.0 with Application Profiling
From the very start, our users requested profiler capabilities in XRebel. As of 2.0, it is possible to get the performance overview for every request and identify the slowest methods.
The profiler view shows the time distribution in the call tree by assigning the percentages to the individual nodes that represent method invocations. The slowest methods are also accompanied with an extra percentage figure that indicates the method own contribution time.
JSP tag mapping is one neat little feature, new in XRebel 2.0. Instead of a cryptic runtime name XRebel displays the real JSP tag.
In 2.0, there are some more notable improvements to the existing features. The session component is now able to handle very large HTTP session snapshots. And of course, there's a ton of little UI improvements -- all to make the profiler more pleasant to use.
Links for XRebel:
Sunday, April 5, 2015
Grails 3 Released. Setting up -javaagent
Grails 3 was released just recently and with all the new stuff it looks really-really-really awesome release! (Really hope that Grails will find the new home now). The two key changes for me are 1) moving to Gradle instead of Gant, and 2) building on top of Spring Boot. NOw it looks like it's basically the Gradle project with custom conventions that are derived from Grails 2.x.
For the first time, it feels like Grails is not a toy framework any more :)
What's not that cool (my own very subjective opinion), is the introduction of application.yml. It's almost impossible to modify it without reading the documentation. Even XML version of it (yes!) would have been more practical.
There are many other nice things added - go look for yourself.
Setting up a -javaagent argument for Grails 3
My personal interest with any new framework or server is usually related to the projects I'm working with. Thus, the first thing I wanted to check is how could I set up a -javaagent for Grails 3 application. Turns out, it's not as simple as you would expect.
Thanks to @bsideup, here's the snippet that you'd have to add to build.gradle file to setup a -javaagent argument, given that the agent JAR is located somewhere in file system:
In the example above, xrebel.jar is the agent package that is located somewhere in my file system. One can use the absolute path just fine in there.
Here's the another snippet, with DSL-style:
With this, I can confirm, that XRebel works with Grails 3 :)
Tuesday, March 24, 2015
IntelliJ IDEA 14.1 - Distraction Free Mode
IntelliJ IDEA 14.1 was released just recently with a good set of new features and improvements. Among other things, one really interesting feature that appeals to me is the new "distraction free mode".
Essentially, entering the distraction free mode means that you'd hide away everything but the editor.
The seasoned IntelliJ IDEA user would now ask, how is it different from "presentation mode" that is already available, or the full screen mode?
it would be helpful if @intellijidea explained the exact differences between 'presenation', 'distraction-free' and 'full screen' modes
— Prashant Deva (@pdeva) March 24, 2015
This is a very good question! Let's try to answer that! :)
Presentation mode
Presentation mode is designed essentially for delivering presentations. Some of my friends have adopted the presentation mode for actual coding. But to be honest, it only works fine if you have a reasonably large screen and you're not switching between windows while coding. This is how the whole screen looks like when IntelliJ IDEA is in presentation mode:
The default font size in presentation mode is much larger and can be configured in Settings -> Appearance & Behavior -> Appearance. Locate the setting at the bottom of the view:
Full screen mode
Entering the full screen means exactly that. IDE window will span the full screen area. On Mac OS X it also means that it will take the application window to another desktop, which I actually dislike very much, but it's rather a personal preference. In this mode, nothing is changed in the IDE window - all the toolbars, views, etc are preserved.
Notice all the control elements and widgets at the screenshot above?
Distraction free mode
"Distraction free mode" is actually just a fancy name that the marketers came up with :) In fact, it just means that by entering this mode you only keep the editor. This might sound like you're actually entering the presentation mode, it's an incorrect conclusion. In distraction free mode the IDE window doesn't expand to full screen and the fonts are preserved in the original configuration. Basically, we could call this mode as "Hide all toolbars" and it would probably confuse some users less.
At the screenshot above, you can see - it's only the editor that occupies the IDE window. No toolbars, no status bar, no additional views, nothing! So this is exactly what I wanted and I'm really pleased with the new feature! In addition, the text is center-aligned!
What's also cool is that in this mode I can still navigate the same way as I'm used to it in the normal mode. Navigate to the project tree:
... or call out the navigation bar:
Just have to learn the shortcuts ;)
P.S. The new distraction free mode is really cool. However, it is not quite new. In fact, all this was possible long before version 14.1. Even in earlier versions of IntelliJ IDEA you can achieve the same, just not with one mouse click or shortcut press. In the earlier Intellij IDEA versions, in the View menu, you could just hide the toobar, tool buttons, status bar and navigation bar and here you go - you have a "distraction free mode"! :) So the new feature isn't really new. It is rather just a convenience that was added on top of the existing features.
Tuesday, March 10, 2015
Packaging Java applications for Mac OS, javapackager
java -jar mucommander.jar
Launching a GUI app from the command line is not convenient at all. One option is to assemble the *.app package using Launch4j. However, I didn't have enough patience to do apply the tool. So I tried looking for an alternative solution.
So I found this guide: Packaging a Java App for Distribution on a Mac. And the instructions worked just fine! Here's what I did:
1. Downloaded the appbundler utility from https://java.net/downloads/appbundler/
2. Create a build.xml file. For instance:
3. Run "bundle" task: ant bundle
Profit! :)
This is all cool and works, but the process is a bit clumsy. One has to download some strange utility and use a legacy build tool to assemble the final artifact. We should do better! So I found another documentation page: Java Platform, Standard Edition Deployment Guide: Self-Contained Application Packaging. Apparently, there's a javapackager utility included in JDK distribution that you can use to create native packages.
By running the following command in the same folder where mucommander.jar is located, it created the desired artefacts:
$JAVA_HOME/bin/javapackager -deploy -native -outdir . -outfile mu.app \
-srcfiles mucommander.jar -appclass com.mucommander.Launcher -name "muCommander" \
-title "muCommander"Voila!
muCommander-0_9_0 anton$ ls -l bundles/ total 269904 -rw-r--r--@ 1 anton staff 75110066 Mar 10 23:53 muCommander-1.0.dmg -rw-r--r-- 1 anton staff 63076596 Mar 10 23:53 muCommander-1.0.pkg drwxr-xr-x 3 anton staff 102 Mar 10 23:53 muCommander.appThe only missing bit there is a proper icon, which I was too lazy to bother about :)















