Tutorial by Examples: l

Every custom loader must directly or indirectly extend the java.lang.ClassLoader class. The main extension points are the following methods: findClass(String) - overload this method if your classloader follows the standard delegation model for class loading. loadClass(String, boolean) - overloa...
Clustering is about grouping similar objects together. It is widely used for pattern recognition. Clustering comes under unsupervised machine learning, therefore there is no training needed. PHP-ML has support for the following clustering algorithms k-Means dbscan k-Means k-Means separates ...
The Java language allows you to use new to create instances Integer, Boolean and so on, but it is generally a bad idea. It is better to either use autoboxing (Java 5 and later) or the valueOf method. Integer i1 = new Integer(1); // BAD Integer i2 = 2; // BEST (autoboxing)...
Using new String(String) to duplicate a string is inefficient and almost always unnecessary. String objects are immutable, so there is no need to copy them to protect against changes. In some older versions of Java, String objects can share backing arrays with other String objects. In those ver...
We're all used to the while syntax, that executes its body while the condition is evaluated to true. What if we want to implement an until loop, that executes a loop until the condition is evaluated to true? In Julia, we can do this by creating a @until macro, that stops to execute its body when th...
gnu-cobol is available via the homebrew system. Open a terminal window from /Applications/Utilities/Terminal or use the keypress Command+Space and type "Terminal". If you do not have the homebrew system installed, add it by typing, or copying and pasting into your terminal: ruby -e &quo...
PHP has built in function pcntl_fork for creating child process. pcntl_fork is same as fork in unix. It does not take in any parameters and returns integer which can be used to differentiate between parent and child process. Consider the following code for explanation <?php // $pid is the P...
# This uses the 'sample.xml' given in the XML::Twig example. # Module requirements (1.70 and above for use of load_xml) use XML::LibXML '1.70'; # let's be a good perl dev use strict; use warnings 'all'; # Create the LibXML Document Object my $xml = XML::LibXML->new(); # Where ...
Standalone Common Lisp binaries can be built with buildapp. Before we can use it to generate binaries, we need to install and build it. The easiest way I know how is using quicklisp and a Common Lisp (this example uses [sbcl], but it shouldn't make a difference which one you've got). $ sbcl Thi...
The simplest possible binary you could build Has no dependencies Takes no command line arguments Just writes "Hello world!" to stdout After you've built buildapp, you can just... $ buildapp --eval '(defun main (argv) (declare (ignore argv)) (write-line "Hello, world!"))'...
A more realistic example involves a project you're building with multiple files on disk (rather than an --eval option passed to buildapp), and some dependencies to pull in. Because arbitrary things can happen during the finding and loading of asdf systems (including loading other, potentially unrel...
One example per topic may be pinned by clicking the pin icon in the bottom left corner of the example. So long as a topic is pinned, it will stay at the top of a topic's example collection.
HTML Form Use a file type input and the browser will provide a field that lets the user select a file to upload. Only forms with the post method can send file data. Make sure to set the form's enctype=multipart/form-data attribute. Otherwise the file's name will be sent but not the file's data...
Uploaded files are available in request.files, a MultiDict mapping field names to file objects. Use getlist — instead of [] or get — if multiple files were uploaded with the same field name. request.files['profile'] # single file (even if multiple were sent) request.files.getlist('charts') # li...
WTForms provides a FileField to render a file type input. It doesn't do anything special with the uploaded data. However, since Flask splits the form data (request.form) and the file data (request.files), you need to make sure to pass the correct data when creating the form. You can use a Combine...
It may be useful to have one catch-all view where you handle complex logic yourself based on the path. This example uses two rules: The first rule specifically catches / and the second rule catches arbitrary paths with the built-in path converter. The path converter matches any string (including sl...
An enumerations value in no way needs to be unique: #include <stdlib.h> /* for EXIT_SUCCESS */ #include <stdio.h> /* for printf() */ enum Dupes { Base, /* Takes 0 */ One, /* Takes Base + 1 */ Two, /* Takes One + 1 */ Negative = -1, AnotherZero /* Takes Negativ...
SQL Server 2008 R2 SET TRANSACTION ISOLATION LEVEL REPEATABLE READ This transaction isolation level is slightly less permissive than READ COMMITTED, in that shared locks are placed on all data read by each statement in the transaction and are held until the transaction completes, as opposed to b...
SQL Server 2008 R2 SET TRANSACTION ISOLATION LEVEL SERIALIZEABLE This isolation level is the most restrictive. It requests range locks the range of key values that are read by each statement in the transaction. This also means that INSERT statements from other transactions will be blocked if the...
We can create it by two way. First from database properties designer mode: And by sql scripts: USE master; GO -- Create the database with the default data -- filegroup and a log file. Specify the -- growth increment and the max size for the -- primary data file. CREATE DATABASE TestDB ON...

Page 479 of 861