Tutorial by Examples: v

const int a = 0; /* This variable is "unmodifiable", the compiler should throw an error when this variable is changed */ int b = 0; /* This variable is modifiable */ b += 10; /* Changes the value of 'b' */ a += 10; /* Throws a compiler error */ The const qualif...
If while working you realize you're on wrong branch and you haven't created any commits yet, you can easily move your work to correct branch using stashing: git stash git checkout correct-branch git stash pop Remember git stash pop will apply the last stash and delete it from the stash list. T...
process.argv is an array containing the command line arguments. The first element will be node, the second element will be the name of the JavaScript file. The next elements will be any additional command line arguments. Code Example: Output sum of all command line arguments index.js var sum = 0...
var degrees:Number = radians * 180 / Math.PI;
var radians:Number = degrees / 180 * Math.PI;
A whole circle is 360 degrees or Math.PI * 2 radians. Half of those values follows to be 180 degrees or Math.PI radians. A quarter is then 90 degrees or Math.PI / 2 radians. To get a segment as a percentage of a whole circle in radians: function getSegment(percent:Number):Number { retur...
Assuming you have the angle you'd like to move in and an object with x and y values you want to move: var position:Point = new Point(10, 10); var angle:Number = 1.25; You can move along the x axis with Math.cos: position.x += Math.cos(angle); And the y axis with Math.sin: position.y += Mat...
A string can reversed using the built-in reversed() function, which takes a string and returns an iterator in reverse order. >>> reversed('hello') <reversed object at 0x0000000000000000> >>> [char for char in reversed('hello')] ['o', 'l', 'l', 'e', 'h'] reversed() can ...
Sometimes you may only need to simulate an event with two outcomes, maybe with different probabilities, but you may find yourself in a situation that calls for many possible outcomes with different probabilities. Let's imagine you want to simulate an event that has six equally probable outcomes. T...
This example demonstrates creating a basic application in ExtJS using Sencha Cmd to bootstrap the process - this method will automatically generate some code and a skeleton structure for the project. Open a console window and change the working directory to an appropriate space in which to work. ...
2.3-2.3.2 An enclosing CoordinatorLayout can be used to achieve Material Design Scrolling Effects when using inner layouts that support Nested Scrolling, such as NestedScrollView or RecyclerView. For this example: app:layout_scrollFlags="scroll|enterAlways" is used in the Toolbar pro...
A slider element can have its value set on initialization by providing a value option. This option is a number: $( "#slider" ).slider({ value: 5 }); A range slider can also have its values set in this way by providing a values option. This option is an array of numbers: $( &qu...
The slider provides an event called slide that will trigger whenever the mouse moves during a slider handle drag. This function holds a reference to the slide event and a reference to the slider ui object. The ui object holds a jQuery object for the handle being moved and the value(s) of the slide...
The slider provides an event called change that will trigger after the mouse completes a slider handle drag or if the value(s) have been changed programmatically. This function holds a reference to the slide event and a reference to the slider ui object. The ui object holds a jQuery object for the ...
Import in your gradle root file classpath 'com.neenbedankt.gradle.plugins:android-apt:1.8' Import in your gradle app file apt 'com.google.auto.value:auto-value:1.2' apt 'com.ryanharter.auto.value:auto-value-gson:0.3.1' provided 'com.jakewharton.auto.value:auto-value-annotations:1.2-update...
When you need to set a pixel value for something like Paint.setTextSize but still want it be scaled based on the device, you can convert dp and sp values. DisplayMetrics metrics = Resources.getSystem().getDisplayMetrics(); float pixels = TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_SP, 12f, m...
VOLUME ["/data"] The VOLUME instruction creates a mount point with the specified name and marks it as holding externally mounted volumes from native host or other containers. The value can be a JSON array, VOLUME ["/var/log/"], or a plain string with multiple arguments, such a...
ENV ENV <key> <value> ENV <key>=<value> ... The ENV instruction sets the environment variable <key> to the value . This value will be in the environment of all “descendant” Dockerfile commands and can be replaced inline in many as well. The ENV instruction has two...
Calculate a 6-month (126-business-day) centered moving average of a price: SELECT TradeDate, AVG(Px) OVER (ORDER BY TradeDate ROWS BETWEEN 63 PRECEDING AND 63 FOLLOWING) AS PxMovingAverage FROM HistoricalPrices Note that, because it will take up to 63 rows before and after each returned row, at...
Make sure your image object is fully loaded before you try to draw it on the canvas with context.drawImage. Otherwise the image will silently fail to display. In JavaScript, images are not loaded immediately. Instead, images are loaded asynchronously and during the time they take to load JavaScript...

Page 87 of 296