background preloader

Java

Facebook Twitter

Poyectinkr. How to Make a US County Thematic Map Using Free Tools. What if you just want a simple map without all the GIS stuff? In this post, I’ll show you how to make a county-specific choropleth map using only free tools. Here’s what we’re after. It’s an unemployment map from 2009. Step 0. System requirements This tutorial was written with Python 2.5 and Beautiful Soup 3. We’re going to make good use of the Python library Beautiful Soup, so you’ll need that too. Step 1. The first step of every visualization is to get the data. It was originally an Excel file. Step 2. Luckily, we don’t have to start from scratch. Blank US counties map in SVG format The important thing here, if you’re not familiar with SVG (which stands for scalable vector graphics), is that it’s actually an XML file. Anyways, we’ve downloaded our SVG map. Step 3. I want to make sure we’re clear on what we’re editing. You should see something like this: SVG is just XML that you can change in a text editor.

Scroll down some more, and we’ll get into the meat of the map: Step 4. Step 5. Cool. Solving OutOfMemoryError (part 4) - memory profilers | Plumbr. December 19, 2011 by Nikita Salnikov-Tarnovski It is about time to continue our Solving OutOfMemoryError blog post series. In retrospect, so far we have covered: Part 1 described the Story of solving an OutOfMemoryError through the eyes of a Developer, Part 2 explained how the Ops usually tackle the OutOfMemoryError problem, and Part 3 started looking at where to start solving the OutOfMemoryError. A couple of next posts will now look at the existing tools that you can use to find a Java memory leak. Our past experience, which is supported by a quick search on Google and Stackoverflow, shows that the first set of tools people tend to jump to when solving memory problems in production is memory profilers. Among them, VisualVM, YourKit and JProbe seem to be the most popular. Let’s use our leaking Pet Clinic sample application as our “dying patient” and, using these three tools, try to find out why it crashes with OutOfMemoryError.

So, to recap the previous articles: VisualVM YourKit JProbe Share. Www.projectlinkr.com/proyecto/Desarrollador-Java/ Introducing JAX-WS 2.0 With the Java SE 6 Platform, Part 1. Axis2 - Axis2 Quick Start Guide. Before we build anything, it's helpful to understand what the finished product looks like. The server side of Axis2 can be deployed on any Servlet engine, and has the following structure. Shown in Code Listing 2. Starting at the top, axis2-web is a collection of JSPs that make up the Axis2 administration application, through which you can perform any action such as adding services and engaging and dis-engaging modules. The WEB-INF directory contains the actual java classes and other support files to run any services deployed to the services directory. The main file in all this is axis2.xml, which controls how the application deals with the received messages, determining whether Axis2 needs to apply any of the modules defined in the modules directory.

Services can be deployed as *.aar files, as you can see here, but their contents must be arranged in a specific way. Here the service is defined, along with the relevant messageReceiver types for the different message exchange patterns. Java Tips, Hacks, Updates - Architect's Diary. Strings in switch statements In the JDK 7 release, you can use a String object in the expression of a switch statement: public String getTypeOfDayWithSwitchStatement(String dayOfWeekArg) { String typeOfDay; switch (dayOfWeekArg) { case "Monday": typeOfDay = "Start of work week"; break; case "Tuesday": case "Wednesday": case "Thursday": typeOfDay = "Midweek"; case "Friday": typeOfDay = "End of work week"; case "Saturday": case "Sunday": typeOfDay = "Weekend"; default: throw new IllegalArgumentException("Invalid day of the week: " + dayOfWeekArg); return typeOfDay; The diamond operator "<>" You can replace the type arguments required to invoke the constructor of a generic class with an empty set of type parameters (<>) as long as the compiler can infer the type arguments from the context.

For example, consider the following variable declaration: Map<String, List<String>> myMap = new HashMap<String, List<String>>(); Map<String, List<String>> myMap = new HashMap<>(); List<String> list = new ArrayList<>(); List<? From Spring to Java EE 6. I recently worked on a quite complex project mixing many Java EE 6 technologies (such as JPA, JAXB, JMS, JTA, JAX-RS, etc…). For productivity and planning reasons, the prototyped application was designed as a standalone pure Spring application. When the development of the real application started, we re-challenged our initial choice (i.e. Spring v3) and analyzed the interest of switching to a Java EE 6 app server like GlassFish or JBoss. This finally ended up in two major questions:can we do in Java EE 6 everything we can do in Spring ?

Can we do that as easy as in Spring ? Well, I would say that, globally, the answer is: yes we can ! I do not want to reopen the (endless) debate of knowing which one, between Spring and Java EE 6, is the best. Let us now study in details some typical requirements of “enterprise” applications, and compare the code to produce in both worlds for: Contexts & Dependency InjectionMessagingTransaction managementWeb services Fine ! In Spring, this is pretty easy. Java Interview: Coding Questions and Answers. EmailShareEmailShare Like the article?

Interviewing for a job can be stressful, but if there is one thing that can add more complexity to the interview process, it would be the technical interview. Nothing strikes fear in the heart of developers faster than the thought of sweating hands and an interview’s stare as you struggle through a coding problem on a whiteboard. This is the stuff of nightmares. It is natural for you to fear this process since many programmers, new and veteran alike, have doubts about their coding abilities. The best thing you can do is prepare yourself for what is to come. Question 1: Explain the difference between sleep() and wait(). This is a good starter question for interviewers since it helps to define the scope of the interviewee’s experience. The wait() method tells the thread of release the lock that it has on an object for a specified amount of time given as an argument. Example of usage for wait(): There are two overloads for sleep().

Here is an example: Java Tools for Source Code Optimization and Analysis' Below is a list of some tools that can help you examine your Java source code for potential problems: 1. PMD from PMD is licensed under a “BSD-style” license PMD scans Java source code and looks for potential problems like: * Possible bugs – empty try/catch/finally/switch statements * Dead code – unused local variables, parameters and private methods * Suboptimal code – wasteful String/StringBuffer usage * Overcomplicated expressions – unnecessary if statements, for loops that could be while loops * Duplicate code – copied/pasted code means copied/pasted bugs You can download everything from here, and you can get an overview of all the rules at the rulesets index page.

PMD is integrated with JDeveloper, Eclipse, JEdit, JBuilder, BlueJ, CodeGuide, NetBeans/Sun Java Studio Enterprise/Creator, IntelliJ IDEA, TextPad, Maven, Ant, Gel, JCreator, and Emacs. 2. FindBugs, a program which uses static analysis to look for bugs in Java code. 3. 4. 6. 7. 8. 9. 10.