Tutorial by Examples: ces

A subprogram is said to be external when it is not contained in the main program, nor in a module or antoher subprogram. In particular it can be defined by means of a programming language other than Fortran. When an external subprogram is invoked, the compiler cannot access to its code, so all the ...
The password in a credential object is an encrypted [SecureString]. The most straightforward way is to get a [NetworkCredential] which does not store the password encrypted: $credential = Get-Credential $plainPass = $credential.GetNetworkCredential().Password The helper method (.GetNetworkCrede...
If efficiency is important, a fast way to iterate over pixels in a cv::Mat object is to use its ptr<T>(int r) method to obtain a pointer to the beginning of row r (0-based index). According to the matrix type, the pointer will have a different template. For CV_8UC1: uchar* ptr = image.ptr&...
Check the app's authorization status with: //Swift let status: CLAuthorizationStatus = CLLocationManager.authorizationStatus() //Objective-C CLAuthorizationStatus status = [CLLocationManager authorizationStatus]; Test the status against the follow constants: //Swift switch status { case ...
Element and attribute names live in namespaces that are URIs. Namespaces are bound to prefixes that are used in the actual element and attribute names, which are called QNames. This document binds a namespace to the prefix prefix and defines a default namespace, bound with the absence of prefix. &...
Cheatsheet DODON'TControl flow with control statementsControl flow with exceptionsKeep track of ignored (absorbed) exception by loggingIgnore exceptionRepeat exception by using throwRe-throw exception - throw new ArgumentNullException() or throw exThrow predefined system exceptionsThrow custom exce...
Having a button there is all well and good, but what's the point if clicking it does nothing? ActionListeners are used to tell your button, or other component to do something when it is activated. Adding ActionListeners is done as such. buttonA.addActionListener(new ActionListener() { @Overri...
The List API has eight methods for positional access operations: add(T type) add(int index, T type) remove(Object o) remove(int index) get(int index) set(int index, E element) int indexOf(Object o) int lastIndexOf(Object o) So, if we have a List: List<String> strings = new ArrayL...
Detailed instructions on launching an EC2 instance.
Escape sequences are not restricted to string and char literals. Suppose you need to override a third-party method: protected abstract IEnumerable<Texte> ObtenirŒuvres(); and suppose the character Œ is not available in the character encoding you use for your C# source files. You are lucky...
Create SharedPreferences BuyyaPref SharedPreferences pref = getApplicationContext().getSharedPreferences("BuyyaPref", MODE_PRIVATE); Editor editor = pref.edit(); Storing data as KEY/VALUE pair editor.putBoolean("key_name1", true); // Saving boolean - true/false ...
There are cases, where custom objects need to be created and defined in the resources of the application. Such objects can be composed of Java simple types, for example Integer, Float, String. Here is the example of how to import an object defined in application resources. The object Category cons...
User is an ActiveRecord or Mongoid class. Replace User with any Rails class in your project (even something like Integer or Array) my_string = "User" # Capitalized string # => 'User' my_constant = my_string.safe_constantize # => User my_constant.all.count # => 18 my...
This example will not work because the string passed in isn't recognized as a constant in the project. Even if you pass in "array", it won't work as it isn't capitalized. my_string = "not_a_constant" # => 'not_a_constant' my_string.safe_constantize # => nil my_s...
Member member/2 has signature member(?Elem, ?List) and denotes true if Elem is a member of List. This predicate can be used to access variables in a list, where different solutions are retrieved through backtracking. Example queries: ?- member(X, [1,2,3]). X = 1 ; X = 2 ; X = 3. ?- member(X...
Using Code Contracts it is possible to apply a contract to an interface. This is done by declaring an abstract class that implments the interfaces. The interface should be tagged with the ContractClassAttribute and the contract definition (the abstract class) should be tagged with the ContractClas...
Casting an instance of a base class to a subclass as in : b = (B) a; is called narrowing (as you are trying to narrow the base class object to a more specific class object) and needs an explicit type-cast. Casting an instance of a subclass to a base class as in: A a = b; is called widening and does...
Creating backpressured data sources is the relatively easier task when dealing with backpressure in general because the library already offers static methods on Observable that handle backpressure for the developer. We can distinguish two kinds of factory methods: cold "generators" that ei...
Group common operations Docker builds images as a collection of layers. Each layer can only add data, even if this data says that a file has been deleted. Every instruction creates a new layer. For example: RUN apt-get -qq update RUN apt-get -qq install some-package Has a couple of downsides: ...
In the following example, the greet function inside Greeter module is run in a separate process: defmodule Greeter do def greet do IO.puts "Hello programmer!" end end iex> spawn(Greeter, :greet, []) Hello #PID<0.122.0> Here #PID<0.122.0> is the ...

Page 13 of 40