Thread safety. A pure function with value parameters is completely thread safe. With reference or pointer parameters, even if they are const, you do need to be aware of the danger that another thread doing non-pure operations might mutate or free the data, but it is still one of the most powerful tools for writing safe multithreaded code.
In Europe, the transformation in the sovereign debt market since Mario Draghi’s “whatever it takes” promise in July 2012 has been remarkable. Ireland, which just exited an IMF bailout program in December, can now issue 5-year debt at yields well below 5-year Treasuries.
Becausesecurityvulnerabilitiesinthird-partysoftwarearesocommon, it is important to manage the versions of your dependencies and to be prepared to upgrade them quickly. For Maven projects, I recommend putting the versions of all your dependencies in the properties section of your pom.xml. Furthermore, for libraries which require multiple dependency entries in pom.xml, this allows you to ensure you use the same version for all of those dependencies.
<projectxmlns="http://maven.apache.org/POM/4.0.0"xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"><properties><spring.version>3.2.6.RELEASE</spring.version><jackson.version>2.2.3</jackson.version></properties><dependencies><!-- spring --><dependency><groupId>org.springframework</groupId><artifactId>spring-core</artifactId><version>${spring.version}</version></dependency><dependency><groupId>org.springframework</groupId><artifactId>spring-beans</artifactId><version>${spring.version}</version></dependency><dependency><groupId>org.springframework</groupId><artifactId>spring-context</artifactId><version>${spring.version}</version></dependency><!-- Jackson --><dependency><groupId>com.fasterxml.jackson.core</groupId><artifactId>jackson-core</artifactId><version>${jackson.version}</version></dependency><dependency><groupId>com.fasterxml.jackson.core</groupId><artifactId>jackson-annotations</artifactId><version>${jackson.version}</version></dependency><dependency><groupId>com.fasterxml.jackson.core</groupId><artifactId>jackson-databind</artifactId><version>${jackson.version}</version></dependency></dependencies></project>
This creates a simple, Hello World application in the hello-world directory. We can verify it works by running it in a local servlet container using the instructions found in Supporting mvn jetty:run in Maven applications. Add the Jetty maven plugin to pom.xml under the build section:
When I’m writing a Java servlet using Maven, I find it convenient to be able to run the Java servlet in a local servlet container for testing purposes. This is very easy to do using the Jetty Maven plugin.
To add the Jetty Maven plugin to your project, modify pom.xml as follows:
In a previous post, I noted that I have a copy of every single email I’ve sent or received at work since mid-2003. Here is the updated chart of the number of work emails I send and receive per year through December 31, 2013.
Here’s the same data charted by month:
This data was calculated by a simple Outlook PST parsing program I wrote called pststats.
This post is a sibling of my earlier post Using Handbrake to Encode DVDs for the Roku and contains the settings I use for Blu-Ray movies. The instructions apply to Handbrake 0.9.9.
Once again, start with the High Profile preset and then make the following changes:
In Output Settings:
Set Container = Mp4
Ensure Large File Size is checked
Ensure Web Optimized is checked
Ensure iPod 5G Support is unchecked
In Picture:
Set Anamorphic = Strict (all Blu-Rays I’ve seen are 1920x1080)
Set Cropping = Automatic.
In Filters:
Set Detelecine = Off
Set Decomb = Fast
Set Deinterlace = Off
Set Denoise = Off
Set Deblock = Off
Ensure Grayscale is unchecked
In Video:
Set Video Codec = H.264 (x264)
Set Framerate (FPS) = Same as source
Set Constant Framerate
Set Quality = Constant Quality of RF:20
Set Optimise Video = Use Advanced Tab instead
In Audio:
Create two audio tracks. The first audio track will have:
Source = AC3 5.1 (which is what you should have ripped from your DVD)
Codec = AAC (faac)
Bitrate = 160
Samplerate = Auto
Mixdown = Stereo
DRC = 1.5
Gain = 0
The second audio track will have:
Source = AC3 5.1
Codec = AC3 Passthru
In Subtitles, keep everything empty. I do not handle subtitles.
In Chapters:
Ensure Create chapter markers is checked
In Advanced:
In Encoding:
Set Reference Frames = 3 (Default)
Set Maximum B-Frames = 3 (Default)
Ensure CABAC is checked
Ensure 8×8 Transform is checked
Ensure Weighted P-Frames is checked
Set Pyramidal B-Frames = Normal (Default)
In Analysis:
Set Adaptive B-Frames = Optimal
Set Adaptive Direct Mode = Automatic
Set Motion Est Method = Hexagon (Default)
Set Subpixel Motion Est = 7: RD in all frames
Set Motion Est Range to 16
Set Partition Type = Most (Default)
Set Trellis = Encode Only (Default)
In Psychovisual:
Set Adaptive Quant Strength = Middle
Set Rate Distortion = Middle
Set Psychovisual Trellis = Leftmost Setting
Ensure No DCT-Decimate is unchecked
Set Deblocking = 0 (Default), 0 (Default)
In x264 Encoder Options, set it to b-adapt=2:rc-lookahead=50:direct=auto
In a previous post, I noted that I use ffmpeg to convert DVDs to MP4s which will play on my Roku. I recently encountered two problems with this approach. First, the resulting MP4s only include a stereo audio track, so are highly sub-optimal for surround sound systems. Second, for a yet-undetermined reason, Plex (my current preferred media client) will transcode the videos rather than play them directly.
Java Management Extensions (JMX) is a technology for managing and monitoring Java applications. JMX instructs application developers how to instrument their applications to expose metrics and management mechanisms, and instructs operations teams how to collect metrics and manage Java applications. JMX is ubiquitous: there are a large number of off-the-shelf commercial and open source tools which speak JMX.
This article is intended for application developers to introduce JMX, to teach them how to create some simple metrics via JMX, and to encourage them to thoroughly instrument their applications with JMX.; This article uses only J2SE 5 and the Java Servlet specification. There may be better, more efficient, or more appropriate ways to add JMX counters to applications using other frameworks. For example, Spring developers should read http://static.springsource.org/spring/docs/2.0.x/reference/jmx.html.