Skip to content

Instantly share code, notes, and snippets.

View rynmrtn's full-sized avatar

Ryan Morton rynmrtn

View GitHub Profile
@rynmrtn
rynmrtn / speed-up-weblogic.sh
Created October 15, 2010 18:02
Trick to increase weblogic startup speed in a development/test environment
# On a linux environment, modify JAVA_OPTIONS:
JAVA_OPTIONS="${JAVA_OPTIONS} -Djava.security.egd=file:/dev/./urandom"
@rynmrtn
rynmrtn / add_user_to_sudoer.sh
Created October 15, 2010 17:59
How to add a user to sudoer
# Used this on redhat - replace user-to-add with your username
echo 'user-to-add ALL=(ALL) ALL' >> /etc/sudoers
# Generate a Key
$ ssh-keygen -t rsa
# Create the .ssh folder on the remote machine w/ the user & setup permisisons
$ mkdir .ssh
$ chmod 700 .ssh
# Copy key to another server
$ cat .ssh/id_rsa.pub | ssh deploy@location.com "cat >> .ssh/authorized_keys2"
@rynmrtn
rynmrtn / .gitattributes
Created September 18, 2010 17:18 — forked from program247365/.gitattributes
Obj-c git setup
*.pbxproj -crlf -diff -merge
<property name="findbugs.home" value="${build.dir}/lib/findbugs-1.3.8" />
<target name="findbugs-html">
<echo message="Running a FindBugs HTML Report..." />
<taskdef name="findbugs" classname="edu.umd.cs.findbugs.anttask.FindBugsTask" />
<findbugs home="${findbugs.home}" output="html" outputFile="${build.dir}/reports/findbugs/findBugs_report.html" jvmargs="-Xmx512M" reportLevel="low">
<sourcepath path="${project.src.dir}" />
<class location="${build.dir}/dist" />
</findbugs>
@rynmrtn
rynmrtn / update_from_csv.groovy
Created January 25, 2010 18:49
Update Statement Generator
/*
This script will take a csv file (specified using the fileName variable) and
generate updates statements. The first row in the CSV file is assumed to be
the column names and all other rows are assumed to be data.
*/
// Setup basic information
tableName = "TABLE_NAME"
fileName = "C:\\file.csv"
@rynmrtn
rynmrtn / insert.groovy
Created January 22, 2010 21:26 — forked from atonse/insert.groovy
Groovy Script to Generate Insert Statements
/**
This groovy script will take a CSV file that represents the data
in a database. The first row should be the name of the columns and
all other rows should represent the data you wish to insert.
The #generate_insert function also assumes that the csv file has the
same name as the sql table that is being inserted into
*/
// Setup basic information
@rynmrtn
rynmrtn / insert.groovy
Created January 22, 2010 21:07
Groovy script to generate insert statements from a CSV file
/**
This groovy script will take a CSV file that represents the data
in a database. The first row should be the name of the columns and
all other rows should represent the data you wish to insert.
*/
// Setup basic information
tableName = "TABLE_NAME"
fileName = "C:\\file\\path"
@rynmrtn
rynmrtn / faces.mdown
Created January 4, 2010 18:03
Notes on Seam Framework

JSF and RichFaces Notes

Validators:

<!-- Combination of rich:beanValidator and a4j:support. This will bind to the hibernate validators for the model and
     validate when the field is no longer in focus (onblur). The event could be any supported event.
-->
<rich:ajaxValidator event="onblur" />

Immutable vs. Mutable Objects

Advantages of Immutable

  • There is no way for multiple threads to concurrently mutate or access an immutable value as no thread can change an immutable object.
  • When passing a value into foreign code, one can be assured that an immutable value will not change.
  • There are fewer concerns - immutable objects cannot have complex states that change over time.

Disadvantages of Immutable

  • When an object is quite large, it is inefficient to update the full object graph. In some cases, it is best to do an in-place modification.