epitools 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,66 @@
1
+ %w[rubygems colorize].each{|r| require r}
2
+
3
+ ASCII_PRINTABLE = (33..126)
4
+
5
+ =begin
6
+ 000352c0 ed 33 8c 85 6e cc f6 f7 72 79 1c e3 3a b4 c2 c6 |.3..n...ry..:...|
7
+ 000352d0 c8 8d d6 ee 3e 68 a1 a5 ae b2 b7 97 a4 1d 5f a7 |....>h........_.|
8
+ 000352e0 d8 7d 28 db f6 8a e7 8a 7b 8d 0b bd 35 7d 25 3c |.}(.....{...5}%<|
9
+ 000352f0 8b 3c c8 9d ec 04 85 54 92 a0 f7 a8 ed cf 05 7d |.<.....T.......}|
10
+ 00035300 b5 e3 9e 35 f0 79 9f 51 74 e3 60 ee 0f 03 8e 3f |...5.y.Qt.`....?|
11
+ 00035310 05 5b 91 87 e6 48 48 ee a3 77 ae ad 5e 2a 56 a2 |.[...HH..w..^*V.|
12
+ 00035320 b6 96 86 f3 3c 92 b3 c8 62 4a 6f 96 10 5c 9c bb |....<...bJo..\..|
13
+ =end
14
+
15
+ # whoops!
16
+ # 48: d2 b1 6d 31 3e 67 e1 88 99 8b 4b 34 1d 61 05 15 |..m1g....K4.a..|
17
+ #
18
+
19
+ def hexdump(data, options={})
20
+ base_offset = options[:base_offset] || 0
21
+ color = options[:color].nil? ? true : options[:color]
22
+ highlight = options[:highlight]
23
+
24
+ p options
25
+ p color
26
+
27
+ lines = data.scan(/.{1,16}/m)
28
+ max_offset = (base_offset + data.size) / 16 * 16
29
+ max_offset_width = max_offset.to_s.size
30
+ max_hex_width = 3 * 16 + 1
31
+
32
+ p [max_offset, max_offset_width]
33
+ lines.each_with_index do |line,n|
34
+ offset = base_offset + n*16
35
+ bytes = line.unpack("C*")
36
+ hex = bytes.map { |c| "%0.2x" % c }.insert(8, '').join(' ')
37
+
38
+ plain = bytes.map do |c|
39
+ if ASCII_PRINTABLE.include?(c)
40
+ c = c.chr
41
+ else
42
+ color ? '<9>.</9>' : '.'
43
+ end
44
+ end.join('')
45
+
46
+ if color
47
+ outstring = "<light_cyan>%s<cyan>: <light_yellow>%s <default>|<light_white>%s<default>|" % [offset.to_s.ljust(max_offset_width), hex.ljust(max_hex_width), plain]
48
+ outstring = outstring.colorize
49
+ else
50
+ outstring = "%s: %s |%s|" % [offset.to_s.ljust(max_offset_width), hex.ljust(max_hex_width), plain]
51
+ end
52
+ puts outstring
53
+ end
54
+ end
55
+
56
+
57
+ if $0 == __FILE__
58
+ data = (0..64).map{ rand(255).chr }.join('')
59
+ hexdump(data)
60
+ puts
61
+ hexdump(data, :color=>false)
62
+ puts
63
+
64
+ data = "1234567890"*10
65
+ hexdump(data)
66
+ end
@@ -0,0 +1,82 @@
1
+ require 'net/http'
2
+ require 'uri'
3
+
4
+ # TODO: what?? this needs to be a class.
5
+
6
+ class PartialPage < Exception
7
+ attr_accessor :data
8
+ end
9
+
10
+ def read_data_from_response(response, amount)
11
+
12
+ amount_read = 0
13
+ chunks = []
14
+
15
+ begin
16
+ response.read_body do |chunk| # read body now
17
+
18
+ amount_read += chunk.length
19
+
20
+ if amount_read > amount
21
+ amount_of_overflow = amount_read - amount
22
+ chunk = chunk[0...-amount_of_overflow]
23
+ end
24
+
25
+ chunks << chunk
26
+
27
+ if amount_read >= amount
28
+ raise PartialPage.new chunks.join('')
29
+ end
30
+
31
+ end
32
+ end
33
+
34
+ end
35
+
36
+
37
+ def http_get_streaming(url = URI.parse("http://epi.is-a-geek.net/files/Mr.%20Show%20-%20Civil%20War%20Re-enactment.avi"))
38
+
39
+ #headers = {'User-Agent' => "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.0.1) Gecko/20060111 Firefox/1.5.0.1"}
40
+ headers = nil
41
+
42
+ Net::HTTP.start(url.host, url.port) do |http|
43
+ # using block
44
+ response = http.request_get(url.path, headers) {|response|
45
+ puts "Response: #{response.inspect}"
46
+ puts "to hash: #{response.to_hash.inspect}"
47
+
48
+ begin
49
+ read_data_from_response(response, 500)
50
+ rescue PartialPage => p
51
+ puts "GOT THE PARTIAL PAGE!"
52
+ data = p.data
53
+ end
54
+
55
+ puts
56
+ puts "===========first 500 bytes================="
57
+ puts data
58
+ }
59
+ end
60
+
61
+ end
62
+
63
+
64
+ # TODO: Remove RIO dependancy.
65
+
66
+ def http_get_cached(url)
67
+ require 'digest/md5'
68
+ require 'rio'
69
+
70
+ tempdir = ENV['TEMP']
71
+ cachefile = rio(tempdir, "cached_url_#{Digest::SHA1.hexdigest(url)}")
72
+
73
+ if cachefile.exist?
74
+ data = rio(cachefile).read
75
+ else
76
+ data = rio(url).read
77
+ rio(cachefile).binmode < data
78
+ end
79
+
80
+ data
81
+ end
82
+
@@ -0,0 +1,39 @@
1
+ # Return the longest common prefix between two strings.
2
+ def longest_common_prefix(strings)
3
+ p = nil
4
+ strings.map{|s|s.size}.min.times do |c|
5
+ if strings.map{|s|s[c]}.uniq.size == 1
6
+ p = c
7
+ else
8
+ break
9
+ end
10
+ end
11
+
12
+ strings.first[0..p] unless p.nil?
13
+ end
14
+
15
+
16
+ def longest_common_subsequence(s1, s2)
17
+
18
+ num = Array.new(s1.size) { Array.new(s2.size) }
19
+ len, ans = 0
20
+
21
+ s1.chars.each_with_index do |l1, i|
22
+ s2.chars.each_with_index do |l2, j|
23
+ unless l1==l2
24
+ num[i][j]=0
25
+ else
26
+ if (i==0 || j==0)
27
+ num[i][j] = 1
28
+ else
29
+ num[i][j] = 1 + num[i-1][j-1]
30
+ end
31
+ len = ans = num[i][j] if num[i][j] > len
32
+ end
33
+ end
34
+ end
35
+
36
+ ans
37
+
38
+ end
39
+
@@ -0,0 +1,28 @@
1
+ class Object
2
+ # The hidden singleton lurks behind everyone
3
+ def metaclass
4
+ class << self
5
+ self
6
+ end
7
+ end
8
+
9
+ def meta_eval &blk
10
+ metaclass.instance_eval &blk
11
+ end
12
+
13
+ # Adds methods to a metaclass
14
+ def meta_def name, &blk
15
+ meta_eval { define_method name, &blk }
16
+ end
17
+
18
+ # Defines an instance method within a class
19
+ def class_def name, &blk
20
+ class_eval { define_method name, &blk }
21
+ end
22
+ end
23
+
24
+ if $0 == __FILE__
25
+ o = Object.new
26
+ p o
27
+ p o.metaclass
28
+ end
@@ -0,0 +1,73 @@
1
+ def niceprint(o, level=0, indent_first_line=true)
2
+ maxstring = 50
3
+ maxarray = 20
4
+
5
+ result = ""
6
+
7
+ dent = " "
8
+ indent = dent * level
9
+
10
+ result << indent if indent_first_line
11
+
12
+ case o
13
+
14
+ when Hash
15
+ #puts "Hash!"
16
+ result << "{\n"
17
+
18
+ o.each_with_index do |(k,v),i|
19
+ result << "#{indent+dent}#{k.inspect} => #{niceprint(v,level+1,false)}"
20
+ result << "," unless i == o.size
21
+ result << "\n"
22
+ end
23
+
24
+ result << "#{indent}}"
25
+
26
+ when Array
27
+ #puts "Array!"
28
+ indent_first = o.any? { |e| e.instance_of? Hash }
29
+
30
+ if indent_first
31
+ result << "[\n"
32
+ else
33
+ result << "["
34
+ end
35
+
36
+ o = o[0..maxarray] if o.size > maxarray
37
+ o.each do |e|
38
+ result << niceprint(e,level+1,indent_first)
39
+ result << ", "
40
+ end
41
+
42
+ result << "]"
43
+
44
+ when String
45
+ #puts "String!"
46
+ o = o[0..maxstring] + "..." if o.size > maxstring
47
+ result << o.inspect
48
+
49
+ else
50
+ result << o.inspect
51
+ end
52
+
53
+ if level == 0
54
+ print result
55
+ else
56
+ result
57
+ end
58
+
59
+ end
60
+
61
+ if $0 == __FILE__
62
+ t = {
63
+ :a => 5,
64
+ :b => 10,
65
+ :c => {
66
+ :x => 10,
67
+ :y => [1,2,3,4,5,6,7],
68
+ },
69
+ :d => "asdf"*1000,
70
+ }
71
+
72
+ puts niceprint(t)
73
+ end
@@ -0,0 +1,53 @@
1
+ require 'epitools/basetypes'
2
+
3
+ class Array
4
+
5
+ alias_method :"original_*_for_cartesian_*", :*
6
+ def *(other)
7
+ case other
8
+ when Integer
9
+ send(:"original_*_for_cartesian_*", other)
10
+ when Array
11
+ # cross-product
12
+ result = []
13
+ (0...self.size).each do |a|
14
+ (0...other.size).each do |b|
15
+ result << [self[a], other[b]]
16
+ end
17
+ end
18
+ result
19
+ end
20
+ end
21
+
22
+ def **(exponent)
23
+ ([self] * exponent).foldl(:*)
24
+ end
25
+
26
+ end
27
+
28
+ def perms(total, n=0, stack=[], &block)
29
+ ps = yield(n)
30
+ results = []
31
+ if n >= total
32
+ results << stack
33
+ else
34
+ ps.each do |p|
35
+ results += perms(total, n+1, stack + [p], &block)
36
+ end
37
+ end
38
+ results
39
+ end
40
+
41
+
42
+ if $0 == __FILE__
43
+ puts "-------------- foldl ---"
44
+ p [:sum, [1,1,1].foldl(:+)]
45
+ p ["[[1,2],[3]].foldl(:+)", [[1,2],[3]].foldl(:+)]
46
+ p [[0,1],[0,1]].foldl(:*)
47
+
48
+ puts "-------------- cartesian product ---"
49
+ p ["[0,1]*[2,3]",[0,1]*[2,3]]
50
+
51
+ puts "-------------- cartesian exponent ---"
52
+ p [0,1]**3
53
+ end
@@ -0,0 +1,289 @@
1
+ require 'pp'
2
+ require 'rubygems'
3
+ require 'colorize'
4
+
5
+ # TODO: Pick a backtrace format. (Also, add a method to replace default backtracer.)
6
+ # TODO: This chould be in a class.
7
+
8
+ class Array
9
+
10
+ def split_when(&block)
11
+
12
+ chunks = []
13
+ start = 0
14
+
15
+ for i in 0...self.size-1
16
+
17
+ split_here = yield(self[i], self[i+1])
18
+ if split_here
19
+ chunks << self[start..i]
20
+ start = i+1
21
+ end
22
+
23
+ end
24
+
25
+ chunks << self[start..-1]
26
+ chunks
27
+
28
+ end
29
+
30
+ end
31
+
32
+
33
+ class Line
34
+
35
+ attr_accessor :path, :num, :meth, :dir, :filename
36
+
37
+ def initialize(path, num, meth)
38
+
39
+ @path = path
40
+ @num = num
41
+ @meth = meth
42
+ @gem = false
43
+
44
+ @dir, @filename = File.split(path)
45
+
46
+ if @dir =~ %r{^/usr/lib/ruby/gems/1.8/gems/(.+)}
47
+ @dir = "[gem] #{$1}"
48
+ @gem = true
49
+ end
50
+
51
+ end
52
+
53
+ def gem?
54
+ @gem
55
+ end
56
+
57
+ def codeline
58
+ l = @num.to_i - 1
59
+ open(path).readlines[l]
60
+ end
61
+
62
+ end
63
+
64
+
65
+ def parse_lines(backtrace)
66
+ backtrace.map do |line|
67
+ case line
68
+ when /^\s+(.+):(\d+):in \`(.+)'/
69
+ Line.new($1, $2, $3)
70
+ when /^\s+(.+):(\d+)/
71
+ Line.new($1, $2, '')
72
+ when /^\s+$/
73
+ next
74
+ else
75
+ raise "huh?!"
76
+ end
77
+ end.compact
78
+ end
79
+
80
+
81
+ def color_backtrace_1(lines)
82
+ groups = lines.split_when { |line,nextline| line.path != nextline.path }
83
+ for group in groups
84
+ dir, filename = File.split(group.first.path)
85
+ puts "#{filename.green} (#{dir.light_white})"
86
+ # /usr/local/lib/site_ruby/1.8/rubygems/custom_require.rb
87
+ # 234: require | 553: new_constants_in |
88
+ group.each do |line|
89
+ puts " |_ #{line.num.magenta}: #{line.meth.light_yellow.underline}"
90
+ end
91
+ #puts " |_ " + group.map{|line| "#{line.num.magenta}: #{line.meth.light_yellow}"}.join(' | '.red)
92
+ end
93
+ end
94
+
95
+
96
+
97
+ def color_backtrace_2(lines, options={})
98
+
99
+ groups = lines.reverse.split_when { |line,nextline| line.path != nextline.path }
100
+
101
+ if options[:no_gems]
102
+ groups = groups.split_when { |a, nexta| a.first.gem? != nexta.first.gem? }
103
+ groups.map! { |group| group.first.gem? ? [] : group }
104
+ end
105
+
106
+
107
+ for group in groups
108
+ if group.empty?
109
+ puts " ... ignored ... "
110
+ puts
111
+ next
112
+ end
113
+
114
+ firstline = group.first
115
+
116
+ # custom_require.rb (/usr/local/lib/site_ruby/1.8/rubygems)
117
+ # 234: require => super
118
+ # 553: new_constants_in =>
119
+
120
+ #puts "#{firstline.filename.green} (#{firstline.dir.light_white})"
121
+ puts "#{firstline.filename.underline} (#{firstline.dir.light_white})"
122
+
123
+ max_methsize = group.map { |line| line.meth.size}.max
124
+ group.each do |line|
125
+ pad = " " * (max_methsize - line.meth.size)
126
+ puts " #{line.num.magenta}: #{line.meth.light_yellow}#{pad}"
127
+ puts " #{"|_".blue} #{line.codeline.strip}"
128
+ end
129
+ puts
130
+ end
131
+
132
+ end
133
+
134
+
135
+ def python_backtrace(lines)
136
+ #groups = lines.reverse.split_when { |line,nextline| line.path != nextline.path }
137
+ lines = lines.reverse
138
+
139
+ puts "Traceback (most recent call last):"
140
+
141
+ for line in lines
142
+ puts %{ File "#{line.path}", line #{line.num}, in #{line.meth}}
143
+ puts %{ #{line.codeline.strip}}
144
+ end
145
+ end
146
+
147
+ def debug_backtrace(lines)
148
+ lines.each do |line|
149
+ p line.path
150
+ end
151
+ end
152
+
153
+
154
+ if $0 == __FILE__
155
+ backtrace = %{
156
+ /usr/lib/ruby/gems/1.8/gems/activerecord-2.1.0/lib/active_record/attribute_methods.rb:256:in `method_missing'
157
+ vendor/plugins/attribute_fu/lib/attribute_fu/associations.rb:28:in `method_missing'
158
+ app/helpers/admin/products_helper.rb:17:in `description_column'
159
+ vendor/plugins/active_scaffold/lib/helpers/list_column_helpers.rb:11:in `send'
160
+ vendor/plugins/active_scaffold/lib/helpers/list_column_helpers.rb:11:in `get_column_value'
161
+ vendor/plugins/active_scaffold/frontends/default/views/_list_record.rhtml:10:in `_run_erb_47vendor47plugins47active_scaffold47frontends47default47views47_list_record46rhtml'
162
+ vendor/plugins/active_scaffold/lib/data_structures/action_columns.rb:68:in `each'
163
+ vendor/plugins/active_scaffold/lib/data_structures/action_columns.rb:55:in `each'
164
+ vendor/plugins/active_scaffold/frontends/default/views/_list_record.rhtml:9:in `_run_erb_47vendor47plugins47active_scaffold47frontends47default47views47_list_record46rhtml'
165
+ /usr/lib/ruby/gems/1.8/gems/actionpack-2.1.0/lib/action_view/base.rb:338:in `send'
166
+ /usr/lib/ruby/gems/1.8/gems/actionpack-2.1.0/lib/action_view/base.rb:338:in `execute'
167
+ /usr/lib/ruby/gems/1.8/gems/actionpack-2.1.0/lib/action_view/template_handlers/compilable.rb:29:in `send'
168
+ /usr/lib/ruby/gems/1.8/gems/actionpack-2.1.0/lib/action_view/template_handlers/compilable.rb:29:in `render'
169
+ /usr/lib/ruby/gems/1.8/gems/actionpack-2.1.0/lib/action_view/partial_template.rb:20:in `render'
170
+ /usr/lib/ruby/gems/1.8/gems/actionpack-2.1.0/lib/action_controller/benchmarking.rb:26:in `benchmark'
171
+ /usr/lib/ruby/gems/1.8/gems/activesupport-2.1.0/lib/active_support/core_ext/benchmark.rb:8:in `realtime'
172
+ /usr/lib/ruby/gems/1.8/gems/actionpack-2.1.0/lib/action_controller/benchmarking.rb:26:in `benchmark'
173
+ /usr/lib/ruby/gems/1.8/gems/actionpack-2.1.0/lib/action_view/partial_template.rb:19:in `render'
174
+ /usr/lib/ruby/gems/1.8/gems/actionpack-2.1.0/lib/action_view/template.rb:22:in `render_template'
175
+ /usr/lib/ruby/gems/1.8/gems/actionpack-2.1.0/lib/action_view/partial_template.rb:28:in `render_member'
176
+ /usr/lib/ruby/gems/1.8/gems/actionpack-2.1.0/lib/action_view/partials.rb:142:in `render_partial_collection_with_known_partial_path'
177
+ /usr/lib/ruby/gems/1.8/gems/actionpack-2.1.0/lib/action_view/partials.rb:141:in `map'
178
+ /usr/lib/ruby/gems/1.8/gems/actionpack-2.1.0/lib/action_view/partials.rb:141:in `render_partial_collection_with_known_partial_path'
179
+ /usr/lib/ruby/gems/1.8/gems/actionpack-2.1.0/lib/action_view/partials.rb:135:in `render_partial_collection'
180
+ /usr/lib/ruby/gems/1.8/gems/actionpack-2.1.0/lib/action_view/base.rb:271:in `render_without_active_scaffold'
181
+ vendor/plugins/active_scaffold/lib/extensions/action_view_rendering.rb:55:in `render_without_haml'
182
+ /usr/lib/ruby/gems/1.8/gems/haml-2.0.2/lib/haml/helpers/action_view_mods.rb:6:in `render'
183
+ vendor/plugins/active_scaffold/frontends/default/views/_list.rhtml:21:in `_run_erb_47vendor47plugins47active_scaffold47frontends47default47views47_list46rhtml'
184
+ /usr/lib/ruby/gems/1.8/gems/actionpack-2.1.0/lib/action_view/base.rb:338:in `send'
185
+ /usr/lib/ruby/gems/1.8/gems/actionpack-2.1.0/lib/action_view/base.rb:338:in `execute'
186
+ /usr/lib/ruby/gems/1.8/gems/actionpack-2.1.0/lib/action_view/template_handlers/compilable.rb:29:in `send'
187
+ /usr/lib/ruby/gems/1.8/gems/actionpack-2.1.0/lib/action_view/template_handlers/compilable.rb:29:in `render'
188
+ /usr/lib/ruby/gems/1.8/gems/actionpack-2.1.0/lib/action_view/partial_template.rb:20:in `render'
189
+ /usr/lib/ruby/gems/1.8/gems/actionpack-2.1.0/lib/action_controller/benchmarking.rb:26:in `benchmark'
190
+ /usr/lib/ruby/gems/1.8/gems/activesupport-2.1.0/lib/active_support/core_ext/benchmark.rb:8:in `realtime'
191
+ /usr/lib/ruby/gems/1.8/gems/actionpack-2.1.0/lib/action_controller/benchmarking.rb:26:in `benchmark'
192
+ /usr/lib/ruby/gems/1.8/gems/actionpack-2.1.0/lib/action_view/partial_template.rb:19:in `render'
193
+ /usr/lib/ruby/gems/1.8/gems/actionpack-2.1.0/lib/action_view/template.rb:22:in `render_template'
194
+ /usr/lib/ruby/gems/1.8/gems/actionpack-2.1.0/lib/action_view/partials.rb:110:in `render_partial'
195
+ /usr/lib/ruby/gems/1.8/gems/actionpack-2.1.0/lib/action_view/base.rb:273:in `render_without_active_scaffold'
196
+ vendor/plugins/active_scaffold/lib/extensions/action_view_rendering.rb:55:in `render_without_haml'
197
+ /usr/lib/ruby/gems/1.8/gems/haml-2.0.2/lib/haml/helpers/action_view_mods.rb:6:in `render'
198
+ vendor/plugins/active_scaffold/frontends/default/views/list.rhtml:9:in `_run_erb_47vendor47plugins47active_scaffold47frontends47default47views47list46rhtml'
199
+ /usr/lib/ruby/gems/1.8/gems/actionpack-2.1.0/lib/action_view/base.rb:338:in `send'
200
+ /usr/lib/ruby/gems/1.8/gems/actionpack-2.1.0/lib/action_view/base.rb:338:in `execute'
201
+ /usr/lib/ruby/gems/1.8/gems/actionpack-2.1.0/lib/action_view/template_handlers/compilable.rb:29:in `send'
202
+ /usr/lib/ruby/gems/1.8/gems/actionpack-2.1.0/lib/action_view/template_handlers/compilable.rb:29:in `render'
203
+ /usr/lib/ruby/gems/1.8/gems/actionpack-2.1.0/lib/action_view/template.rb:35:in `render'
204
+ /usr/lib/ruby/gems/1.8/gems/actionpack-2.1.0/lib/action_view/template.rb:22:in `render_template'
205
+ /usr/lib/ruby/gems/1.8/gems/actionpack-2.1.0/lib/action_view/base.rb:245:in `render_file'
206
+ /usr/lib/ruby/gems/1.8/gems/actionpack-2.1.0/lib/action_controller/base.rb:1108:in `render_for_file'
207
+ /usr/lib/ruby/gems/1.8/gems/actionpack-2.1.0/lib/action_controller/base.rb:865:in `render_with_no_layout'
208
+ /usr/lib/ruby/gems/1.8/gems/actionpack-2.1.0/lib/action_controller/base.rb:880:in `render_with_no_layout'
209
+ /usr/lib/ruby/gems/1.8/gems/actionpack-2.1.0/lib/action_controller/layout.rb:251:in `render_without_benchmark'
210
+ /usr/lib/ruby/gems/1.8/gems/actionpack-2.1.0/lib/action_controller/benchmarking.rb:51:in `render_without_active_scaffold'
211
+ /usr/lib/ruby/gems/1.8/gems/activesupport-2.1.0/lib/active_support/core_ext/benchmark.rb:8:in `realtime'
212
+ /usr/lib/ruby/gems/1.8/gems/actionpack-2.1.0/lib/action_controller/benchmarking.rb:51:in `render_without_active_scaffold'
213
+ vendor/plugins/active_scaffold/lib/extensions/action_controller_rendering.rb:13:in `render'
214
+ vendor/plugins/active_scaffold/lib/actions/list.rb:37:in `list'
215
+ /usr/lib/ruby/gems/1.8/gems/actionpack-2.1.0/lib/action_controller/mime_responds.rb:131:in `call'
216
+ /usr/lib/ruby/gems/1.8/gems/actionpack-2.1.0/lib/action_controller/mime_responds.rb:131:in `custom'
217
+ /usr/lib/ruby/gems/1.8/gems/actionpack-2.1.0/lib/action_controller/mime_responds.rb:160:in `call'
218
+ /usr/lib/ruby/gems/1.8/gems/actionpack-2.1.0/lib/action_controller/mime_responds.rb:160:in `respond'
219
+ /usr/lib/ruby/gems/1.8/gems/actionpack-2.1.0/lib/action_controller/mime_responds.rb:154:in `each'
220
+ /usr/lib/ruby/gems/1.8/gems/actionpack-2.1.0/lib/action_controller/mime_responds.rb:154:in `respond'
221
+ /usr/lib/ruby/gems/1.8/gems/actionpack-2.1.0/lib/action_controller/mime_responds.rb:107:in `respond_to'
222
+ vendor/plugins/active_scaffold/lib/actions/list.rb:35:in `list'
223
+ vendor/plugins/active_scaffold/lib/actions/list.rb:8:in `index'
224
+ /usr/lib/ruby/gems/1.8/gems/actionpack-2.1.0/lib/action_controller/base.rb:1162:in `send'
225
+ /usr/lib/ruby/gems/1.8/gems/actionpack-2.1.0/lib/action_controller/base.rb:1162:in `perform_action_without_filters'
226
+ /usr/lib/ruby/gems/1.8/gems/actionpack-2.1.0/lib/action_controller/filters.rb:580:in `call_filters'
227
+ /usr/lib/ruby/gems/1.8/gems/actionpack-2.1.0/lib/action_controller/filters.rb:573:in `perform_action_without_benchmark'
228
+ /usr/lib/ruby/gems/1.8/gems/actionpack-2.1.0/lib/action_controller/benchmarking.rb:68:in `perform_action_without_rescue'
229
+ /usr/lib/ruby/1.8/benchmark.rb:293:in `measure'
230
+ /usr/lib/ruby/gems/1.8/gems/actionpack-2.1.0/lib/action_controller/benchmarking.rb:68:in `perform_action_without_rescue'
231
+ /usr/lib/ruby/gems/1.8/gems/actionpack-2.1.0/lib/action_controller/rescue.rb:201:in `perform_action_without_caching'
232
+ /usr/lib/ruby/gems/1.8/gems/actionpack-2.1.0/lib/action_controller/caching/sql_cache.rb:13:in `perform_action'
233
+ /usr/lib/ruby/gems/1.8/gems/activerecord-2.1.0/lib/active_record/connection_adapters/abstract/query_cache.rb:33:in `cache'
234
+ /usr/lib/ruby/gems/1.8/gems/activerecord-2.1.0/lib/active_record/query_cache.rb:8:in `cache'
235
+ /usr/lib/ruby/gems/1.8/gems/actionpack-2.1.0/lib/action_controller/caching/sql_cache.rb:12:in `perform_action'
236
+ /usr/lib/ruby/gems/1.8/gems/actionpack-2.1.0/lib/action_controller/base.rb:529:in `send'
237
+ /usr/lib/ruby/gems/1.8/gems/actionpack-2.1.0/lib/action_controller/base.rb:529:in `process_without_filters'
238
+ /usr/lib/ruby/gems/1.8/gems/actionpack-2.1.0/lib/action_controller/filters.rb:569:in `process_without_session_management_support'
239
+ /usr/lib/ruby/gems/1.8/gems/actionpack-2.1.0/lib/action_controller/session_management.rb:130:in `sass_old_process'
240
+ /usr/lib/ruby/gems/1.8/gems/haml-2.0.2/lib/sass/plugin/rails.rb:19:in `process'
241
+ /usr/lib/ruby/gems/1.8/gems/actionpack-2.1.0/lib/action_controller/base.rb:389:in `process'
242
+ /usr/lib/ruby/gems/1.8/gems/actionpack-2.1.0/lib/action_controller/dispatcher.rb:149:in `handle_request'
243
+ /usr/lib/ruby/gems/1.8/gems/actionpack-2.1.0/lib/action_controller/dispatcher.rb:107:in `dispatch'
244
+ /usr/lib/ruby/gems/1.8/gems/actionpack-2.1.0/lib/action_controller/dispatcher.rb:104:in `synchronize'
245
+ /usr/lib/ruby/gems/1.8/gems/actionpack-2.1.0/lib/action_controller/dispatcher.rb:104:in `dispatch'
246
+ /usr/lib/ruby/gems/1.8/gems/actionpack-2.1.0/lib/action_controller/dispatcher.rb:120:in `dispatch_cgi'
247
+ /usr/lib/ruby/gems/1.8/gems/actionpack-2.1.0/lib/action_controller/dispatcher.rb:35:in `dispatch'
248
+ /usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/lib/mongrel/rails.rb:76:in `process'
249
+ /usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/lib/mongrel/rails.rb:74:in `synchronize'
250
+ /usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/lib/mongrel/rails.rb:74:in `process'
251
+ /usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb:159:in `process_client'
252
+ /usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb:158:in `each'
253
+ /usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb:158:in `process_client'
254
+ /usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb:285:in `run'
255
+ /usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb:285:in `initialize'
256
+ /usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb:285:in `new'
257
+ /usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb:285:in `run'
258
+ /usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb:268:in `initialize'
259
+ /usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb:268:in `new'
260
+ /usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb:268:in `run'
261
+ /usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/lib/mongrel/configurator.rb:282:in `run'
262
+ /usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/lib/mongrel/configurator.rb:281:in `each'
263
+ /usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/lib/mongrel/configurator.rb:281:in `run'
264
+ /usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/bin/mongrel_rails:128:in `run'
265
+ /usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/lib/mongrel/command.rb:212:in `run'
266
+ /usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/bin/mongrel_rails:281
267
+ /usr/lib/ruby/gems/1.8/gems/activesupport-2.1.0/lib/active_support/dependencies.rb:502:in `load'
268
+ /usr/lib/ruby/gems/1.8/gems/activesupport-2.1.0/lib/active_support/dependencies.rb:502:in `load'
269
+ /usr/lib/ruby/gems/1.8/gems/activesupport-2.1.0/lib/active_support/dependencies.rb:354:in `new_constants_in'
270
+ /usr/lib/ruby/gems/1.8/gems/activesupport-2.1.0/lib/active_support/dependencies.rb:502:in `load'
271
+ /usr/lib/ruby/gems/1.8/gems/rails-2.1.0/lib/commands/servers/mongrel.rb:64
272
+ /usr/local/lib/site_ruby/1.8/rubygems/custom_require.rb:27:in `gem_original_require'
273
+ /usr/local/lib/site_ruby/1.8/rubygems/custom_require.rb:27:in `require'
274
+ /usr/lib/ruby/gems/1.8/gems/activesupport-2.1.0/lib/active_support/dependencies.rb:509:in `require'
275
+ /usr/lib/ruby/gems/1.8/gems/activesupport-2.1.0/lib/active_support/dependencies.rb:354:in `new_constants_in'
276
+ /usr/lib/ruby/gems/1.8/gems/activesupport-2.1.0/lib/active_support/dependencies.rb:509:in `require'
277
+ /usr/lib/ruby/gems/1.8/gems/rails-2.1.0/lib/commands/server.rb:39
278
+ /usr/local/lib/site_ruby/1.8/rubygems/custom_require.rb:27:in `gem_original_require'
279
+ /usr/local/lib/site_ruby/1.8/rubygems/custom_require.rb:27:in `require'
280
+ script/server:3
281
+ }.split("\n").select{|line| line.any?}
282
+
283
+ lines = parse_lines(backtrace)
284
+ #debug_backtrace(lines)
285
+ #color_backtrace_1(lines)
286
+ #python_backtrace(lines)
287
+ color_backtrace_2(lines)#, :no_gems=>true)
288
+ end
289
+