Tutorial by Examples: c

Map<String, String> num = new HashMap<>(); num.put("one", "first"); if (num.containsKey("one")) { System.out.println(num.get("one")); // => first } Maps can contain null values For maps, one has to be carrefull not to confuse &quot...
Overview In order to debug Java classes that are called during MATLAB execution, it is necessary to perform two steps: Run MATLAB in JVM debugging mode. Attach a Java debugger to the MATLAB process. When MATLAB is started in JVM debugging mode, the following message appears in the command wi...
Constants are declared like variables, but using the const keyword: const Greeting string = "Hello World" const Years int = 10 const Truth bool = true Like for variables, names starting with an upper case letter are exported (public), names starting with lower case are not. // not e...
Swift supports the creation of custom operators. New operators are declared at a global level using the operator keyword. The operator's structure is defined by three parts: operand placement, precedence, and associativity. The prefix, infix and postfix modifiers are used to start an custom op...
Change Index Initialize or update a particular element in the array array[10]="elevenths element" # because it's starting with 0 3.1 Append Modify array, adding elements to the end if no subscript is specified. array+=('fourth element' 'fifth element') Replace the entire ar...
This is the primary purpose of cat. cat file1 file2 file3 > file_all cat can also be used similarly to concatenate files as part of a pipeline, e.g. cat file1 file2 file3 | grep foo
To jump back to a previous commit, first find the commit's hash using git log. To temporarily jump back to that commit, detach your head with: git checkout 789abcd This places you at commit 789abcd. You can now make new commits on top of this old commit without affecting the branch your head is...
C++17 C++17 introduces structured bindings, which makes it even easier to deal with multiple return types, as you do not need to rely upon std::tie() or do any manual tuple unpacking: std::map<std::string, int> m; // insert an element into the map and check if insertion succeeded auto [i...
To get a verbose list of all devices connected to adb, write the following command in your terminal: adb devices -l Example Output List of devices attached ZX1G425DC6 device usb:336592896X product:shamu model:Nexus_6 device:shamu 013e4e127e59a868 device usb:337641472X produc...
Write the following command in your terminal: adb shell getprop This will print all available information in the form of key/value pairs. You can just read specific information by appending the name of a specific key to the command. For example: adb shell getprop ro.product.model Here are a...
Composer is a dependency/package manager for PHP. It can be used to install, keep track of, and update your project dependencies. Composer also takes care of autoloading the dependencies that your application relies on, letting you easily use the dependency inside your project without worrying about...
While composer provides a system to manage dependencies for PHP projects (e.g. from Packagist), it can also notably serve as an autoloader, specifying where to look for specific namespaces or include generic function files. It starts with the composer.json file: { // ... "autoload&q...
An alternative community de facto standard is an addon called ember-concurrency that makes a lot of the promise confusion go away. It can be installed with the command ember install ember-concurrency. Pros Intuitive reasoning of complex asynchronous code. Offers a complete API for managing tas...
After creating a new model or modifying existing models, you will need to generate migrations for your changes and then apply the migrations to the specified database. This can be done by using the Django's built-in migrations system. Using the manage.py utility when in the project root directory: ...
Units of measure are additional type annotations that can be added to floats or integers. They can be used to verify at compile time that calculations are using units consistently. To define annotations: [<Measure>] type m // meters [<Measure>] type s // seconds [<Measure>] typ...
You can use traits to modify methods of a class, using traits in stackable fashion. The following example shows how traits can be stacked. The ordering of the traits are important. Using different order of traits, different behavior is achieved. class Ball { def roll(ball : String) = println(&q...
We can name our loops and break the specific one when necessary. outerloop: for (var i = 0;i<3;i++){ innerloup: for (var j = 0;j <3; j++){ console.log(i); console.log(j); if (j == 1){ break outerloop; } } } Output: 0 0...
All looping constructs allow the use of break and continue statements. They affect the immediately surrounding (innermost) loop. Basic Loop Control break terminates the loop: for x in 0..5 { if x > 2 { break; } println!("{}", x); } Output 0 1 2 continue finishes...
While many people think that ^ means the start of a string, it actually means start of a line. For an actual start of string anchor use, \A. The string hello\nworld (or more clearly) hello world Would be matched by the regular expressions ^h, ^w and \Ah but not by \Aw
With IronPython you can access any .net assembly which is compiled using the same or a lower version than the IronPython core. Example: Importing a a .net assembly and class from System import Math Example: Using an imported class: from System import Math print Math.Abs(-123) You can also lo...

Page 78 of 826