Tutorial by Examples: c

to_upper(): #include <iostream> #include <string> #include <boost/algorithm/string.hpp> using namespace std; int main() { // String to convert characters to uppercase string str = "ThIS iS SUpPoSEd tO Be UpPeR CAsE."; // Convert characters i...
Objective-C NSMutableAttributedString *str = [[NSMutableAttributedString alloc] initWithString:@"Hello. That is a test attributed string."]; [str addAttribute:NSBackgroundColorAttributeName value:[UIColor yellowColor] range:NSMakeRange(3,5)]; [str addAttribute:NSForegroundColorAttrib...
So far, we defined how easy it is to write a custom element that hides the messy html behind it and gives the user, an easy to write and brief markup. Time to code it! Our custom element, to display the bar below the hero image should Accept a Link to be shared Accept a Link to the Repo to be ...
<link rel="import" href="../bower_components/iron-icon/iron-icon.html"> <link rel="import" href="../bower_components/iron-icons/iron-icons.html"> <link rel="import" href="../bower_components/iron-icons/social-icons.html"&gt...
On whichever page you want to display your product / project portfolio, invoke the custom element like so: <article id="project-neighbourhood"> <div class="row"> <div class="col-12 hero"> <img src="path-to-hero-image...
Catching exceptions in Kotlin looks very similar to Java try { doSomething() } catch(e: MyException) { handle(e) } finally { cleanup() } You can also catch multiple exceptions try { doSomething() } catch(e: FileSystemException) { handle(e) } catch(e: Network...
IF you are using simple categories, with each physics body belonging to only one category, then this alternative form of didBeginContact may be more readable: func didBeginContact(contact: SKPhysicsContact) { let contactMask = contact.bodyA.categoryBitMask | contact.bodyB.categoryBitMask ...
Here is a simple Sprite-Kit GameScene.swift. Create a new, empty SpriteKit project and replace the GameScene.swift with this. Then build and run. Click on any of the objects on screen to give make them move. Check the logs and the comments to see which ones collide and which ones make contact. // ...
Depth-first search is an algorithm for traversing or searching tree or graph data structures. One starts at the root and explores as far as possible along each branch before backtracking. A version of depth-first search was investigated in the 19th century French mathematician Charles Pierre Trémaux...
If the tables use InnoDB, MySQL automatically uses row level locking so that multiple transactions can use same table simultaneously for read and write, without making each other wait. If two transactions trying to modify the same row and both uses row level locking, one of the transactions waits f...
Dictionaries are great for managing information where multiple entries occur, but you are only concerned with a single value for each set of entries — the first or last value, the mininmum or maximum value, an average, a sum etc. Consider a workbook that holds a log of user activity, with a script ...
Bubble sort is also known as Sinking Sort. It is a simple sorting algorithm that repeatedly steps through the list to be sorted, compares each pair of adjacent items and swaps them if they are in the wrong order. Bubble sort example Implementation of Bubble Sort I used C# language to implement ...
The Problem: Given a set of items where each item contains a weight and value, determine the number of each to include in a collection so that the total weight is less than or equal to a given limit and the total value is as large as possible. Pseudo code for Knapsack Problem Given: Values(arr...
Counting sort is an integer sorting algorithm for a collection of objects that sorts according to the keys of the objects. Steps Construct a working array C that has size equal to the range of the input array A. Iterate through A, assigning C[x] based on the number of times x appeared in A. Tr...
Cycle Sort is sorting algorithm which uses comparison sort that is theoretically optimal in terms of the total number of writes to original array, unlike any other in-place sorting algorithm. Cycle sort is unstable sorting algorithm. It is based on idea of permutation in which permutations are facto...
;;Recursively print the elements of a list (defun print-list (elements) (cond ((null elements) '()) ;; Base case: There are no elements that have yet to be printed. Don't do anything and return a null list. (t ;; Recursive case ;; Print the next elem...
ASP.NET identity is a membership management system which allows a user to register and login into a web application. ASP.NET identity system can be used in entire ASP.NET framework, like ASP.NET MVC, Web Forms, Web Pages, Web API and SignalR. ASP.NET identity can be used when people are building a w...
You can technically access the Google Analytics APIs using any programing language that can handle a HTTP Post or HTTP Get request. That being said, Google has also created a number of official standard client libraries to help you with this. Using a standard client library for your chosen programm...
For performance reasons, or due to the existence of mature C libraries, you may want to call C code from a Haskell program. Here is a simple example of how you can pass data to a C library and get an answer back. foo.c: #include <inttypes.h> int32_t foo(int32_t a) { return a+1; } F...
Let us assume the following stock market data stored in HDFS. It is a CSV file with fields: Symbol, Date, Open, High, Close & Volume. ABT,20160106,42.310001,42.98,42.209999,42.560001,5906000 BAC,20160201,14.05,14.09,13.8,13.96,105739400 CAS,20160129,1.9,1.97,1.83,1.84,34500 DCA,20160129,3.46...

Page 603 of 826