Tutorial by Examples: c

@Configuration @EnableAsync public class ApplicationConfiguration{ @Bean public TaskExecutor getAsyncExecutor() { ThreadPoolTaskExecutor executor = new ThreadPoolTaskExecutor(); executor.setCorePoolSize(2); executor.setThreadNamePrefix("executor-task...
Let say you want to create css/js file specific to a platform. For that you have to create a merges folder in root folder of you cordova porject. In merges folder create directory for each platform (android/ios..). then in specific platform folder create a css/js folder and put your css/js file spec...
/* * This example show some ways of using std::function to call * a) C-like function * b) class-member function * c) operator() * d) lambda function * * Function call can be made: * a) with right arguments * b) argumens with different order, types and count */ #include &lt...
Some programs need so store arguments for future calling of some function. This example shows how to call any function with arguments stored in std::tuple #include <iostream> #include <functional> #include <tuple> #include <iostream> // simple function to be called d...
In the following example there are 2 Screens: SettingsScreen and MenuScreen Using the first button, on the current screen will change your screen to the other screen. Here is the code: from kivy.app import App from kivy.lang import Builder from kivy.uix.screenmanager import ScreenManager, Scr...
public async Task<actionresult> Index() { return View("View", await db.UserMasers.ToListAsync()); }
Typescript supports costant enumerables, declared through const enum. This is usually just syntax sugar as the costant enums are inlined in compiled JavaScript. For instance the following code const enum Tristate { True, False, Unknown } var something = Tristate.True; compil...
The ConstainsKey method is the way to know if a key already exists in the Dictionary. This come in handy for data reduction. In the sample below, each time we encountner a new word, we add it as a key in the dictionary, else we increment the counter for this specific word. Dim dic As IDictionary(...
Pancake Sort is a the colloquial term for the mathematical problem of sorting a disordered stack of pancakes in order of size when a spatula can be inserted at any point in the stack and used to flip all pancakes above it. A pancake number is the minimum number of flips required for a given number o...
public class PancakeSort { private static void SortPancake(int[] input, int n) { for (var bottom = n - 1; bottom > 0; bottom--) { var index = bottom; var maxIndex = input[bottom]; int i; for (i = bottom - 1; i >= ...
The Caesar cipher is a classic encryption method. It works by shifting the characters by a certain amount. For example, if we choose a shift of 3, A will become D and E will become H. The following text has been encrypted using a 23 shift. THE QUICK BROWN FOX JUMPS OVER THE LAZY DOG QEB NRFZH YOL...
To connect to a mongo database from node application we require mongoose. Installing Mongoose Go to the toot of your application and install mongoose by npm install mongoose Next we connect to the database. var mongoose = require('mongoose'); //connect to the test database running on defau...
With Mongoose, everything is derived from a Schema. Lets create a schema. var mongoose = require('mongoose'); var Schema = mongoose.Schema; var AutoSchema = new Schema({ name : String, countOf: Number, }); // defining the document structure // by default the collection...
For inserting a new document in the collection, we create a object of the schema. var Auto = require('models/auto') var autoObj = new Auto({ name: "NewName", countOf: 10 }); We save it like the following autoObj.save(function(err, insertedAuto) { if (err) return cons...
You can use plugman command to install/uninstall custom cordova plugins. To install plugman npm install -g plugman Install plugin command syntax: plugman <install|uninstall> --platform <ios|android|blackberry10|wp8> --project <directory> --plugin <name|url|path> Exa...
To call a list of goals as if it were a conjunction of goals, combine the higher-order predicates call/1 and maplist/2: ?- Gs = [X = a, Y = b], maplist(call, Gs). Gs = [a=a, b=b], X = a, Y = b.
The names of modules follow the filesystem's hierarchical structure. With the following file layout: Foo/ ├── Baz/ │ └── Quux.hs └── Bar.hs Foo.hs Bar.hs the module headers would look like this: -- file Foo.hs module Foo where -- file Bar.hs module Bar where -- file Foo/Bar.hs m...
systemd provides a modern implementation of cron. To execute a script periodical a service and a timer file ist needed. The service and timer files should be placed in /etc/systemd/{system,user}. The service file: [Unit] Description=my script or programm does the very best and this is the descri...
XML Example The below configuration configures two appenders (log output). The first logs to standard system output (console) and the other logs to file. In this example, the location of the file can be set statically in configuration (appender file) or dynamically via maven filtering feature (<...
Recursive functions can get quite expensive. If they are pure functions (functions that always return the same value when called with the same arguments, and that neither depend on nor modify external state), they can be made considerably faster at the expense of memory by storing the values already...

Page 618 of 826