Tutorial by Examples: a

let url = "https://path-to-media" let request = URLRequest(url: url) let downloadTask = URLSession.shared.downloadTask(with: request) { (location, response, error) in guard let location = location, let response = response, let documentsPath = NSSearchPathForDirectori...
let url = "https://path-to-media" guard let documentsUrl = FileManager.default.urls(for: .documentDirectory, in: .userDomainMask).first, let searchQuery = url.absoluteString.components(separatedBy: "/").last else { return nil } do { let directoryContents = try F...
Detailed instructions on getting kendo-asp.net-mvc set up or installed.
In the IF THEN ELSE statement the result can be either a single statement: DEFINE VARIABLE i AS INTEGER NO-UNDO. IF i = 0 THEN MESSAGE "Zero". ELSE MESSAGE "Something else". Or a block, for instance by adding a DO-block: DEFINE VARIABLE i AS INTEGER NO...
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" ...
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. ...
Tweepy can be installed from its PyPI repository using pip or easy_install: pip install tweepy or easy_install tweepy You can also download the source from GitHub and install it using setup.py: python setup.py install See the tweepy documentation for more.
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...
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): ...
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-...

Page 916 of 1099