Intents can be used to broadcast messages to other components of your application (such as a running background service) or to the entire Android system.
To send a broadcast within your application, use the LocalBroadcastManager class:
Intent intent = new Intent("com.example.YOUR_ACTION"...
TRUNCATE TABLE Employee;
Using truncate table is often better then using DELETE TABLE as it ignores all the indexes and triggers and just removes everything.
Delete table is a row based operation this means that each row is deleted. Truncate table is a data page operation the entire data page is...
This code selects data out of a table and displays it in the query tool (usually SSMS)
SELECT Column1, Column2, Column3 FROM MySourceTable;
This code inserts that data into a table:
INSERT INTO MyTargetTable (Column1, Column2, Column3)
SELECT Column1, Column2, Column3 FROM MySourceTable;
This code selects data out of a table:
SELECT Column1, Column2, Column3 FROM MySourceTable;
This code creates a new table called MyNewTable and puts that data into it
SELECT Column1, Column2, Column3
INTO MyNewTable
FROM MySourceTable;
To move data you first insert it into the target, then delete whatever you inserted from the source table. This is not a normal SQL operation but it may be enlightening
What did you insert? Normally in databases you need to have one or more columns that you can use to uniquely identify rows so we w...
You can access SharedPreferences in several ways:
Get the default SharedPreferences file:
import android.preference.PreferenceManager;
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(this);
Get a specific SharedPreferences file:
public static final String PREF_FILE_NAM...
The shift operators allow programmers to adjust an integer by shifting all of its bits to the left or the right. The following diagram shows the affect of shifting a value to the left by one digit.
Left-Shift
uint value = 15; // 00001111
uint doubled = value << 1; // Resu...
Within a catch block the throw keyword can be used on its own, without specifying an exception value, to rethrow the exception which was just caught. Rethrowing an exception allows the original exception to continue up the exception handling chain, preserving its call stack or associated data:
try...
SRXMPPDemo
Download the example and all the classes here - https://github.com/SahebRoy92/SRXMPPDemo
A demo on XMPP in Objective C, with various simple and complex features implemented in it. All the features of XMPP is done by "in band" xmpp functions.
Few features this project contains...
Comparable is one of the most popular modules in Ruby. Its purpose is to provide with convenience comparison methods.
To use it, you have to include Comparable and define the space-ship operator (<=>):
class Rectangle
include Comparable
def initialize(a, b)
@a = a
@b = b
...
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.
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...
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...
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...
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)=>
...