Tutorial by Examples: and

Sometimes, if an action should be bind to a collection view's cell selection, you have to implement the UICollectionViewDelegate protocol. Let's say the collection view is inside a UIViewController MyViewController. Objective-C In your MyViewController.h declares that it implements the UICollecti...
An interface is declared like a class, but without access modifiers (public, private, ...). Also, no definitions are allowed, so variables and constants can't be used. Interfaces should always have an Unique Identifier, which can be generated by pressing Ctrl + Shift + G. IRepository = interface ...
When using the DllImport attribute you have to know the correct dll and method name at compile time. If you want to be more flexible and decide at runtime which dll and methods to load, you can use the Windows API methods LoadLibrary(), GetProcAddress() and FreeLibrary(). This can be helpful if the ...
Get NSData from Hexadecimal String + (NSData *)dataFromHexString:(NSString *)string { string = [string lowercaseString]; NSMutableData *data= [NSMutableData new]; unsigned char whole_byte; char byte_chars[3] = {'\0','\0','\0'}; int i = 0; int length = (int) string.len...
Often times, it is helpful to evaluate multiple expressions and to return the result from the first or second form rather than the last. This is easy to accomplish using let and, for instance: (let ((form1-result form1)) form2 form3 ;; ... form-n-1 form-n form1-result) Because...
Every Windows Phone project contains App.cs class: public sealed partial class App : Application This class is your global application context. General Application class usage: App entry point, particularly for various activation contracts. Application lifecycle management. Application g...
In most scripting languages, if a function call fails, it may throw an exception and stop execution of the program. Bash commands do not have exceptions, but they do have exit codes. A non-zero exit code signals failure, however, a non-zero exit code will not stop execution of the program. This can...
The behaviour of virtual functions in constructors and destructors is often confusing when first encountered. #include <iostream> using namespace std; class base { public: base() { f("base constructor"); } ~base() { f("base destructor"); } virtual co...
The addition and multiplication have equivalents in this type algebra. They correspond to the tagged unions and product types. data Sum a b = A a | B b data Prod a b = Prod a b We can see how the number of inhabitants of every type corresponds to the operations of the algebra. Equivalently, we...
The auto keyword by itself represents a value type, similar to int or char. It can be modified with the const keyword and the & symbol to represent a const type or a reference type, respectively. These modifiers can be combined. In this example, s is a value type (its type will be inferred as s...
$ pwd /home/bob/somedir1/somedir2/somedir3 $ pushd /home/bob/otherdir1/otherdir2 /home/bob/otherdir1/otherdir2 /home/bob/somedir1/somedir2/somedir3 $ popd /home/bob/somedir1/somedir2/somedir3 $ pushd /usr /usr /home/bob/somedir1/somedir2/somedir3 $ pushd /var /var /usr /home/bob/som...
Makes a request only sending part of the form. The text1 value is set, but not text2, as the listener states. Bean.java @ManagedBean @ViewScoped public class Bean { private String text1; private String text2; public String getText1() { return text1; } pu...
The Scala compiler can also deduce type parameters when polymorphic methods are called, or when generic classes are instantiated: case class InferedPair[A, B](a: A, b: B) val pairFirstInst = InferedPair("Husband", "Wife") //type is InferedPair[String, String] // Equiv...
#include <SPI.h> #define CSPIN 1 void setup() { pinMode(CSPIN, OUTPUT); // init chip select pin as an output digitalWrite(CSPIN, 1); // most slaves interpret a high level on CS as "deasserted" SPI.begin(); SPI.beginTransaction(SPISettings(1000000, MSBFIRST, SPI_MO...
#include <Servo.h> Servo srv; void setup() { srv.attach(9); // Attach to the servo on pin 9 } To use a servo, you need to call attach() function first. It starts generating a PWM signal controlling a servo on a specified pin. On boards other than Arduino Mega, use of Servo lib...
OneGet was originally a product from the Open Source Technology Center at Microsoft. Not only is it inspired by open-source Linux package managers, OneGet itself is also open source. It's now part of PowerShell As opposed to Unix based package managers (such as apt-get, yum, or dpkg), Windows allow...
Atomic variables can be accessed concurrently between different threads without creating race conditions. /* a global static variable that is visible by all threads */ static unsigned _Atomic active = ATOMIC_VAR_INIT(0); int myThread(void* a) { ++active; // increment active race fr...
Scale the image using START. Scale the image using END. Official Docs FitStart This will fit to the smallest size of the container, and it will align it to the start. <ImageView android:layout_width="200dp" android:layout_height="200dp" android:src...
When write() is called for a named or unnamed pipe or stream socket whose reading end is closed, two things happen: POSIX.1-2001 SIGPIPE signal is sent to the process that called write() POSIX.1-2004 SIGPIPE signal is sent to the thread that called write() EPIPE error is returned ...
Jersey is one of the many frameworks available to create Rest Services, This example will show you how to create Rest Services using Jersey and Spring Boot 1.Project Setup You can create a new project using STS or by using the Spring Initializr page. While creating a project, include the followi...

Page 76 of 153