Tutorial by Examples: and

import java.util.Scanner; Scanner s = new Scanner(System.in); int number = s.nextInt(); If you want to read an int from the command line, just use this snippet. First of all, you have to create a Scanner object, that listens to System.in, which is by default the Command Line, when you start ...
You can place an SKCameraNode into an SKScene to define which part of the scene is shown in the SKView. Think of the SKScene as a 2D world with a camera floating above it: the SKView will show what the camera 'sees'. E.g. the camera could be attached to the main character's sprite to follow the act...
The following function can be used to get some basic information about the current browser and return it in JSON format. function getBrowserInfo() { var json = "[{", /* The array containing the browser info */ info = [ navigator.userA...
The easiest and quickest way to encode a Haskell data type to JSON with Aeson is using generics. {-# LANGUAGE DeriveGeneric #-} import GHC.Generics import Data.Text import Data.Aeson import Data.ByteString.Lazy First let us create a data type Person: data Person = Person { firstName :...
Media queries are not supported at all in IE8 and below. A Javascript based workaround To add support for IE8, you could use one of several JS solutions. For example, Respond can be added to add media query support for IE8 only with the following code : <!--[if lt IE 9]> <script ...
This program demonstrates how to run another process using fork() and wait its termination using waitpid(): fork() creates an identical copy of the current process. The original process is the parent process, while the newly created one is the child process. Both processes continue exactly afte...
The complete sample code for this application (Android + Node server) is available in the PayPal Developer Github repository. The first stage of creating the Android portion of our application is to set up a basic layout and handle responses that come back from the server that we'll set up in Node....
The complete sample code for this application (Android + Node server) is available in the PayPal Developer Github repository. At this point the PayPal future payments button has been clicked, we have an auth code and metadata ID from the PayPal SDK, and we need to pass those on to our server to com...
The complete sample code for this application (Android + Node server) is available in the PayPal Developer Github repository. From step 2, an async request has been made to our server at the /fpstore endpoint, passing along the auth code and metadata ID. We now need to exchange those for a token in...
Lets say we have a class Classy that has property Propertua public class Classy { public string Propertua {get; set;} } to set Propertua using reflection: var typeOfClassy = typeof (Classy); var classy = new Classy(); var prop = typeOfClassy.GetProperty("Propertua"); prop.Se...
The macros @spawn and @spawnat are two of the tools that Julia makes available to assign tasks to workers. Here is an example: julia> @spawnat 2 println("hello world") RemoteRef{Channel{Any}}(2,1,3) julia> From worker 2: hello world Both of these macros will evaluate an ex...
According to the documentation under ?@async, "@async wraps an expression in a Task." What this means is that for whatever falls within its scope, Julia will start this task running but then proceed to whatever comes next in the script without waiting for the task to complete. Thus, for...
SELECT s.name AS [schema], t.object_id AS [table_object_id], t.name AS [table_name], c.column_id, c.name AS [column_name], i.name AS [index_name], i.type_desc AS [index_type] FROM sys.schemas AS s INNER JOIN sys.tables AS t ON s.schema_id = t.schema_id I...
You can use limit to tell the number of records to be fetched, and use offset to tell the number of records to skip before starting to return the records. For Example User.limit(3) #returns first three records It will generate following sql query. "SELECT `users`.* FROM `users` LIMIT 3&q...
AppDomain.UnhandledException This event provides notification of uncaught exceptions.It allows the application to log information about the exception before the system default handler reports the exception to the user and terminates the application.If sufficient information about the state of the a...
The using keyword ensures that the resource defined within the statement only exists within the scope of the statement itself. Any resources defined within the statement must implement the IDisposable interface. These are incredibly important when dealing with any connections that implement the IDi...
Extension methods can be used to "hide" processing of inelegant business rules that would otherwise require cluttering up a calling function with if/then statements. This is similar to and analogous to handling nulls with extension methods. For example, public static class CakeExtensions ...
If you need to write a file using different locale settings to the default, you can use std::locale and std::basic_ios::imbue() to do that for a specific file stream: Guidance for use: You should always apply a local to a stream before opening the file. Once the stream has been imbued you shoul...
By default, a new class module is a Private class, so it is only available for instantiation and use within the VBProject in which it is defined. You can declare, instantiate and use the class anywhere in the same project: 'Class List has Instancing set to Private 'In any other module in the SAME ...
An object can only be deallocated by delete if it was allocated by new and is not an array. If the argument to delete was not returned by new or is an array, the behavior is undefined. An object can only be deallocated by delete[] if it was allocated by new and is an array. If the argument to delet...

Page 69 of 153