Tutorial by Examples: 3

<svg width="900px" height="400px" viewBox="0 0 900 400"> <defs> <filter id="BokehBlur" color-interpolation-filters="sRGB"> <feGaussianBlur stdDeviation="2" result="blurSource"/> <feCol...
Padding Remember, members of a struct are usually padded to ensure they are aligned on their natural boundary: struct t { int a, b, c, d; // a is at offset 0, b at 4, c at 8, d at 0ch char e; // e is at 10h short f; // f is at 12h (naturally aligned) lo...
This example is based on a blog post by Nicolas Hery. It utilizes ES6 classes and ReactJS's lifecycle methods to keep the D3 component updated d3_react.html <!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>Hello, d3React!</title>...
We can use org.apache.commons.lang3.RandomUtils to generate random numbers using a single line. int x = RandomUtils.nextInt(1, 1000); The method nextInt(int startInclusive, int endExclusive) takes a range. Apart from int, we can generate random long, double, float and bytes using this class. R...
Create a Dictionary<TKey, TValue> from an IEnumerable<T>: using System; using System.Collections.Generic; using System.Linq; public class Fruits { public int Id { get; set; } public string Name { get; set; } } var fruits = new[] { new Fruits { Id = 8 , Nam...
CSS div.needle { margin: 100px; height: 150px; width: 150px; transform: rotateY(85deg) rotateZ(45deg); /* presentational */ background-image: linear-gradient(to top left, #555 0%, #555 40%, #444 50%, #333 97%); box-shadow: inset 6px 6px 22px 8px #272727; } HTML <div c...
HTML: <div id="title"> <h1 data-content="HOVER">HOVER</h1> </div> CSS: *{margin:0;padding:0;} html,body{height:100%;width:100%;overflow:hidden;background:#0099CC;} #title{ position:absolute; top:50%; left:50%; transform:translate(-50%,-...
In this example we illustrate how to take a double real-type 3D matrix from MATLAB, and pass it to a C double* array. The main objectives of this example are showing how to obtain data from MATLAB MEX arrays and to highlight some small details in matrix storage and handling. matrixIn.cpp #include...
Android 6 (API23) introduced Doze mode which interferes with AlarmManager. It uses certain maintenance windows to handle alarms, so even if you used setExactAndAllowWhileIdle() you cannot make sure that your alarm fires at the desired point of time. You can turn this behavior off for your app using...
Microcontrollers use pins to interact with the rest of the circuit. These pins will usually be one of input / output pins, vin or ground. I/O pins can be simple digital I/O pins, or they can have some special carachteristics like being able to vary the voltage of their output using pulse width modul...
This example shows how to establish a connection to an SSL-enabled POP3 email server and send a simple (text only) email. // Configure mail provider Properties props = new Properties(); props.put("mail.smtp.host", "smtp.mymailprovider.com"); props.put("ma...
<style> input:in-range { border: 1px solid blue; } </style> <input type="number" min="10" max="20" value="15"> <p>The border for this value will be blue</p> The :in-range CSS pseudo-class matches when an element...
Rebar3 is written in Erlang, so you need Erlang to run it. It is available as a binary that you can download and run. Just fetch the nightly build and give it execution permissions: $ wget https://s3.amazonaws.com/rebar3/rebar3 && chmod +x rebar3 Place this binary in a convenient place a...
Using D3js with Angular can open up new fronts of possibilities such as live updation of charts as soon as data is updated. We can encapsulate complete chart functionality within an Angular directive, which makes it easily reusable. index.html >> <!DOCTYPE html> <html ng-app="...
Note: Following instructions are written for Python 2.7 (unless specified): instructions for Python 3.x are similar. WINDOWS First, download the latest version of Python 2.7 from the official Website (https://www.python.org/downloads/). Version is provided as an MSI package. To install it manu...
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...
If you wish to make a complete backup of a large MySql installation and do not have sufficient local storage, you can dump and compress it directly to an Amazon S3 bucket. It's also a good practice to do this without having the DB password as part of the command: mysqldump -u root -p --host=localho...
Notice, this is only for angular-cli up to 1.0.0-beta.10 version ! Some libraries or plugins may not have typings. Without these, TypeScript can't type check them and therefore causes compilation errors. These libraries can still be used but differently than imported modules. Include a scr...
Before starting with the example I'd recommend to create a Singleton with a delegate class member so you could achieve a use case of uploading a file in the background and let the user keep using your app while the files are being uploaded even when the app is the background. Let's start, first, we...
def to_flare_json(df, filename): """Convert dataframe into nested JSON as in flare files used for D3.js""" flare = dict() d = {"name":"flare", "children": []} for index, row in df.iterrows(): parent = row[...

Page 3 of 11