Thursday May 12, 2005

More Beer !

Somewhat inspiried by the python beer.py script, and more so by Brendan Gregg's dtrace'd Guessing Game, heres some beer thanks to dtrace.

#!/usr/sbin/dtrace -s

BEGIN
{
        n = 10;
        ifor = 1;
}

tick-1sec
/!n && !ifor/
{
        printf("no more bottles of beer on the wall");
        exit(0);
}

tick-1sec
/n == 1 && !ifor/
{
        printf("one more bottle of beer on the wall");
        ifor = 1;
}

tick-1sec
/n > 1 && !ifor/
{
        printf("%d bottles of beer on the wall", n);
        ifor = 1;
}

tick-1sec
/ifor/
{
        n--;
        ifor = 0;
}

Dtrace can't do loops (for good reason), but this script shows an example of getting something similar out of it..

# dtrace -s beer.d   
dtrace: script 'beer.d' matched 5 probes
CPU     ID                    FUNCTION:NAME
  0  39815                       :tick-1sec 9 bottles of beer on the wall
  0  39815                       :tick-1sec 8 bottles of beer on the wall
  0  39815                       :tick-1sec 7 bottles of beer on the wall
  0  39815                       :tick-1sec 6 bottles of beer on the wall
  0  39815                       :tick-1sec 5 bottles of beer on the wall
  0  39815                       :tick-1sec 4 bottles of beer on the wall
  0  39815                       :tick-1sec 3 bottles of beer on the wall
  0  39815                       :tick-1sec 2 bottles of beer on the wall
  0  39815                       :tick-1sec one more bottle of beer on the wall
  0  39815                       :tick-1sec no more bottles of beer on the wall

# 

Comments:

There is a site collecting code like this for as many computer languages as they can. http://www.99-bottles-of-beer.net/ Off you go!

Posted by John Corrigan on May 12, 2005 at 04:39 PM IST #

Cool, thanks John. I've submitted the dtrace version!

Posted by smg on May 13, 2005 at 10:13 AM IST #

I am from Backbone Media, an Internet marketing company based in the Greater Boston area. While searching the web for bloggers who work for companies and blog about their company’s products and services, I found your blog.

Blogging is all about starting online conversations about a particular topic. Backbone Media is attempting to understand the value of blogging for companies, to build a model of what makes a good business related blog. We asked ourselves the following questions to start that conversation about corporate blogging:

· What is the value of corporate blogs?
· Who blogs in a company?
· What can it bring to the company?
· What makes a corporate blog successful?
To find answers to these questions, we are reaching out to bloggers at companies by conducting a survey for corporate bloggers. We were inspired in part by the corporate blogging survey conducted last year on the The NewPR Wiki week.

We want to get your feedback on corporate blogging, and after the survey closes, we will understand more about corporate blogging and we will publish and send you the complete results.

If you’d like to remain anonymous, it is not necessary to fill out the contact information. However, if you would still like to receive the results of the survey, please email us at bloggingsurvey@backbonemedia.com and let us know. Since you will have filled the survey out anonymously, we will not associate your contact information or company with your survey responses.

We’d really appreciate the bloggers taking our survey. It can be filled out here: http://www.backbonemedia.com/blogsurvey/

You can contact me directly at kristine@backbonemedia.com or contact our blogging survey team at bloggingsurvey@backbonemedia.com

Thanks!
Kristine

Posted by Kristine on May 16, 2005 at 03:26 PM IST #

http://www.bestjewellerybox.org/

Posted by bestjewellerybox on May 26, 2007 at 07:46 PM IST #

http://www.bestofbeers.org/

Posted by bestofbeers on May 26, 2007 at 07:48 PM IST #

Post a Comment:
  • HTML Syntax: NOT allowed