Tutorial by Examples: er

With Git, you can (almost) always turn the clock back Don't be afraid to experiment with commands that rewrite history*. Git doesn't delete your commits for 90 days by default, and during that time you can easily recover them from the reflog: $ git reset @~3 # go back 3 commits $ git reflog c4...
Elements can be selected by jQuery using jQuery Selectors. The function returns either an element or a list of elements. Basic selectors $("*") // All elements $("div") // All <div> elements $(".blue") ...
The charset attribute specifies the character encoding for the HTML document and needs to be a valid character encoding (examples include windows-1252, ISO-8859-2, Shift_JIS, and UTF-8). UTF-8 (Unicode) is the most widely used and should be used for any new project. 5 <meta charset="UTF-8...
This error appears while trying to update or delete records without including the WHERE clause that uses the KEY column. To execute the delete or update anyway - type: SET SQL_SAFE_UPDATES = 0; To enable the safe mode again - type: SET SQL_SAFE_UPDATES = 1;
Improper use of pointers are frequently a source of bugs that can include security bugs or program crashes, most often due to segmentation faults. Not checking for allocation failures Memory allocation is not guaranteed to succeed, and may instead return a NULL pointer. Using the returned value, w...
When contributors add to a project from different machines or operating systems, it may happen that they use different email addresses or names for this, which will fragment contributor lists and statistics. Running git shortlog -sn to get a list of contributors and the number of commits by them co...
This example is showing how to query a database with database/sql, taking as example a MySql database. package main import ( "log" "fmt" "database/sql" _ "github.com/go-sql-driver/mysql" ) func main() { dsn := "mysql_usern...
Normally, string literals in Haskell have a type of String (which is a type alias for [Char]). While this isn't a problem for smaller, educational programs, real-world applications often require more efficient storage such as Text or ByteString. OverloadedStrings simply changes the type of literals...
Standard Haskell allows you to write integer literals in decimal (without any prefix), hexadecimal (preceded by 0x or 0X), and octal (preceded by 0o or 0O). The BinaryLiterals extension adds the option of binary (preceded by 0b or 0B). 0b1111 == 15 -- evaluates to: True
In C++, sequences of characters are represented by specializing the std::basic_string class with a native character type. The two major collections defined by the standard library are std::string and std::wstring: std::string is built with elements of type char std::wstring is built with e...
As seen in "Lambda Functions", functions can take other functions as a parameter. The "function type" which you'll need to declare functions which take other functions is as follows: # Takes no parameters and returns anything () -> Any? # Takes a string and an integer a...
We can reference a function without actually calling it by prefixing the function's name with ::. This can then be passed to a function which accepts some other function as a parameter. fun addTwo(x: Int) = x + 2 listOf(1, 2, 3, 4).map(::addTwo) # => [3, 4, 5, 6] Functions without a receiv...
One of the very basic animations that you could come across is the NumberAnimation. This animation works by changing the numeric value of a property of an item from an initial state to a final state. Consider the following complete example: import QtQuick 2.7 import QtQuick.Controls 2.0 ...
In some cases, you might not want to use the default maps, Apple provides. You can add an overlay to your mapView that contains custom tiles for example from OpenStreetMap. Let's assume, self.mapView is your MKMapView that you have already added to your ViewController. At first, your ViewControll...
You can use route parameters to get the part of the URI segment. You can define a optional or required route parameter/s while creating a route. Optional parameters have a ? appended at the end of the parameter name. This name is enclosed in a curly braces {} Optional Parameter Route::get('profi...
// View to hold the CAGradientLayer. let view: UIView = UIView(frame: CGRect(x: 0, y: 0, width: 320, height: 320)) // Initialize gradient layer. let gradientLayer: CAGradientLayer = CAGradientLayer() // Set frame of gradient layer. gradientLayer.frame = view.bounds // Color a...
// View to hold the CAGradientLayer. let view: UIView = UIView(frame: CGRect(x: 0, y: 0, width: 320, height: 320)) // Initialize gradient layer. let gradientLayer: CAGradientLayer = CAGradientLayer() // Set frame of gradient layer. gradientLayer.frame = view.bounds // Color at the top of...
// View to hold the CAGradientLayer. let view: UIView = UIView(frame: CGRect(x: 0, y: 0, width: 320, height: 320)) // Initialize gradient layer. let gradientLayer: CAGradientLayer = CAGradientLayer() // Set frame of gradient layer. gradientLayer.frame = view.bounds // Color at the top of...
Initialize the UITapGestureRecognizer with a target, self in this case, and an action which is a method that has a single parameter: a UITapGestureRecognizer. After initialization, add it to the view that it should recognize taps in. Swift override func viewDidLoad() { super.viewDidLoad() ...
For instance, a computation involving commands to read and write from the prompt: First we describe the "commands" of our computation as a Functor data type {-# LANGUAGE DeriveFunctor #-} data TeletypeF next = PrintLine String next | ReadLine (String -> next) derivin...

Page 51 of 417