Tutorial by Examples: c

This example uses the Thread Class, but multithreaded applications can also be made using BackgroundWorker. The AddNumber, SubstractNumber, and DivideNumber functions will be executed by separate threads: Edit: Now the UI thread waits for the child threads to finish and shows the result. Module Mo...
int fakeMalloc(__local int * addrCounter,int size) { // lock addrCounter // adds size to addrCounter's pointed cell value // unlock // return old value of addrCounter's pointed cell // serial between all threads visiting -> slow ret...
GSON does not support inheritance our of the box. Let's say we have the following class hierarchy: public class BaseClass { int a; public int getInt() { return a; } } public class DerivedClass1 extends BaseClass { int b; @Override public int getIn...
The Android Account Authenticator system can be used to make the client authenticate with a remote server. Three pieces of information are required: A service, triggered by the android.accounts.AccountAuthenticator. Its onBind method should return a subclass of AbstractAccountAuthenticator. An a...
libraryDependency is the SettingKey that handles 'managed' library dependencies, which are dependencies that are automatically downloaded, matching the supplied versions. To add a single dependency: libraryDependencies += "com.typesafe.slick" %% "slick" % "3.2.0-M1" ...
The standard structure for a project built by SBT is: projectName/ build.sbt project/ <SBT sub-build information> src/ main/ scala/ <Scala source files> java/ <Java source files> resources/ ...
This sheet assumes that you are in the root directory of the project, containing the build.sbt. $ indicates a command prompt and > indicates commands run inside the SBT console. Compile a project $ sbt compile Test a project $ sbt test Enter SBT REPL: $ sbt Enter Scala Console with B...
If your project has this: scalaVersion := 2.11 // Replace '2.11' with the version of Scala your project is running on Then you can use %% to automatically get the version of the library compiled against the version of Scala the project is using: libraryDependencies += "com.typesafe.slick&...
A library can be 'pinned' to a specific version of Scala using the % operator between the groupId and the artifactId (the first two strings in a library dependency). In this example, we pin the library with the artifactId of slick to Scala version 2.10: libraryDependencies += "com.typesafe.sl...
On a desktop version of Chrome, the contents of the page can be inspected. This shows the document object model (DOM) of the HTML, the Cascading Style Sheet styles (CSS), and much more. Enter inspection by one of many options: Right click on a web page, and select Inspect From the Chrome Menu, ...
$ProductCollection=Mage::getModel('catalog/product')->getCollection(); Selecting the specific Attribute $ProductCollection->addAttributeToSelect(array('name', 'product_url', 'small_image')); Selecting the All Attribute $ProductCollection->addAttributeToSelect('*'); Add Filter on ...
What is a metaclass? In Python, everything is an object: integers, strings, lists, even functions and classes themselves are objects. And every object is an instance of a class. To check the class of an object x, one can call type(x), so: >>> type(5) <type 'int'> >>> typ...
You may have heard that everything in Python is an object. It is true, and all objects have a class: >>> type(1) int The literal 1 is an instance of int. Lets declare a class: >>> class Foo(object): ... pass ... Now lets instantiate it: >>> bar = Foo() Wh...
Let's assume we have an entity status field with 3 options Tentative Pending Approved Our goal is to show different color for each status as follow: Tentative will be Red Pending will be Orange Approved will be Green The switch condition: =Switch(Fields!ItemStatus.Value = "Tentativ...
Q. Why we need compilation? Ans. We need compilation for achieving higher level of efficiency of our Angular applications. Take a look at the following example, // ... compile: function (el, scope) { var dirs = this._getElDirectives(el); var dir; var scopeCreated; dirs.forEach(functi...
module main; auto getMemberNames(T)() @safe pure { string[] members; foreach (derived; __traits(derivedMembers, T)) { members ~= derived; } return members; } class Foo { int a; int b; } class Bar : Foo { int c; int d; int e...
// get product collection object $productCollection = Mage::getResourceModel('catalog/product_collection'); // get customer collection object $customerCollection = Mage::getResourceModel('customer/customer_collection'); // get order collection object $orderCollection = M...
Dependencies can be added for specific Build types: android { ... buildTypes { release { //... } debug { //.... } } } dependencies { debugCompile 'com.android.support:appcompat-v7:24.1.1' releaseCompile ...
Template Literals act like strings with special features. They are enclosed by by the back-tick `` and can be spanned across multiple lines. Template Literals can contain embedded expressions too. These expressions are indicated by a $ sign and curly braces {} //A single line Template Literal v...
Three main functions available (description from man pages): fromfile - A highly efficient way of reading binary data with a known data-type, as well as parsing simply formatted text files. Data written using the tofile method can be read using this function. genfromtxt - Load data from a t...

Page 572 of 826