This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
After install zsh | |
- brew update | |
- brew install nvm | |
- mkdir ~/.nvm | |
after in your ~/.zshrc or in .bash_profile if your use bash shell: | |
export NVM_DIR=~/.nvm | |
source $(brew --prefix nvm)/nvm.sh |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private void enlistCreateTable(String sql, DDLType ddlType) | |
throws SQLException { | |
String tn = ddlType.getDBObjectName(sql); | |
UcanaccessConnection ac = UcanaccessConnection.getCtxConnection(); | |
String execId = UcanaccessConnection.getCtxExcId(); | |
Connection hsqlConn = ac.getHSQLDBConnection(); | |
Database db = ac.getDbIO(); | |
LoadJet lfa = new LoadJet(hsqlConn, db); | |
lfa.synchronisationTriggers(tn, true,true); | |
CreateTableCommand c4io; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private static Table createUniqueTable(Database db, String name, | |
List<ColumnBuilder> columns, | |
ResultSetMetaData md, | |
ImportFilter filter) | |
throws IOException, SQLException | |
{ | |
// otherwise, find unique name and create new table | |
String baseName = name; | |
int counter = 2; | |
while(db.getTable(name) != null) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
String generateToken(Map<String, Object> claims) { | |
return Jwts.builder() | |
.setClaims(claims) | |
.setExpiration(generateExpirationDate()) | |
.signWith(SignatureAlgorithm.HS512, secret) | |
.compact(); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class Scheduler { | |
@Scheduled(fixedDelay = 1000, initialDelay = 3000) | |
public void fixedDelaySch() { | |
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS"); | |
Date now = new Date(); | |
String strDate = sdf.format(now); | |
System.out.println("Fixed Delay scheduler:: " + strDate); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def shared_locations(self): | |
""" | |
A dictionary of shared locations whose keys are in the set 'prefix', | |
'purelib', 'platlib', 'scripts', 'headers', 'data' and 'namespace'. | |
The corresponding value is the absolute path of that category for | |
this distribution, and takes into account any paths selected by the | |
user at installation time (e.g. via command-line arguments). In the | |
case of the 'namespace' key, this would be a list of absolute paths | |
for the roots of namespace packages in this distribution. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
version: '3' | |
services: | |
postgres: | |
image: postgres:9.6 | |
environment: | |
- POSTGRES_USER=airflow | |
- POSTGRES_PASSWORD=airflow | |
- POSTGRES_DB=airflow | |
ports: | |
- "5432:5432" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="utf-8"?> | |
<resources> | |
<color name="colorPrimary">#008577</color> | |
<color name="colorPrimaryDark">#00574B</color> | |
<color name="colorAccent">#FBC02D</color> | |
</resources> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Create the dataframe | |
val df = Seq("Red", "Green", "Blue").map(Tuple1.apply).toDF("color") | |
df.createOrReplaceTempView("data") | |
val df4 = sql(""" select *, case when color = 'green' then 1 else 0 end as Green_ind from data """) | |
df4.show() | |
df4:org.apache.spark.sql.DataFrame = [color: string, Green_ind: integer] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sc = spark.sparkContext | |
# A JSON dataset is pointed to by path. | |
# The path can be either a single text file or a directory storing text files | |
path = "examples/src/main/resources/people.json" | |
peopleDF = spark.read.json(path) | |
# The inferred schema can be visualized using the printSchema() method | |
peopleDF.printSchema() | |
# root |
NewerOlder