Tutorial by Examples: c

void main() { import std.algorithm : group; import std.range; [1, 2].chain([3, 4]).retro; // [4, 3, 2, 1] [1, 1, 2, 2, 2].group.dropOne.front; // tuple(2, 3u) }
When either a signed or unsigned integer is converted to a signed integer type, and its value is not representable in the destination type, the value produced is implementation-defined. Example: // Suppose that on this implementation, the range of signed char is -128 to +127 and // the range of un...
infixr 5 ++ infixl 4 <*>, <*, *>, <**> infixl 8 `shift`, `rotate`, `shiftL`, `shiftR`, `rotateL`, `rotateR` infix 4 ==, /=, <, <=, >=, > infix ??
Sometimes in a development or testing environment, the SSL certificate chain might not have been fully established (yet). To continue developing and testing, you can turn off SSL verification programmatically by installing an "all-trusting" trust manager: try { // Create a trust mana...
Config values can be set in three ways: Via private static variables on any class within a SilverStripe project Via yaml config files (stored in module-folder/_config/[file].yml) Via PHP at run time (Config::inst()->update('Director', 'environment_type', 'dev') Generally it's best to se...
Exceptions are powerful, but a single overzealous except clause can take it all away in a single line. try: res = get_result() res = res[0] log('got result: %r' % res) except: if not res: res = '' print('got exception') This example demonstrates 3 symptoms of t...
The Scala Collections framework, according to its authors, is designed to be easy to use, concise, safe, fast, and universal. The framework is made up of Scala traits that are designed to be building blocks for creating collections. For more information on these building blocks, read the official S...
GetHashCode has major performance effects on Dictionary<> and HashTable. Good GetHashCode Methods should have an even distribution every integer should have a roughly equal chance of returning for a random instance if your method returns the same integer (e.g. the constant '999') for e...
/*add this code to your function.php file now your api will include transaction_id */ add_action( 'woocommerce_api_order_response', 'my_woocommerce_api_order', 10, 2); function my_woocommerce_api_order( $data ) { //you can do anything with the $data here lets add the transaction id ...
Setters and Getters allow for an object to contain private variables which can be accessed and changed with restrictions. For example, public class Person { private String name; public String getName() { return name; } public void setName(String name) { i...
In this example, we'll create a simple echo server that will listen on the specified port, and being able to handle new connections: #include <stdio.h> #include <stdlib.h> #include <unistd.h> #include <sys/socket.h> #include <sys/types.h> #include <arpa/inet.h&...
<ImageView android:id="@+id/imgExample" android:layout_width="wrap_content" android:layout_height="wrap_content" ... /> set a drawable as content of ImageView using XML attribute: android:src="@drawable/android2" set a drawable program...
If you want to show local notification immediately, you should call: Swift 3 UIApplication.shared.presentLocalNotificationNow(notification) Swift 2 UIApplication.sharedApplication().presentLocalNotificationNow(notification) Objective-C [[UIApplication sharedApplication] presentLocalNotific...
public class OnSwipeListener implements View.OnTouchListener { private final GestureDetector gestureDetector; public OnSwipeListener(Context context) { gestureDetector = new GestureDetector(context, new GestureListener()); } @Override public boolean onTouch(Vi...
public class GestureActivity extends Activity implements GestureDetector.OnDoubleTapListener, GestureDetector.OnGestureListener { private GestureDetector mGestureDetector; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedIn...
Create a new Console Application Add the NuGet package Microsoft.CodeAnalysis Import the namespaces Microsoft.CodeAnalysis.MSBuild, System.Linq and Microsoft.CodeAnalysis.CSharp.Syntax Write the following example code in the Main method: // Declaring a variable with the current project file ...
Create a new console application with one line in the Main method: Console.WriteLine("Hello World") Remember the path to the .csproj file and replace it in the example. Create a new Console Application and install the Microsoft.CodeAnalysis NuGet package and try the following code: cons...
Create a new console application with one line in the Main method: Console.WriteLine("Hello World") Remember the path to the .vbproj file and replace it in the example. Create a new Console Application and install the Microsoft.CodeAnalysis NuGet package and try the following code: Cons...
var syntaxTree = CSharpSyntaxTree.ParseText( @"using System; using System.Collections; using System.Linq; using System.Text; namespace HelloWorldApplication { class Program { static void Main(string[] args) { Console.WriteLine(""Hello World""); } } }"); ...
If the shift count value is a negative value then both left shift and right shift operations are undefined1: int x = 5 << -3; /* undefined */ int x = 5 >> -3; /* undefined */ If left shift is performed on a negative value, it's undefined: int x = -5 << 3; /* undefined */ I...

Page 398 of 826