Tutorial by Examples: e

Some programmers think that it is a good idea to save space by using a null to represent an empty array or collection. While it is true that you can save a small amount of space, the flipside is that it makes your code more complicated, and more fragile. Compare these two versions of a method for ...
Common Lisp has a way to influence the compilation strategies. It makes sense to define your preferred values. Optimization values are between 0 (unimportant) and 3 (extremely important). 1 is the neutral value. It's useful to always use safe code (safety = 3) with all runtime checks enabled. Not...
All arrays implement the non-generic IList interface (and hence non-generic ICollection and IEnumerable base interfaces). More importantly, one-dimensional arrays implement the IList<> and IReadOnlyList<> generic interfaces (and their base interfaces) for the type of data that they cont...
On StackOverflow, we often see code like this in Answers: public String joinStrings(String a, String b) { if (a == null) { a = ""; } if (b == null) { b = ""; } return a + ": " + b; } Often, this is accompanied with an asse...
Rust's coherence rule requires that either the trait or the type for which you are implementing the trait must be defined in the same crate as the impl, so it is not possible to implement Serialize and Deserialize for a type in a different crate directly. The newtype pattern and Deref coercion provi...
Use vectors to calculate incremental [x,y] from [startX,startY] to [endX,endY] // dx is the total distance to move in the X direction var dx = endX - startX; // dy is the total distance to move in the Y direction var dy = endY - startY; // use a pct (percentage) to travel the total distance...
With functional testing data is often modified. This can cause subsequent runs of the test suite to fail (as the data could have changed from the original state it was in). If you have setup your data source using an ORM or framework that supports migration or seeding (like Doctrine, Propel, Larave...
Functional testing also can include testing processes that leave your environment, such as external API calls and emails. As an example, imagine you're functionally testing the registration process for your website. The final step of this process involves sending an email with an activation link. U...
HTML: <div class="container"> <div class="child"></div> </div> CSS: .container { height: 500px; width: 500px; display: flex; // Use Flexbox align-items: center; // This centers children vertically in the parent. ...
Because data is sensitive when dealt with between two threads (think concurrent read and concurrent write can conflict with one another, causing race conditions), a set of unique objects were made in order to facilitate the passing of data back and forth between threads. Any truly atomic operation c...
In features/step_definitions/documentation.rb: When /^I go to the "([^"]+)" documentation$/ do |section| path_part = case section when "Documentation" "documentation" else raise "Unknown documentation section: #{section...
Detailed instructions on getting filemaker set up or installed.
PHP is able to parse a number of date formats. If you want to parse a non-standard format, or if you want your code to explicitly state the format to be used, then you can use the static DateTime::createFromFormat method: Object oriented style $format = "Y,m,d"; $time = "2009,2,26&...
Messages can be written with; Write-Verbose "Detailed Message" Write-Information "Information Message" Write-Debug "Debug Message" Write-Progress "Progress Message" Write-Warning "Warning Message" Each of these has a preference variable; $Ve...
Utilizing .Net System.Security.Cryptography.HashAlgorithm namespace to generate the message hash code with the algorithms supported. $example="Nobody expects the Spanish Inquisition." #calculate $hash=[System.Security.Cryptography.HashAlgorithm]::Create("sha256").ComputeHas...
Here is an example of how to define a different action for each Marker's InfoWindow click event. Use a HashMap in which the marker ID is the key, and the value is the corresponding action it should take when the InfoWindow is clicked. Then, use a OnInfoWindowClickListener to handle the event of a ...
Data providers allow creating multiple test inputs to be run within a test. Let's consider a test which verifies that numbers are doubled correctly. To create data provider provide a static method which returns either Object[][] or Iterator<Object[]> (the latter allows for lazy computation of ...
To alias a command in you ~/.zshrc file, you can use the following syntax: alias [alias-name]="[command-to-execute]" For example, it is common to execute the command ls -a. You can alias this command as la as such: alias la="ls -a" After reloading the ~/.zshrc file, you w...
zsh loads configuration from the ~/.zshrc file on startup. If you make changes to that file, you can either restart zsh or run the following command to reload the configuration. . ~/.zshrc You can alias this useful command in your ~/.zshrc like this: alias reload=". ~/.zshrc"
Detailed instructions on getting yarn set up or installed. If you have npm installed on your system: npm install --global yarn On macOS: via Homebrew: brew install yarn via MacPorts: sudo port install yarn (node will be installed if not present) On Windows: via Chocolatey: choco install...

Page 702 of 1191