Tutorial by Examples: e

Any value in Clojure is considered truthy unless it is false or nil. You can find the truthiness of a value with (boolean value). You can find the truthiness of a list of values using (or), which returns true if any arguments are truthy, or (and) which returns true if all arguments are truthy. =&gt...
Given items as (value, weight) we need to place them in a knapsack (container) of a capacity k. Note! We can break items to maximize value! Example input: values[] = [1, 4, 5, 2, 10] weights[] = [3, 2, 1, 2, 4] k = 8 Expected output: maximumValueOfItemsInK = 20; Algorithm: 1) Sort values...
Detailed instructions on getting concurrency set up or installed.
Basic error handling should be added to all procedures in production code, since otherwise an unexpected error will cause Access to crash or invite the end-user to enter debug mode. A typical pattern for a basic error handler that traps all errors is: Sub Name() On Error GoTo errHandler '[some...
Use the makemigrations --name <your_migration_name> option to allow naming the migrations(s) instead of using a generated name. python manage.py makemigrations --name <your_migration_name> <app_name>
Opening Generic ASCII Text Files 5.6.0 open my $filehandle, '<', $name_of_file or die "Can't open $name_of_file, $!"; This is the basic idiom for "default" File IO and makes $filehandle a readable input stream of bytes, filtered by a default system-specific decoder, which...
Enable utf8 pragma In order to enable utf8 pragma in one-liner, perl interpreter should be called with -Mutf8 option: perl -Mutf8 -E 'my $人 = "human"; say $人' Unicode handling with -C switch The -C command line flag lets you control Unicode features. It can be followed by a list of o...
Setting encoding with open() When opening a text file, you may specify it's encoding explicitly with a three-argument open(). This en-/decoder attached to a file handle is called an "I/O layer": my $filename = '/path/to/file'; open my $fh, '<:encoding(utf-8)', $filename or die "...
The utf8 pragma indicates that the source code will be interpreted as UTF-8. Of course, this will only work if your text editor is also saving the source as UTF-8 encoded. Now, string literals can contain arbitrary Unicode characters; identifiers can also contain Unicode but only word-like characte...
8 The proposed Object.entries() method returns an array of key/value pairs for the given object. It does not return an iterator like Array.prototype.entries(), but the Array returned by Object.entries() can be iterated regardless. const obj = { one: 1, two: 2, three: 3 }; Object...
If we need to parse a large file, e.g. a CSV more than 10 Mbytes containing millions of rows, some use file or file_get_contents functions and end up with hitting memory_limit setting with Allowed memory size of XXXXX bytes exhausted error. Consider the following source (top-1m.csv has exactly...
After successfully installing Xamarin as described in the first example, it's time to launch the first sample application. Step 1: Creating a new Project. In Visual Studio, choose New -> Project -> Visual C# -> Cross-Platform -> Blank App (Xamarin.Forms Portable) Name the app "He...
The Salesforce application consists of several products which can be integrated with each other: Sales Cloud Marketing Page, Salesforce Documentation Service Cloud Marketing Page, Salesforce Documentation, Trailhead Marketing Cloud Marketing Page Community Cloud Marketing Page, Salesforce Do...
LeakCanary is an Open Source Java library to detect memory leaks in your debug builds. Just add the dependencies in the build.gradle: dependencies { debugCompile 'com.squareup.leakcanary:leakcanary-android:1.5.1' releaseCompile 'com.squareup.leakcanary:leakcanary-android-no-op:1.5.1' ...
Normal mode Ctrl-wo Ex mode :only or short :on
static and templates folder in the apps may should also contain a folder with the name of app ex. blog this is a convention used to prevent namespace pollution, so we reference the files like /blog/base.html rather than /base.html which provides more clarity about the file we are referencing and pre...
The coordinate systems of Matplotlib come very handy when trying to annotate the plots you make. Sometimes you would like to position text relatively to your data, like when trying to label a specific point. Other times you would maybe like to add a text on top of the figure. This can easily be achi...
In order for a program to react to a certain signal, other than using default action, custom signal handler can be installed using sigaction. sigaction receives three arguments - signal to act on, pointer to sigaction_t structure which, if not NULL, is describing new behaviour and pointer to sigacti...
SELECT DATE('2003-12-31 01:02:03'); The output will be: 2003-12-31
Least squares is a standard approach to problems with more equations than unknowns, also known as overdetermined systems. Consider the four equations: x0 + 2 * x1 + x2 = 4 x0 + x1 + 2 * x2 = 3 2 * x0 + x1 + x2 = 5 x0 + x1 + x2 = 4 We can express this as a matrix multiplication A * x = b: A ...

Page 548 of 1191