Skip to content

Instantly share code, notes, and snippets.

View mrnovalles's full-sized avatar
🚲

Mariano Vallés mrnovalles

🚲
View GitHub Profile
@mrnovalles
mrnovalles / KthfsDBCalls.java
Created December 1, 2011 17:03
Every DB Call opens a session, and then closes it
public static BlockInfo getBlockInfo(long blockId) {
int tries = RETRY_COUNT;
boolean done = false;
Session session = DBConnector.sessionFactory.getSession(); //Gets a session
Transaction tx = session.currentTransaction(); //Starts transaction
while (done == false && tries > 0) {
try {
tx.begin();
BlockInfo ret = getBlockInfoInternal(blockId, session, false);
tx.commit();
@mrnovalles
mrnovalles / peerReview.erl
Created October 16, 2011 17:54
Getting to know who peer reviews a Sci-Writing assignment
-module(peer).
-export ([draw/0]).
draw()->
R = random:uniform(100),
io:format ("~w",[r]),
if
R < 33 ->
io:format ("Vasia peer reviews Erisa's S. Writing");
true ->