Safe boot your mac to repair startupdisk

Just hold the shift key after the startup tone to repair your startupdisk.
What is Safe Boot, Safe Mode? and Starting up in Safe Mode

How Many Germs Live On Your Keyboard?

Studies have shown that your keyboard and mouse are some of the most germ-ridden devices you own, surpassing even doorknobs and toilet seats. Take this short quiz to see how many germs lovingly call your keyboard home.

2,741,340How Many Germs Live On Your Keyboard?

RSpec & Growl

Oef…. ff rspec opzetten was niet zo gemakkelijk als de screencast op railsenvy doet geloven. Er is hier en daar wat veranderd in de library’s en deze kun je overrulen met een .autotest bestand. Helemaal zelf bedacht heb ik het niet maar het een en ander van andere weblogs geplukt.

# -*- ruby -*-
require 'autotest/growl'
require 'autotest/redgreen'

module Autotest::Growl
  # save the name of the working directory (e.g., the app name)
  # to be used as a key to identify this particular run of autotest
  # so the same growl notification will be reused for updates,
  # instead of a new growl window for every posting.
  @@current_directory_name = Dir.pwd.match(/([^\/]+)\z/).to_s

  def self.growl title, msg, pri=0, img=""
    title += " in #{@@current_directory_name}"
    msg += " at #{Time.now}"
    system "growlnotify -n autotest #{pri > 0 ? '-s ' : ''}--image #{img} -p #{pri} -d '#{Dir.pwd}' -m #{ msg.inspect} #{title}"
  end

  Autotest.add_hook :ran_command do |autotest|
    results = [autotest.results].flatten.join("\n")
    output = results.slice(/(\d+)\s+examples?,\s*(\d+)\s+failures?(,\s*(\d+)\s+pending)?/)
    if output  =~ /[1-9]\sfailures?/
      growl "FAIL:", "#{output}", 2, "~/Library/autotest/rails_fail.png"
    elsif output  =~ /[1-9]\spending?/
      growl "PENDING:", "#{output}", 1, "~/Library/autotest/rails_pending.png"
    else
      growl "PASS:", "#{output}", 0, "~/Library/autotest/rails_ok.png"
    end
  end
end

Get the pictures from here:

rails_ok.png

rails_pending.png

rails_fail.png

Noot: Bij het schrijven van deze blogentry kwam ik een andere .autotest tegen op http://pastie.caboo.se/96573/download. Met logging, stripping van color codes, uitgebreidere foutafhandeling. wat ik er nog bij heb getikt is de extra optie voor reuse van de notificatie:

system "growlnotify -n autotest --image #{img} #{pri > 0 ? '-s ' : ''}-p #{pri} -d '#{Dir.pwd}' -m #{msg.inspect} #{title} #{stick}"

RailsConf2007 Europe

Jawel! Ik ben d’r bij!
Zondagochtend om 8.20 vertrekken :( da’s wel een beetje vroeg….

Atending:

Monday:

  • Handling Large Concurrent Uploads and Media Transcoding David NaffisVervallen
  • Using Adobe Flex with Rails
  • Keynote Dave Thomas

Tuesday:

  • Keynote David Heinemeier Hansson
  • Deployment and Continuous Integration from the Trenches
  • Screenscraping as a Tool for Changing the (Legacy) World mhhooaa… legacy applicaties draaien we niet echt, dus….
  • Really Scaling Rails (Twitter!!)
  • Tabnav: Do We Really Need a Plugin for Tabbed Navigation?

Wednesday:

  • Building Rich Internet Applications with Flex and Ruby on Rails
  • Ruby on Rails Security
  • Exploring Very Rapid Web Development Techniques with Hobo
  • Debugging and Testing the Web Tier
  • Teaching Rails at a University

Capistrano deployment met verschillende SVN url’s

de SVN repository (file:///var/svn/app/trunk) is lokaal op de webserver maar vanaf buiten alleen te berijken via ssh (svn+ssh://www/var/svn/app/trunk). hoe zet je die verschillen in je config/deploy.rb? sim-pel:

set :local_repository,  "svn+ssh://www/var/svn/app/trunk"
set :repository,  "file:///var/svn/app/trunk"

Whoa! procmail is heavy on the CPU

Inkomende mail verwerken zoals beschreven in diverse “officiele” handleidingen via een .procmail is best ok…. als je een paar mails per dag krijgt…..
zo deed ik dus eerst tests met een mailtje of 3, niks aan de hand. Maar injecteer een mail of 350 tegelijk, dat is dus killing voor je CPU/swap!
Ik had dus een load van 200! dus op zoek naar een andere methode: poppen via een fetcher Duurde even om de oplossing voor elkaar te krijgen maar op een of andere manier deed ie het dus niet. Regel 50 aanpassen in fetcher/lib/fetcher/base.rb did the trick
< @receiver.receive(message)
> eval "#{@receiver}.receive(message)"

Edit: Contact gehad met de ontwikkelaar en die heeft ‘t gefixed in de svn

Read the rest of this entry »

Copy records between tables with sql

To copy records between tables with sql:
sql = "INSERT INTO batch_items (batch_id, mailuser_id, sendstate_id )
SELECT DISTINCT #{@batch_id}, mailuser_id, 2
FROM
subscriptions s, mailusers m
WHERE
template_id = #{@newsletter.template_id}
AND s.active = 1
AND m.client_id = #{@newsletter.client_id}
AND s.mailuser_id =m.id"

conn = ActiveRecord::Base.connection()
conn.execute sql

CruiseControl.rb: Automated Continuous Integration voor Ruby en Rails

CruiseControl.rb is een Continous Integration tool geschreven in Rails waarin het mogelijk is om applicaties geschreven in o.a. Ruby, Rails, Java en C++ automatisch te compilen en te testen wanneer er een commit op de centrale subversion repository is gedaan.

Hierbij wordt frequent de volledige testcyclus doorlopen, welke stappen als het compilen van de applicatie, het uitvoeren van geautomatiseerde testen en het packagen van een applicatie kan bevatten.

Een geautomatiseerde versie van dit proces is bekend als Automated Continuous Integration. Wanneer er tijdens de integratietest een fout optreedt (een unit test faalt bijvoorbeeld) dan is het mogelijk om elke ontwikkelaar automatisch op de hoogte te stellen d.m.v. een email, sms of een instant message.

De volledige test suite wordt automatisch bij elke commit uitgevoerd en zodoende wordt continu de gezondheid van je applicatie(s) gecontroleerd.

In dit artikel wordt beschreven hoe je CruiseControl.rb op kunt zetten, hoe een standaard Ruby project erin op te nemen en hoe de functionaliteit op basis van plugins uit te breiden is.

Color Scheme Generator 2

Color Scheme Generator 2 voor het bepalen van kleur combinaties. Tevens de mogelijkheid om te kijken of kleurenblinden het ook kunnen zien!

backgroundrb: render rhtml templates in worker

Duurde ff voordat ik dat had gevonden maar het equivalent van render_to_string in een backgroundrb process wordt hiermee ondervangen:

Subject: [Backgroundrb-devel] render rhtml templates in worker

So i have not figured out any sane way to access controllers inside of backgroundrb
or other rails-working scripts but instead i've resorted to rendering my rhtml
templates directly using the ERB module that rails already includes from ruby standard lib.

There are a few limitations to using ERB in the raw:
- it doesn't understand the trailing dash in <% -%> so you have to strip those.
- obviously it doesn't know about any rails helper methods although i
  think you might be able to explicitly include their classes.
- you have to pass it a binding to your namespace or else it won't be
  able to access any instance variables

Here's an example that works from inside of a model class:
     #load template into ERB object for rendering
     erb = ERB.new( IO.read( rhtml_template_path ) )

     #set instance variables for rendering
     @report = self
     @chart = @report.chart

     # in order for the erb template to access the instance variables
     # we must pass it a binding to this namespace
     b = binding

     #render template with instance variables
     rendered_result = erb.result(b)

One upside to giving up all the rails framework help is that it runs a
bit faster and lighter.

-Jacob

Update:‘trailing dash’ was niet zichtbaar ivm html codes, heeft me dus een paar uur gekost :(