Tutorial by Examples

The prototype pattern can be implemented using the ICloneable interface in .NET. class Spoon { } class DessertSpoon : Spoon, ICloneable { ... public object Clone() { return this.MemberwiseClone(); } } class SoupSpoon : Spoon, ICloneable { ... public object Clone() { ret...
The following code illustrates how to make 'hello world' app in kivy.To run this app in ios and android save it as main.py and use buildozer. from kivy.app import App from kivy.uix.label import Label from kivy.lang import Builder Builder.load_string(''' <SimpleLabel>: text: 'Hello ...
Objective C AVSpeechSynthesizer *synthesizer = [[AVSpeechSynthesizer alloc]init]; AVSpeechUtterance *utterance = [AVSpeechUtterance speechUtteranceWithString:@"Some text"]; [utterance setRate:0.2f]; [synthesizer speakUtterance:utterance]; Swift let synthesizer = AVSpeechSynthesizer...
The Search API provides access to recent tweets*. This is as opposed to the Stream API, which provides search results in real-time. <example> *Note that "the Search API is focused on relevance and not completeness" - Twitter Search API
The Stream API provides access to tweets in real-time. Streams can be filtered based on keywords, language, location, and more. Here's a simple example to track mentions of the word "tweepy": #set up a new class using tweepy.StreamListener class SimpleListener(tweepy.StreamListener): ...
@Component({ selector: 'main-component', template: '<example-component *ngFor="let hero of heroes" [hero]="hero"></example-component>' }) @Component({ selector: 'example-component', t...
app.module.ts import {routes} from "./app.routes"; @NgModule({ declarations: [AppComponent], imports: [BrowserModule, mainModule.forRoot(), RouterModule.forRoot(routes)], providers: [], bootstrap: [AppComponent] }) export class AppModule { } app.routes.t...
There are 2 ways to set formBuilder controls parameters. On initialize: exampleForm : FormGroup; constructor(fb: FormBuilder){ this.exampleForm = fb.group({ name : new FormControl({value: 'default name'}, Validators.compose([Validators.required, Validators.maxLength(15)])) }); ...
Inside of your {CATALINA_HOME}/conf/ folder exists a server.xml and context.xml file. Each one of these contains similar code, but references different parts of Tomcat to complete the same task. server.xml is server-wide configuration. This is where you can set up HTTPS, HTTP2, JNDI Resources, etc....
public void test() { Connection conn = null; Statement stmt = null; try { Context ctx = (Context) new InitialContext().lookup("java:comp/env"); conn = ((DataSource) ctx.lookup("jdbc/SomeDataSource")).getConnection(); stmt = conn.createS...
The Wrong Way Consider the following structure { "users": { // Uniquely generated IDs for children is common practice, // it's actually really useful for automating child creation. // Auto-incrementing an integer for a key can be problematic when a child is removed. ...
The following is an example of a simple and minimal college database that uses two-way relationships { "students": { "-SL3Cs0KFvDMQLIYZEzv": { "name": "Godric Gryffindor", "id": "900130309", "courses"...
A common technique for using channels is to create some number of workers (or consumers) to read from the channel. Using a sync.WaitGroup is an easy way to wait for those workers to finish running. package main import ( "fmt" "sync" "time" ) func ...
Let's consider the below snippet, Get-ChildItem -Path C:\MyFolder | Select-Object Name, CreationTime, Length It simply output the folder content with the selected properties. Something like, What if I want to display the file size in KB ? This is where calcualted properties comes handy. Get-...
Unlike functions, there's no need to forward declare a procedure. It can be placed anywhere in your code, before or after you call it using RUN. RUN proc. //Procedure starts here PROCEDURE proc: //Procedure ends here END PROCEDURE. The procedure name is folowed by a colon sign telling u...
A procedure can have parameters of different kinds: input, output, input-output (bidirectional) and also some special types like temp-tables and datasets). In the run statement it's optional to declare INPUT (it's considered default) - all other directions must be specifically declared. A procedur...
Recursion is easy - RUN the procedure itself from inside the procedure. However if you recurse too far the stack will run out of space. A procedure calculation the factorial. PROCEDURE factorial: DEFINE INPUT PARAMETER piNum AS INTEGER NO-UNDO. DEFINE OUTPUT PARAMETER piFac AS INTEG...
The procedure has it's own scope. The outside scope will "bleed" into the procedure but not the other way arround. DEFINE VARIABLE i AS INTEGER NO-UNDO INIT 1. DEFINE VARIABLE j AS INTEGER NO-UNDO. PROCEDURE p: MESSAGE i VIEW-AS ALERT-BOX. // 1 MESSAGE j VIEW-AS AL...
Set createVBScriptRegExObject = CreateObject("vbscript.RegExp") Tools> References> Microsoft VBScript Regular Expressions #.# Associated DLL: VBScript.dll Source: Internet Explorer 1.0 and 5.5 MSDN-Microsoft Beefs Up VBScript with Regular Expressions MSDN-Regular Expression ...
Incorrect Code Sub DoSomething() GoSub DoThis DoThis: Debug.Print "Hi!" Return End Sub Why doesn't this work? Execution enters the DoSomething procedure, jumps to the DoThis label, prints "Hi!" to the debug output, returns to the instruction immediately afte...

Page 1119 of 1336