This file contains hidden or 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
@Path("/data") | |
@Produces(MediaType.APPLICATION_JSON) | |
public class Route { | |
MyDAO dao; | |
public Route(Jdbi jdbi) { | |
dao = jdbi.onDemand(MyDAO.class); | |
try { | |
dao.testQuery(); | |
} catch (Exception e) { | |
dao.createUserTable(); |
This file contains hidden or 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 User { | |
private int id; | |
private String name; | |
public User() {} | |
public User(int _id, String _name) { | |
this.id = _id; | |
this.name = _name; | |
} |
This file contains hidden or 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 interface MyDAO { | |
@SqlUpdate("create table userData (id int primary key, name varchar(100))") | |
void createUserTable(); | |
@SqlUpdate("insert into userData (id, name) values (:id, :name)") | |
void insert(@Bind("id") int id, @Bind("name") String name); | |
@SqlQuery("select name from userData where id = :id") | |
String findNameById(@Bind("id") int id); |
This file contains hidden or 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
<dependency> | |
<groupId>io.dropwizard</groupId> | |
<artifactId>dropwizard-jdbi3</artifactId> | |
<version>${dropwizard.version}</version> | |
</dependency> | |
<dependency> | |
<groupId>org.postgresql</groupId> | |
<artifactId>postgresql</artifactId> | |
<version>42.2.11</version> | |
</dependency> |
This file contains hidden or 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
@Valid | |
@NotNull | |
private DataSourceFactory database = new DataSourceFactory(); | |
@JsonProperty("database") | |
public void setDataSourceFactory(DataSourceFactory factory) { | |
this.database = factory; | |
} | |
@JsonProperty("database") |
This file contains hidden or 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
database: | |
# the name of your JDBC driver | |
driverClass: org.postgresql.Driver | |
# the username | |
user: <username> | |
# the password | |
password: <passowrd> |
This file contains hidden or 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
@Path("/getData") | |
@Produces(MediaType.APPLICATION_JSON) | |
public class Route { | |
@GET | |
public String getData() { | |
String s = "Hello world"; | |
return s; | |
} |
This file contains hidden or 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
a83350f9af7058f0e3134a0f1beeb4b7b1ab997942afee13c4ebbfb87346a2c9485aba3fb48b12df463a951cec77ba119363b32332f5f7c9194e4249e975a600 |
This file contains hidden or 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
var fs = require('fs'); | |
fs.readdir('./data',(err,items)=>{ | |
// console.log(items); | |
items.map(file=>{ | |
let newFile = file.replace(/\d+/g,''); | |
newFile = newFile.replace(/-/g,' '); | |
newFile = newFile.replace(/_/g,' '); | |
fs.rename('./data/'+file, './data/'+newFile, (err)=>{ | |
if(err) |
This file contains hidden or 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
#! /bin/bash | |
#Created by following tutorials by https://www.youtube.com/channel/UCs6nmQViDpUw0nuIx9c_WvA Programming Knowledge | |
# echo "hello world" | |
# echo "Enter names: " | |
# read name1 name2 name3 | |
# echo "Name : $name1 , $name2 , $name3" |