Skip to content

Instantly share code, notes, and snippets.

@maartenl
maartenl / List.java
Created November 20, 2012 08:00
An example of an iteration over a synchronized list, found in the javadoc.
List list = Collections.synchronizedList(new ArrayList());
synchronized (list) {
Iterator i = list.iterator(); // Must be in synchronized block
while (i.hasNext())
foo(i.next());
}
@maartenl
maartenl / virtualbox_error.txt
Created December 3, 2012 08:11
Installing VirtualBox error
rpm -i VirtualBox-4.2-4.2.4_81684_fedora16-1.x86_64.rpm
warning: VirtualBox-4.2-4.2.4_81684_fedora16-1.x86_64.rpm: Header V4 DSA/SHA1 Signature, key ID 98ab5139: NOKEY
Creating group 'vboxusers'. VM users must be member of that group!
No precompiled module for this kernel found -- trying to build one. Messages
emitted during module compilation will be logged to /var/log/vbox-install.log.
Stopping VirtualBox kernel modules [ OK ]
Recompiling VirtualBox kernel modules [FAILED]
@maartenl
maartenl / fitnesse_started.txt
Created December 5, 2012 09:44
FitNesse has started.
FitNesse (v20111024) Started...
port: 9999
root page: fitnesse.wiki.FileSystemPage at ./FitNesseRoot
logger: none
authenticator: fitnesse.authentication.PromiscuousAuthenticator
html page factory: fitnesse.html.HtmlPageFactory
page version expiration set to 0 days.
Custom symbol types loaded:
fitnesse.wikitext.widgets.MavenClasspathSymbolType
@maartenl
maartenl / git.txt
Created December 21, 2012 21:56
Git
Repository is at:
git@github.com:maartenl/testing.git
git+ssh://git@github.com/maartenl/testing.git
Export svn to git:
/var/lib/gems/1.8/bin/svn2git
svn+ssh://maartenl@www.karchan.org/home/maartenl/subversion --nobranches
--exclude build --exclude build.xml --exclude dist --exclude gclient
----exclude nbproject --exclude src --exclude test --exclude web
@maartenl
maartenl / Person.java
Last active December 10, 2015 06:28
An example of the use of @joincolumn in an Entity class to refer to itself.
/**
* A person.
*/
@Entity
@Table(name = "mm_usertable", catalog = "mmud", schema = "")
public class Person implements Serializable
{
@Id
@Basic(optional = false)
@NotNull
@maartenl
maartenl / allman_style_javascript.js
Last active December 10, 2015 23:59
JavaScript Doesn't Support Allman Style
function helloWorld()
{
alert("Hello, world.");
return
{
world: "Hello"
}
}
result = helloWorld();
@maartenl
maartenl / nvl_to_coalesce.sql
Created February 7, 2013 05:54
Transformation from NVL to COALESCE
-- provides an employees mobile phonenumber or his/her
-- regular phonenumber if he/she doesn't have one
nvl(empl.mobile_phonenumber, empl.phonenumber)
-- changed to
coalesce(empl.mobile_phonenumber, empl.phonenumber)
@maartenl
maartenl / decode_to_case_1.sql
Created February 7, 2013 06:14
Examples of DECODE to CASE.
-- provides percentage taxation
DECODE (tax.taxtype, 'VAT', tax.vat, tax.general) TAX,
-- changed to
CASE tax.taxtype
WHEN 'VAT' THEN tax.vat
ELSE tax.general
END TAX,
@maartenl
maartenl / decode_to_case_2.sql
Last active December 12, 2015 06:28
Transformation of DECODE to CASE - Example 2
-- provides percentage taxation
DECODE(tax_notice.taxtype ,'VAT',NVL(tax.vat, tax.general)
,'PROP',NVL(tax.property_tax, tax.general)
,'INC',NVL(tax.income_tax, tax.general)
,'TAR',NVL(tax.tariff, tax.general)
,tax.general)
-- changed to
@maartenl
maartenl / oracle_to_outer_join.sql
Last active December 12, 2015 06:39
Transformation of Oracle outer join to Standard SQL OUTER JOIN statement
-- provides all employee that are not higher management
-- includes employees without a job title
SELECT * FROM employees
WHERE jobtitle (+) not in ('manager', 'department head', 'president')
-- changed to
select * from employees
where jobtitle not in ('manager', 'department head', 'president')