Tutorial by Examples: c

mock-data.ts Create the mock api data export class MockData { createDb() { let mock = [ { id: '1', name: 'Object A' }, { id: '2', name: 'Object B' }, { id: '3', name: 'Object C' }, { id: '4', name: 'Object D' } ]; return {mock}; } } main.t...
Django is a full stack, feature rich web development framework. It bundles a lot of functionality together to provide a common, quick and productive experience for web developers. Django projects consist of common settings, and one or more applications. Each application is a set of functionality al...
A view is any piece of code that responds to a request and returns a response. Views normally return templates along with a dictionary (called the context) which usually contains data for placeholders in the template. In django projects, views are located in the views.py module of applications. Th...
In django, a template is simply a file that contains special tags which may be replaced by data from the view. The canonical template example would be: <strong>Hello {{ name }}, I am a template!</strong> Here, the string {{ name }} identifies a placeholder that may be replaced by a ...
In django, there is a url mapper which maps URLs to specific functions (views) which return responses. This strict separation between the file system layout and the URL layout allows great flexibility when writing applications. All url patterns are stored in one or more urls.py files, and there is ...
add_shortcode is wp keyword. // recent-posts is going to be our shortcode. add_shortcode('recent-posts', 'recent_posts_function'); // This function is taking action when recent post shortcode is called. function recent_posts_function() { query_posts(array('orderby' => 'date', 'order' =&...
This functions takes parameter for how many recent posts you want to display. Ex : you want to display only five recent posts. Just passed the arguments with posts="5" (you can pass any number of recent posts that you want to display). Function fetch only five recent posts from database....
ASP.NET Core provides the status code pages middleware, that supports several different extension methods, but we are interesting in UseStatusCodePages and UseStatusCodePagesWithRedirects: UseStatusCodePages adds a StatusCodePages middleware with the given options that checks for responses with...
href binding is not native to KnockoutJS, so to get dynamic links use a custom binding handler: <a data-bind="href: myUrl">link with dynamic href</a> ko.bindingHandlers['href'] = { update: function(element, valueAccessor) { element.href = ko.utils.unwrapObservable(v...
/* SD card test This example shows how use the utility libraries on which the' SD library is based in order to get info about your SD card. Very useful for testing a card when you're not sure whether its working or not. The circuit: * SD card attached to SPI bus as follows: ** MOS...
/* SD card datalogger This example shows how to log data from three analog sensors to an SD card using the SD library. The circuit: * analog sensors on analog ins 0, 1, and 2 * SD card attached to SPI bus as follows: ** MOSI - pin 11 ** MISO - pin 12 ** CLK - pin 13 ** CS - ...
/* SD card file dump This example shows how to read a file from the SD card using the SD library and send it over the serial port. The circuit: * SD card attached to SPI bus as follows: ** MOSI - pin 11 ** MISO - pin 12 ** CLK - pin 13 ** CS - pin 4 created 22 December 20...
/* SD card basic file example This example shows how to create and destroy an SD card file The circuit: * SD card attached to SPI bus as follows: ** MOSI - pin 11 ** MISO - pin 12 ** CLK - pin 13 ** CS - pin 4 created Nov 2010 by David A. Mellis modified 9 Apr 2012 by ...
/* SD card read/write This example shows how to read and write data to and from an SD card file The circuit: * SD card attached to SPI bus as follows: ** MOSI - pin 11 ** MISO - pin 12 ** CLK - pin 13 ** CS - pin 4 created Nov 2010 by David A. Mellis modified 9 Apr 2012 ...
ggplot(iris[iris$Species == "setosa",],aes(Sepal.Width)) + geom_density() Here, we are subsetting the dataframe before passing it to ggplot. It is a very useful tool derived from the data frame data structure. To make the code more readable, one can also use dplyr's filter: libr...
When testing with Google App Engine's testing library the challenges of eventual consistency are present in the same manner they will be in production. Therefore in order to write something into the datastore to test retrieval you have to create a context which is strongly consistent. type Foo str...
This example shows how to find circular blobs in an grayscale image. The evaluation of the circularity of a blob is done using the area and the perimeter (arc length) of the contour. The center point gets evaluated using the moments of the contour. #include "opencv/cv.h" #include &quot...
install loaders npm install --save-dev ts-loader source-map-loader tsconfig.json { "compilerOptions": { "sourceMap": true, "noImplicitAny": true, "module": "commonjs", "target": "es5", "jsx&quo...
/// <summary> /// Button with some additional options /// </summary> public class TurboButton : Button { public static readonly BindableProperty StringDataProperty = BindableProperty.Create( propertyName: "StringData", returnType: typeof(string), d...
When the temp table is created by itself, it will remain while the connection is open. // Widget has WidgetId, Name, and Quantity properties public async Task PurchaseWidgets(IEnumerable<Widget> widgets) { using(var conn = new SqlConnection("{connection string}")) { ...

Page 559 of 826