Posted by Seon
on September 18, 2007
Dan Diephouse (formerly of XFire, now with MuleSource) gave a presentation recently at JavaZone Norway and the PDF and MP3 are now available here.
I haven’t listened to the MP3 but the PDF had some good tidbits and gave some insight into Dan’s approach regarding RESTful services in an SOA environment. He doesn’t go into enough detail for my tastes (I like to see as much nitty gritty detail as possible) but it’s more than just a rehash of management-techno-speak so I appreciated it. There are some sections which are pretty basic (like explanation of SSL). There is also some good information about transactions and why we should approach them differently knowing some technical constraints in the HTTP protocol and stateless web communications. He briefly touches upon security issues also. All in all I wish he went into more detail, but it’s all good; another contribution to the RESTful services discussion and it’s pros/cons.
Update
Dan’s website mentioned in the PDF doesn’t seem to work (http://www.netzooidicom.com/blog).
Posted by Seon
on September 17, 2007
The boys at CollegeHumor have been escalating their pranks for the better part of this year (since February) and the latest prank (number 6) happened just last week. If you haven’t been keeping up you can watch them in order here starting from the first to the last.
I wonder how other people feel about these pranks. The first two were pretty innocent and drew some good laughs from me. The later ones were funny but also drew some groans of sympathy pain; Streeter and Amir are escalating the war very rapidly. Amir’s latest prank has set a precedent by introducing a second “victim.”; Sharon (Streeter’s GF) has is an innocent casualty of war. Where is the epilogue to this latest skirmish!? This might be better than reality TV.
Posted by Seon
on September 17, 2007
It Is Pitch Dark is the awesome video and song by MC Frontalot that pays homage to the classic Infocom text adventure game Zork. MC Frontalot cracks me up – I was first introduced to him by my friend Matt McNealy. This video brings back fond memories. I spent many hours after school playing the entire Zork series and most other Infocom games on my trusty 8086 with an amber monochrome monitor. Btw, nerdcore is hilariously fun and dorky.
Update:
Try it now! A port of the original here: http://thcnet.net/error/index.php
Posted by Seon
on September 03, 2007
I’ve replaced tcpmon with ngrep as my tool of preference for debugging service interaction while working with Mule. Tcpmon required modifications to service configurations in order pass data through the tcpmon proxies for monitoring. However ngrep is transparent and doesn’t require these configuration changes. It has a simple and fast text interface. No complicated gui to navigate. The output can be piped to grep or saved to file. Run on *nix and Win32. Sweet!
On OSX (version 10.4.10) I decided to compile and install the latest ngrep using the following steps…
1
2
3
4
5
6
7
|
wget http://prdownloads.sourceforge.net/ngrep/ngrep-1.45.tar.bz2?download
tar -jxvf ngrep-1.45.tar.bz2
cd ngrep-1.45
./configure --prefix=/usr/local
make
sudo make install
|
I use ifconfig to determine the interface I want to monitor with ngrep…
1
2
3
4
5
6
7
8
9
|
ifconfig
en1: flags=8963<UP,BROADCAST,SMART,RUNNING,PROMISC,SIMPLEX,MULTICAST> mtu 1500
inet6 fe80::216:cbff:feb7:5de%en1 prefixlen 64 scopeid 0x5
inet 172.16.1.3 netmask 0xffffff00 broadcast 172.16.1.255
ether 00:16:cb:b7:05:de
media: autoselect status: active
supported media: autoselect
|
Then startup ngrep on eth1 monitoring port 80. The -Wbyline detects linebreaks in the packet data…
1
2
3
4
5
|
sudo ngrep -Wbyline -d en1 port 80
Password:
interface: en1 (172.16.1.0/255.255.255.0)
filter: (ip) and ( port 80 )
|
Example ngrep output…
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
|
####
T 172.16.1.3:57867 -> a.b.c.d:80 [AP]
GET /usage.html HTTP/1.1.
Host: ngrep.sourceforge.net.
User-Agent: Mozilla/5.0 (Macintosh; U; Intel Mac OS X; en-US; rv:1.8.1.6) Gecko/20070725 Firefox/2.0.0.6.
Accept: HTTP Accept=text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5.
Accept-Language: en-us,en;q=0.5.
Accept-Encoding: gzip,deflate.
Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7.
Keep-Alive: 300.
Connection: keep-alive.
Referer: http://ngrep.sourceforge.net/.
Cookie: __utmz=191645736.1188003977.1.1.utmccn=(referral)|utmcsr=jibx.sourceforge.net|utmcct=/mail-lists.html|utmcmd=referral; __utma=191645736.2030039243.1188003977.1188003977.1188003977.1.
.
##
T a.b.c.d:80 -> 172.16.1.3:57867 [A]
HTTP/1.0 200 OK.
Date: Mon, 03 Sep 2007 21:43:32 GMT.
Server: Apache/1.3.33 (Unix) PHP/4.3.10.
Last-Modified: Thu, 24 Feb 2005 04:41:08 GMT.
ETag: "219bb8-4827-421d5ae4".
Accept-Ranges: bytes.
Content-Length: 18471.
Content-Type: text/html.
X-Cache: MISS from sims.sofast.net.
Connection: keep-alive.
.
<?xml version="1.0" encoding="UTF-8"?>
<!doctype html public "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head><title>ngrep - network grep</title>
</head>
<style>
body {
text-align: center;
padding: 20px;
margin: 0;
background: #888;
color: #000;
font: 10px/15px verdana, geneva, helvetica, arial, sans-serif;
}
h2 {
text-align: center;
margin: auto;
width: 600px;
}
...snip...
|
Posted by Seon
on September 03, 2007
A few code snippets using CodeRay filters for syntax highlighting.
lang=”ruby”
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
|
require 'coderay'
class CodeMacro < FilteredColumn::Macros::Base
def self.filter(attributes, inner_text = '', text = '')
lang = attributes.delete(:lang)
attributes[:line_numbers] = :table unless attributes.has_key?(:line_numbers)
attributes.each do |key, value|
attributes[key] = value == 'nil' ? nil : value.to_sym rescue nil
end
begin
CodeRay.scan(inner_text, lang.to_sym).html(attributes)
rescue ArgumentError
CodeRay.scan(inner_text, lang.to_sym).html(:line_numbers => :table)
rescue
unless lang.blank?
RAILS_DEFAULT_LOGGER.warn "CodeRay Error: #{$!.message}"
RAILS_DEFAULT_LOGGER.debug $!.backtrace.join("n")
end
"<pre><code>#{inner_text}</code></pre>"
end
end
end
|
lang=”javascript”
1
2
3
4
5
6
7
|
fixIEOverlapping: function() {
Position.clone(this.update, this.iefix, {setTop:(!this.update.style.height)});
this.iefix.style.zIndex = 1;
this.update.style.zIndex = 2;
Element.show(this.iefix);
},
|
Posted by Seon
on September 02, 2007
I completed my first tandem skydive this Saturday at Skydive Orange. It was an experience like nothing else I’ve ever had in my life. Some people might think it feels like riding a roller coaster but they are wrong; skydiving is very different and not similar to any rollercoaster ride you’ve taken. I can summarize my first skydiving experience in two words: Too Short. I am definitely going back for more.
Update
I confirmed that we were free falling at a speed of ~120mph. We hit terminal velocity pretty quickly, and there was zero sensation of acceleration hence the absence of the “roller coaster” feeling. My jump master was Kevin Gibson – he’s had 5000+ jumps in his lifetime.
Posted by Seon
on September 01, 2007
My friend and coworker Gabe (of Slickr and Dclicio.us fame) has recently released a great ruby gem for generating rake tasks and templates for developing Adobe AIR apps. Check it out!
Airrake, Rake tasks and generators for Adobe AIR apps.
Posted by Seon
on August 28, 2007
I’ve hopped on board the Nginx + Mongrel train for my website (mephisto, rails, mysql, mongrel cluster, nginx – deployed with vlad capistrano v2). After some brief wrangling with apache conf files, I took a break and looked over Nginx. Turns out it’s pretty simple to get up and running. The best thing about nginx aside from its small memory foot print (compared to Apache2) is the ability to hot-swap new binaries using unix kill signals. The nginx configuration can also be reloaded on-the-fly. Nginx is a sweet little daemon.
Here are some of the steps I followed to get it up and running on Debian Etch. These instructions assume you know/have already installed the appropriate ruby gems.
Compiling nginx/0.5.31 (updated 09/05/2007)
1
2
3
4
5
6
7
8
9
|
apt-get install libpcre3
apt-get install libpcre3-dev
wget http://sysoev.ru/nginx/nginx-0.5.31.tar.gz
tar xzvf nginx-0.5.31.tar.gz
cd nginx-0.5.31
./configure --sbin-path=/usr/local/sbin --with-http_ssl_module --with-http_ssl_module --with-http_realip_module --with-http_addition_module --with-http_sub_module --with-http_dav_module --with-http_stub_status_module --with-mail --with-mail_ssl_module --with-cc-opt="-I /usr/include/pcre"
make
sudo make install
|
Configuration summary
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
|
+ threads are not used
+ using system PCRE library
+ using system OpenSSL library
+ md5 library is not used
+ sha1 library is not used
+ using system zlib library
nginx path prefix: "/usr/local/nginx"
nginx binary file: "/usr/local/sbin"
nginx configuration file: "/usr/local/nginx/conf/nginx.conf"
nginx pid file: "/usr/local/nginx/logs/nginx.pid"
nginx error log file: "/usr/local/nginx/logs/error.log"
nginx http access log file: "/usr/local/nginx/logs/access.log"
nginx http client request body temporary files: "/usr/local/nginx/client_body_temp"
nginx http proxy temporary files: "/usr/local/nginx/proxy_temp"
nginx http fastcgi temporary files: "/usr/local/nginx/fastcgi_temp"</code>
|
Nginx configuration (updated 09/05/2007)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
|
worker_processes 2;
error_log current_path/log/nginx.error.log debug;
pid shared_path/pids/nginx.pid;
events {
worker_connections 1024;
}
http {
include /usr/local/nginx/conf/mime.types;
default_type application/octet-stream;
log_format main '$remote_addr - $remote_user [$time_local] $status '
'"$request" $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for"';
access_log current_path/log/nginx.access.log main;
sendfile on;
tcp_nopush on;
tcp_nodelay on;
keepalive_timeout 70;
gzip on;
gzip_min_length 1000;
gzip_buffers 4 8k;
gzip_comp_level 9;
gzip_proxied any;
gzip_types application/xml application/javascript application/x-javascript application/atom+xml application/rss+xml;
gzip_types text/css text/html text/javascript text/js text/plain text/xml;
upstream mongrel {
server 127.0.0.1:8000;
server 127.0.0.1:8001;
}
server {
listen 80;
server_name fucema.net www.fucema.net;
root current_path/public;
index index.html index.htm;
location / {
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host "www.fucema.net";
proxy_redirect false;
proxy_max_temp_file_size 0;
# rewrite 'fucema.net' -> 'www.fucema.net'
if ($host = 'fucema.net' ) {
rewrite ^/(.*)$ http://www.fucema.net/$1 permanent;
}
# if static file exists serve now, skip rewrite rules
if (-f $request_filename) {
expires max;
break;
}
# redirect feed requests to feedburner, unless its the feedburner agent
if ($http_user_agent !~ FeedBurner) {
rewrite ^/feed/atom.xml$ http://feeds.feedburner.com/fucema;
}
if (-f $request_filename/index.html) {
expires 7d;
rewrite (.*) $1/index.html break;
}
# support rails page caching
if (-f $request_filename.html) {
rewrite (.*) $1.html break;
}
# pass it onto upstream mongrel cluster
if (!-f $request_filename) {
proxy_pass http://mongrel;
break;
}
}
location ~* ^.+.(jpg|jpeg|gif|png|ico|css|zip|tgz|gz|rar|bz2|doc|xls|exe|pdf|ppt|txt|tar|mid|midi|wav|bmp|rtf|js|mov).*?$ {
root current_path/public;
if (!-f $request_filename) {
proxy_pass http://mongrel;
break;
}
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root current_path/public;
}
}
}
|
Mongrel cluster configuration
1
2
3
4
5
6
7
8
9
|
---
cwd: current_path
log_file: log/mongrel.log
environment: production
address: 127.0.0.1
pid_file: tmp/pids/mongrel.pid
port: "8000"
servers: 2
|