background preloader

Jenkov.com - Software and Tutorials for Software Developers

Jenkov.com - Software and Tutorials for Software Developers
Related:  excpectocodo

st - A place for geeks to share what they've done, who they did it with and connect with great companies Zip File System Provider Introduction The zip file system provider introduced in the Java SE 7 release is an implementation of a custom file system provider. The zip file system provider treats a zip or JAR file as a file system and provides the ability to manipulate the contents of the file. The demo/nio/zipfs/src.zip file in your Java SE 7 installation contains the source code for the zip file system provider. Using the Zip File System Provider You can use the factory methods of the java.nio.file.FileSystems class to create a new zip file system or to obtain a reference to an existing zip file system. By using the JAR URL syntax defined in the java.net.JarURLConnection class URI uri = URI.create("jar:file:/codeSamples/zipfs/zipfstest.zip"); FileSystem fs = FileSystems.newFileSystem(uri, env); By specifying a path and using automatic file type detection Path zipfile = Paths.get("/codeSamples/zipfs/zipfstest.zip"); FileSystem fs = FileSystems.newFileSystem(zipfile, env, null); Resources

Java Tutorial | Learn Java Our core Java programming tutorial is designed for students and working professionals. Java is an object-oriented, class-based, concurrent, secured and general-purpose computer-programming language. It is a widely used robust technology. What is Java? Java is a programming language and a platform. Java was developed by Sun Microsystems (which is now the subsidiary of Oracle) in the year 1995. Platform: Any hardware or software environment in which a program runs, is known as a platform. Java Example Let's have a quick look at Java programming example. Simple.java class Simple{ public static void main(String args[]){ System.out.println("Hello Java"); } } class Simple{ public static void main(String args[]){ System.out.println("Hello Java"); } } Test it Now Application According to Sun, 3 billion devices run Java. Types of Java Applications There are mainly 4 types of applications that can be created using Java programming: 1) Standalone Application 2) Web Application 3) Enterprise Application

Lorem Ipsum - All the facts - Lipsum generator Java I/O Streams and Channels 15.3. Converting Between Streams and Channels Channels are cool, but streams aren't going away. The java.nio.Channels class provides eight static utility for connecting channels to streams and vice versa. 15.3.1. The newInputStream( ) method converts any ReadableByteChannel , including FileChannel s, into an InputStream : public static InputStream newInputStream(ReadableByteChannel ch) You can use the methods of the InputStream class to read from the channel. XMLReader parser = XMLReaderFactory.createXMLReader( ); FileInputStream in = new FileInputStream("document.xml"); FileChannel channel = in.getChannel( ); Now say you want to pass this channel to the XML parser. in = Channels.newInputStream(channel); parser.parse(in); At this point you may be objecting. Sometimes it's an OutputStream that's needed. public static OutputStream newOutputStream(WritableByteChannel ch) One advantage of these streams is that, unlike most streams, they are threadsafe. 15.3.2. Example 15-4.

Researchers: Depression May Be a Physical Illness Linked to Inflammation In Brief Scientists are now calling the link between depression and inflammation caused by a faulty immune system definitive. Whether it's causal or not, the connection opens up new avenues for treatment, and new hope for sufferers. Physical Roots of Depression Although current treatments for depression mostly focus on brain chemicals such as serotonin, scientists now think inflammation throughout the entire body (triggered by an overactive immune system) may be the root cause of the problem. A growing body of research, including scientific papers and results from clinical trials, appears to be revealing a connection between treating inflammation and alleviating depression. In October 2016, a major review of research on the next generation anti-inflammatory drugs (most often used to treat autoimmune disorders) revealed a definitive link between inflammation and depression. Immuno-Neurology

SpringSource.org | ThreadLocal, partie 1, principes du stockage magique | Codes et autres, sauce java, parfum objet Dans l’API java, on trouve une classe au comportement tout a fait particulier, ThreadLocal. Son principe: stocker des données dans le Thread courant afin de les récupérer plus tard, dans une autre méthode par exemple, sans avoir à les passer en argument à toute la chaine d’appel. Cette classe peut vous être d’un grand secours, mais elle doit être utilisée judicieusement et surtout en extrêmement précautionneusement! La classe ThreadLocal est apparue dans le JDK1.2, vers la fin 1998 (et oui, elle est méconnue, mais elle date!). Son utilisation principale, permettre à plusieurs threads de travailler simultanément sur une variable statique, tout en permettant à chaque Thread d’avoir sa propre instance de la variable ainsi qu’éventuellement, proposer un constructeur pour créer la valeur par défaut pour les threads qui n’en ont pas encore recu. Exemple, soit la classe suivante utilisée par 2 Threads: La première implémentation (jdk 1.2) de cette classe était assez simple.

Sorting Calculations explained Introduction Sorting is ordering a list of objects. We can distinguish two types of sorting. If the number of objects is small enough to fits into the main memory, sorting is called internal sorting. If the number of objects is so large that some of them reside on external storage during the sort, it is called external sorting. Bucket sort Bubble sort Insertion sort Selection sort Heapsort Mergesort O(n) algorithms Bucket Sort Suppose we need to sort an array of positive integers {3,11,2,9,1,5}. Suppose we are sorting a large number of local phone numbers, for example, all residential phone numbers in the 412 area code region (about 1 million) We sort the numbers without use of comparisons in the following way. We immediately see two drawbacks to this sorting algorithm. The first problem is solved by using linked lists, attached to each array index. Moving through the array we increment counters: Next,we simply read off the number of each occurrence: 2 2 3 3 4 5. O(n2) algorithms Bubble Sort

Wireframing Tool for Professionals Fork/Join (The Java™ Tutorials > Essential Classes > Concurrency) The fork/join framework is an implementation of the ExecutorService interface that helps you take advantage of multiple processors. It is designed for work that can be broken into smaller pieces recursively. The goal is to use all the available processing power to enhance the performance of your application. As with any ExecutorService implementation, the fork/join framework distributes tasks to worker threads in a thread pool. The center of the fork/join framework is the ForkJoinPool class, an extension of the AbstractExecutorService class. Basic Use The first step for using the fork/join framework is to write code that performs a segment of the work. if (my portion of the work is small enough) do the work directly else split my work into two pieces invoke the two pieces and wait for the results Wrap this code in a ForkJoinTask subclass, typically using one of its more specialized types, either RecursiveTask (which can return a result) or RecursiveAction. Blurring for Clarity

Laufzeit und O-Notation Laufzeit Man kann den Zeitaufwand von Algorithmen nicht eindeutig bestimmen. Viel zu viele Faktoren (Hardware, parallel laufende Programme, Eingabereihenfolge, ...) spielen eine Rolle, so dass man mit normalen Mitteln niemals eine genaue und allgemeine Aussgae über die benötigte Zeit machen kann. O-Notation Möchten wir nun wissen, ob eine Laufzeit in eine Klasse gehört, so müssen wir ihr asymptotisches Wachstum beobachten. Wir können nun die Laufzeit folgendermaßen einteilen: Die O-Notation ist eine Abschätzung der Laufzeit bei unendlich großen Eingaben. Anwendung Es gibt folgenden Regeln zur Bestimmung der Klasse: Wachstum im Vergleich: 1 < log n < √n < n < n(log n)2 < n2 < na < an Umformen der Basen von Logerithmen: logcb = logab / logac O - Notation Wichtige Laufzeiten Tiefensuche O(V+E)Breitensuche O(V+E)Dijktra O(V+E) Merkblatt der O-Notation von Augustin O-Notation: Definition auf der Sortieralgorithmen-SeiteLaufzeit FibonacciLaufzeit reverse

www.tuaw.com/about Established December 5, 2004, The Unofficial Apple Weblog (TUAW) is a resource for all things Apple and beyond. TUAW publishes news stories, credible rumors and how-to's covering a variety of topics daily. As a trusted tech blog, TUAW provides opinion and analysis on the news in addition to the facts. TUAW is a trusted source for news, information and analysis about Apple and its products. Our readership is made up of new users, intermediate and business users and advanced users. TUAW's writers and editors are trusted worldwide for their fair reviews, and TUAW reviews everything from hardware to software to accessories and bags. Mel Martin Writer, App review (specializes in photo, news and GPS apps)

Related: