Tutorial by Examples: c

DELETE FROM `table_name` WHERE `field_one` = 'value_one' This will delete all rows from the table where the contents of the field_one for that row match 'value_one' The WHERE clause works in the same way as a select, so things like >, <, <> or LIKE can be used. Notice: It is necessa...
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...
Privileges The CREATE VIEW statement requires the CREATE VIEW privilege for the view, and some privilege for each column selected by the SELECT statement. For columns used elsewhere in the SELECT statement, you must have the SELECT privilege. If the OR REPLACE clause is present, you must also have ...
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 ...
lst = ['a', 'b', 'c', 'd', 'e'] lst[2:4] # Output: ['c', 'd'] lst[2:] # Output: ['c', 'd', 'e'] lst[:4] # Output: ['a', 'b', 'c', 'd']
Private inheritance is useful when it is required to restrict the public interface of the class: class A { public: int move(); int turn(); }; class B : private A { public: using A::turn; }; B b; b.move(); // compile error b.turn(); // OK This approach efficiently pr...
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/channels/appearance_channel.rb class NotificationsChannel < ApplicationCable::Channel def subscribed stream_from "notifications" end def unsubscribed end def notify(data) ActionCable.server.broadcast "notifications", { title: 'New things!', ...
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...
Creating a Snackbar can be done as follows: Snackbar.make(view, "Text to display", Snackbar.LENGTH_LONG).show(); The view is used to find a suitable parent to use to display the Snackbar. Typically this would be a CoordinatorLayout that you've defined in your XML, which enables adding ...
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: ...

Page 113 of 826