skip to navigation
skip to content

Planet Jython

Last update: December 19, 2014 07:37 AM

December 10, 2014


Josh Juneau

Honored to be Part of the NetBeans Dream Team


I have recently been honored via invitation to join the NetBeans Dream Team.  I've been using NetBeans IDE since its infancy, and I've watched it evolve into one of the top IDEs for developing Java applications, amongst other things.  I am honored and privileged to have the opportunity to help promote NetBeans, and collaborate with the other NetBeans Dream Team experts to help make the NetBeans IDE even better.

There were 16 new members that were invited to join, and Geertjan Wielenga has written a post about the new members here:  http://netbeans.dzone.com/articles/16-new-netbeans-dream-team.   I want to thank all of the members for having me as a NetBeans Dream Team member...I am looking forward to working with you.

To kick off my membership to the NetBeans Dream Team, I wanted to write a post that promoted some of my favorite, but perhaps most overlooked NetBeans features.  I will list three such features in this post, as I must keep my writings short...and I could go on writing about my favorite features for quite some time.  All that said...here are my favorite NetBeans IDE features that are oftentimes overlooked:

#1:  Built-in Terminal:  Did you know that NetBeans has a built in terminal at your disposal?  Sure, it is acceptable to have a terminal window or command line open outside of NetBeans, but maintaining one or more of them inside of the IDE makes it even easier to focus on your tasks at hand...without the need to move outside of the IDE.  (Speaking of which, did you know there is a task list in NetBeans...sorry, I digress).  The NetBeans built-in terminal provides you with the ability to open one or more terminal sessions right within the IDE, and you can even open up an SSH connection to a remote server.  This provides a unified development environment at its best!  To open up a terminal, simply go to the "Window" menu, then select "IDE Tools" -> "Terminal".



#2:  Version Control Made Easy:  No matter which version control you use, NetBeans makes it simple, providing convenient integration points for version control with your NetBeans projects.  I've used Mercurial, Subversion, and Git within NetBeans, and each of them is easy to use...with an intuitive interface, and even some additional plugins to make use easier.  One of my favorite plugins is the Git Toolbar, which provides easy buttons for showing history, committing changes, etc.

#3:  Debugger:  When I am having an issue with one of my applications, the NetBeans debugger can be an invaluable utility.  Perhaps my favorite feature of the NetBeans debugger is the ability to see the values of variables as the application is running.  


The debugger provides the ability to set breakpoints (conditional if you'd like), so that one can evaluate the current status of the code when breakpoints are reached.  If you are having an issue in one of your classes, the debugger allows you to see the current variable values, and step through the code to find the offending line.  It also provides you with numerous other capabilities, such as the ability to set expression watches, easily see the call stack, the ability to see which classes are currently loaded, sessions, current threads, and more.  The debugger has become one of those features that I cannot live without, and it deserves a book of its own.

That does it for this short post.  Once again, I want to thank Geertjan and all of the members of the NetBeans Dream Team for having me...I am very glad to be a part of the team!





December 10, 2014 06:38 AM

November 28, 2014


Josh Juneau

Book Review: RESTful Java Patterns and Best Practices

I had the privilege to review the book RESTful Java Patterns and Best Practices, authored by Bhakti Mehta for Packt Publishing.  In short, this book hits the sweet spot when it comes to learning utilization of RESTful web services.  As the book provides a solid foundation for the creation, testing, and utilization of RESTful web services with JAX-RS 2.0, it also provides information on essential topics, such as authentication, security, and performance.  There is even coverage of advanced topics, such as rate-limiting, polling, and micro services.  




The book begins by providing a general understanding RESTful web services, design principals, and the differences between the various HTTP verbs.  This discussion is provided at a high level, such that it is generalized enough to cover various RESTful web service implementations.  The first chapter then goes into the Java API for RESTful Web Services.  This section of the first chapter is brief, and to the point.  It clearly explains how to create services and then test/access them via the Client API, cURL, and other utilities.  As mentioned at the top of this post, Chapter 1 provides a solid foundation...and it is a quick read also, which enables developers to get up and running quickly with the JAX-RS API.

Chapter 2 covers fundamentals, such as returning various content types (JSON, XML, etc.), and designing meaningful URL patterns to obtain the desired media type.  This chapter delves into streaming and chunked content, parsing JSON, and versioning support.  Chapter 2 builds upon Chapter 1 very nicely, further explaining the fundamental concepts of RESTful services.

The third chapter covers security, validation, and logging of RESTful web services.  This is a chapter for intermediate users, as it goes beyond the basics and covers the use of filters for logging, and constraint annotations for validation.  It then provides a brief example of building an exception class.  Lastly, this chapter goes into authentication practices using SAML (Security Assertion Markup Language), OAuth, and tokens.  While this chapter sets a good stage for discussing the various types of authentication, it does not go into detail on these topics.

Chapter 4 covers performance via caching, asynchronous and long-running jobs, and partial updates.  The chapter clearly explains how to utilize the Cache-Control header and ETags.  It then explains how to design asynchronous web services, and some best practices.  The last topic in the chapter is partial updates...a topic that is briefly explained, but leaves room for further exploration.

The next chapter goes into advanced topics for RESTful web services...including rate-limiting, response pagination, internationalization and localization, and pluggability and extensibility.  I really liked the way that this chapter covered rate-limiting in detail, and explained why this is an important topic.  It then provides a detailed explanation for response pagination, along with a good example.  The internationalization and localization section is brief, but provides a good enough explanation for getting started with internationalization.  Lastly, the chapter provides a brief overview HATEOAS (Hypermedia as the Engine of Application State), testing, and extensibility.

The final chapter does a good job of wrapping up the many topics of RESTful web services, discussing the future of REST and emerging standards.  It is a chapter that explains polling and the importance of providing real-time APIs for avoiding inefficiencies.  Along the way, it touches upon various topics, such as WebHooks, SSEs (Server Sent Events), and WebSockets, and how they relate to RESTful services.

The book contains a helpful Appendix which covers various APIs from GitHub, Facebook, and Twitter.  It is a nice closeout to the book, providing an overview of how to glean information from these important social media networks.

Overall, this book is a great read for getting started with RESTful web service creation and utilization with JAX-RS.  I enjoyed the fact that the book was authored by Bhakti, who is very experienced with the topic, as she is a founding member of the GlassFish Application Server.  I recommend this read for anyone who wants to get up and running quickly with REST, and also learn about various other RESTful concepts along the way.  While this book does not delve into fine-grained details of topics such as authentication and partial updates, it provides a good foundation for learning more on such topics.  Readers will go away from this book with a solid understanding of how to develop RESTful web services, and they will be able to start developing services after reading through the book.  Those who wish to delve into more advanced topics will be provided with a good overview after reading this book, and they'll be pointed into the right direction for learning more on such topics.

November 28, 2014 11:11 AM

November 23, 2014


Josh Juneau

NetBeans Tip: Working with JPQL

Have you heard of the NetBeans JPQL tool?  This is an often overlooked feature of NetBeans IDE that can save developers a lot of time.

If you are a Java EE developer, then you've likely encountered moments when you would like to see the results of a Java Persistence Query Language (JPQL) query before you've written your session bean method.  Being that I come from a database administrator background, I am oftentimes finding myself at the SQL command-line (or NetBeans SQL Editor) writing queries, and then translating the SQL into JPQL.  NetBeans IDE contains a JPQL tool (since NetBeans 7.3), which makes it easy to write JPQL queries and retrieve results immediately.  Let's see how:

The JPQL tool can be invoked within the context of a NetBeans project.  The project must have a valid Persistence Context, meaning that it is wired up for database access.  Once this is in-place, simply right click on the persistence.xml file, and click on the "Run JPQL Query" to open the tool.





















The tool provides a nice editor that provides a top pane for entering a query, and a bottom pane for showing the SQL or the results of the query execution.  If you have more than one Persistence Context within your persistence.xml, then you will have the option to select which context you would like to utilize for the query.












To execute the JPQL, simply click on the button next to the Persistence Context pull-down, or right click in the query editor and choose "Run JPQL".

The tool comes in super handy when you are executing queries that involve more than one entity.













Another handy reference for the tool, Geertjan's blog post:
https://blogs.oracle.com/geertjan/entry/test_jpql_with_netbeans_ide

Note:  Be sure to "Build" your project successfully before trying to use the JPQL tool.  If you do not have a successful build, you will likely encounter an error stating that the abstract schema type cannot be found:

November 23, 2014 09:02 AM

November 21, 2014


James Abley

VelocityConf EU 2014 – Day 1

TLDR; Velocity is a great conference for web and operations people, and why didn't you go already?

Is TLS Fast Yet?

This was a talk by Ilya Grigorik full of practical, actionable things that you can do to serve your site over TLS, and make it fast.

My notes on Ilya's talk.

Monitoring: The Math Behind Bad Behavior

Theo Schlossnagle gave an excellent talk (which didn't involve much maths) about the problems that Circonus see with handling massive amounts of data, and reliably detecting anomalies. I found this quite hard to take notes, and it wasn't as practical in my context as the first talk, but still really interesting.

My notes on Theo's talk.

Design Reviews for Operations

Mandi Walls of Chef showed us how operations should be involved early on. She did a great job of emphasising the importance of having the right people having the right conversations at the right time.

I felt a little over-qualified for this talk, given that I've worked with Gareth Rushgrove for most of the last 3 years, and helped write some of the user stories for operations that GDS published on GOV.UK. Not everyone has had that privilege though!

My notes on Mandi's talk.

What Ops Can Learn From Design

Rob Treat of Omniti brought together The Design of Everyday Things and The Art of UNIX Programming to show how designing with empathy to create intuitive interfaces can be easy to overlook, but can have a massive impact on people using your stuff.

My notes on Rob's talk.

Statistical Learning-based Automatic Anomaly Detection @Twitter

Anomaly Detection seemed to be quite popular this year (see Theo's talk and Baron's proposed talk). Here, Arun Kejariwal talked about the state of the art, how it didn't quite fit for Twitter's usage, and what they did about it. The tools and code should be open-sourced in a few weeks, so people can plug it into their own problems.

My notes on Arun's talk.

Your Place or Mine: A Discussion of Where to Host Your Site

This was an emergency panel convened since the originally planned speaker had something come up. Nice end to the day, talking about cloud and similar issues. Michael did a nice job of not answering someone that seemed to be either aggrieved, or trolling quite hard. He's a proper civil servant.

November 21, 2014 08:58 PM