DELETE FROM table_name ;
This will delete everything, all rows from the table. It is the most basic example of the syntax. It also shows that DELETE statements should really be used with extra care as they may empty a table, if the WHERE clause is omitted.
CommandDescription<C-w>Delete word before cursor<C-t>Indent current line with by one shiftwidth<C-d>Unindent current line with by one shiftwidth<C-f>reindent the line, (move cursor to auto indent position)<C-a>Insert previously inserted text<C-e>Insert the charact...
An unnamed namespace can be used to ensure names have internal linkage (can only be referred to by the current translation unit). Such a namespace is defined in the same way as any other namespace, but without the name:
namespace {
int foo = 42;
}
foo is only visible in the translation uni...
4.0.3
Using a CustomTabsIntent, it is now possible to configure Chrome custom tabs in order to customize key UI components in the browser that is opened from your app.
This is a good alternative to using a WebView for some cases. It allows loading of a web page with an Intent, with the added abil...
In C#, there are two different kinds of equality: reference equality and value equality. Value equality is the commonly understood meaning of equality: it means that two objects contain the same values. For example, two integers with the value of 2 have value equality. Reference equality means that ...
There are few approaches available there:
You can subscribe for keyboard appearance events notifications and change offset manually:
//Swift 2.0+
override func viewDidLoad() {
super.viewDidLoad()
NSNotificationCenter.defaultCenter().addObserver(self, selector: #selector(YourVCClas...
Controller class names are pluralized. The reason is the controller controls multiple instances of object instance.
For Example: OrdersController would be the controller for an orders table. Rails will then look for the class definition in a file called orders_controller.rb in the /app/controllers ...
The model is named using the class naming convention of unbroken MixedCase and is always the singular of the table name.
For Example: If a table was named orders, the associated model would be named Order
For Example: If a table was named posts, the associated model would be named Post
Rails will...
Predefined macros are those that the compiler defines (in contrast to those user defines in the source file). Those macros must not be re-defined or undefined by user.
The following macros are predefined by the C++ standard:
__LINE__ contains the line number of the line this macro is used on, an...
To show some content in a new window, a Stage needs to be created. After creation and initialisation show or showAndWait needs to be called on the Stage object:
// create sample content
Rectangle rect = new Rectangle(100, 100, 200, 300);
Pane root = new Pane(rect);
root.setPrefSize(500, 500);
...
If you have an existing class that you'd like to use, perform Step 2 and then skip to Step 5. (For some cases, I had to add an explicit #import <Foundation/Foundation.h to an older ObjC File)
Step 1: Add Objective-C Implementation -- .m
Add a .m file to your class, and name it CustomObje...
Step 1: Create New Swift Class
Add a .swift file to your project, and name it MySwiftObject.swift
In MySwiftObject.swift:
import Foundation
class MySwiftObject : NSObject {
var someProperty: AnyObject = "Some Initializer Val"
init() {}
func someFunction(someArg...
app/assets/javascripts/channels/notifications.coffee
App.notifications = App.cable.subscriptions.create "NotificationsChannel",
connected: ->
# Called when the subscription is ready for use on the server
$(document).on "change", "input", (e)=>
...
Java-like enumerations can be created by extending Enumeration.
object WeekDays extends Enumeration {
val Mon, Tue, Wed, Thu, Fri, Sat, Sun = Value
}
def isWeekend(day: WeekDays.Value): Boolean = day match {
case WeekDays.Sat | WeekDays.Sun => true
case _ => false
}
isWeekend...
An alternative to extending Enumeration is using sealed case objects:
sealed trait WeekDay
object WeekDay {
case object Mon extends WeekDay
case object Tue extends WeekDay
case object Wed extends WeekDay
case object Thu extends WeekDay
case object Fri extends WeekDay
case objec...
The String List passed as a parameter to the share() method contains the paths of all the files you want to share.
It basically loops through the paths, adds them to Uri, and starts the Activity which can accept Files of this type.
public static void share(AppCompatActivity context,List<Strin...
Functions can either be named or unnamed (anonymous functions):
var namedSum = function sum (a, b) { // named
return a + b;
}
var anonSum = function (a, b) { // anonymous
return a + b;
}
namedSum(1, 3);
anonSum(1, 3);
4
4
But their names are private to their own scope:
...
To avoid verbose null checking, the ?. operator has been introduced in the language.
The old verbose syntax:
If myObject IsNot Nothing AndAlso myObject.Value >= 10 Then
Can be now replaced by the concise:
If myObject?.Value >= 10 Then
The ? operator is particularly powerful when you...
The NameOf operator resolves namespaces, types, variables and member names at compile time and replaces them with the string equivalent.
One of the use cases:
Sub MySub(variable As String)
If variable Is Nothing Then Throw New ArgumentNullException("variable")
End Sub
The old sy...