Tutorial by Examples: ti

["Guten Tag " | [<<"Hello">>]]. [<<"Guten Tag ">> | [<<"Hello">>]]. [$G, $u, $t, $e, $n , $T, $a, $g | [<<"Hello">>]]. [71,117,116,101,110,84,97,103,<<"Hello">>].
Data = ["Guten tag ",<<"Hello">>], Len = iolist_size(Data), [<<Len:32>> | Data]. The size of an iolist can be calculated using the iolist_size/1. This snippet calculates the size of a message and creates and appends it to the front as a four byte bina...
The following example uses expect and receive to mock an Order's call to a CreditCardService, so that the test passes only if the call is made without having to actually make it. class Order def cancel CreditCardService.instance.refund transaction_id end end describe Order do des...
Clear the canvas using compositing operation. This will clear the canvas independent of transforms but is not as fast as clearRect(). ctx.globalCompositeOperation = 'copy'; anything drawn next will clear previous content.
Most Common Lisp implementations will try to load an init file on startup: ImplementationInit fileSite/System Init fileABCL$HOME/.abclrcAllegro CL$HOME/.clinit.clECL$HOME/.eclrcClasp$HOME/.clasprcCLISP$HOME/.clisprc.lispClozure CLhome:ccl-init.lisp or home:ccl-init.fasl or home:.ccl-init.lispCMUCL$...
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...
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...
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&...
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...
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...
Some Java programmers have a general aversion to throwing or propagating exceptions. This leads to code like the following: public Reader getReader(String pathname) { try { return new BufferedReader(FileReader(pathname)); } catch (IOException ex) { System.out.println(&q...
mod_rewrite must be enabled before being used on an Apache server. Debian/Ubuntu Run a2enmod rewrite Then restart Apache with service apache2 restart General case Add or uncomment the following line in the static configuration file (such as httpd.conf): LoadModule rewrite_module modules/mod_re...
There are many time zones around the world, it is important to make sure your server is set to the right one. This is done in .htaccess by using: SetEnv TZ America/Indianapolis A few example of possible other time zones: America/Los_Angeles America/Los_Angeles - Pacific Time Pacific/Honolulu...
Let's have a look at various options to wait for completion of tasks submitted to Executor ExecutorService invokeAll() Executes the given tasks, returning a list of Futures holding their status and results when everything is completed. Example: import java.util.concurrent.*; import ja...
Entity class @Entity @Table(name = "USER") public class User { @Id @Column(name = "ID") private Long id; @Column(name = "USERNAME") private String username; @ManyToOne @JoinColumn("ORGANIZATION_ID") pr...

Page 297 of 505