Thứ Sáu, 28 tháng 3, 2014

How to Begin Learning and Applying LaTeX

I recently started working with LaTeX based on a colleague's recommendation. To be honest, it was a little steeper learning curve installing it and initially learning it than I've become used to when installing and using new software development products and I hope in this post to provide some basic tips to help others who want to investigate this "document preparation system." The main LaTeX project page describes it as "a high-quality typesetting system" that "is designed for the production of technical and scientific documentation."

An introduction to LaTeX helps to understand what LaTeX is at a high-level and is probably the best place to start when trying to determine whether to invest more time in learning LaTeX. This page emphasizes that LaTeX is "not a word processor!" This page provides a simple example to demonstrate a driving principle of LaTex: "LaTeX is based on the idea that it is better to leave document design to document designers, and to let authors get on with writing documents."

Mike Unwalla's LaTeX: an introduction is a single-page PDF that also introduces LaTeX and provides another simple example of LaTeX code with the corresponding output. This article emphasizes how to pronounce LaTeX (it's NOT pronounced like the the rubber product latex that might dominate an initial Google search for this term).

A person interested in LaTeX after reading An introduction to LaTeX and LaTex: an introduction might want to next see the ubiquitous Hello World example so familiar to software developers applied to LaTeX. The best resource for this is the initial tutorial in Andrew Roberts's excellent series Getting to Grips with LaTeX. Tutorial #1 in the Getting to Grips with LaTeX tutorial series is called Absolute Beginners and provides a bare-bones Hello World example in LaTeX.

At this point, the person investigating LaTeX probably wants to try it out. The main LaTeX project page references the Obtaining LaTeX page for information on acquiring LaTeX. My recommendation for LaTeX first-timers is to download the appropriate distribution for their operating system from the top "LaTeX for the impatient" section of this page. In this post, I'll talk more about downloading and installing proTeXt for Windows.

proTeXt can be downloaded from the proTeXt - MiKTeX-based distribution for Windows page. This page states that "proTeXt aims to be an easy-to-install TeX distribution for Windows, based on MiKTeX" (Joseph Wright compares MiKTeX to TEX Live in TEX on Windows: MiKTEX or TEX Live?). The page warns that this file is large (well over 1 GB in size). Once this large download is complete, click on the setup.exe file that appears as part of the download. That will lead to the appropriate extraction of proTeXt into a specified directory. At that point, click on the protext.exe file to install proTeXt. Clicking on (running) protext.exe brings up an installation pop-up that allows you to click buttons to install MiKTeX (version 2.9 currently) and TeXstudio (version 2.5.2 currently). MiKTeX is large and its installation takes a considerable amount of time while the much smaller TeXstudio installs very quickly.

With MiKTeX and TeXstudio installed, we are ready to try a LaTeX example out. To do this, I will run TeXstudio in Windows. The next two screen snapshots show this in two different ways (one from selecting from "All Programs" and one from selecting it after it's been used and is pinned to the Startup Menu).

Once I have started up TeXstudio, I will see something like that shown in the next screen snapshot.

You can click on the icon in the top left corner that looks like a page of paper with a white plus sign inscribed within a green circle to create a new TeX source file. After doing this, pasting code from the Getting to Grips with LaTeX Absolute beginners Hello World example, adapting that example slightly, and saving the file as hello.text, I see the following (with the "About" popup included):

At this point, we have specified the content of our file and now need to convert it to the presentation format of our choice. In this case, I am going to use the downloaded MiKTeX to convert this hello.tex file to a PDF. I do this by opening a DOS command prompt and navigating to the directory where I told TeXstudio to save the hello.tex file (C:\latex\examples in this case). The next screen snapshot shows that file in that location.

At this point, I want to run the MiKTeX tools against this file. I can verify that the MiKTeX installation has placed MiKTeX in my path on Windows by typing echo %PATH% and looking for something like "C:\Program Files\MiKTeX 2.9\miktex\bin\" in the output. That directory has numerous executable (.exe) files including pdflatex.exe which I am going to use her to generate a PDF from hello.tex. This is demonstrated in the next screen snapshots which show the command-line generation process and a snapshot of the resultant PDF.

The next screen snapshot indicates that we now have four files in the directory in which the hello.tex file was the original sole occupant. The new three files are the PDF output file just shown, a text-based log file, and a text-based .aux file.

With the appropriate LaTeX distribution downloaded, a useful LaTeX editor with code completion and color syntax available, and the ability to run the LaTeX distribution executables against generated LaTeX source code, one can now start to experiment with the numerous commands that LaTeX supports. There are numerous listings and "cheat sheets" for these numerous commands, including Scott Pakin's The Comprehensive LaTeX Symbol List, LaTeX Command Summary, and TeX Reference Card. Basic LaTeX Commands has a nice brief introduction to some of the most important LaTeX commands.

One of the best ways to quickly learn LaTeX commands is to apply styling and structure via the graphical TeXstudio tool. The tool has icons for bold, italics, basic math operations, miscellaneous symbols, etc. The next screen snapshot shows an edited file in TeXstudio in which I almost randomly applied LaTeX commands entirely via TeXstudio. The screen snapshot after that shows the PDF generated with pdflatex.exe.

Conclusion

The most difficult aspect of learning LaTeX is dealing with so many options. The numerous options for LaTeX implementations/distributions can make it a bit overwhelming deciding which to download and use. Once that obstacle has been overcome, the large number of commands that LaTeX supports can be a bit daunting. Fortunately, I found that I have been able to start apply LaTeX by following the steps outlined in this blog post.

Additional Resources

Thứ Năm, 27 tháng 3, 2014

Abstract Class Versus Interface in the JDK 8 Era

In The new Java 8 Date and Time API: An interview with Stephen Colebourne, Stephen Colebourne tells Hartmut Schlosser, "I think the most important language change isn't lambdas, but static and default methods on interfaces." Colebourne adds, "The addition of default methods removes many of the reasons to use abstract classes." As I read this, I realized that Colebourne is correct and that many situations in which I currently use abstract classes could be replaced with interfaces with JDK 8 default methods. This is pretty significant in the Java world as the difference between abstract classes and interfaces has been one of the issues that vex new Java developers trying to understand the difference. In many ways, differentiating between the two is even more difficult in JDK 8.

There are numerous examples of online forums and blogs discussing the differences between interfaces and abstract classes in Java. These include, but are not limited to, JavaWorld's Abstract classes vs. interfaces, StackOverflow's When do I have to use interfaces instead of abstract classes?, Difference Between Interface and Abstract Class, 10 Abstract Class and Interface Interview Questions Answers in Java, As useful and informative as these once were, many of them are now outdated and may be part of even more confusion for those new to Java who start their Java experience with JDK 8.

As I was thinking about the remaining differences between Java interfaces and abstract classes in a JDK 8 world, I decided to see what the Java Tutorial had to say on this. The tutorial has been updated to reflect JDK 8 and the Abstract Methods and Classes has a section called "Abstract Classes Compared to Interfaces" that has been updated to incorporate JDK 8. This section points out the similarities and differences of JDK 8 interfaces with abstract classes. The differences it highlights are the accessibility of data members and methods: abstract classes allow non-static and non-final fields and allow methods to be public, private, or protected while interfaces' fields are inherently public, static, and final, and all interface methods are inherently public.

The Java Tutorial goes on to list bullets for when an abstract class should be considered and for when an interface should be considered. Unsurprisingly, these are derived from the previously mentioned differences and have primarily to do with whether you need fields and methods to be private, protected, non-static, or not final (favor abstract class) or whether you need the ability to focus on typing without regard to implementation (favor interface).

Because Java allows a class to implement multiple interfaces but extend only one class, the interface might be considered advantageous when a particular implementation needs to be associated with multiple types. Thanks to the JDK 8's default methods, these interfaces can even provide default behavior for implementations.

A natural question might be, "How does Java handle a class that implements two interfaces, both of which describe a default method with the same signature?" The answer is that this is a compilation error. This is shown in the next screen snapshot which shows NetBeans 8 reporting the error when my class implemented two interfaces that each defined a default method with the same signature [String speak()].

As the screen snapshot above indicates, a compiler error is shown that states, "class ... inherits unrelated defaults for ... from types ... and ..." (where the class name, defaults method name, and two interface names are whatever are specified in the message). Peter Verhas has written a detailed post ("Java 8 default methods: what can and can not do?") looking at some corner cases (gotchas) related to multiply implemented interfaces with default method names with the same signature.

Conclusion

JDK 8 brings arguably the abstract class's greatest advantage over the interface to the interface. The implication of this is that a large number of abstract classes used today can likely be replaced by interfaces with default methods and a large number of future constructs that would have been abstract classes will now instead be interfaces with default methods.

Thứ Tư, 26 tháng 3, 2014

The Illuminating Javadoc of JDK 8

One of the nice features of the standard JDK 8 API documentation is the ability to view all or different categories of methods as discussed in my blog post JDK 8 Javadoc Tweaked For Methods Listings. As convenient and useful as this categorization is, the text comments associated with many of the new classes and packages in JDK 8 are arguably even more useful, especially as many of us start to adopt JDK 8. I look at some of examples of highly useful JDK 8 API documentation in this post. In the course of this quick perusal of the JDK 8 Javadoc documentation, anyone entirely new to JDK 8 is bound to learn something about the libraries of JDK 8.

Good examples of the usefulness of the JDK 8 API documentation are in the familiar String class documentation. That class features two new overloaded static methods, join(CharSequence, CharSequence...) and join(CharSequence delimiter, Iterable elements). The Javadoc comments for these two new methods not only explain the methods' behaviors, but illustrate them with code that demonstrates the methods in use. This is similar to the Javadoc comment I've always found helpful on the String.substring(int, int) method.

The all-new StringJoiner class includes code examples of its usage in the class-level Javadoc comments. One of the code examples seems targeted toward easing "traditional Java development" while the second example applies the power of lambda expressions and streams.

Code examples are used liberally in other new (to JDK 8) classes' Javadoc documentation as well, especially in the java.util.streams package. The class-level Javadoc documentation for the java.util.stream.Collectors class provides code examples of 7 potential uses for Collectors such as accumulation and grouping. The Stream interface provides an example of useful JDK 8 documentation on an interface. The text detail on applying the Stream interface is accompanied by a simple code example that demonstrates "an aggregate operation using Stream and IntStream." The java.util.stream package itself has great description text regarding Streams that includes a simple example of employing a Stream with a detailed discussion of what is going on with that example. The package documentation for java.util.stream goes onto discuss several different aspects of using Streams such as stream operations and pipelines, parallelism, side effects, and reduction.

Just as it is important to understand Streams when working with JDK 8 lambda expressions, it is also useful to understand functional interfaces when using lambda expressions and the java.util.function package-level description provides a nice overview.

Another good example of JDK 8 Javadoc-based documentation with enlightening code examples is the documentation for Calendar.Builder, a class I covered in the post JDK 8's Calendar.Builder.

Most of the JDK 8 Javadoc-based documentation I've discussed so far provides code examples demonstrating use of the described package, class, or interface. Some of the new JDK API documentation uses code to demonstrate the new API feature by showing code that formerly would have needed to be written but is replaced by the new feature. Good examples of this exist in the well-known Java Map interface. The Java Map interface has several new methods specified in JDK 8 and many of these new JDK 8 methods include Javadoc documentation indicating code that would have been required prior to JDK 8 to accomplish the same thing as the newly added method. For example, the methods computeIfAbsent, computeIfPresent, forEach, getOrDefault, and putIfAbsent methods all have comments providing code demonstrating what the "default implementation is equivalent to." Although this may be explaining the default behavior of Map implementations, it is also useful for understanding the type of pre-JDK 8 code these methods emulate or replace.

JDK 8 introduces a completely new Date/Time API and the java.time package has a nice package-level overview of the API. Constructs in this entirely new package have individual level comments that are useful for learning this API. Examples include Clock, Instant, LocalDateTime, Period, and ZonedDateTime. The package-level documentation helps clarify the relationship between LocalDate, LocalDateTime, LocalTime, ZonedDateTime, and Instant.

JDK 8 Javadoc isn't only changed for the standard JDK API. JDK 8 brings some enhancements to the javadoc tool that will impact developers' own Javadoc comments and code. It is also important to be aware of the -Xdoclint:none option (mentioned in Stephen Colebourne's blog post Turning off doclint in JDK 8 Javadoc) for preventing Javadoc that doesn't conform to "W3C HTML 4.01 HTML" from breaking. The final bullet on the Enhancements in Javadoc, Java SE 8 page states that this Javadoc HTML conformance compliance "feature is also available in javac, although it is not enabled by default there." That same bullet tells us that we can learn more about the -Xdoclint:none flag by running javadoc -X.

Conclusion

I sometimes hear that there is never a need for comments when the code speaks for itself. I believe that is true to a degree, but the presence of useful Javadoc comments on packages, classes, and interfaces and their methods that were introduced with JDK 8 will make the adoption of JDK 8 much quicker than reading everyone of these constructs' code listings would. It reinforces my opinion that we often don't need comments on specific lines of code that do something, but most often do need comments on interfaces and contracts. In my ideal world, the code would be so well written that the only necessary comments would be Javadoc style comments (/** */) and we'd need very few // or /* */ style comments. JDK 8 continues a trend that has occurred in recent major revisions of the JDK of improved Javadoc comments in terms of readability and understandability.

Thứ Ba, 25 tháng 3, 2014

jdeps: JDK 8 Command-line Static Dependency Checker

I'm a big fan of the command-line tools delivered with the Sun/Oracle HotSpot JDK. I have blogged about some of my favorites including jcmd, jps, jstack, javap, javac (-Xlint and -Xprint), jinfo, and xjc. In this post, I look briefly at a new command-line tool introduced with JDK 8: jdeps.

Although there is understandable and significant disappointment that we did not get modularity built into the Java platform with the punting of Project Jigsaw to a future release of Java, we can still gain benefits in JDK 8 from some work that went into getting the platform ready for Project Jigsaw. The new jdeps command came from work on Java modularity and is delivered with JDK 8.

jdeps is a "Java [static] class dependency analyzer" that is useful for quickly identifying "static dependencies of [developers'] applications and libraries." The level of detail shown is configurable and some ways of configuring this command's output are shown next.

The following screen snapshot demonstrates basic usage of the jdeps command against a Guava 16 JAR. Note that the basic use indicates dependencies at the package level (which packages in the JAR depend on which other packages).

Much (and I emphasize the "much") greater detail is gained by using jdeps -v (verbose) because this reports class-level dependencies rather than only package-level dependencies. The beginning of such output is shown next.

The class-level output becomes very verbose quickly and so it will often need to be redirected to a file or one can use jdeps's -dotoutput argument to write the output into files in the directory specified with the -dotoutput argument. The latter is demonstrated in the next screen snapshot.

As the screen snapshot above demonstrates, executing jdeps with the -dotoutput argument writes *.dot files to the specified directory. One of the files has the same name as the JAR whose dependencies are being analyzed (but with .dot extension rather than .jar extension) and the other file is a summary of static dependencies (much shorter than the verbose file in the same directory). These .dot files are text files and can be viewed with any text editor or text display command. As a side note, machines running Windows may "recognize" these files as Word template files based on their .dot extension (see next screen snapshot), but these are simple text files.

Conclusion

There are a few more useful options available for use with jdeps that are not covered in this post, but these can be seen by running jdeps -help or by accessing the tool's Tech Notes. The jdeps command-line tool is easy to use and quickly identifies static dependencies on a provided JAR and its package or class contents.

Thứ Hai, 24 tháng 3, 2014

The Wait is Over: JDK 8 is Here!

Mark Reinhold's post JDK 8: General Availability announced the general availability of JDK 8 this past week. In this post I look at some of the plethora of posts and articles on JDK 8.

General JDK 8 Information

The JDK 8 Release Notes include links to many resources including to the post What's New in JDK 8 that outlines the new features of JDK 8. Other referenced pages include JDK 8 Adoption Guide, Java Platform, Standard Edition 8 Names and Versions, Known Issues for JDK 8, and the Java Platform Standard Edition 8 Documentation.

There are numerous other posts announcing JDK 8 availability. These include Java 8 officially arrives at last, Java 8 is going live today - here's your crib sheet, 8 new features for Java 8, Java SE 8 is Now Available, David Thompson's Six Important New Features in Java 8 (JDK 8), Lucy Carey's Java 8 is the biggest change to the syntax of the JVM since generics in Java 5, 5 Features In Java 8 That WILL Change How You Code, Happy 8th Birthday Java!, Java Developers Readiness to Get Started with Java 8 Release, Benjamin Winterberg's Java 8 Tutorial, and Pierre-Hugues Charbonneau's Java 8 is Now Released!

I've also previously referenced the useful Baeldung Java 8 page and the Java 8 Friday series of posts has useful details on Java 8.

IDE Support for JDK 8

The most commonly discussed Java IDEs (NetBeans, Eclipse, and IntelliJ IDEA) are providing support for JDK 8. NetBeans 8 was released in conjunction with JDK 8 and includes JDK 8 support. Daniel Megert announced "[Eclipse] Luna (4.4) builds contain the Eclipse support for JavaTM 8" and that support for Eclipse Kepler is available with a feature patch. IDEA 13.1 was released with JDK 8 support.

Lambda Expressions

Lambda expressions are arguably the most anticipated and biggest feature of JDK 8. Oracle has provided a Java SE 8: Lambda Quick Start. Other useful resources on JDK 8 lambda expressions include Java Lambda Expressions Basics, Java programming with lambda expressions, and Stephen Chin's Java 8 Released! — Lambdas Tutorial.

Date/Time API

A welcome new feature of JDK 8 is the Joda-inspired Date/Time API. Introductions to the new Java Date/Time API include Oracle's Java Date-Time Packages Tech Notes, Fabian Becker's A new Date and Time API for JDK 8, and Java Time API Now In Java 8.

Nashorn

Project Nashorn, which its OpenJDK page describes as "a lightweight high-performance JavaScript runtime in Java with a native JVM," was announced at JavaOne 2011 and is delivered with JDK 8. There is an Oracle Tech Notes Introduction to Nashorn along with other useful resources such as Java 8: Compiling Lambda Expressions in The New Nashorn JS Engine and Oracle Nashorn: A next-generation JavaScript engine for the JVM.

Miscellaneous New Libraries, Classes, and Tools

Michael Scharhag demonstrates StringJoiner in Java can finally join strings. Default methods are the subject of Ryan Kenney's Java 8 Default Methods and Multiple Inheritance. Java Mission Control 5.3 is also included with Oracle's JDK 8 (as it has been with JDK 7 since update 40). Other new features in JDK 8 include Calendar.Builder and the jdeps static dependency analysis tool. We also recently learned that JDK 8 will use TLS 1.2 as default.

Conclusion

The arrival of JDK 8 brings much to be excited about. Streams and lambda expressions rightfully dominate the discussion, but many other features of JDK 8 are sure to make Java quicker and easier to use. There is a lot to learn in JDK 8, but fortunately there are numerous freely available online resources to aid this effort. I've tried to summarize a small sample of those resources here.

Thứ Tư, 19 tháng 3, 2014

Video Review: jQuery UI Development

This post is my review of jQuery UI Development, a Packt Publishing video course by Ben Fhala that is intended to help viewers "utilize jQuery UI to its full potential." The jQuery UI page describes jQuery UI as "a curated set of user interface interactions, effects, widgets, and themes built on top of the jQuery JavaScript Library."

jQuery UI Development consists of six sections viewable in the same browser-based Packt Video Player as the video courses I have previously reviewed (JBoss EAP Configuration, Deployment, and Administration and HTML5 Game Development). As was the case with those video courses, jQuery UI Development is divided into separate and videos ranging from roughly 1 minute long to 8 minutes long.

Section 1: Getting Started with jQuery UI

The first section of the video course jQuery UI Development is very introductory. The first video of this section introduces the video course and the next two videos introduce jQuery and jQuery UI at high levels based on a review of their current main web pages. Fhala explains why jQuery is so popular for web development and how jQueryUI supplements core jQuery. His video shows current content on the main jQuery and jQuery UI pages and he adds explanation and personal opinions to what is stated on those pages.

The fourth and fifth videos in Section 1 briefly describe the two methods for acquiring jQuery and jQuery UI: downloading them ("local download") at http://jquery.com/download/ and http://jqueryui.com/download/ respectively or referencing them in Content Delivery/Distribution Networks (CDN). The author/narrator specifically describes accessing jQuery and jQuery UI from the Google CDN (jQuery/jQuery UI) and from the Microsoft Ajax CDN (jQuery/jQuery UI). He outlines advantages and disadvantages of using CDNs in each case (jQuery and jQuery UI) and briefly summarizes tactics for developing against downloaded versions and deploying against CDN versions. He also discusses and demonstrates how to reference these CDN-hosted libraries from HTML pages. The narrator references his site http://02geek.com/ to show an example of converting HTML links to buttons. An interesting side note is that there is also a jQuery CDN.

The final video of the first section covers the tools the narrator is using for the video course. He uses MacOS, Safari web browser, and Sublime Text editor, but he also points out that a viewer could use any tools that he or she is comfortable with rather than these tools. He also shows how one can configure Safari's Developer Tools to be enabled and how to view source in Safari.

Section 2: Working with the CSS Framework

The second section of jQuery UI Development focuses on Cascading Style Sheets (CSS) support. It starts with videos demonstrating how to add an HTML input field, easily convert that field to a jQuery UI datepicker, and then how to easily change the jQuery UI theme via change of specified theme folder.

The fourth video in Section 2 demonstrates how to only download pieces of jQuery UI that an application needs using Download Builder and the fifth video demonstrates applying these "minified" code dependencies to an application. The sixth and seventh videos of Section 2 delve deeper into jQuery CSS support by looking at the overall file hierarchy of CSS support files and introducing the impressive ThemeRoller that allows one to dynamically create jQueryUI themes with no knowledge of CSS and without any CSS skills (style and taste are the only limiting factors).

Section 3: Working with Widgets

The third section focuses on "Widgets" components. It is the longest section of the video series (the second longest section, Section 5, is also the second session on "Widgets"). The narrator begins by demonstrating creation and manipulation of a simple jQuery UI Dialog. As part of this, he demonstrates Download Builder's really useful feature of associating selected components with components they depend upon so that all dependencies are automatically selected with any components that depend upon them.

Options, methods, and events for widgets are explained in this section. They are introduced collectively in a video as the jQuery UI API documentation for Dialog is shown and then each of them is featured in its own video. Widget events are covered as callbacks in this third section.

Section 4: Adding Interaction

The focus of the fourth section is on using Events to add interaction to an application. Fhala uses console.log to show some of the internal workings of Events and to figure out what options, methods, and events a particular widget supports. Fhala explains why a standalone Event might be preferable over a simple inline callback (more than one widget can use the same named standalone Event) and discusses practices to make these more generally useful. He makes several mistakes during the demonstration and does some on-the-fly debugging and resolves those typos and mistakes. These don't add much overall time to the length of the section, but I think they add a realistic view of what anyone who does real application development experiences every day.

Section 5: More about Widgets

Section 5 is the last significant section of the video course because Section 6 is a very short overall summary. Section 5 returns to the topic of Widgets with focus on six jQuery UI widgets (Tooltip, Spinner, Menu, Slider, Accordion, Tabs) with one video per covered widget. I liked the general pattern Fhala followed in the videos of this section. He started with simple HTML elements such as <div> or <input> tags and then applied the jQuery UI components to those HTML elements. By showing each step in code and demonstration, the pattern was established and it was obvious how easy it was to apply jQuery UI components to traditional HTML elements. The video on the Slider component was perhaps the longest of the entire video course (over 8 minutes), but included a look at a bit more complex JavaScript than most of the other examples in this video course.

Section 6: Course Recap

The final section is a single, short video. It's not really so much a recap as it is a reference to the author's contact information and finding other work of the author on Packt Publishing's site.

General Observations
  • One thing that is quite different about this video course as compared to the HTML5 Game Development and JBoss EAP Configuration, Deployment, and Administration video courses is that this course features video of the speaker himself throughout whereas the speaker is never visible in the other courses. I was a bit concerned at first when the video of him speaking seemed to take up too much real estate on the screen, but was relieved to see that he minimized the video of him speaking and moved it into the lower corner when it was important to show documentation, code, or application demonstration on the screen.
  • Fhala states the versions of jQuery (1.9) and jQueryUI (1.10.1) covered in this video course. I appreciate this because with rapidly changing technologies, it is important to know to which versions the teaching material applies. Fhala states that he chose jQuery 1.9 rather than jQuery 2 to allow support for older versions of Microsoft Internet Explorer (IE 6, IE 7, and IE 8).
  • Fhala heavily references the jQuery documentation and especially the jQuery UI documentation. This documentation is pretty impressive, thorough, and approachable, but Fhala's presentation makes it even more approachable and easier to understand. He mixes emphasis on text in the documentation with his verbal commentary and illustrations of the documentation principles in practice via coding and running the examples. Although most of the material covered in this video course is readily available online, the video presentation smooths out the initial learning curve and allows the viewer in roughly 2 hours to be very comfortable with the overall concept and use of jQuery UI and how to effectively use the jQuery UI documentation.
  • It feels like Fhala did plan out the overall presentation and topics of this video course ahead of time, but that many of the low-level specifics of the presentation were not as practiced, scripted, or rehearsed as the overall concept was. Although this could be seen as less polished, I did not mind it and thought it provided a more realistic view of how a developer would use and apply jQuery UI documentation and jQuery UI in coding. The fact that some real typos and other mistakes were made did not take a lot of extra time to fix and provided a realistic view of how a developer works with any language or framework including jQuery UI. It is useful to see what types of errors occur rather than always seeing the polished "happy path."
  • jQuery UI Development is very approachable for those new to jQuery and jQuery UI. It is helpful for viewers to have very basic HTML, JavaScript, and CSS knowledge, but very little knowledge of these is needed. Fhala does a good job of presenting this material in a way that is approachable even to those with only a very small amount of experience with JavaScript, CSS, HTML, and jQuery. About the only thing one needs to understand about jQuery when approaching this video course is that the dollar sign ($) is an alias for jQuery rather than for document.getElementById().
  • The video is clear and easy to view (should be viewed in full screen mode when watching code examples). The audio is generally good, though once or twice the narrator's voice seems to trail off a bit and there were occasional mistakes in the verbal descriptions that were generally quickly remedied.
  • Besides video of code editing in Sublime Text, video of running and debugging the simple applications in Safari, and video of the author speaking, the videos in this course occasionally include other minor effects that add some liveliness and emphasis to the presentation.
  • Other online reviews of jQuery UI Development video course are available at Video Course Review: jQuery UI Development and O'Reilly reviews.
  • The Packt Publishing site for this video course features numerous screen snapshots of the video course under the heading "Screenshots from the course." Some of these provide representative samples of how the video is laid out for examples and for featuring the narrator speaking.
  • The Packt Publishing site for this video course also features a sample video clip. I highly recommend viewing this clip to determine if this approach to learning jQuery UI suits you.
  • Most of the sections in this video course featured an initial video that provided a high-level overview of what was to come in that section.
  • As stated in the previous bullet, Fhala does an excellent job providing an introductory jQuery UI video course. It is important to note that the emphasis is introductory and that developers with moderate to significant jQuery UI experience are likely to get less out of the video course. It seems targeted at people with little or no jQuery UI experience.
Conclusion

jQuery UI Development is a great introduction to jQuery UI that is especially suited for those with minimal HTML/JavaScript/CSS experience and little or no jQuery and jQuery UI experience. The video course provides a high level overview of jQuery UI along with enough details to present a representative sample of the types of things one can do with jQuery UI and the basic patterns used to apply jQuery UI. Along the way, author Ben Fhala highlights some key commonly accepted best practices of JavaScript/jQuery development. Although the material covered in this video course is available online in the excellent jQuery UI documentation that Fhala frequently references, there are advantages to seeing video of the concepts being applied that are difficult to match in a static text-oriented web page.

Thứ Bảy, 8 tháng 3, 2014

Video Review: JBoss EAP Configuration, Deployment, and Administration

Packt Publishing released the video JBoss EAP Configuration, Deployment, and Administration by Red Hat employee Jason Shepherd in October 2013. This post is my review of this training video on configuring, deploying, and administrating the JBoss Enterprise Application Platform.

Like HTML5 Game Development which I recently reviewed, JBoss EAP Configuration, Deployment, and Administration is actually a series of short videos (1 to 5 minutes each and grouped with related videos in sections/chapters) that run in the Packt Video Player within a web browser.

Section 1: Standalone versus Domain Mode

The first section (or chapter) covers download and installation of JBoss along with coverage of the basics of setting up standalone instances and domain instances of the application server. Two approaches (command line copying of WAR file into appropriate directory and use of web-based Management Console at http://localhost:9990 with newly created user) for standalone deployment are demonstrated. The first section then moves onto coverage of using command line (emphasizing JBoss AS7's Command Line Interface) tool and web-based Management Console to deploy to multiple instances in domain mode.

Section 2: Adding and Configuring Databases and Message Queues and Using Them from Your Application

The second section of JBoss EAP Configuration, Deployment, and Administration contains short videos related to using database and JMS with JBoss. The first video in this section demonstrates using the browser-based Management Console to associate a JDBC driver with the application server using JBoss's JCA support. A MySQL database is used in this example. The second video also shows association of a datasource with the JBoss instance, but uses the Command Line Interface this time. It introduces and demonstrates use of the commands deployment-info and data-source. The third video of Section 2 indicates a third way of configuring a datasource to be used by JBoss Application Server: directly editing the configuration file. The narrator explains why this must be done when the application server is not running and demonstrates changing the configuration file by changing the datasource to be an XA datasource.

The fourth video of Section 2 is simply titled "Connecting to a Database," but demonstrates far more than that. In this video, the author demonstrates use of the JBoss Tools plugin for Eclipse IDE. The demonstration shows use of a sample application included with JBoss Tools that uses Java Persistence API to connect to the database (note that installation of the JBoss Tools plugin for Eclipse is demonstrated in the first video of Section 7). The fifth video of Section 2 demonstrates use of the Management Console to configure database connection pooling and demonstrates how to use files provided with the JBoss distribution to learn about more potential settings to adjust.

The final two videos of Section 2 demonstrate setting configuring a JMS Queue in JBoss using the Management Console and then interacting with that JMS Queue with simple examples written in Java and displayed in the video in the Eclipse IDE.

Section 3: Configuring the Java Virtual Machine (JVM) for Troubleshooting and Diagnostics

The third section of JBoss EAP Configuration, Deployment, and Administration looks at troubleshooting and diagnosing performance and memory related issues with JBoss. The majority of the information provided in these videos in this section are not JBoss-specific, but rather cover use of the standard tools provided by the Oracle JDK (and OpenJDK) and by Linux. For example, demonstrated tools include jps, jstack, top (including a useful script for running it periodically), and so forth. There are some JBoss-specific aspects to the videos in Section 3 such as how to specify the garbage collector to use, enabling logging of garbage collection events, and specifying JVM heap sizes that JBoss instances should use. The videos provide introductory detail on analyzing output of these tools (garbage collection logging, thread dumps, and heap dumps) and what common symptoms of the output indicate about potential issues. Useful tools for helping with this analysis are also briefly mentioned: GCViewer (garbage collection), Samurai (thread dumps), and Eclipse Memory Analyzer (heap dumps).

Section 4: Clustering and Load Balancing for Web Applications

After the highly general Section 3 with few JBoss-specific details, Section 4 returns to a heavy JBoss focus with its coverage of clustering and load balancing. This section of videos uses Linux command line options heavily and most of the work is done and verified with Linux commands and viewing output.

Section 5: Classloading with JBoss Modules

Section 5 is on JBoss Modules. The author explains that while developers may have run into issues with classes using by the application server being available and even erroneously used by the applications in some previous versions of the application server, JBoss AS7 (JBoss EAP 6) provides special class loading support to help avoid this issue. This section discusses this and also talks about the implicit module dependencies in JBoss. The videos show how to exclude certain implicitly provided modules and how to explicitly declare dependencies on different modules. The videos demonstrate using and changing jboss-deployment-structure.xml files to control JBoss classloading. The final video in this section uses JBoss AS 7: Configuration, Deployment, and Administration to show in writing how JBoss classloading precedence rules work.

Section 6: Deploying Applications

Although the title of Section 6 is "Deploying Applications," this is not the first section in which deployment to a JBoss application server instance is covered. Instead, this section focuses on more specific capabilities that can be enabled in JBoss at deployment time for performance improvements and for greater security. The first video in this section emphasizes using Java EE 6 Servlet 3.0 asynchronous servlets and shows how use of these improves ability to serve frequently repeated requests sent in as tests using JMeter.

The second video of Section 6 is on using SSL with JBoss. This video showed key portions of the "JBoss community document" Using SSL with JBoss using JSSE and moves back and forth between describing concepts covered on that page and video illustrations of how to apply those concepts.

The third video of Section 6 uses the servlet-security example of the JBoss AS Quick Starts to demonstrate integrating Java Authentication and Authorization Service (JAAS) support into a JBoss application. I noted that the comments in the referenced servlet-security example were perhaps the first references in these videos to "JBoss Enterprise Application Platform." These comments stated that the example applies to "JBoss Enterprise Application Platform 6 or JBoss Application Server 7."

The final video in Section 6 demonstrates how to secure JBoss passwords (encrypt them rather than storing them in plain text) using the JBoss Vault. As with the second video in this same section, the narrator moves back and forth between online documentation (JBoss AS7 Securing Passwords) and video illustration of applying the concepts in the documentation.

Section 7: Building and Testing Application with Maven and JBoss Tools

Although JBoss Tools for Eclipse was mentioned in a previous video, the first video of Section 7 demonstrates configuration of JBoss Tools in Eclipse. The second video of this section revisits JBoss AS QuickStarts to demonstrate use of Maven (jboss-javaee-6.0-with-tools BOM and jboss-as-maven-plugin) to build and deploy JBoss applications.

JBoss Tools in Eclipse is the featured tool of the third video of Section 7. In this video, deployment of a JBoss-hosted application via JBoss Tools for Eclipse is demonstrated. Arquillian is the main tool covered in the final two videos of Section 7. The first of these demonstrates running test suites in JBoss with Arquillian and the second video features use of Arquillian with Shrinkwrap to run init tests against a JBoss instance.

Section 8: Configuring the Application Server Logging

The final section of JBoss EAP Configuration, Deployment, and Administration focuses on logging in JBoss. The first video briefly references the JBoss Command Line Interface Recipe called Toggle root logger level during runtime with out bouncing the server before demonstrating changing the log level by changing the XML configuration file directly (requires stopping the server) and by using CLI both in standalone mode and in domain mode. This demonstration shows how to set the logging appenders so that different levels of logs go to the console than to log files. The second video of Section 8 looks at setting log levels at category levels rather than at more general system-wide levels. It demonstrates doing this both by editing the file directly and by using CLI.

The final three videos of Section 8 look at making JBoss logging more efficient. Techniques demonstrated include using async-handler for asynchronous logging, rolling the generated server.log file based on specified maximum size, and overriding JBoss's default logging configuration with application-specific logging configuration.

General Observations
  • I liked that JBoss EAP Configuration, Deployment, and Administration generally illustrated these tasks with both the web browser-based Management Console and with the Command Line Interface tool. I find myself using both approaches when working with application servers that support both approaches. I generally lean toward use of the web interface when first learning and then gradually move to the command-line as I start to script steps I am tired of doing manually. It is nice to see how to do things with both approaches.
  • Verbal cues in the narration and examples showing the command-line, Management Console, and Eclipse plugin indicate that it is JBoss 7.1.1 being used in these videos. To the best of my understanding, this implies that it is JBoss Enterprise Application Platform 6 being demonstrated. I don't recall any verbal mention and only a few written mentions of "JBoss Enterprise Platform" in this video, but "JBoss Application Server" was mentioned numerous times in text and verbally. Perhaps my biggest negative observation regarding this video tutorial is that its title might have been better as "JBoss AS7 Configuration, Deployment, and Administration" (which probably was not done because there is a book already with this title).
    • It is not a fault of this video, but a more general challenge is the difficulty differentiating JBoss Application Server, JBoss Enterprise Application Platform, and Wildfly. According to jboss.org community documentation, JBoss Application Server "allows innovation at a faster pace" while JBoss Enterprise Application Platform is described as "a rigorously tested, stable, supported platform for developing and deploying mission critical Java applications and services." The JBoss Application Server 7 FAQ states that "JBoss Enterprise Application Platform (EAP) is the productized version of JBoss Application Server (AS)." The "community edition" JBoss Application Server was renamed Wildfly and the post JBoss EAP and WildFly - a Symbiotic Relationship describes the relationship between JBoss Enterprise Application Platform and newly named Wildfly.
    • The best way I've found to get my head around which version of JBoss Enterprise Application Platform corresponds to a particular version of JBoss Application Server/Wildfly version is to cite the JBoss Downloads page. As of this writing, that page indicates that JBoss Enterprise Application Platform 6.x versions are "built from" AS 7.x versions. Therefore, I can conclude that the videos I am reviewing here are demonstrating configuration, deployment, and administration of JBoss Enterprise Application Platform 6 when I see JBoss Application Server 7 references in the tools and command-line output shown in the videos.
  • JBoss EAP Configuration, Deployment, and Administration should probably not be a person's initial and only exposure to JBoss Application Server or Enterprise Application Platform. A viewer of these video snippets would be better served to have at least rudimentary awareness of how an application server works conceptually and preferably would have at least some awareness of JBoss specific concepts. Although the videos start by showing how to download JBoss, I doubt that someone entirely new to application servers would be able to keep up with the videos for very long.
  • Demonstration of configuration, deployment, and administration of JBoss EAP are done in Linux. It will be easier for the viewer to understand the points the video makes if the viewer understands basic Linux because commands such as ls, grep, less, diff, scp, connect, ip addr show, and ifconfig, are used and Linux tools such as vim and top are used.
  • The videos in JBoss EAP Configuration, Deployment, and Administration will be useful to anyone wanting to learn how to configure, deploy, and administrate JBoss Application Server 7/JBoss Enterprise Platform 6. However, they will be slightly more approachable to those using Eclipse IDE and Linux because that operating system and IDE are used for demonstrations.
  • Although Section 3 had very few JBoss-specific details, this is the type of information that I believe all intermediate or advanced Java developers should know. The author's mixing of Oracle JDK tools, Linux tools, and other available tools provides a good overview of the basics of using these tools to improve performance of any (not just JBoss-based) Java-based application.
  • JBoss EAP Configuration, Deployment, and Administration references written documentation in several of the videos. I like that the author shows the actual page (so it will look familiar when I pull it up in my own browser) and emphasizes the URL so that I can make note of it for later reference. An advantage of this is that a viewer can not only learn the concept being illustrated, but can learn where to go for more details or to refresh one's memory.
  • The best fit for this video tutorial is probably someone with general Java EE/application server experience, but with relatively little JBoss AS7 administration experience. The videos don't waste anytime getting into the core subject and are probably not best suited for someone totally new to Java EE. However, a person familiar with configuring other Java EE application servers should be able to pick up JBoss specifics shown in these short videos without significant trouble.
  • The videos I have reviewed here provide much information in quick fashion, making it easy to quickly see the overall approaches one can use. In some cases, it would probably be helpful for the viewer to have access to online or other "print" details to reference in case small details outside the videos' scope are desired.
  • The audio is clear on all of the videos and the videos was clear on my laptop screen as long as I ran the video in full-screen mode.
Conclusion

I found JBoss EAP Configuration, Deployment, and Administration to be engaging and informative. These videos provide a mechanism for a person to easily and quickly understand how to work with configuration, deployment, and administration features in JBoss Application Server 7/JBoss Enterprise Application Platform 6/Wildfly.