Tutorial by Examples: c

The power of idling resources lies in not having to wait for some app's processing (networking, calculations, animations, etc.) to finish with sleep(), which brings flakiness and/or prolongs the tests run. The official documentation can be found here. Implementation There are three things that you...
As Angular uses HTML to extend a web page and plain Javascript to add logic, it makes it easy to create a web page using ng-app, ng-controller and some built-in directives such as ng-if, ng-repeat, etc. With the new controllerAs syntax, newcomers to Angular users can attach functions and data to the...
This is the basic HTML file that can be used as a boilerplate when starting a project. This boilerplate uses orbit controls with damping (camera that can move around an object with deceleration effect) and creates a spinning cube. <!DOCTYPE html> <html> <head> <t...
Factors are one method to represent categorical variables in R. Given a vector x whose values can be converted to characters using as.character(), the default arguments for factor() and as.factor() assign an integer to each distinct element of the vector as well as a level attribute and a label attr...
public function drawDisplayObjectUsingBounds(source:DisplayObject):BitmapData { var bitmapData:BitmapData;//declare a BitmapData var bounds:Rectangle = source.getBounds(source);//get the source object actual size //round bounds to integer pixel values (to aviod 1px str...
One of the most common errors in compilation happens during the linking stage. The error looks similar to this: $ gcc undefined_reference.c /tmp/ccoXhwF0.o: In function `main': undefined_reference.c:(.text+0x15): undefined reference to `foo' collect2: error: ld returned 1 exit status $ So l...
UIBezierPath using to create a circular path ShapeLayer CAShapeLayer *circleLayer = [CAShapeLayer layer]; [circleLayer setPath:[[UIBezierPath bezierPathWithOvalInRect: CGRectMake(50, 50, 100, 100)] CGPath]]; circleLayer.lineWidth = 2.0; [circleLayer setStrokeColor:[[UIColor redColor] CGColor]];...
Const baseString As String = "Hello World" Dim charLength As Long charLength = Len(baseString) 'charlength = 11
Const baseString As String = "Hello World" Dim byteLength As Long byteLength = LenB(baseString) 'byteLength = 22
The following example demonstrates a simple HTTP GET request. http.get() returns an Observable which has the method subscribe. This one appends the returned data to the posts array. var posts = [] getPosts(http: Http):void { this.http.get(`https://jsonplaceholder.typicode.com/posts`) ...
It may be a good idea to encapsulate the HTTP handling logic in its own class. The following class exposes a method for getting Posts. It calls the http.get() method and calls .map on the returned Observable to convert the Response object to a Post object. import {Injectable} from "@angular/co...
The first step in accessing a data source via ADO is creating an ADO Connection object. This is typically done using a connection string to specify the data source parameters, although it is also possible to open a DSN connection by passing the DSN, user ID, and password to the .Open method. Note t...
Queries can be performed in two ways, both of which return an ADO Recordset object which is a collection of returned rows. Note that both of the examples below use the OpenDatabaseConnection function from the Making a connection to a data source example for the purpose of brevity. Remember that the...
ADO connections can be used to perform pretty much any database function that the provider supports via SQL. In this case it isn't always necessary to use the Recordset returned by the Execute function, although it can be useful for obtaining key assignments after INSERT statements with @@Identity o...
Any time SQL executed through an ADO connection needs to contain user input, it is considered best practice to parameterize it in order to minimize the chance of SQL injection. This method is also more readable than long concatenations and facilitates more robust and maintainable code (i.e. by using...
The following example utilizes the tm text mining package to scrape and mine text data from the web to build word clouds with symbolic shading and ordering. require(RWeka) require(tau) require(tm) require(tm.plugin.webmining) require(wordcloud) # Scrape Google Finance -----------------------...
Const string1 As String = "foo" Const string2 As String = "bar" Const string3 As String = "fizz" Dim concatenatedString As String 'Concatenate two strings concatenatedString = string1 & string2 'concatenatedString = "foobar" 'Concatenate three s...
'Declare and assign a string array Dim widgetNames(2) As String widgetNames(0) = "foo" widgetNames(1) = "bar" widgetNames(2) = "fizz" 'Concatenate with Join and separate each element with a 3-character string concatenatedString = VBA.Strings.Join(widgetNames, &q...
Dim lineOfHyphens As String 'Assign a string with 80 repeated hyphens lineOfHyphens = String$(80, "-")
Dim stringOfSpaces As String 'Assign a string with 255 repeated spaces using Space$ stringOfSpaces = Space$(255) 'Assign a string with 255 repeated spaces using String$ stringOfSpaces = String$(255, " ")

Page 294 of 826