background preloader

Dcnm

Facebook Twitter

Java Threads Tutorial. Multithreading refers to two or more tasks executing concurrently within a single program.

Java Threads Tutorial

A thread is an independent path of execution within a program. Many threads can run concurrently within a program. Every thread in Java is created and controlled by the java.lang.Thread class. A Java program can have many threads, and these threads can run concurrently, either asynchronously or synchronously. Multithreading has several advantages over Multiprocessing such as; Threads are lightweight compared to processesThreads share the same address space and therefore can share both data and codeContext switching between threads is usually less expensive than between processesCost of thread intercommunication is relatively low that that of process intercommunicationThreads allow different tasks to be performed concurrently.

The following figure shows the methods that are members of the Object and Thread Class. Tutorial: Hello World with Apache Ant. This document provides a step by step tutorial for starting java programming with Apache Ant.

Tutorial: Hello World with Apache Ant

It does not contain deeper knowledge about Java or Ant. This tutorial has the goal to let you see, how to do the easiest steps in Ant. Content Preparing the project We want to separate the source from the generated files, so our java source files will be in src folder. We have to create only the src directory. Md src. Main Page - APIDesign. Design Patterns. Java API Design Guidelines. Dr.

Java API Design Guidelines

Dichotomy's Development DiaryJava API Design Guidelinesby Eamonn McManusDecember 28, 2005 Summary There are tons of books and articles about how to design and write good Java code, but surprisingly little about the specific topic of API design. Here's a summary of what I've learnt on the subject from various sources and my own experience. I recently attended an excellent talk at JavaPolis, Elliotte Rusty Harold's XOM Design Principles. Although the talk is nominally about XOM (an API for XML documentation manipulation), in fact more than half of it is about API design principles in general. I've been closely involved with the evolution of the JMX API for over five years and have learnt a great deal about what works and what doesn't during that time. Abstract Factory Design Pattern. Intent Provide an interface for creating families of related or dependent objects without specifying their concrete classes.A hierarchy that encapsulates: many possible "platforms", and the construction of a suite of "products".The new operator considered harmful.

Abstract Factory Design Pattern

Problem. Home. How to close a Java Swing application from the code. How to use ArrayList in Java. Use DOM methods to navigate a document: jsoup Java HTML parser. Problem You have a HTML document that you want to extract data from.

Use DOM methods to navigate a document: jsoup Java HTML parser

You know generally the structure of the HTML document. Solution Use the DOM-like methods available after parsing HTML into a Document. File input = new File("/tmp/input.html");Document doc = Jsoup.parse(input, "UTF-8", " Element content = doc.getElementById("content");Elements links = content.getElementsByTag("a");for (Element link : links) { String linkHref = link.attr("href"); String linkText = link.text();} Description Elements provide a range of DOM-like methods to find elements, and extract and manipulate their data.

Finding elements Element data Manipulating HTML and text. Coding, by Derek Young: Using Eclipse Efficiently. Using Eclipse Efficiently Wednesday November 14, 2007 by Derek Young Eclipse is a powerful tool with a lot of features.

coding, by Derek Young: Using Eclipse Efficiently

I’m always looking for tips on working more efficiently. Most of the time when I come across a page of Eclipse tips it’s just the most basic usage, like “hit F3 to go to a declaration!” I’ve tried to put together some lesser known tips and features that I see my coworkers overlooking when I stop by their cube. Comparison - How do you compare two version Strings in Java. Downloader.java. Opinion / Lead : Believe me, Muslims are not a herd. The myth of the Muslim vote bank, though denied by sociologists and debunked by psephologists, refuses to die.

Opinion / Lead : Believe me, Muslims are not a herd

It reasserts itself with new vigour at every election. Even those well aware of the diversity within the community cannot resist building their arguments on this spurious claim. The vote bank theory has been convenient for labelling Muslims and shoving them into handy brackets. It was done in India to explain the political behaviour of Muslims across regional, linguistic, caste, class and social barriers. Java servlet file Upload example, JSP file upload,file upload servlet tutorial. Abdus Salam. Hacker Typer. Use DOM parser to deal with XML document with attributes : DOM Node « XML  XML Parsers. In order to avoid the difficulties inherent in parsing raw XML input, almost all programs that need to process XML documents rely on an XML parser to actually read the document.

XML Parsers

The parser is a software library (in Java it’s a class) that reads the XML document and checks it for well-formedness. Client applications use method calls defined in the parser API to receive or request information the parser retrieves from the XML document. The parser shields the client application from all the complex and not particularly relevant details of XML including: How can I see POST methods in raw HTTP that my computer sends to a page. How to use HttpURLConnection POST data to web server? How to post XML to server thru HTML form. A RESTful Web service, an example. When using Eclipse, what are the set of shortcuts, that increase productivity. Become an Eclipse hotkey showoff. The great thing about Eclipse is that it's so feature rich.

Become an Eclipse hotkey showoff

If you can't find a feature, then either you just haven't looked hard enough or there's a plug-in that adds it. The worst thing about Eclipse is also that it's so feature rich. The toolbars are crowded, the menus are congested, and the configuration dialogs remind me of the Minotaur's labyrinth (although configuration is much better in version 3.1). Even experienced Eclipse programmers are slow and clumsy users. Java - How can I list all the files in folder on tomcat. Getting started with Java servlets. Getting started with Java servlets To get Java servlets up and running requires more than knowledge about Java in general or servlets in particular: one needs to know about servers, servlet containers, and XML.

Getting started with Java servlets

To get started, it is useful to have some "cookbook" instructions, however published books shy away from such instructions, in part because the technical details keep changing. A Web-based guide can be more current: this document is meant to get you started using the book "Java Servlet Programming". This guide takes a lowest-common-denominator platform using recent versions of free servlet-related software that you can run on your local computer as well as a low cost reliable Web-hosting arrangement for running your servlets from the Web.