Tutorial by Examples: e

Consider this simple class: class SmsUtil { public bool SendMessage(string from, string to, string message, int retryCount, object attachment) { // Some code } } Before C# 3.0 it was: var result = SmsUtil.SendMessage("Mehran", "Maryam", "Hello...
Doxygen is a commonly used code documentation tool (for languages including C++, C# and Java) that also supports the use of Markdown. In addition to the standard Markdown syntax, there are a number of Doxygen-specific elements. The primary features are the use of @ref tags for references, and the @...
The Python Standard Library includes an interactive debugging library called pdb. pdb has extensive capabilities, the most commonly used being the ability to 'step-through' a program. To immediately enter into step-through debugging use: python -m pdb <my_file.py> This will start the debu...
PHP 7 introduces a new kind of operator, which can be used to compare expressions. This operator will return -1, 0 or 1 if the first expression is less than, equal to, or greater than the second expression. // Integers print (1 <=> 1); // 0 print (1 <=> 2); // -1 print (2 <=> 1...
The simple answer is that you cannot do this. Once an array has been created, its size cannot be changed. Instead, an array can only be "resized" by creating a new array with the appropriate size and copying the elements from the existing array to the new one. String[] listOfCities = ne...
setTimeout Executes a function, after waiting a specified number of milliseconds. used to delay the execution of a function. Syntax : setTimeout(function, milliseconds) or window.setTimeout(function, milliseconds) Example : This example outputs "hello" to the console after 1 secon...
Responses can be written to a http.ResponseWriter using templates in Go. This proves as a handy tool if you wish to create dynamic pages. (To learn how Templates work in Go, please visit the Go Templates Documentation page.) Continuing with a simple example to utilise the html/template to respond ...
Normal types, like String, are not nullable. To make them able to hold null values, you have to explicitly denote that by putting a ? behind them: String? var string : String = "Hello World!" var nullableString: String? = null string = nullableString // Compiler error: Can't...
To access functions and properties of nullable types, you have to use special operators. The first one, ?., gives you the property or function you're trying to access, or it gives you null if the object is null: val string: String? = "Hello World!" print(string.length) // Compile erro...
In order to install PostgreSQL on OSX, you need to know which versions are currently supported. Use this command to see what versions you have available. sudo port list | grep "^postgresql[[:digit:]]\{2\}[[:space:]]" You should get a list that looks something like the following: post...
Ruby Standard Library has a Singleton module which implements the Singleton pattern. The first step in creating a Singleton class is to require and include the Singleton module in a class: require 'singleton' class Logger include Singleton end If you try to instantiate this class as you n...
If need set value 0 to column B, where in column A are duplicated data first create mask by Series.duplicated and then use DataFrame.ix or Series.mask: In [224]: df = pd.DataFrame({'A':[1,2,3,3,2], ...: 'B':[1,7,3,0,8]}) In [225]: mask = df.A.duplicated(keep=False) In...
Use drop_duplicates: In [216]: df = pd.DataFrame({'A':[1,2,3,3,2], ...: 'B':[1,7,3,0,8]}) In [217]: df Out[217]: A B 0 1 1 1 2 7 2 3 3 3 3 0 4 2 8 # keep only the last value In [218]: df.drop_duplicates(subset=['A'], keep='last') Out[218]: ...
When working with regular expressions one modifier for PCRE is g for global match. In R matching and replacement functions have two version: first match and global match: sub(pattern,replacement,text) will replace the first occurrence of pattern by replacement in text gsub(pattern,replace...
Running the command: grep sam someFile.txt When someFile.txt contains: fred 14 m foo sam 68 m bar christina 83 f baz bob 22 m qux Sam 41 m quux Will produce this output: sam 68 m bar
class Person { public string FirstName { get; set; } public string LastName { get; set; } } class Pet { public string Name { get; set; } public Person Owner { get; set; } } public static void Main(string[] args) { var magnus = new Person { FirstName = "Magnus...
The unary plus (+) precedes its operand and evaluates to its operand. It attempts to convert the operand to a number, if it isn't already. Syntax: +expression Returns: a Number. Description The unary plus (+) operator is the fastest (and preferred) method of converting something into a n...
The delete operator deletes a property from an object. Syntax: delete object.property delete object['property'] Returns: If deletion is successful, or the property did not exist: true If the property to be deleted is an own non-configurable property (can't be deleted): false in non...
The typeof operator returns the data type of the unevaluated operand as a string. Syntax: typeof operand Returns: These are the possible return values from typeof: TypeReturn valueUndefined"undefined"Null"object"Boolean"boolean"Number"number"String&quot...
The void operator evaluates the given expression and then returns undefined. Syntax: void expression Returns: undefined Description The void operator is often used to obtain the undefined primitive value, by means of writing void 0 or void(0). Note that void is an operator, not a functio...

Page 227 of 1191