Tutorial by Examples: by

Below won't work on a Windows machine $file = $request->file('file_upload'); $sampleName = 'UserUpload'; $destination = app_path() . '/myStorage/'; $fileName = $sampleName . '-' . date('Y-m-d-H:i:s') . '.' . $file->getClientOriginalExtension(); $file->move($destination, $fileName); ...
This query gets all books with ratings greater than or equal to zero and less than six. all_books = Book.objects.filter(ratings_range_contained_by=(0, 6))
byte type has no literal suffix. Integer literals are implicitly converted from int: byte b = 127;
sbyte type has no literal suffix. Integer literals are implicitly converted from int: sbyte sb = 127;
Consider the following C# code Expression<Func<int, int>> expression = a => a + 1; Because the C# compiler sees that the lambda expression is assigned to an Expression type rather than a delegate type it generates an expression tree roughly equivalent to this code ParameterExpres...
document.getElementById('uniqueID') will retrieve <div id="uniqueID"></div> As long as an element with the given ID exists, document.getElementById will return only that element. Otherwise, it will return null. Note: IDs must be unique. Multiple elements cannot have the...
document.getElementsByClassName('class-name') will retrieve <a class="class-name">Any</a> <b class="class-name">tag</b> <div class="class-name an-extra-class">with that class.</div> If no existing elements contain the given c...
document.getElementsByTagName('b') will retrieve <b>All</b> <b>of</b> <b>the b elements.</b> If no elements with the given tag name exist, an empty collection will be returned.
The SDK supports time triggered based on CRON expressions with 6 fields ({second} {minute} {hour} {day} {month} {day of the week}). It requires an extra setting on the JobHostConfiguration: config.UseTimers(); Your time triggered functions respond to this syntax: // Runs once every 5 minutes p...
Error handling is extremely important, we can define functions to be triggered when an execution error happens in one of your triggered functions: //Fires when 10 errors occur in the last 30 minutes (sliding) public static void ErrorMonitor([ErrorTrigger("0:30:00", 10)] TraceFilter filte...
Here is a program that calls malloc but not free: #include <stdio.h> #include <stdlib.h> int main(int argc, char **argv) { char *s; s = malloc(26); // the culprint return 0; } With no extra arguments, valgrind will not look for this error. But if we turn on...
import java.nio.charset.StandardCharsets; import java.util.Arrays; public class GetUtf8BytesFromString { public static void main(String[] args) { String str = "Cyrillic symbol Ы"; //StandardCharsets is available since Java 1.7 //for ealier version use ...
In general, it is considered good practice to throw by value (rather than by pointer), but catch by (const) reference. try { // throw new std::runtime_error("Error!"); // Don't do this! // This creates an exception object // on the heap and would require you to catch the ...
You can find records by any field in your table using find_by. So, if you have a User model with a first_name attribute you can do: User.find_by(first_name: "John") #=> #<User id: 2005, first_name: "John", last_name: "Smith"> Mind that find_by doesn't thr...
Cloning an object by implementing the Cloneable interface. public class Sheep implements Cloneable { private String name; private int weight; public Sheep(String name, int weight) { this.name = name; this.weight = weight; } @Override public Ob...
string str = "this--is--a--complete--sentence"; string[] tokens = str.Split(new[] { "--" }, StringSplitOptions.None); Result: [ "this", "is", "a", "complete", "sentence" ]
This book is known as CLtL2. This is the second edition of the book Common Lisp the Language. It was published in 1990, before the ANSI CL standard was final. It took the original language definition from the first edition (published in 1984) and described all changes in the standardization process...
1. Character Class Character class is denoted by []. Content inside a character class is treated as single character separately. e.g. suppose we use [12345] In the example above, it means match 1 or 2 or 3 or 4 or 5 . In simple words, it can be understood as or condition for single characters (...
This program copies a file using readable and a writable stream with the pipe() function provided by the stream class // require the file system module var fs = require('fs'); /* Create readable stream to file in current directory named 'node.txt' Use utf8 encoding Read the data...
app.js const readline = require('readline'); const fs = require('fs'); var file = 'path.to.file'; var rl = readline.createInterface({ input: fs.createReadStream(file), output: process.stdout, terminal: false }); rl.on('line', function (line) { console.log(line) // print...

Page 6 of 23