Tutorial by Examples: sin

Classification in Machine Learning is the problem that identifies to which set of categories does a new observation belong. Classification falls under the category of Supervised Machine Learning. Any algorithm that implements classification is known as classifier The classifiers supported in P...
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...
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 ...
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...
JSON that has been encoded as a string can easily be parsed into a standard Julia type: julia> using JSON julia> JSON.parse("""{ "this": ["is", "json"], "numbers": [85, 16, 12.0], "and": [t...
Memcache is a distributed object caching system and uses key-value for storing small data. Before you start calling Memcache code into PHP, you need to make sure that it is installed. That can be done using class_exists method in php. Once it is validated that the module is installed, you start with...
A simple example which provides the options: OptAlt. OptDetails-h--helpShow help-v--versionShow version info-dr path--doc-root pathAn option which takes a secondary parameter (a path)-i--installA boolean option (true/false)-*--Invalid option #!/bin/bash dr='' install=false skip=false for op ...
The following script shows more advanced split file technique, where FOR function loops through a list of files in a directory, and each file content is piped to FINDSTR that looks for a string containing substring var preceded by undefined number of spaces and superseded by any extra text. Once fou...
To download a file from remote server to the local machine - type: scp tom@server2:$HOME/file.txt /local/machine/path/ This example shows how to download the file named file.txt from user tom's home directory to our local machine's current directory.
|& connects standard output and standard error of the first command to the second one while | only connects standard output of the first command to the second command. In this example, the page is downloaded via curl. with -v option curl writes some info on stderr including , the downloaded pag...
There is a mantra that some Java experts are wont to recite: "Exceptions should only be used for exceptional cases." (For example: http://programmers.stackexchange.com/questions/184654 ) The essence of this is that is it is a bad idea (in Java) to use exceptions and exception handli...
core.async is about making processes that take values from and put values into channels. (require [clojure.core.async :as a]) Creating channels with chan You create a channel using the chan function: (def chan-0 (a/chan)) ;; unbuffered channel: acts as a rendez-vous point. (def chan-1 (a/chan...
One of the core benefits of Typescript is that it enforces data types of values that you are passing around your code to help prevent mistakes. Let's say you're making a pet dating application. You have this simple function that checks if two pets are compatible with each other... checkCompatible...
BufferedImage cat = ImageIO.read(new File("cat.jpg")); //read existing file //modify it Graphics g = cat.createGraphics(); g.setColor(Color.RED); g.drawString("Cat", 10, 10); g.dispose(); //now create a new image BufferedImage cats = new BufferedImage(256, 256, Buffere...
Let's say we have a table team_person as below: +======+===========+ | team | person | +======+===========+ | A | John | +------+-----------+ | B | Smith | +------+-----------+ | A | Walter | +------+-----------+ | A | Louis | +------+-----------+ | C | ...
R contains a Date class, which is created with as.Date(), which takes a string or vector of strings, and if the date is not in ISO 8601 date format YYYY-MM-DD, a formatting string of strptime-style tokens. as.Date('2016-08-01') # in ISO format, so does not require formatting string ## [1] &quot...
NIO appeared in Java 1.4 and introduced the concept of "Channels", which are supposed to be faster than regular I/O. Network-wise, the SelectableChannel is the most interesting as it allows to monitor different states of the Channel. It works in a similar manner as the C select() system ca...
You can retrieve the data stored at the located referenced by the pointer variable, using the ToString() method. The following example demonstrates this: using System; namespace UnsafeCodeApplication { class Program { public static void Main() { unsafe { ...

Page 92 of 161