Tutorial by Examples: c

For the sample XML (without namespaces): This XPath, /r/f/text() will select the text node with this string value: "Text 1" And this XPath, string(/r/f) will return the string value of f, which is also: "Text 1"
For the sample XML (without namespaces): This XPath, /r/e will select this element: <e a="1"/>
JavaScript will try to automatically convert variables to more appropriate types upon use. It's usually advised to do conversions explicitly (see other examples), but it's still worth knowing what conversions take place implicitly. "1" + 5 === "15" // 5 got converted to string. ...
A new thread separate from the main thread's execution, can be created using Thread.new. thr = Thread.new { sleep 1 # 1 second sleep of sub thread puts "Whats the big deal" } This will automatically start the execution of the new thread. To freeze execution of the main Thread, ...
Python 2.x2.3 Objects of different types can be compared. The results are arbitrary, but consistent. They are ordered such that None is less than anything else, numeric types are smaller than non-numeric types, and everything else is ordered lexicographically by type. Thus, an int is less than a st...
Any type can be declared as an array using either the dimension attribute or by just indicating directly the dimension(s) of the array: ! One dimensional array with 4 elements integer, dimension(4) :: foo ! Two dimensional array with 4 rows and 2 columns real, dimension(4, 2) :: bar ! Three...
fn main() { // Statically allocated string slice let hello = "Hello world"; // This is equivalent to the previous one let hello_again: &'static str = "Hello world"; // An empty String let mut string = String::new(); // An empty String ...
Let's say we have an interface for logging: interface Logger { function log($message); } Now say we have two concrete implementations of the Logger interface: the FileLogger and the ConsoleLogger. class FileLogger implements Logger { public function log($message) { // Append...
Generate a certificate In order to run a HTTPS server, a certificate is necessary. Generating a self-signed certificate with openssl is done by executing this command: openssl req -x509 -newkey rsa:4096 -sha256 -nodes -keyout key.pem -out cert.pem -subj "/CN=example.com" -days 3650` T...
foo.h #ifndef FOO_DOT_H /* This is an "include guard" */ #define FOO_DOT_H /* prevents the file from being included twice. */ /* Including a header file twice causes all kinds */ /* of interesting problems.*/ /** * This is a functi...
While static constructors are always called before the first usage of a type it's sometimes useful to be able to force them to be called and the RuntimeHelpers class provide an helper for it: using System.Runtime.CompilerServices; // ... RuntimeHelpers.RunClassConstructor(typeof(Foo).TypeHand...
What is a Singleton Class? A singleton class returns the same instance no matter how many times an application requests it. Unlike a regular class, A singleton object provides a global point of access to the resources of its class. When to Use Singleton Classes? Singletons are used in situations ...
This example use the default boxplot() function and the irisdata frame. > head(iris) Sepal.Length Sepal.Width Petal.Length Petal.Width Species 1 5.1 3.5 1.4 0.2 setosa 2 4.9 3.0 1.4 0.2 setosa 3 4.7 3.2 ...
First install Mono by going through the install instructions for the platform of your choice as described in their installation section. Mono is available for Mac OS X, Windows and Linux. After installation is done, create a text file, name it HelloWorld.cs and copy the following content into it: ...
ALTER TABLE Employees DROP CONSTRAINT DefaultSalary This Drops a constraint called DefaultSalary from the employees table definition. Note:- Ensure that constraints of the column are dropped before dropping a column.
ALTER TABLE Employees ADD CONSTRAINT DefaultSalary DEFAULT ((100)) FOR [Salary] This adds a constraint called DefaultSalary which specifies a default of 100 for the Salary column. A constraint can be added at the table level. Types of constraints Primary Key - prevents a duplicate record in...
Multiple inheritance is a feature that allows one class to inherit from multiple classes(i.e., more than one parent). Ruby does not support multiple inheritance. It only supports single-inheritance (i.e. class can have only one parent), but you can use composition to build more complex classes using...
The String.Join method will help us to construct a string From array/list of characters or string. This method accepts two parameters. The first one is the delimiter or the separator which will help you to separate each element in the array. And the second parameter is the Array itself. String from...
A cross join is a Cartesian join, meaning a Cartesian product of both the tables. This join does not need any condition to join two tables. Each row in the left table will join to each row of the right table. Syntax for a cross join: SELECT * FROM table_1 CROSS JOIN table_2 Example: /* Sample...
You can manually trigger the Garbage Collector by calling System.gc(); However, Java does not guarantee that the Garbage Collector has run when the call returns. This method simply "suggests" to the JVM (Java Virtual Machine) that you want it to run the garbage collector, but does not ...

Page 75 of 826