Tutorial by Examples: c

MSDN: Determines whether a sequence contains a specified element by using a specified IEqualityComparer<T> List<int> numbers = new List<int> { 1, 2, 3, 4, 5 }; var result1 = numbers.Contains(4); // true var result2 = numbers.Contains(8); // false List<int> secondN...
Design (layout XML): <AutoCompleteTextView android:id="@+id/autoCompleteTextView1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignParentTop="true" android:layout_centerHorizontal="true&...
Marshal class contains a function named PtrToStructure, this function gives us the ability of reading structures by an unmanaged pointer. PtrToStructure function got many overloads, but they all have the same intention. Generic PtrToStructure: public static T PtrToStructure<T>(IntPtr ptr); ...
DECLARE CURSOR c_emp_to_be_raised(p_sal emp.sal%TYPE) IS SELECT * FROM emp WHERE sal < p_sal; BEGIN FOR cRowEmp IN c_emp_to_be_raised(1000) LOOP dbms_Output.Put_Line(cRowEmp .eName ||' ' ||cRowEmp.sal||'... should be raised ;)'); END LOOP; END; /
BEGIN FOR x IN (SELECT * FROM emp WHERE sal < 100) LOOP dbms_Output.Put_Line(x.eName ||' '||x.sal||'... should REALLY be raised :D'); END LOOP; END; / First advantage is there is no tedious declaration to do (think of this horrible "CURSOR" thing you had in previous ve...
SYS_REFCURSOR can be used as a return type when you need to easily handle a list returned not from a table, but more specifically from a function: function returning a cursor CREATE OR REPLACE FUNCTION list_of (required_type_in IN VARCHAR2) RETURN SYS_REFCURSOR IS v_ SYS_REFCURSOR; BEGIN...
Declare the cursor to scan a list of records Open it Fetch current record into variables (this increments position) Use %notfound to detect end of list Don't forget to close the cursor to limit resources consumption in current context -- DECLARE CURSOR curCols IS -- select column name a...
You can override the default vmoptions with your own personal settings by choosing Help > Edit Custom VM Options from the toolbar. This will create a local copy of the file which you are free to edit. For example, if you double the value set for Xmx, the maximum size of the memory allocation poo...
qplot is intended to be similar to base r plot() function, trying to always plot out your data without requiring too much specifications. basic qplot qplot(x = disp, y = mpg, data = mtcars) adding colors qplot(x = disp, y = mpg, colour = cyl,data = mtcars) adding a smoother qplot(x = d...
C++11 During exception handling there is a common use case when you catch a generic exception from a low-level function (such as a filesystem error or data transfer error) and throw a more specific high-level exception which indicates that some high-level operation could not be performed (such as b...
A downcast can be used to make use of a subclass's code and data inside of a function taking a parameter of its superclass. class Rat { var color = "white" } class PetRat: Rat { var name = "Spot" } func nameOfRat(🐭: Rat) -> String { guard let petRat = ...
In the following code let us assume for simplicity that float and uint32_t have the same size. void fun(uint32_t* u, float* f) { float a = *f *u = 22; float b = *f; print("%g should equal %g\n", a, b); } u and f have different base type, and thus the compiler can a...
If we have two pointer arguments of the same type, the compiler can't make any assumption and will always have to assume that the change to *e may change *f: void fun(float* e, float* f) { float a = *f *e = 22; float b = *f; print("is %g equal to %g?\n", a, b); } f...
Copy byte-per-byte of a file The following function copies a file into another by performing an exact byte-per-byte copy, ignoring the kind of content (which can be either lines of characters in some encoding or binary data): (defun byte-copy (infile outfile) (with-open-file (instream infile :d...
A common use of macros is to create templates for data structures which obey common rules but may contain different fields. By writing a macro, you can allow the detailed configuration of the data structure to be specified without needing to repeat boilerplate code, nor to use a less efficient struc...
null returns True if there are no elements a in a foldable structure t a, and False if there is one or more. Structures for which null is True have a length of 0. ghci> null [] True ghci> null [14, 29] False ghci> null Nothing True ghci> null (Right 'a') False ghci> null ('x'...
Converts the specified string representation of a date and time to its DateTime equivalent using the specified format and culture-specific format information. The format of the string representation must match the specified format exactly. Convert a specific format string to equivalent DateTime Le...
JSON Web Encryption (JWE) represents encrypted content using JavaScript Object Notation (JSON) based data structures. It defines a way to encrypt your claims data so that only intended receiver can read the information present in a token. In the JWE JSON Serialization, a JWE is represented as a JS...
The FileSystem API of Java 7 allows to read and add entries from or to a Zip file using the Java NIO file API in the same way as operating on any other filesystem. The FileSystem is a resource that should be properly closed after use, therefore the try-with-resources block should be used. Reading ...
The WeakSet object is used for storing weakly held objects in a collection. The difference from Set is that you can't store primitive values, like numbers or string. Also, references to the objects in the collection are held weakly, which means that if there is no other reference to an object stored...

Page 456 of 826