http://www.ibm.com/developerworks/websphere/library/techarticles/0905_roberts/0905_roberts.html
- Modify the deployment XML file to change data source implementation class:
package com.fct.wcs.cache; | |
import java.io.IOException; | |
import javax.servlet.Filter; | |
import javax.servlet.FilterChain; | |
import javax.servlet.FilterConfig; | |
import javax.servlet.ServletException; | |
import javax.servlet.ServletRequest; | |
import javax.servlet.ServletResponse; | |
import javax.servlet.http.HttpServletRequest; |
http://www.ibm.com/developerworks/websphere/library/techarticles/0905_roberts/0905_roberts.html
package main | |
import ( | |
"fmt" | |
"io" | |
"log" | |
"net/http" | |
) | |
type HttpConnection struct { |
-- Read: http://en.wikipedia.org/wiki/Graham_scan | |
-- ================================================ -- | |
-- =========== Definitions/Imports ============== -- | |
-- ================================================ -- | |
import Data.List | |
-- ch03/ex09.hs | |
data Direction = LeftTurn | RightTurn | Straight deriving (Show,Eq) | |
data Point2D = Point2D {x :: Double, y :: Double} deriving (Show,Ord,Eq) |
# can probably cross reference with ltrace | |
# this removes shared libraries from the total memory count | |
def memory_estimate(pid) | |
`sudo pmap #{pid}`.lines.reject{|line| | |
line[%r[/lib[^.]+\.so]] or line[/^ total/] | |
}.drop(1).reduce(0){|total,line| | |
total + line.match(/(\d+)K/)[1].to_i | |
} | |
end |
sudo tcpdump -w /tmp/memcached.pcap -i any -A -vv 'port 11211' |
new File("/tmp/java_timezones.txt").withWriter { out -> | |
TimeZone.getAvailableIDs().each{ timezoneId -> | |
timezone = TimeZone.getTimeZone(timezoneId) | |
def items = [timezone.getID(), | |
(int)(timezone.getRawOffset()/1000), | |
(int)(timezone.getDSTSavings()/1000)] | |
out.print sprintf("%6d %32s %6d\n",items[1],items[0],items[2]) | |
} | |
} |
# http://zookeeper.apache.org/doc/r3.3.4/recipes.html#sc_leaderElection | |
require 'rubygems' | |
require 'bundler/setup' | |
require 'zookeeper' | |
require 'hashie' | |
class ElectionCandidate | |
ROOT_PATH = "/election" | |
NODE_PATH = "candidate_" |
class Player | |
def initialize | |
@max_health = 20 | |
@last_health = @max_health | |
@taking_damage = false | |
@directions = [:backward, :forward] | |
@current_direction = :forward | |
@reached_wall = false | |
end | |
context 'performance' do | |
before do | |
require 'benchmark' | |
@posts = [] | |
@users = [] | |
8.times do |n| | |
user = Factory.create(:user) | |
@users << user | |
aspect = user.aspects.create(:name => 'people') | |
connect_users(@user, @aspect0, user, aspect) |