Signup/Sign In

Answers

All questions must be answered. Here are the Answers given by this user in the Forum.

If you have 3 tables with the same ID to be joined, I think it would be like this:

***SELECT * FROM table1 a
JOIN table2 b ON a.ID = b.ID
JOIN table3 c ON a.ID = c.ID***
Just replace * with what you want to get from the tables.
4 years ago
Check out the percent function from the formattable package:

***library(formattable)
x <- c(0.23, 0.95, 0.3)
percent(x)
[1] 23.00% 95.00% 30.00%***
4 years ago
Let's make it simple:

***df[nrow(df) + 1,] = c("v1","v2")***
4 years ago
If you want to do it as simply as possible:

***packages <- c("ggplot2", "dplyr", "Hmisc", "lme4", "arm", "lattice", "lavaan")

install.packages(setdiff(packages, rownames(installed.packages()))) ***
4 years ago
I have a package **(beepr)** with the sole purpose of making notification sounds in R which should work cross-platform. Run the following to install beepr and make a sound:

***install.packages("beepr")
library(beepr)
beep()***
4 years ago
Correct answer is:

***select table_record_id,
group_concat(if(value_name='note', value_text, NULL)) as note
,group_concat(if(value_name='hire_date', value_text, NULL)) as hire_date
,group_concat(if(value_name='termination_date', value_text, NULL)) as termination_date
,group_concat(if(value_name='department', value_text, NULL)) as department
,group_concat(if(value_name='reporting_to', value_text, NULL)) as reporting_to
,group_concat(if(value_name='shift_start_time', value_text, NULL)) as shift_start_time
,group_concat(if(value_name='shift_end_time', value_text, NULL)) as shift_end_time
from other_value
where table_name = 'employee'
and is_active = 'y'
and is_deleted = 'n'
GROUP BY table_record_id***
4 years ago
You shouldn't be manually deleting users that way. MySQL has **REVOKE** syntax for removing privileges and **DROP USER** for deleting them:

***REVOKE priv1,priv2,priv3,etc... FROM 'jack@localhost'; // remove certain privileges
DROP USER 'jack@localhost'; // completely delete the account***
Best to use the tools provided rather than mucking around in the background.
4 years ago
You can also tell MySQL what database to use (if you have it created already):

***mysql -u example_user -p --database=example < ./example.sql***
4 years ago
On MySQL 5.5 I have in my.cnf

***[mysqld]
init_connect='SET collation_connection = utf8_unicode_ci'
init_connect='SET NAMES utf8'
character-set-server=utf8
collation-server=utf8_unicode_ci
skip-character-set-client-handshake***
4 years ago
The following SQL statements are nearly equivalent:

***SELECT COLUMN_NAME
FROM INFORMATION_SCHEMA.COLUMNS
WHERE table_name = 'tbl_name'
[AND table_schema = 'db_name']
[AND column_name LIKE 'wild']

SHOW COLUMNS
FROM tbl_name
[FROM db_name]
[LIKE 'wild']***
4 years ago
If you have a grouped table with just one cell per section, just add this extra line to the code: ***bgColorView.layer.cornerRadius = 10;***

***UIView *bgColorView = [[UIView alloc] init];
[bgColorView setBackgroundColor:[UIColor redColor]];
bgColorView.layer.cornerRadius = 10;
[cell setSelectedBackgroundView:bgColorView];
[bgColorView release]; ***
4 years ago
With React >= 16.3 you can use ref and forwardRef, to gain access to child's DOM from its parent. Don't use old way of refs anymore.
Here is the example using your case :

***import React, { Component } from 'react';

export default class P extends React.Component {
constructor (props) {
super(props)
this.state = {data: 'test' }
this.onUpdate = this.onUpdate.bind(this)
this.ref = React.createRef();
}

onUpdate(data) {
this.setState({data : this.ref.current.value})
}

render () {
return (




)
}
}

const C1 = React.forwardRef((props, ref) => (



));

class C2 extends React.Component {
render () {
return
C2 reacts : {this.props.data}

}
}
See Refs and ForwardRef for detailed info about refs and forwardRef.***
4 years ago