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
# include this library | |
library(RMySQL) | |
# to kill all the open connections at once | |
killDbConnections <- function () { | |
all_cons <- dbListConnections(MySQL()) | |
#print(all_cons) | |
for(con in all_cons) | |
+ dbDisconnect(con) | |
#print(paste(length(all_cons), " connections killed.")) |
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
# disconnect from database | |
onSessionEnded(function() { | |
dbDisconnect(con) | |
}) |
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
## command to update database | |
dbExecute(conn, "INSERT INTO table_name("val1", "val2");") |
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
# querying the database | |
result <- dbGetQuery(conn, "SELECT * FROM table_name;" ) |
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
#defining database connection | |
conn<- dbConnect(RMySQL::MySQL(), | |
dbname="db", | |
Server="localhost", | |
port=3306, | |
user="root", | |
password="root1" | |
) |
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
# include in shiny ui | |
res_auth <- secure_server( | |
check_credentials = check_credentials(credentials) | |
) |
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
# written globally | |
credentials <- data.frame( | |
# username root belongs to the admin, with root1 as password. | |
user = c("user", "root"), # mandatory | |
password = c("user1", "root1"), # mandatory | |
) |
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
self.encoder = Sequential( | |
[ | |
Dense(100, activation="relu"), | |
Dense(20, activation="relu") | |
] | |
) | |
self.decoder = Sequential( | |
[ | |
Dense(100, activation="relu"), |