Tutorial by Examples: c

Slices have both length and capacity. The length of a slice is the number of elements currently in the slice, while the capacity is the number of elements the slice can hold before needing to be reallocated. When creating a slice using the built-in make() function, you can specify its length, and ...
The latest SDK can be downloaded here The latest SDK libraries are also available on NuGet under Microsoft's official crmsdk account
To catch a long click and use it you need to provide appropriate listener to button: View.OnLongClickListener listener = new View.OnLongClickListener() { public boolean onLongClick(View v) { Button clickedButton = (Button) v; String buttonText = clickedButton.getText().toStri...
Once you've got all your settings, you'll want to use them in your code. To do so, add the following import to your file: from django.conf import settings You may then access your settings as attributes of the settings module, for example: if not settings.DEBUG: email_user(user, message) ...
Using environment variables is a widely used way to setting an app's config depending on it environment, as stated in The Twelve-Factor App. As configurations are likely to change between deployment environments, this is a very interesting way to modify the configuration without having to dig in th...
public enum DayOfWeek { Sunday, Monday, Tuesday, Wednesday, Thursday, Friday, Saturday } // Enum to string string thursday = DayOfWeek.Thursday.ToString(); // "Thursday" string seventhDay = Enum.GetName(typeof(DayOfWeek), 6); // "Satur...
The things Array contains values of Any type. let things: [Any] = [1, "Hello", 2, true, false, "World", 3] We can extract values of a given type and create a new Array of that specific type. Let's say we want to extract all the Int(s) and put them into an Int Array in a safe ...
connection.Execute(@"some Query with @a,@b,@c", new {a=somevalueOfa,b=somevalueOfb,c=somevalueOfc});
This snippet will grab a JSON formatted resource, decode it and print it in PHP array format. // Fetch $response = wp_remote_get( 'http://www.example.com/resource.json' ); if ( ! is_wp_error( $response ) ) { $headers = wp_remote_retrieve_headers( $response ); if ( isset( $headers[ 'con...
<!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta name="viewport" content="width=device-widt...
Jumping to characters f{char} - move to the next occurrence of {char} to the right of the cursor on the same line F{char} - move to the next occurrence of {char} to the left of the cursor on the same line t{char} - move to the left of the next occurrence of {char} to the right of the cursor on th...
The background property can be used to set one or more background related properties: ValueDescriptionCSS Ver.background-imageBackground image to use1+background-colorBackground color to apply1+background-positionBackground image's position1+background-sizeBackground image's size3+background-repeat...
Database seeds are stored in the /database/seeds directory. You can create a seed using an Artisan command. php artisan make:seed UserTableSeeder Alternatively you can create a new class which extends Illuminate\Database\Seeder. The class must a public function named run().
Structure data types are useful way to package related data and have them behave like a single variable. Declaring a simple struct that holds two int members: struct point { int x; int y; }; x and y are called the members (or fields) of point struct. Defining and using structs: ...
Trim is used to remove write-space at the beginning or end of selection In MSSQL there is no single TRIM() SELECT LTRIM(' Hello ') --returns 'Hello ' SELECT RTRIM(' Hello ') --returns ' Hello' SELECT LTRIM(RTRIM(' Hello ')) --returns 'Hello' MySql and Oracle SELECT TRIM(' Hello ') ...
In (standard ANSI/ISO) SQL, the operator for string concatenation is ||. This syntax is supported by all major databases except SQL Server: SELECT 'Hello' || 'World' || '!'; --returns HelloWorld! Many databases support a CONCAT function to join strings: SELECT CONCAT('Hello', 'World'); --retur...
SELECT UPPER('HelloWorld') --returns 'HELLOWORLD' SELECT LOWER('HelloWorld') --returns 'helloworld'
While the Java Date class has several constructors, you'll notice that most are deprecated. The only acceptable way of creating a Date instance directly is either by using the empty constructor or passing in a long (number of milliseconds since standard base time). Neither are handy unless you're lo...
We can provide a consumer that will be called with the multiple relevant values: C++11 template <class F> void foo(int a, int b, F consumer) { consumer(a + b, a - b, a * b, a / b); } // use is simple... ignoring some results is possible as well foo(5, 12, [](int sum, int , int , i...
// The Option type can either contain Some value or None. fn find(value: i32, slice: &[i32]) -> Option<usize> { for (index, &element) in slice.iter().enumerate() { if element == value { // Return a value (wrapped in Some). return Some(index);...

Page 83 of 826