27 novembre 2015 / meltedpenguin / 0 Comments
In order to start using PostgreSQL, you will first need to add its JDBC driver dependency in your build.sbt file: (you can find all the available versions here)
"org.postgresql" % "postgresql" % "9.4-1201-jdbc41"
Then you will just need to add access configurations:
slick.dbs.default.driver= "slick.driver.PostgresDriver$"
slick.dbs.default.db.driver="org.postgresql.Driver"
slick.dbs.default.db.url="jdbc:postgresql://localhost:5432/dbname"
slick.dbs.default.db.user="postgres"
slick.dbs.default.db.password=""
27 novembre 2015 / meltedpenguin / 0 Comments
If you have a CSV with some rows that you want to directly insert into your PostgreSQL database, you can you the command COPY:
COPY table_name FROM 'path/to/file.csv' DELIMITER ' ' CSV;
Here I used a tab as delimiter but you can of course use any other character, probably ‘;‘ or ‘,‘. This PostgreSQL command can only be executed as SuperUser. A workaround if you are not/don’t want to use root, is to use the psql command ‘\copy’ in your terminal. (more)
With H2 you can also import CSVs but with CSVREAD:
INSERT INTO table_name SELECT * FROM CSVREAD
('path/to/file.csv', null, 'fieldSeparator=' || CHAR(9));
Thi should have the same result. The CHAR(9) is just a tab (9 is its ASCII value)
17 novembre 2015 / meltedpenguin / 1 Comment
Vous aviez une envie soudaine d’insérer des diagrammes de Gantt avec pgfgantt dans vos beaux documents LaTeX.
Mais à peine copié le petit example du guide, vous vous êtes retrouvé avec plusieurs erreurs mettant en cause le « Package tikz » avec des messages comme :
« + or – expected » encore « Giving up on this path. Did you forget a semicolon?« .
La cause semble être une simple incompatibilité avec le paquet babel qui se résout en ajoutant simplement la ligne suivante à vos dépendances :
\usetikzlibrary{babel}