Skip to content

Instantly share code, notes, and snippets.

View alf239's full-sized avatar

Alexey Filippov alf239

  • Cambridge, UK
View GitHub Profile
@alf239
alf239 / ConcurrentSection.java
Created June 8, 2011 07:41
synchronized method vs block
// : c13:CriticalSection.java
// Synchronizing blocks instead of entire methods. Also
// demonstrates protection of a non-thread-safe class
// with a thread-safe one.
// From 'Thinking in Java, 3rd ed.' (c) Bruce Eckel 2002
// www.BruceEckel.com. See copyright notice in CopyRight.txt.
import java.util.ArrayList;
import java.util.List;
@alf239
alf239 / chebi.xml
Created March 17, 2011 09:48
chEBI output proposal
<ontologyReferences>
<term accession="CHEBI:29022">
<a href="http://www.ebi.ac.uk/gxa/experiment/E-MEXP-1573" rel="experiment">E-MEXP-1573</a>
<a href="http://www.ebi.ac.uk/gxa/experiment/E-MEXP-2209" rel="experiment">E-MEXP-2209</a>
<a href="http://www.ebi.ac.uk/gxa/experiment/E-MEXP-749" rel="experiment">E-MEXP-749</a>
</term>
<term accession="CHEBI:17790">
<a href="http://www.ebi.ac.uk/gxa/experiment/E-GEOD-5301" rel="experiment">E-GEOD-5301</a>
<a href="http://www.ebi.ac.uk/gxa/experiment/E-MEXP-1797" rel="experiment">E-MEXP-1797</a>
</term>
@alf239
alf239 / public_data.sql
Created February 28, 2011 11:47
I love write-only languages
/*
A very special SQL file - actually, a configuration for the exporter
the exporter is in the where.clause.awk script,
which is called as follows:
awk -v table=$TABLE_NAME -f where_clause.awk Schema/public_data.sql
NB: We have slightly weird syntax for comments here: a line containing / and *
will be completely ignored; so will the line containing */
/*
@alf239
alf239 / CHECK_TABLES.sql
Created February 18, 2011 14:30
Fix the Oracle sequences
select * from all_sequences where sequence_owner = sys_context('USERENV', 'SESSION_USER')
@alf239
alf239 / HSQL.java
Created February 3, 2011 18:53
Aggregare function for HSQL to emulate Oracle's WM_CONCAT
@SuppressWarnings("unused")
public static String wmConcat(String in, Boolean flag,
String[] register, Integer[] counter) {
if (flag) {
if (register[0] == null) {
return null;
}
return register[0];
}
if (in == null) {