Tutorial by Examples

Reading file using a BufferedInputStream generally faster than FileInputStream because it maintains an internal buffer to store bytes read from the underlying input stream. import java.io.BufferedInputStream; import java.io.FileInputStream; import java.io.IOException; public class FileReadin...
Plain lists are the simplest type of list in Common Lisp. They are an ordered sequence of elements. They support basic operations like getting the first element of a list and the rest of a list in constant time, support random access in linear time. (list 1 2 3) ;=> (1 2 3) (first (list 1 ...
Plain lists are useful for representing a sequence of elements, but sometimes it is more helpful to represent a kind of key to value mapping. Common Lisp provides several ways to do this, including genuine hash tables (see 18.1 Hash Table Concepts). There are two primary ways or representing key t...
Plain lists are useful for representing a sequence of elements, but sometimes it is more helpful to represent a kind of key to value mapping. Common Lisp provides several ways to do this, including genuine hash tables (see 18.1 Hash Table Concepts). There are two primary ways or representing key t...
Each Java Thread has an interrupt flag, which is initially false. Interrupting a thread, is essentially nothing more than setting that flag to true. The code running on that thread can check the flag on occasion and act upon it. The code can also ignore it completely. But why would each Thread have...
The double tap, like a single tap, also uses the UITapGestureRecognizer. You simply set the numberOfTapsRequired to 2. Swift override func viewDidLoad() { super.viewDidLoad() // Double Tap let doubleTapGesture = UITapGestureRecognizer(target: self, action: #selector(handleDoubleTa...
The UILongPressGestureRecognizer lets you listen for a long press on a view. You can set the length of delay before the action method is called. Swift override func viewDidLoad() { super.viewDidLoad() // Long Press let longPressGesture = UILongPressGestureRecognizer(target: self, ...
Swipe gestures allow you to listen for the user moving their finger across the screen quickly in a certain direction. Swift override func viewDidLoad() { super.viewDidLoad() // Swipe (right and left) let swipeRightGesture = UISwipeGestureRecognizer(target: self, action: #selector(...
Pinches are a two fingered gesture where the fingers move closer or farther from each other. This gesture is generally used for resizing a view. Swift override func viewDidLoad() { super.viewDidLoad() // Pinch let pinchGesture = UIPinchGestureRecognizer(target: self, action: #sele...
Two fingers rotating around a center can be listened for with the UIRotationGestureRecognizer. This is generally used for rotating a view. Swift override func viewDidLoad() { super.viewDidLoad() // Rotate let rotateGesture = UIRotationGestureRecognizer(target: self, action: #selec...
Drag a gesture recognizer from the object library onto your view. Control drag from the gesture in the Document Outline to your View Controller code in order to make an Outlet and an Action. Notes This example comes from this fuller sample project demonstrating gesture recognizers.
//Creates a Random instance with a seed of 12345. Random random = new Random(12345L); //Gets a ThreadLocalRandom instance ThreadLocalRandom tlr = ThreadLocalRandom.current(); //Set the instance's seed. tlr.setSeed(12345L); Using the same seed to generate random numbers will return the sa...
Time series data can be stored as a ts object. ts objects contain information about seasonal frequency that is used by ARIMA functions. It also allows for calling of elements in the series by date using the window command. #Create a dummy dataset of 100 observations x <- rnorm(100) #Convert ...
Jetty is a Java-based, open-source project providing a HTTP server/client and javax.servlet container. Jetty also provides support for HTTP/2, JMX, JNDI, OSGi JAAS and other integrations. Jetty can be deployed as a standard distribution package or as an embeddable web server, allowing users to custo...
The current release version of Jetty is 9.4. Support is still provided for Jetty 9.2 and 9.3, and maintenance releases are provided for Jetty 7 and Jetty 8 when needed. The most up-to-date distributions can be found on the Jetty Downloads page. It is worth noting that current releases of Jetty requ...
Add below entries in pom.xml. <dependency> <groupId>org.springframework.security</groupId> <artifactId>spring-security-web</artifactId> <version>3.1.0.RELEASE</version> </dependency> <dependency> <groupId>org.springfr...
Bytecode is the set of instructions used by the JVM. To illustrate this let's take this Hello World program. public static void main(String[] args){ System.out.println("Hello World"); } This is what it turns into when compiled into bytecode. public static main([Ljava/lang/String...
Firstly the classes from the jar need to be loaded. We'll use three methods for this process: loadClasses(File) readJar(JarFile, JarEntry, Map) getNode(byte[]) Map<String, ClassNode> loadClasses(File jarFile) throws IOException { Map<String, ClassNode> classes = new HashMap&...
/** * Load a class by from a ClassNode * * @param cn * ClassNode to load * @return */ public static Class<?> load(ClassNode cn) { ClassWriter cw = new ClassWriter(ClassWriter.COMPUTE_FRAMES); return new ClassDefiner(ClassLoader.getSystemClassLoader()).get(cn....
public static void main(String[] args) throws Exception { File jarFile = new File("Input.jar"); Map<String, ClassNode> nodes = JarUtils.loadClasses(jarFile); Map<String, byte[]> out = JarUtils.loadNonClassEntries(jarFile); Map<String, String> map...

Page 500 of 1336