So far, we have looked at inserting a node at the beginning of a singly linked list. However, most of the times you will want to be able to insert nodes elsewhere as well. The code written below shows how it is possible to write an insert() function to insert nodes anywhere in the linked lists.
#...
To start the process:
$ forever start index.js
warn: --minUptime not set. Defaulting to: 1000ms
warn: --spinSleepTime not set. Your script will exit if it does not stay up for at least 1000ms
info: Forever processing file: index.js
List running Forever instances:
$ forever list
i...
To create a parallel collection from a sequential collection, call the par method. To create a sequential collection from a parallel collection, call the seq method. This example shows how you turn a regular Vector into a ParVector, and then back again:
scala> val vect = (1 to 5).toVector
vect:...
The most common mode of using TensorFlow involves first building a dataflow graph of TensorFlow operators (like tf.constant() and tf.matmul(), then running steps by calling the tf.Session.run() method in a loop (e.g. a training loop).
A common source of memory leaks is where the training loop conta...
context.lineCap=capStyle // butt (default), round, square
Sets the cap style of line starting points and ending points.
butt, the default lineCap style, shows squared caps that do not extend beyond the line's starting and ending points.
round, shows rounded caps that extend beyond the ...
context.lineJoin=joinStyle // miter (default), round, bevel
Sets the style used to connect adjoining line segments.
miter, the default, joins line segments with a sharp joint.
round, joins line segments with a rounded joint.
bevel, joins line segments with a blunted joint.
<!doctype...
context.strokeStyle=color
Sets the color that will be used to stroke the outline of the current path.
These are color options (these must be quoted):
A CSS named color, for example context.strokeStyle='red'
A hex color, for example context.strokeStyle='#FF0000'
An RGB color, for e...
context.fillStyle=color
Sets the color that will be used to fill the interior of the current path.
These are color options (these must be quoted):
A CSS named color, for example context.fillStyle='red'
A hex color, for example context.fillStyle='#FF0000'
An RGB color, for example ...
context.lineWidth=lineWidth
Sets the width of the line that will stroke the outline of the path
<!doctype html>
<html>
<head>
<style>
body{ background-color:white; }
#canvas{border:1px solid red; }
</style>
<script>
window.onload=(function(){...
shadowColor = color // CSS color
shadowBlur = width // integer blur width
shadowOffsetX = distance // shadow is moved horizontally by this offset
shadowOffsetY = distance // shadow is moved vertically by this offset
This set of attributes will add a shadow around a path.
Bo...
int main (void)
{
const int foo_readonly = 10;
int *foo_ptr;
foo_ptr = (int *)&foo_readonly; /* (1) This casts away the const qualifier */
*foo_ptr = 20; /* This is undefined behavior */
return 0;
}
Quoting ISO/IEC 9899:201x, section 6.7.3 §2:
If an attempt i...
To calculate moving average of salary of the employers based on their role:
val movAvg = sampleData.withColumn("movingAverage", avg(sampleData("Salary"))
.over( Window.partitionBy("Role").rowsBetween(-1,1)) )
withColumn() creates a new column named m...
The format of the struct statement is this:
struct [structure tag]
{
member definition;
member definition;
...
member definition;
} [one or more structure variables];
Example: declare the ThreeFloats structure:
typedef struct {
float x, y, z;
} ThreeFloats;
@inter...
Class Car
Private wheels_
Private distances_
' Property getter
Public Property Get Wheels()
Wheels = wheels_
End Property
' Property setter
Public Property Let Wheels(v)
wheels_ = v
End Property
' Parameterless Constructo...
' Initialize the object
Dim myCar
Set myCar = new Car
' Setting a property
myCar.Wheels = 4
' Getting a property value
wscript.echo myCar.Wheels
' Using a subroutine in a class
myCar.Drive 10
myCar.Drive 12
' Using a function in a class
wscript.echo myCar.GetTotalDistance() ' r...
This example shows the process from designing the shape you want to drawing it on a view. A specific shap is used but the concepts you learn can be applied to any shape.
How to draw a Bézier path in a custom view
These are the main steps:
Design the outline of the shape you want.
Divide the ou...
Useful information
The very beginning of the text field text:
let startPosition: UITextPosition = textView.beginningOfDocument
The very end of the text field text:
let endPosition: UITextPosition = textView.endOfDocument
The currently selected range:
let selectedRange: UITextRange? = textV...