Tutorial by Examples

With Class-Based Views, we use classes instead of methods to implement our views. A simple example of using Class-Based Views looks as follows: from flask import Flask from flask.views import View app = Flask(__name__) class HelloWorld(View): def dispatch_request(self): ret...
Dim classFile : classFile = "carClass.vbs" Dim fsObj : Set fsObj = CreateObject("Scripting.FileSystemObject") Dim vbsFile : Set vbsFile = fsObj.OpenTextFile(classFile, 1, False) Dim myFunctionsStr : myFunctionsStr = vbsFile.ReadAll vbsFile.Close Set vbsFile = Nothing Set fs...
Sample uses Install-Package Google.Apis.AnalyticsReporting.v4 Public Shared Function getServiceInitializer() As BaseClientService Dim serviceAccountCredentialFilePath = "Path to Json service account key file" REM from Google Developers console Dim myKeyEMail ...
@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...
Detailed instructions on getting eloquent set up or installed.
Using an Asynchronous Controller in ASP.NET MVC. The AsyncController class enables you to write asynchronous action methods. You can use asynchronous action methods for long-running, non-CPU bound requests. This avoids blocking the Web server from performing work while the request is being processed...
public async Task<actionresult> Index() { return View("View", await db.UserMasers.ToListAsync()); }
YouTube is an online video streaming service, unique in the fact that users can upload their own videos for the purposes of sharing whatever they recorded. This can range massively, from someone cooking breakfast, to playing a live concert. Now owned by Google Inc., this site has always been free to...
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 >= ...
You can use a TStringList to store Key-Value pairs. This can be useful if you want to store settings, for example. A settings consists of a Key (The Identifier of the setting) and the value. Each Key-Value pair is stored in one line of the StringList in Key=Value format. procedure Demo(const FileN...
@echo off setlocal set /p "_myvar=what is your name?" echo HELLO!>file.txt echo %_myvar%!>>file.txt echo done! pause type file.txt endlocal exit Now file.txt looks like: HELLO! John Smith! (assuming you typed John Smith as your name.) Now your batch file's consol...
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...
The ASCII way This shifts the characters but doesn't care if the new character is not a letter. This is good if you want to use punctuation or special characters, but it won't necessarily give you letters only as an output. For example, "z" 3-shifts to "}". def ceasar(text, shi...

Page 993 of 1336