Tutorial by Examples: c

To check if a value exits in a WeakSet, use the .has() method. const obj1 = {}, obj2 = {}; const weakset = new WeakSet([obj1]); console.log(weakset.has(obj1)); // true console.log(weakset.has(obj2)); // false
import java.util.stream.IntStream; public class Concurrent { public static void printAndWait(String s) { System.out.println(s); try { Thread.sleep(1000); } catch (Exception e) {} } public static void main(String[] args) { Threa...
Our server object is given an 'application' parameter which can be any callable application object (see other examples). It writes first the headers, then the body of data returned by our application to the system standard output. import os, sys def run(application): environ['wsgi.inpu...
Description This is a self-contained running example including/showcasing: minimum dependencies needed, Java Configuration, Bean declaration by annotation and Java Configuration, Dependency Injection by Constructor and by Property, and Pre/Post hooks. Dependencies These dependencies are needed in...
Once an object has an effective type, you should not attempt to modify it through a pointer of another type, unless that other type is a character type, char, signed char or unsigned char. #include <inttypes.h> #include <stdio.h> int main(void) { uint32_t a = 57; // conversion...
To do this first locate config folder in your root. Then open connections.js Locate // someMysqlServer: { // adapter: 'sails-mysql', // host: 'YOUR_MYSQL_SERVER_HOSTNAME_OR_IP_ADDRESS', // user: 'YOUR_MYSQL_USER', //optional // password: 'YOUR_MYSQL_PASSWORD', //optional /...
A problem: Canvas only remembers pixels, not shapes or images This is an image of a circular beach ball, and of course, you can't drag the ball around the image. It may surprise you that just like an image, if you draw a circle on a Canvas you cannot drag that circle around the canvas. That's be...
What is a "Shape"? You typically save your shapes by creating a JavaScript "shape" object representing each shape. var myCircle = { x:30, y:20, radius:15 }; Of course, you're not really saving shapes. Instead, you're saving the definition of how to draw the shapes. Then put...
Most Canvas drawings are either rectangular (rectangles, images, text-blocks) or circular (circles). Circles & rectangles have mathematical tests to check if the mouse is inside them. This makes testing circles and rectangles easy, quick and efficient. You can "hit-test" hundreds of c...
See this Example for a general explanation of dragging Shapes around the Canvas. This annotated example shows how to drag images around the Canvas // canvas related vars var canvas=document.createElement("canvas"); var ctx=canvas.getContext("2d"); canvas.width=378; canvas.h...
Here is an example of an IntentService that pretends to load images in the background. All you need to do to implement an IntentService is to provide a constructor that calls the super(String) constructor, and you need to implement the onHandleIntent(Intent) method. public class ImageLoaderIntentSe...
The exposition pipe operator, %$%, exposes the column names as R symbols within the left-hand side object to the right-hand side expression. This operator is handy when piping into functions that do not have a data argument (unlike, say, lm) and that don't take a data.frame and column names as arg...
Given the 3 points of a quadratic curve the following function returns the length. function quadraticBezierLength(x1,y1,x2,y2,x3,y3) var a, e, c, d, u, a1, e1, c1, d1, u1, v1x, v1y; v1x = x2 * 2; v1y = y2 * 2; d = x1 - v1x + x3; d1 = y1 - v1y + y3; e = v1x - 2 * x1; ...
Open Script Editor. 2.12.4 With Mac OS X Leopard and earlier, and OS X Yosemite and later, Script Editor is located at /Applications/Utilities/Script Editor.app 2.12.4 Between Mac OS X Snow Leopard and OS X Mavericks inclusive, Script Editor is AppleScript Editor. /Applications/Utiliti...
Composing multiple functions into one is a functional programming common practice; composition makes a pipeline through which our data will transit and get modified simply working on the function-composition (just like snapping pieces of a track together)... you start out with some single responsi...
Python's built-in crypto functionality is currently limited to hashing. Encryption requires a third-party module like pycrypto. For example, it provides the AES algorithm which is considered state of the art for symmetric encryption. The following code will encrypt a given message using a passphrase...
Consider the following Python2.x code. Save the file as example.py Python 2.x2.0 def greet(name): print "Hello, {0}!".format(name) print "What's your name?" name = raw_input() greet(name) In the above file, there are several incompatible lines. The raw_input() meth...
c++17 C++17 introduces int std::uncaught_exceptions() (to replace the limited bool std::uncaught_exception()) to know how many exceptions are currently uncaught. That allows for a class to determine if it is destroyed during a stack unwinding or not. #include <exception> #include <strin...
In VBA, this attribute is ignored. It was not ported over from VB6. In VB6, it creates a Default Global Instance of the class (a "shortcut") so that class members can be accessed without using the class name. For example, DateTime (as in DateTime.Now) is actually part of the VBA.Conversio...
This attribute is ignored. It was not ported over from VB6. In VB6, it was used in combination with the VB_Exposed attribute to control accessibility of classes outside of the current project. VB_Exposed=True VB_Creatable=True Would result in a Public Class, that could be accessed from other ...

Page 457 of 826