Twitter Engineering: Caching with Twemcache

Twitter Engineering: Caching with Twemcache

Conversion Optimization

Conversion Optimization

Backbone.js v.s. Spine.js

Backbone.js v.s. Spine.js

Generic Bash Java Executor

Simple script to compile and execute a Java application with any number of parameters

  • e.g. ./BashJavaExecutor.sh MyApp.java
  • e.g. ./BashJavaExecutor.sh MyApp.java “arg1” “arg2” 33
JAVA=$JAVA_HOME/bin/java
JAVAC=$JAVA_HOME/bin/javac
JAVA_HEAP_MAX=-Xmx1024m
CLASSPATH=${CLASSPATH}

args=("$@")

#Remove old class files (suppress warning for DNE)
rm ${args[0]}*.class 2> /dev/null

echo "Compiling Script ${args[0]}"
$JAVAC -classpath "$CLASSPATH" ${args[0]}.java

numOfArgs=${#args[@]}
arr=()
for (( c=1; c <= $numOfArgs; c++))
do
   let pos=$c-1
   arr[$pos]=${args[$c]}
done

$JAVA $JAVA_HEAP_MAX -classpath "$CLASSPATH" ${args[0]} ${arr[@]}

RabbitMQ Peformance Measurements

RabbitMQ Peformance Measurements

Proper Application Logging

Proper Application Logging

Badass JavaScript: WebKit.js: Yes it has finally happened! Browser Inception is now possible.

Badass JavaScript: WebKit.js: Yes it has finally happened! Browser Inception is now possible.

Unset your PHP references!

foreach ($infs as &$inf) {
   …
}

foreach($infs as $i => $inf) {
   …
}

What’s wrong with the above code? Why after the second loop are there duplicate entries in my $infs array when I did no such thing?

The reason is because I reused the reference variable $inf. That’s a big no-no. To be safe, always unset reference variables when you’re done with them, like this:

foreach ($infs as &$inf) {

}
unset($inf);


Redis and Lua

Redis and Lua