Tutorial by Examples: code

Run go test as normal, yet with the coverprofile flag. Then use go tool to view the results as HTML. go test -coverprofile=c.out go tool cover -html=c.out
To enable code shrinking with ProGuard, add minifyEnabled true to the appropriate build type in your build.gradle file. android { buildTypes { release { minifyEnabled true proguardFiles getDefaultProguardFile(‘proguard-android.txt'), 'pro...
For a class Person like: public class Person { public string Name { get; set; } public int Age { get; set; } public string Clothes { get; set; } } var person1 = new Person { Name = "Jon", Age = 20, Clothes = "some clothes" }; var person2 = new Person { Name ...
For given type Person: public class Person { public string Name { get; set; } public int Age { get; set; } public string Clothes { get; set; } } List<Person> persons = new List<Person> { new Person{ Name = "Jon", Age = 20, Clothes = "some clothes...
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&...
Apart from the Javadoc documentation code can be documented inline. Single Line comments are started by // and may be positioned after a statement on the same line, but not before. public void method() { //single line comment someMethodCall(); //single line comment after statement }...
php bin/magento setup:di:compile You might need to delete var/di (including the folder) in order to go through compilation. rm -rf var/di
The method charCodeAt retrieves the Unicode character code of a single character: var charCode = "µ".charCodeAt(); // The character code of the letter µ is 181 To get the character code of a character in a string, the 0-based position of the character is passed as a parameter to charCo...
Print the path to the active developer directory (selected Xcode) xcode-select -p Select a different version of Xcode, e.g. Beta sudo xcode-select -s /Applications/Xcode-beta.app Reset to the default version of Xcode sudo xcode-select -r This is equivalent to running sudo xcode-select -s /Appl...
When pasting text through a terminal emulator, the auto-indent feature may destroy the indentation of the pasted text. For example: function () { echo 'foo' echo 'bar' echo 'baz' } will be pasted as: function () { echo 'foo' echo 'bar' echo 'baz' ...
The canonical way of writing code inside documentation is with the {@code } construct. If you have multiline code wrap inside <pre></pre>. /** * The Class TestUtils. * <p> * This is an {@code inline("code example")}. * <p> * You should wrap it in pre tags...
This example shows how to update a UI component from a background thread by using a SynchronizationContext void Button_Click(object sender, EventArgs args) { SynchronizationContext context = SynchronizationContext.Current; Task.Run(() => { for(int i = 0; i < 10; i++) ...
The received bytes have to be decoded with the correct character encoding to be interpreted as text: Python 3.x3.0 import urllib.request response = urllib.request.urlopen("http://stackoverflow.com/") data = response.read() encoding = response.info().get_content_charset() html = d...
With AspNetCore you can develop the application on any platform including Mac,Linux,Window and Docker. Installation and SetUp Install visual Studio Code from here Add C# extesnion Install dot net core sdk. You can install from here Now you have all the tools available. To develop the applic...
C# allows using pointer variables in a function of code block when it is marked by the unsafe modifier. The unsafe code or the unmanaged code is a code block that uses a pointer variable. A pointer is a variable whose value is the address of another variable i.e., the direct address of the memory l...
For compiling unsafe code, you have to specify the /unsafe command-line switch with command-line compiler. For example, to compile a program named prog1.cs containing unsafe code, from command line, give the command: csc /unsafe prog1.cs If you are using Visual Studio IDE then you need to enabl...
A complex type allows you to map selected fields of a database table into a single type that is a child of the main type. [ComplexType] public class Address { public string Street { get; set; } public string Street_2 { get; set; } public string City { get; set; } public string...
Generate code Alt+Insert Add comment lines Ctrl+Shift+C Remove comment lines Ctrl+/ Format selection Alt+Shift+F Fix all class imports Ctrl-Shift-I Fix selected class's import Alt+Shift+I Shift lines left Alt+Shift+← Shift lines right Alt+Shift+→ Shift lines up Alt+Shift+↑ Shift li...
Julia code can create, manipulate, and execute command literals, which execute in the OS's system environment. This is powerful but often makes programs less portable. A command literal can be created using the `` literal. Information can be interpolated using the $ interpolation syntax, as with st...

Page 10 of 21