12 Jun '12, 8am

Ruby Best Practices- USP: Handling excessive CPU Usage within a Process:

# Users of older Rubies may want to use Process::RLIMIT_CPU # instead of :CPU in this code. soft, hard = Process.getrlimit(:CPU) last_update = Time.now max_cpu_time = 5 # this signal handler runs once we've hit max_cpu_time: trap(:XCPU) do # Calculate CPU utilization based on elapsed (wall clock) time # and max_cpu_time elapsed = Time.now - last_update cpu_usage = max_cpu_time / elapsed puts "CPU utilization: #{"%0.2f" % (cpu_usage * 100)}" if cpu_usage > 0.5 # 50% abort "CPU utilization exceeded 50%" end # If we're below our CPU usage threshold, install a new limit based on # current Process.times last_update = Time.now t = Process.times Process.setrlimit(:CPU, max_cpu_time + t.utime.round + t.stime.round, hard) # We now return to our regularly scheduled looping ... end # Install an initial limit for max_cpu_time using existing process times t = Process.times Process.setr...

Full article: http://blog.rubybestpractices.com/posts/ewong/017-Handlin...

Tweets

Good refresher on the best practices for domain SEO - SEO Best Practices | SEOmoz

Good refresher on the best practices for domain...

seomoz.org 15 Jun '12, 7pm

To maximize search engine referred traffic, it is important to keep each of the following elements in mind: 1. Domain Name...

Luxe et e-Commerce : Chiffres, Tendances et Best Practices

Luxe et e-Commerce : Chiffres, Tendances et Bes...

webandluxe.com 12 Jun '12, 5am

Le marché de la vente en ligne de produits de luxe (textile, maroquinerie, accessoires, montres et bijoux, etc.) qui pesai...

Up to 36% off Ysnore Anti-Snoring Nasal Drop – Available in 5ml (30 Days Usage) or 10ml (60 Days Usage)

Up to 36% off Ysnore Anti-Snoring Nasal Drop – ...

deal.com.sg 12 Jun '12, 7am

Ysnore Anti-Snoring Nasal Drop 2 Price Options Available: Ysnore Anti-Snoring Nasal Drop: 5ml (30 Days Usage) – Only $17.5...

What is ‘Excessive Exercise,’ Anyway?

What is ‘Excessive Exercise,’ Anyway?

news.runnersworld.com 14 Jun '12, 6pm

By Scott Douglas You've probably seen recent news reports about "excessive exercise" being worse for your health than more...