Skip to content

Instantly share code, notes, and snippets.

View ssandra102's full-sized avatar
Focusing on the perfect coffee

Sandra Skaria ssandra102

Focusing on the perfect coffee
View GitHub Profile
# 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."))
# disconnect from database
onSessionEnded(function() {
dbDisconnect(con)
})
## command to update database
dbExecute(conn, "INSERT INTO table_name("val1", "val2");")
# querying the database
result <- dbGetQuery(conn, "SELECT * FROM table_name;" )
#defining database connection
conn<- dbConnect(RMySQL::MySQL(),
dbname="db",
Server="localhost",
port=3306,
user="root",
password="root1"
)
# include in shiny ui
res_auth <- secure_server(
check_credentials = check_credentials(credentials)
)
# 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
)
self.encoder = Sequential(
[
Dense(100, activation="relu"),
Dense(20, activation="relu")
]
)
self.decoder = Sequential(
[
Dense(100, activation="relu"),