SELECT 1,22,44
UNION
SELECT 2,33,55
SELECT 1,22,44
UNION
SELECT 2,33,55
UNION
SELECT 2,33,55
The result is the same as above.
use UNION ALL
when
SELECT 1,22,44
UNION
SELECT 2,33,55
UNION ALL
SELECT 2,33,55
In InnoDB, having a long PRIMARY KEY (either a single column with a
lengthy value, or several columns that form a long composite value)
wastes a lot of disk space. The primary key value for a row is duplicated in all the secondary index records that point to the same
row. Create an AUTO_INCREME...
You may want to re-seed your database without affecting your previously created seeds. For this purpose, you can use firstOrCreate in your seeder:
EmployeeType::firstOrCreate([
'type' => 'manager',
]);
Then you can seed the database:
php artisan db:seed
Later, if you want to add a...
The correct invocation of helper modules and functions can be intimidating because
these are generated dynamically (e.g., when creating a new project or adding a new resource)
they are not documented explicitly (e.g., MyApp.ErrorHelpers.error_tag)
the documentation does not cover all examples (...
To automatically reload vimrc upon save, add the following to your vimrc:
if has('autocmd') " ignore this section if your vim does not support autocommands
augroup reload_vimrc
autocmd!
autocmd! BufWritePost $MYVIMRC,$MYGVIMRC nested source %
augroup END
endif
a...
The Ruby Version Manager is a command line tool to simply install and manage different versions of Ruby.
rvm istall 2.3.1 for example installs Ruby version 2.3.1 on your machine.
With rvm list you can see which versions are installed and which is actually set for use.
user@dev:~$ rvm li...
To integrate Siri capabilities in your app, you should add an extensions as you would do while creating an iOS 10 Widget (old Today View Extension) or a custom keyboard.
Adding capability
1- In the project settings, select your iOS app target and go to Capabilities tab
2- Enable the Siri capabili...
Method 1:
proc sql;
create table foo like sashelp.class;
quit;
Method 2:
proc sql;
create table bar as
select * from sashelp.class (obs=0);
quit;
Method 1 should be the preferred option
PROC SQL options;
SELECT column(s)
FROM table-name | view-name
WHERE expression
GROUP BY column(s)
HAVING expression
ORDER BYcolumn(s);
QUIT;
Example 1:
proc sql;
select name
,sex
from sashelp.class ;
quit;
The SELECT statement is specified in this order :
1....
Importing the framework
Swift
import Contacts
Objective-C
#import <Contacts/Contacts.h>
Checking accessibility
Swift
switch CNContactStore.authorizationStatusForEntityType(CNEntityType.Contacts){
case .Authorized: //access contacts
case .Denied, .NotDetermined: //request permissio...
Applying a filter
To access contacts, we should apply a filter of type NSPredicate to our contactStore variable which we defined it in Authorizing Contact Access example. For example, here we want to sort out contacts with name matching with our own:
Swift
let predicate = CNContact.predicateForCo...
Here is an example of a pipeline script that builds a Docker container, then runs the tests inside of it. The entrypoint is assumed to be either manage.py or invoke/fabric with a runtests command available.
#!/usr/bin/groovy
node {
stage 'Checkout'
checkout scm
sh 'git submodule update ...
The push notification plugin requires an init an initialization which tells the plugin to start running using the sender id provided.
let push = Push.init({
android: {
senderID: "------------",
},
ios: {
alert: "true",
badge: tru...
The registration step registers the app with the device's system and returns a registration id
import { Push, RegistrationEventResponse} from "ionic-native";
//the push element is created in the initialization example
push.on("registration", async (response:...
To receive push notifications we are supposed to tell the plugin to listen to incoming push notifications. This step is done after initialization & registration
import { Push, NotificationEventResponse} from "ionic-native";
//the push element is created in the initial...
The Maven Surefire plugin runs during the test phase of the Maven build process or when test is specified as a Maven goal. The following directory structure and minimum pom.xml file will configure Maven to run a test.
Directory structure inside the project's root directory:
─ project_root
├─ p...
Most of linux distros stores its version info in the /etc/lsb-release (debian) or /etc/redhat-release (RPM based) file. Using below generic command should get you past most of the Debian and RPM derivatives as Linux Mint and Cent-Os.
Example on Ubuntu Machine:
cat /etc/*release
DISTRIB_ID=Ubuntu
...