Tutorial by Examples: c

You can change the "$" delimiter to any other. The following example: from string import Template class MyOtherTemplate(Template): delimiter = "#" data = dict(id = 1, name = "Ricardo") t = MyOtherTemplate("My name is #name and I have the id: #id&quot...
Blog.html <div data-bind="visible: isLoading()"> Loading... </div> <div data-bind="visible: !isLoading(), foreach: blogs"> <br /> <span data-bind="text: entryPostedDate"></span> <br /> <h3> ...
QGraphics can be used to organize complicated scenes of visual objects into a framework that makes them easier to handle. There are three major types of objects used in this framework QGraphicsView, QGraphicsScene, and QGraphicsItems. QGraphicsItems are the basic visual items that exist in the scen...
Usually, services call remote Api to retrieve/send data. But unit tests shouldn't do network calls. Angular internally uses XHRBackend class to do http requests. User can override this to change behavior. Angular testing module provides MockBackend and MockConnection classes which can be used to tes...
'Base string Dim exStr : exStr = " <Head>data</Head> " 'Left Dim res: res = Left(exStr,6) 'res now equals " <Head" 'Right Dim res: res = Right(exStr,6) 'res now equals "Head> " 'Mid Dim res: res = Mid(exStr,8,4) 'res now equals "data&quot...
Given a text file test.txt: Ford Jeep Honda The following script is processing this text file: 'Read in File Data to an array, separate by newline vb equivalent (vbcrlf) Dim car, cars Dim filefullname : filefullname = "C:\testenv\test.txt" cars = Split(CreateObject("Scriptin...
'Note: I use this method to extract non-html data in extracted GET telnet results 'This example effectively grabs every other vehicle that have start and finish 'characters, which in this case is "/". 'Resulting in an array like this: 'extractedData(0) = "/Jeep" 'extractedD...
Dim exStr : exStr = " <Head>data</Head> " Dim res res = Ucase(Replace(Mid(exStr, instr(exStr, ">")+1,4), "ata", "ark")) 'res now equals DARK 'instr(exStr, ">") returns 7 'Mid(" <Head>data</Head> ", 7+1,...
Dim mddArray() ReDim mddArray(0) Dim ti, testinc: testinc = "test": ti = 1 For i = 0 To 4 Dim tmpArray(): ReDim tmpArray(0) For j = 0 To 3 tmpArray(UBound(tmpArray)) = testinc & ti ti = ti + 1 ReDim Preserve tmpArray(UBound(tmpArray) + 1) Ne...
def createDissolvedGDB(workspace, gdbName): gdb_name = workspace + "/" + gdbName + ".gdb" if(arcpy.Exists(gdb_name): arcpy.Delete_management(gdb_name) arcpy.CreateFileGDB_management(workspace, gdbName, "") else: arcpy.CreateFi...
In the build.sbt file (or where the project is defined if it is in another location), add the following setting: scalacOptions += "-language:experimental.macros" For instance, a project might be defined like this: lazy val main = project.in(file(".")) // root project .se...
When the last command in an interactive bash instance is done, the evaluated PS1 variable is displayes. Before actually displaying PS1 bash looks whether the PROMPT_COMMAND is set. This value of this var must be a callable program or script. If this var is set this program/script is called BEFORE th...
All that is needed to define a task is a declaration of it's type and a description: lazy val exampleTask = taskKey[Unit]("An example task that will return no value.") Because Unit is the type, this task is composed entirely of side-effects. Once defined, to implement actions: example...
Using async initialization is a recommended way for application development. It uses the OpenCV Manager to access OpenCV libraries externally installed in the target system. Code snippet implementing the async initialization: public class MainActivity extends Activity implements CvCameraViewListen...
According to this approach all OpenCV binaries are included into your application package. It is designed mostly for development and debugging purposes. This approach is deprecated for the production code, async initialization is recommended. If your application project doesn’t have a JNI part, jus...
This example covers some advanced features and use-cases for Exceptions. Examining the callstack programmatically Java SE 1.4 The primary use of exception stacktraces is to provide information about an application error and its context so that the programmer can diagnose and fix the problem. Som...
Due to way that the float type is represented in computer memory, results of operations using this type can be inaccurate - some values are stored as approximations. Good examples of this are monetary calculations. If high precision is necessary, other types should be used. e.g. Java 7 provides Big...
Swift import Contacts // Creating a mutable object to add to the contact let contact = CNMutableContact() contact.imageData = NSData() // The profile picture as a NSData object contact.givenName = "John" contact.familyName = "Appleseed" let homeEmail = CNLabele...
typealias SuccessHandler = (NSURLSessionDataTask, AnyObject?) -> Void This code block creates a type alias named SuccessHandler, just in the same way var string = "" creates a variable with the name string. Now whenever you use SuccessHandler, for example: func example(_ handler: S...
typealias Handler = () -> Void typealias Handler = () -> () This block creates a type alias that works as a Void to Void function (takes in no parameters and returns nothing). Here is a usage example: var func: Handler? func = {}

Page 621 of 826