Tutorial by Examples: c

Step 1: Creating Custom Error Logging Filter which will write Errors in Text Files According to DateWise. public class ErrorLogger : HandleErrorAttribute { public override void OnException(ExceptionContext filterContext) { string strLogText = ""; Excepti...
Implemented in a router: export const MainRoutes: Route[] = [{ path: '', children: [ { path: 'main', component: MainComponent , canActivate : [CanActivateRoute] }] }]; The canActivateRoute file: @Injectable() export class CanActivateRoute implements CanActi...
service I created post service with postRequest method. import {Injectable} from '@angular/core'; import {Http, Headers, Response} from "@angular/http"; import {PostModel} from "./PostModel"; import 'rxjs/add/operator/map'; import {Observable} from "rxjs"; ...
First lets create basic navbar.html with 3 options. (Home, List , Create) <nav class="navbar navbar-default" role="navigation"> <ul class="nav navbar-nav"> <li> <a id="home-navbar" routerLink="/home">Home</a> ...
run the follows commands at cmd npm install -g protractor webdriver-manager update webdriver-manager start **create protractor.conf.js file in the main app root. very important to decleare useAllAngular2AppRoots: true const config = { baseUrl: 'http://localhost:3000/', s...
The CASE-statement is a lot more strict than the IF/ELSE-conditional. It can only compare a single variable and only equality, not larget/smaller than etc. DEFINE VARIABLE c AS CHARACTER NO-UNDO. CASE c: WHEN "A" THEN DO: RUN procedureA. END. WHEN "B" ...
IF THEN ELSE can also be used like a function to return a single value. This is a lot like the ternary ?-operator of C. DEFINE VARIABLE i AS INTEGER NO-UNDO. DEFINE VARIABLE c AS CHARACTER NO-UNDO. /* Set c to "low" if i is less than 5 otherwise set it to "high" c...
The DICOM Image file is a tagged image file; the file contains both an image (most of the time) and a collection of data about the image. The data in a DICOM image file is stored as a sequence of individual elements. Each element contains one item of information about the image or the image itself. ...
Installing Heroku Scheduler heroku addons:create scheduler:standard
Here's a basic example of how to do a very simple class system Class = {} local __instance = {__index=Class} -- Metatable for instances function Class.new() local instance = {} setmetatable(instance, __instance) return instance -- equivalent to: return setmetatable({}, __instance)...
Having local Class = {} Class.__meta = {__index=Class} function Class.new() return setmetatable({}, Class.__meta) Assuming we want to change the behavior of a single instance object = Class.new() using a metatable, there are a few mistakes to avoid: setmetatable(object, {__call = table.conca...
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...
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...

Page 695 of 826