04
Dec
12

500 and server timeouts on Passenger and Apache

Ran across an error on Ubuntu 12.04 where Apache was serving 500s on an otherwise fine Sinatra app after moving hosts. It had been funning fine at Rackspace but was not running fine now.

Specifically there were timeouts and then errors that said that a proxy couldn’t be found, we weren’t running any kind of a proxy but I was able to figure out passenger was throwing that.

After putting in some google fu I found the following and added these lines to the apache config. Strangely enough these weren’t’ in place on the rackspace VPS but were needed when we moved them.

    1 # PassengerMaxPoolSize
    2 # Default: 6
    3 # For 2gb RAM: 30
    4 # For 256 slice with MySQL running: 2
    5 PassengerMaxPoolSize 2
    6 
    7 # PassengerPoolIdleTime
    8 # Recommended to be avg time per page * 2
    9 # In Google Analytics... (Avg time on site / Avg page views) * 2
   10 # Default: 300
   11 PassengerPoolIdleTime 144
   12 
   13 # PassengerMaxInstancesPerApp < PassengerMaxPoolSize 
   14 PassengerMaxInstancesPerApp 1
   15 
   16 # Must be used with RailsBaseURI in Vhost
   17 RailsAutoDetect off
25
Aug
12

pure-ftpd on OS X

If you find that you are using the pure-ftpd manager on OS X and are getting a default limit of 2000 files you can run

sudo brew instal pure-ftpd

This will update the daemon installed with pure-ftpd manager to a newer version that supports a 10000 file limit.

10
Apr
12

Standing in Idaho Owyhees Cases

Letter I wrote for Advocates West to increase standing in public lands cases.

My name is Brian Loomis. As an Eagle Scout and current Scoutmaster with Troop 155 I am writing to express my displeasure regarding the management of grazing in the Idaho Owyhee Mountains.

Recently I took a group of our scouts to the Mud Flat area to camp and work on orienteering (map and compass) training. The junipers in the Owyhees provide an excellent cover for this type of activity as it forces the scouts to rely on true bearings and dead reckoning, and not as much on other features. The junipers provide a natural cover that allows the orienteering flags to not be seen from a distance thus aiding in the skill acquisition.

I had spent a fair amount of time petitioning the boys to select Mud Falt for the campout (we have a youth led and adult guided troop and they make choices for locations by consensus) and expounded on the beauty of the Owyhees, which I had not visited for several years.

During our journey into the Mud Flat area and upon our arrival there I was simply shocked to see the damage being done from grazing cattle in this area. Not only were natural waterways destroyed and turned into wallows, the natural lichen crust which is important to prevent erosion was damaged over vast areas by prints from cattle hooves.

We also noticed that there appeared to be logging operations going and that large old junipers had been extracted and logged using chains and skidder cables, that there were piles of slash for burning left all about and that in general the land management practices, if any were certainly not being enforced.

It saddened and sickened me to have to explain to my son, my nephew and the other scouts in the troop how unmanaged cattle grazing and un-enforced policies are wrecking our public lands. It did however serve as a good example of how following ‘leave no trace’ principles applies to not only backpackers, and campers, but society in general, and that stewardship of public lands is everyone’s responsibility.

We plan on returning to the same area we visited again in a year to see if things have recovered, and to compare pictures taken on iPhones and digital cameras over the course of time and see if the area improves or worsens. I hope that we will find good results.

Brian Loomis
Boise, ID

29
Mar
12

Just showed @ravnon68 my #ruby twitter bot to archive #instagram posts to twitter #economyofmotion

Taken with Instagram http://instagr.am/p/IyKBe7ip6x/
25
Jan
12

Benchmarking GoGrid Servers Old 1 core 2.27 server

    1 Geekbench 2.2.6 : http://www.primatelabs.ca/geekbench/
    2 
    3 System Information
    4   Operating System      Linux 2.6.18-274.7.1.el5 x86_64
    5   Model                 Xen HVM domU
    6   Motherboard            
    7   Processor             Intel(R) Xeon(R) CPU           E5520  @ 2.27GHz @ 2.27 GHz
    8                         1 Processor
    9   Processor ID          GenuineIntel Family 6 Model 26 Stepping 5
   10   L1 Instruction Cache  32.0 KB
   11   L1 Data Cache         32.0 KB
   12   L2 Cache              256 KB
   13   L3 Cache              8.00 MB
   14   Memory                3.87 GB 
   15   BIOS                  Xen 3.1.2-164.11.1.el5
   16 
   17 Integer
   18   Blowfish
   19     single-threaded scalar    832 |||
   20     multi-threaded scalar    1079 ||||
   21   Text Compress
   22     single-threaded scalar   1941 |||||||
   23     multi-threaded scalar    1863 |||||||
   24   Text Decompress
   25     single-threaded scalar   2110 ||||||||
   26     multi-threaded scalar    2186 ||||||||
   27   Image Compress
   28     single-threaded scalar   1725 ||||||
   29     multi-threaded scalar    1687 ||||||
   30   Image Decompress
   31     single-threaded scalar   2046 ||||||||
   32     multi-threaded scalar    2141 ||||||||
   33   Lua
   34     single-threaded scalar   3726 ||||||||||||||
   35     multi-threaded scalar    3753 |||||||||||||||
   36 
   37 Floating Point
   38   Mandelbrot
   39     single-threaded scalar   1893 |||||||
   40     multi-threaded scalar    1917 |||||||
   41   Dot Product
   42     single-threaded scalar   2478 |||||||||
   43     multi-threaded scalar    2601 ||||||||||
   44     single-threaded vector   3180 ||||||||||||
   45     multi-threaded vector    3649 ||||||||||||||
   46   LU Decomposition
   47     single-threaded scalar   1788 |||||||
   48     multi-threaded scalar    1797 |||||||
   49   Primality Test
   50     single-threaded scalar   3781 |||||||||||||||
   51     multi-threaded scalar    2983 |||||||||||
   52   Sharpen Image
   53     single-threaded scalar   5221 ||||||||||||||||||||
   54     multi-threaded scalar    5291 |||||||||||||||||||||
   55   Blur Image
   56     single-threaded scalar   1801 |||||||
   57     multi-threaded scalar    1817 |||||||
   58 
   59 Memory
   60   Read Sequential
   61     single-threaded scalar   3089 ||||||||||||
   62   Write Sequential
   63     single-threaded scalar   4039 ||||||||||||||||
   64   Stdlib Allocate
   65     single-threaded scalar   3511 ||||||||||||||
   66   Stdlib Write
   67     single-threaded scalar   2440 |||||||||
   68   Stdlib Copy
   69     single-threaded scalar   5008 ||||||||||||||||||||
   70 
   71 Stream
   72   Stream Copy
   73     single-threaded scalar   3459 |||||||||||||
   74     single-threaded vector   5537 ||||||||||||||||||||||
   75   Stream Scale
   76     single-threaded scalar   3495 |||||||||||||
   77     single-threaded vector   5174 ||||||||||||||||||||
   78   Stream Add
   79     single-threaded scalar   3697 ||||||||||||||
   80     single-threaded vector   5526 ||||||||||||||||||||||
   81   Stream Triad
   82     single-threaded scalar   3592 ||||||||||||||
   83     single-threaded vector   3915 |||||||||||||||
   84 
   85 Benchmark Summary
   86   Integer Score              2090 ||||||||
   87   Floating Point Score       2871 |||||||||||
   88   Memory Score               3617 ||||||||||||||
   89   Stream Score               4299 |||||||||||||||||
   90 
   91   Geekbench Score            2889 |||||||||||
   92 
   93 
25
Jan
12

Benchmarking GoGrid Servers New 8 core 2.67 server

    1 Geekbench 2.2.6 : http://www.primatelabs.ca/geekbench/
    2 
    3 System Information
    4   Operating System      Linux 2.6.18-274.7.1.el5 x86_64
    5   Model                 Xen HVM domU
    6   Motherboard            
    7   Processor             Intel(R) Xeon(R) CPU           X5650  @ 2.67GHz @ 2.67 GHz
    8                         1 Processor, 8 Threads
    9   Processor ID          GenuineIntel Family 6 Model 44 Stepping 2
   10   L1 Instruction Cache  32.0 KB x 8
   11   L1 Data Cache         32.0 KB x 8
   12   L2 Cache              256 KB x 8
   13   L3 Cache              12.0 MB x 8
   14   Memory                7.81 GB 
   15   BIOS                  Xen 3.1.2-164.11.1.el5
   16 
   17 Integer
   18   Blowfish
   19     single-threaded scalar   1800 |||||||
   20     multi-threaded scalar   13754 ||||||||||||||||||||||||||||||||||||||||
   21   Text Compress
   22     single-threaded scalar   2200 ||||||||
   23     multi-threaded scalar   14993 ||||||||||||||||||||||||||||||||||||||||
   24   Text Decompress
   25     single-threaded scalar   2433 |||||||||
   26     multi-threaded scalar   16283 ||||||||||||||||||||||||||||||||||||||||
   27   Image Compress
   28     single-threaded scalar   1997 |||||||
   29     multi-threaded scalar    9861 |||||||||||||||||||||||||||||||||||||||
   30   Image Decompress
   31     single-threaded scalar   2239 ||||||||
   32     multi-threaded scalar    8465 |||||||||||||||||||||||||||||||||
   33   Lua
   34     single-threaded scalar   4210 ||||||||||||||||
   35     multi-threaded scalar   27226 ||||||||||||||||||||||||||||||||||||||||
   36 
   37 Floating Point
   38   Mandelbrot
   39     single-threaded scalar   2223 ||||||||
   40     multi-threaded scalar   15518 ||||||||||||||||||||||||||||||||||||||||
   41   Dot Product
   42     single-threaded scalar   2923 |||||||||||
   43     multi-threaded scalar   21016 ||||||||||||||||||||||||||||||||||||||||
   44     single-threaded vector   3547 ||||||||||||||
   45     multi-threaded vector   27470 ||||||||||||||||||||||||||||||||||||||||
   46   LU Decomposition
   47     single-threaded scalar   1998 |||||||
   48     multi-threaded scalar   11009 ||||||||||||||||||||||||||||||||||||||||
   49   Primality Test
   50     single-threaded scalar   4276 |||||||||||||||||
   51     multi-threaded scalar   23493 ||||||||||||||||||||||||||||||||||||||||
   52   Sharpen Image
   53     single-threaded scalar   6097 ||||||||||||||||||||||||
   54     multi-threaded scalar   24567 ||||||||||||||||||||||||||||||||||||||||
   55   Blur Image
   56     single-threaded scalar   2117 ||||||||
   57     multi-threaded scalar   16269 ||||||||||||||||||||||||||||||||||||||||
   58 
   59 Memory
   60   Read Sequential
   61     single-threaded scalar   3553 ||||||||||||||
   62   Write Sequential
   63     single-threaded scalar   4808 |||||||||||||||||||
   64   Stdlib Allocate
   65     single-threaded scalar   3886 |||||||||||||||
   66   Stdlib Write
   67     single-threaded scalar   2191 ||||||||
   68   Stdlib Copy
   69     single-threaded scalar   4324 |||||||||||||||||
   70 
   71 Stream
   72   Stream Copy
   73     single-threaded scalar   2939 |||||||||||
   74     single-threaded vector   3639 ||||||||||||||
   75   Stream Scale
   76     single-threaded scalar   2848 |||||||||||
   77     single-threaded vector   3267 |||||||||||||
   78   Stream Add
   79     single-threaded scalar   2721 ||||||||||
   80     single-threaded vector   3698 ||||||||||||||
   81   Stream Triad
   82     single-threaded scalar   2957 |||||||||||
   83     single-threaded vector   2711 ||||||||||
   84 
   85 Benchmark Summary
   86   Integer Score              8788 |||||||||||||||||||||||||||||||||||
   87   Floating Point Score      11608 ||||||||||||||||||||||||||||||||||||||||
   88   Memory Score               3752 |||||||||||||||
   89   Stream Score               3097 ||||||||||||
   90 
   91   Geekbench Score            8198 ||||||||||||||||||||||||||||||||
   92 
   93 
15
May
11

Using ruby to parse .bex files from Billings Pro

#!/usr/bin/env ruby
# bex_parser.rb

# If you are a Ruby Programmer, this script may be interesting to you.

require 'rubygems'
require 'hpricot'
require 'mysql'
require 'time'

# Set the File to read from the slips that were exported.
doc = Hpricot::XML(File.read("Desktop/slips.bex"))
# Loop through the top element, silly since there is only one, but needed
(doc/'plist').each do |sx|

  # Loop through all the time slips that were exported and exist in the .bex file.
  (sx/'dict array dict').each do |sm|

    # Loop through each component of time slip
    (sm/'array').each do |st|
  
      # Setting the billing comment from the position, may be in 1 or 2 [0][1]
      ((st.parent/'key')[1].inner_html == 'comment') ? @billing_comment = (st.parent/'string')[0].inner_html : @billing_comment = ''
      ((st.parent/'key')[2].inner_html == 'comment') ? @billing_comment = (st.parent/'string')[1].inner_html : @billing_comment = ''

      # Setting the category from the position, may be in 1 or 2 [0][1] 
      ((st.parent/'key')[1].inner_html == 'category.name') ? @billing_category = (st.parent/'string')[0].inner_html : @billing_category = ''
  
      if ((st.parent/'string')[2].inner_html == 'Billings')
        @billing_description = ((st.parent/'string')[2].inner_html == 'Billings' ? (st.parent/'string')[3].inner_html : (st.parent/'string')[2].inner_html)
        @billing_worker = ((st.parent/'string')[2].inner_html == 'Billings' ? (st.parent/'string')[4].inner_html : (st.parent/'string')[3].inner_html)
      else
        @billing_description = ((st.parent/'string')[4].inner_html == 'Billings' ? (st.parent/'string')[5].inner_html : (st.parent/'string')[4].inner_html)
        @billing_worker = ((st.parent/'string')[4].inner_html == 'Billings' ? (st.parent/'string')[6].inner_html : (st.parent/'string')[5].inner_html)
      end

      # Look through each time entry for each timeslip.
      (st/'dict').each do |sz|
        @time_uuid = (sz/'string')[1].inner_html
        @time_start = (sz/'date')[2].inner_html
        @time_end = (sz/'date')[1].inner_html
        @time_duration = (Time.parse(@time_end) - Time.parse(@time_start)) / 3600 

        begin
          db = Mysql.real_connect("localhost", "username", "password", "dbname")
          sth = db.prepare(
                            "INSERT INTO timeslips 
                              (uuid, begin, end, title, duration, worker, description, category)
                            VALUES
                              (?,?,?,?,?,?,?,?) 
                            ON DUPLICATE KEY UPDATE 
                              count=count + 1, begin=?, end=?, title=?, duration=?, worker=?, description=?, category=?"
                            )
          sth.execute(@time_uuid, @time_start, @time_end, @billing_description, @time_duration, @billing_worker, @billing_comment, @billing_category, @time_start, @time_end, @billing_description, @time_duration, @billing_worker, @billing_comment, @billing_category)
          
        # puts "Number of rows inserted: #{db.affected_rows}"
        rescue Mysql::Error => e
          puts "Error code: #{e.errno}"
          puts "Error message: #{e.error}"
          puts "Error SQLSTATE: #{e.sqlstate}" if e.respond_to?("sqlstate")
         
        ensure
          db.close if db
        end
      end # Ends (st/'dict').each
    end # Ends (sm/'array').each
  end # Ends (sx/'dict array dict').each
end # (doc/'plist').each



Tweets

del.icio.us motion