Blinksale: Easy, painless, online invoicing for small businesses

Learn Ruby While Making Fun of Condiment-Lovers (formerly “Soocial invite”)

This was a blog created for the purpose of me asking for a Soocial invite, but I've now gotten one.

However, it seems to have morphed into a thread that's not really related to anything at all. But keep talking, if you want.

:P

Posted by soprano on Jun 10, 2008 in Blab | 659 comments

soprano on Jun 10, 2008

Still looking…

soprano on Jun 10, 2008

Pwetty pwease?

soprano on Jun 10, 2008

Surely someone has one.

soprano on Jun 11, 2008

But maybe not.

soprano on Jun 11, 2008

I sure hope so.

rajr19 on Jun 11, 2008

i do too

soprano on Jun 12, 2008

Hey, another request.

annikalee on Jun 12, 2008

this is kindof funny to read

soprano on Jun 12, 2008

Is it?

annikalee on Jun 12, 2008

very much so. for…reasons

laulena on Jun 12, 2008

i was going to say the same thing as annikalee said earlier but i didn't want to interrupt your conversation with yourself. heehee :)

annikalee on Jun 12, 2008

see? it's not just me

soprano on Jun 12, 2008

Well, now it's more interesting.

annikalee on Jun 12, 2008

that's an understatement

laulena on Jun 12, 2008

to say the least

soprano on Jun 12, 2008

Hey, I don't really think you guys are _that_ interesting…

Darkneo Vip-micro on Jun 12, 2008

I would like one too neokid90@(google's mail domain)

annikalee on Jun 13, 2008

nice emphasis on the "that" there soprano. personally, i think between your conversation with yourself and our commentaries we have made this _very_ interesting.

soprano on Jun 13, 2008

@Darkneo: I'll send you one if I get one.

annikalee on Jun 13, 2008

@soprano: not commenting on my comment? why i'm surprised. :)

laulena on Jun 13, 2008

well not that it matters if he's amused...at least we amused ourselves! haha :)

terremom Vip-micro on Jun 13, 2008

unfortunately, soprano spends too much time on line...that amuses me the rare momements I have to scan the blogs. Have fun kiddo.

annikalee on Jun 14, 2008

actually, i haven't been online lately either but this coversation is making me come online more. i'm pretty sure soprano's busy and he might be back soon.

@laulena: i totally, absolutely, completely agree!

soprano on Jun 15, 2008

@annikalee: Wow, you seem to be psychic, I just got back home.

Well, still doesn't look like someone has one. :(

MrDee on Jun 15, 2008

I can haz noo invyte
wanna cheezburger?

annikalee on Jun 15, 2008

@soprano: i believe we've had this conversation before. of course i'm psychic! duh! and yes

soprano on Jun 16, 2008

@MrDee: I love cheezburgerz.

terremom Vip-micro on Jun 16, 2008

me cheezburger 2, plz??

soprano on Jun 16, 2008

Hey, I just got one. Turns out that people don't get the ability to invite others, but if you act fast, then you'll find one here

annikalee on Jun 16, 2008

has anyone else noticed that whenever i talk on these threads, the thread usually ends up off-topic?

soprano on Jun 16, 2008

Nope.

annikalee on Jun 16, 2008

okay so it's just me :)

soprano on Jun 16, 2008

Or is it?

annikalee on Jun 16, 2008

maybe it's you

soprano on Jun 16, 2008

Huh?!

annikalee on Jun 16, 2008

instead of it being me, it's you. duh

soprano on Jun 16, 2008

Ah.

Huh and duh rhyme.

annikalee on Jun 16, 2008

they do.

B3llit0 on Jun 16, 2008

I'm now going to interrupt this conversation (which is indeed interesting) to note that I have been under the impression that soprano was a she for all the time I've been at IB. That conclusion was based solely on his username. I also assumed that soprano enjoys singing. This conclusion has yet to be (dis)proved.

anti on Jun 16, 2008

Being The Hoff, priceless.

soprano on Jun 16, 2008

I love singing.

I love singing high, too.

annikalee on Jun 16, 2008

and even though he is a guy, he really can sing well high

soprano on Jun 16, 2008

Thanks. :)

annikalee on Jun 16, 2008

well it's true

soprano on Jun 16, 2008

@B3llit0: Out of curiosity, how did you decide that I _wasn't_ a girl? My profile, maybe?

MrDee on Jun 16, 2008

cheezburgerz 4 y'all

annikalee on Jun 17, 2008

@MrDee: thanks i like cheeseburgers

soprano on Jun 17, 2008

Mmm… food….

B3llit0 on Jun 17, 2008

@soprano: annikalee stated that (s)he was pretty sure that "soprano's busy and he might be back soon".

so… i herd u liek merengue? Because I really like merengue. I'm listening to it right now. And I'm tempted to type the lyrics of the current song. *resists temptation* *clicks submit button before resistance becomes futile*

soprano on Jun 17, 2008

Oh, it looks like she did say that, doesn't it?

B3llit0 on Jun 17, 2008

Indeed it does.

annikalee on Jun 17, 2008

@soprano: you're not good at hinting ;)

soprano on Jun 20, 2008

Hinting?

B3llit0 on Jun 20, 2008

If you mean hinting as in “I'm hinting each glyph in my font”, then I can help. But I will have to bring the delicious lemonade from Kyoto Cola.

soprano on Jun 20, 2008

Wait, I get free font hinting AND lemonade?

Sign me up!

Granf on Jun 20, 2008

You're avatar is confusing, and i never noticed it before. I just looked and said, "hey, that's a one-flat key signature, and that's not B" but then i saw the clef, indicating that the first line was C4. Who uses that, anyway? It's not a tener clef...

soprano on Jun 20, 2008

It's a soprano clef. Really.

Look it up.

B3llit0 on Jun 20, 2008

That's correct. Unfortunately, the B-shaped clef is used in three ways (as far as I know). When the middle brackets the centre line of the staff, it is a tenor clef. Move it down one and you have an alto clef, again and you get a soprano clef. It's sort of confusing, but I want to be an opera conductor when I'm older, so I have to know these things. :-)

B3llit0 on Jun 20, 2008

Reading the Wikipedia article about clef has informed me that the alto clef is also called the mezzo-soprano clef (which makes more sense), and that just as moving it down produces higher tones, moving it up makes them lower (baritone clef, anyone?)

Also, I have a correction to make: when it brackets the centre, it is an alto clef; tenor clef is in a different position. I rarely ever see this clef (except in the score of Rodelinda), so which position is which escapes my memory sometimes.

Granf on Jun 20, 2008

A soprano clef? Does that mean that the first line is actually C5? It wouldn't make sense if it was C4. That would gear it for lower voices...

soprano on Jun 20, 2008

Tenor clef is used in cello music fairly frequently.

I think that it the bottom line is C4, then the top space is C5.

B3llit0 on Jun 20, 2008

I've never played the cello, though I do play the violin. I need to get more scores with tenor clefs on them, XD

Let's talk about sushi.

soprano on Jun 20, 2008

Yum.

Salmon, anyone?

B3llit0 on Jun 21, 2008

Salmon, indeed! At our local sushi bar (Yokozuna Sushi), there's a roll called the Yokozuna Special Roll. Crab and cucumber inside, salmon on top, two sauces over it- nom nom nom.

annikalee on Jun 21, 2008

@Granf: I was a little confused about his avatar for a while until I googled "soprano clef" I also thought of the viola when I saw it

Yum, sushi. I like california rolls and uni is pretty good. Great now i'm hungry

B3llit0 on Jun 21, 2008

California rolls are what most people start out with for some reason; that's what I started with too. My parents were against allowing me to eat raw fish at first, but they allowed me to anyway.

annikalee on Jun 21, 2008

I think california rolls are what people start out with because they are everywhere. I only like the fresh ones.

B3llit0 on Jun 21, 2008

Something else that sucks that you can get when eating sushi is dry, overly sticky rice that feels like glue. The only sushi bar my dad likes serves all their sushi like that, which is why I usually don't get sushi there.

annikalee on Jun 21, 2008

i know exactly what you mean. i also hate it when the rice is harder than normal and you have to chew _way_ too much. yuk!

B3llit0 on Jun 21, 2008

My favourite sushi bar (Yokozuna Sushi) is owned by a guy who's half-Japanese, half-Korean. He's a nice guy, and will often talk to customers he recognises (me, my sister, her dad). They have really good sushi there. Another one I like is called Oh! Sushi. It still has a little LED sign going in the window that tells you the types of sushi they serve, and to this day says “Grand Opening” after a little over a year of being open. Whoops.

annikalee on Jun 21, 2008

that's great. i don't really have a favorite place to eat sushi, but i just love it! but then again that could just be my love of all food, especially asian food.

B3llit0 on Jun 21, 2008

I can go on and on about Japanese food… we have this restaurant close by called Ozeki Noodle owned by Japanese people… BEST. UDON. EVER. Also to be exalted are their donburi, tempura, sunomono, gyoza, and mochi ice cream.

annikalee on Jun 21, 2008

wow you know your food. :P

B3llit0 on Jun 21, 2008

Heh, I suppose one could say that. I don't actually consider food to be one of my hobbies or something I'm really into… those things would be music (excluding pop, rap, most rock, etc.), computers, and linguistics.

soprano on Jun 21, 2008

Wow. You two sure love sushi.

(As do I, of course.)

B3llit0 on Jun 22, 2008

Now let's discuss the fact that I think there's some kind of security vulnerability in YouTube. I like Latin music, so I thought I'd look at this video of a guy singing a tango. It loads, yes– but I am confronted with a JavaScript alert(); urging me to click OK so that I can get security software for my PC (PC? What PC?). Just for the heck of it, I say OK. The resulting page is quickly pwned by my Mac. Nothing happens and I close the tab to return to my video. I couldn't replicate it.

soprano on Jun 22, 2008

Hmm.

darkelf2099 on Jun 22, 2008

the only thing i love about sushi is wasabi...mmmm yummy:)

B3llit0 on Jun 22, 2008

Then you don't love sushi, you love sushi condiments.

Condiment-lover!

soprano on Jun 22, 2008

That sounds wrong.

B3llit0 on Jun 22, 2008

It does.

That's the second time we've had a two-word declarative sentence that can be said in Japanese using only one word. “It does” is taken care of with です。“They are” could be あります。

annikalee on Jun 22, 2008

Wow, for once that sounds almost so wrong that I am speechless. Almost.

B3llit0 on Jun 22, 2008

What, “condiment-lover”?

soprano on Jun 22, 2008

Indeed.

darkelf2099 on Jun 23, 2008

seriously i love that tingling sensation u get from eating wasabi....

annikalee on Jun 23, 2008

haha. that sounds more wrong.

soprano on Jun 23, 2008

No, "condiment-lover" does.

annikalee on Jun 23, 2008

no, "tingling sensation" from a condiment does

B3llit0 on Jun 23, 2008

They both sound wrong, you wrong-declarist!

soprano on Jun 23, 2008

Wrong-declarist? Shouldn't that be pluralized?

"wrong-declarist".pluralize #=> "wrong-declarists"

B3llit0 on Jun 23, 2008

function pluraliseWrongDeclarist {
var pluralForm = pluralise("wrong-declarist");
alert(pluralForm);
}
pluraliseWrongDeclarist();

soprano on Jun 23, 2008

(function() {
  var word = pluralize("wrong-declarist");
  alert(word);
})();

B3llit0 on Jun 23, 2008

XD, now let's do AppleScript

set word to "wrong-declarist"
set finalWord to the result of pluralise word
alert finalWord
end tell

soprano on Jun 23, 2008

Or (ba/c/z)sh:

echo "wrong-declarist" | pluralize

B3llit0 on Jun 23, 2008

I use bash a few times a week on average.

soprano on Jun 23, 2008

I use bash 8 days a week on average.

B3llit0 on Jun 23, 2008

LOL!

Ooh, I need your shell, babe
Guess you know it = true
Hope you need my shell, babe
Just like I need you

SIGSTOP me, SIGSTART me, SIGSTOP me, SIGSTART me
I ain't got nothin' but commands, babe
Eight days a week

Invoke you every day, shell
Always on my /dev/stdout
One thing I can echo,
Love you every day

Eight days a week
I love to invoke you
Eight days a week
!enough to show I care

soprano on Jun 23, 2008

$ sudo killall -SIGKILL B3llit0
Password:
$

Just kidding.

B3llit0 on Jun 23, 2008

Noooooooooooo! At least SIGABRT me, so I can finish what I was doing.

Granf on Jun 23, 2008

shred /home/B3llit0

there. Now you needn't finish it. 'Cause it's gone! :)

Granf on Jun 23, 2008

$ ls -R / | grep "B3llit0" | sudo rm -rf

In case that last one didn't get it...

Granf on Jun 23, 2008

now that i think about it...

$ ssh b3llit0@69.13.36.138 shred ~

soprano on Jun 23, 2008

This should do the trick nicely on OS X.

$ sudo srm -rf ~B3llit0
Password:
$

annikalee on Jun 23, 2008

nerds

Granf on Jun 23, 2008

Roughly along with that same train of thought, I'd be positively amazed if any body knew what the following html-like language was:

.TH B3LLIT0 1 LOCAL

.SH NAME
b3llit0 - member of icon buffet

Granf on Jun 23, 2008

So amazed, in fact, that i'd be willing to accept 10 tokens worth of sets from them come the 28th.

annikalee on Jun 23, 2008

*has no idea, but thinks that's a good deal*

soprano on Jun 23, 2008

Troff, I believe.

No, I didn't look that up.

B3llit0 on Jun 23, 2008

That would be the macro language of manpages, specifically a troff macro. ^_^

soprano on Jun 23, 2008

Duuuuude, I think I'm right. (I looked it up just now.)

Ever read "The UNIX Programming Environment" by Kernighan and Pike? (Or maybe it was "The C Programming Language" by Kernighan and Richie… I can't remember.)

B3llit0 on Jun 23, 2008

In the sample provided, since it is for a man page about me, it's usually referred to as nroff, though they're pretty much one and the same.

soprano on Jun 23, 2008

Hey, I beat you to the punch. :)

B3llit0 on Jun 23, 2008

You wrote that while I was typing! XD I can't believe we're both on right now, I thought for sure you'd be asleep and I could get that.

soprano on Jun 23, 2008

I thought the same. But I should remember that you're an hour earlier.

B3llit0 on Jun 23, 2008

So who wins, if we both posted it without knowing the other was on and typing the correct answer simultaneously? Do we each get to send five tokens' worth?

soprano on Jun 23, 2008

No, I want my diamond. Only 300 points to 30k!

B3llit0 on Jun 23, 2008

Hey, I'd like one too, but we can't always get what we want.

I felt like my /dev/parent echoing that. I felt happy speaking in UNIX terms, which erased the odd feeling of posting the above maxim.

B3llit0 on Jun 23, 2008

/dev/parents: system shutdown required
$ shutdown now

soprano on Jun 23, 2008

Shutdown NOW!

*** FINAL System shutdown message from parents@B3llit0.local ***
System going down IMMEDIATELY

System shutdown time has arrived

darkelf2099 on Jun 24, 2008

java java java....

annikalee on Jun 24, 2008

haha…nerds

B3llit0 on Jun 24, 2008

I actually opened up Terminal and did shutdown now. It was funny because the little shutdown wheel starts turning instantly. Good emergency shutdown procedure if you're on later than you're supposed to be, because it doesn't take nearly as much time.

annikalee on Jun 24, 2008

this thread _almost_ makes me want to learn to program. just so that i can understand parts of it.

B3llit0 on Jun 24, 2008

Some of it isn't programming; the shutdown now and /dev/ stuff are parts of UNIX-like (or based, in some cases) operating systems.

annikalee on Jun 24, 2008

okay *is even more confused* but thanks

soprano on Jun 24, 2008

@annikalee: Why almost?

I think UNIX-based counts as UNIX-like.

annikalee on Jun 24, 2008

@soprano: because, as i just learned, it's not all programming and is just more confusion

B3llit0 on Jun 24, 2008

:set annikalee=noconfuse

That would be a vim command.

$ confuse -u annikalee

That's a UNIX command (not a real one, of course)

noconfuse("annikalee");

That would be JavaScript.

tell application "IconBuffet" to stop confusing "annikalee"
end tell

That's AppleScript.

soprano on Jun 24, 2008

No, these are AppleScript:

tell application "IconBuffet" to stop confusing "annikalee"

and

tell application "IconBuffet"
    stop confusing "annikalee"
end tell

annikalee on Jun 24, 2008

well i understood the AppleScript but i'm still confused

B3llit0 on Jun 24, 2008

You don't have to indent it. That's what the editor does on its own. You could make a better example that doesn't do anything if annikalee isn't confused:

if ("annikalee" is confused)
tell application "IconBuffet" to stop confusing annikalee
else
return 0
end if

annikalee on Jun 24, 2008

@B3llit0: i'm always confused

soprano on Jun 24, 2008

But you don't need an "end tell" if you have the "to".

"annikalee".confused? #=> true

annikalee on Jun 24, 2008

*is even more confused*

soprano on Jun 24, 2008

Time.now = Time.now + 1.year
IconBuffet::People.find_by_name("annikalee).confused? #=> false

The first line doesn't _actually_ work in Ruby, but it should. Time travel FTW!

B3llit0 on Jun 24, 2008

That's true, forgot about that. AppleScript will still take it if you put it, though.

var annikalee = new Object;
var annikalee.isConfused = true
alert("Annikalee\'s confused status: " + annikalee.isConfused);

annikalee on Jun 24, 2008

okay fine you win:

*is still confused*

puts 'blink' * 10

soprano on Jun 24, 2008

You mean:

var annikalee = {
    isConfused: true
};
alert("annikalee's confused status: " + annikalee.isConfused);

annikalee on Jun 24, 2008

huh? *is confused and lost*

soprano on Jun 24, 2008

Yeah, let's just work on Ruby for now.

B3llit0 on Jun 24, 2008

Breaking Down Code
featuring B3llit0 and soprano

Let's look at the UNIX example from earlier:

$ confuse -u annikalee

"confuse" is an (imaginary) UNIX command that accepts arguments and switches (we'll get to that in a moment).

"-u" is a switch. Switches are case-sensitive and pretty much always consist of a hyphen followed by a letter. They turn some kind of option on or off. In this case, the "u" stands for "undo".

"annikalee" is the argument of the command. In more clear terms, an argument is an object on which the command acts. We want to remove your confusion specifically, so the argument is "annikalee". Arguments always come after switches.

Taken together, if you read it literally it says "confuse undo annikalee", or "undo the confusion of annikalee".

Any other questions?

annikalee on Jun 24, 2008

*is less confused*

soprano on Jun 24, 2008

I thought that the -u was for user. Like the ones in ps and killall?

You really need something like this (think gzip/gunzip):

$ unconfuse -f annikalee

B3llit0 on Jun 24, 2008

Soprano told me he's trying to teach you Ruby. I don't know if we should start with Ruby, we might want to pick something else.

soprano on Jun 24, 2008

I've been told that you can pick which language you learn. The choices are:

Ruby, Python, JavaScript, C, PHP, XML, HTML, UNIX, and Vim

annikalee on Jun 24, 2008

uhm...i think some are missing..like C++

soprano on Jun 24, 2008

Hmm?

annikalee on Jun 24, 2008

@B3llit0: what is wrong with Ruby?

B3llit0 on Jun 24, 2008

@soprano: lol… let's just fsck -f /Volumes/annikalee.
****FILE SYSTEM WAS MODIFIED****

Oh, annika: fsck stands for “file system check”, not a bad word.

Coding With B3llit0 and soprano

Here are some hints to help you choose a language:

• Ruby is what you've been seeing so far over IM with soprano.
• Python is somewhat similar, maybe a little easier.
• JavaScript is one of the web-based languages. I learned a good amount of it pretty quickly with the help of a book I have.
• C will be a nightmare for you. I don't recommend it.
• PHP is another web-based language. You might find it a bit difficult.
• XML might be a little difficult when you start, but after you get the basics down you'll probably be OK.
• HTML is part of pretty much every webpage. I learned it when I was 9 by reading and typing for 6 hours straight. A good project.
• UNIX isn't exactly a programming language, it's an operating system. You can use it within a window on most operating systems (soprano and I use it on most days), so it's practical.
• Vim is a text editor that's pretty complicated. I learned a good deal of Vim in about an hour. If you do lots of text editing, you may want to try Vim.

soprano on Jun 24, 2008

Oh, B3llit0, you need to see this shirt: https://store.joyent.com/products/show/5.

I learned HTML a loong time ago, too. Maybe around the same age as you… What JS book did you use? Vim is too arcane. Emacs is cooler!

annikalee on Jun 24, 2008

okay...i think i'll go with ruby.

annikalee on Jun 24, 2008

which means i side with soprano

B3llit0 on Jun 24, 2008

I used JavaScript in Easy Steps. Quite a nice book.

I don't know a ton about Ruby, I'm going to do some reading before your lessons start.

annikalee on Jun 24, 2008

before my lessons start?

B3llit0 on Jun 24, 2008

Yes.

annikalee on Jun 24, 2008

but those lessons have already started...

soprano on Jun 24, 2008

Indeed.

debbye on Jun 24, 2008

i just thought i'd say hello! i am book marking this thread so i can read it's absurd entirety later … when i have a free hour!

ta ta :)

B3llit0 on Jun 24, 2008

@debbye: Alright, then. ^_^

OK, I learned things. Let's get Rubying!

B3llit0 on Jun 24, 2008

Oh, soprano- email me how much you've taught, so I know where we are.

darkelf2099 on Jun 24, 2008

oh yeah by the way B3llit0,how did that spelling competition you were in go?

B3llit0 on Jun 24, 2008

(whispered reply)

*is getting impatient waiting for soprano's email*

annikalee on Jun 25, 2008

@B3lli0: Can i know too about your competition? Oh and i have a feeling soprano will be on soon.

soprano on Jun 25, 2008

@darkelf2099, annikalee: He misspelled wassail as wassel in the second round.

annikalee on Jun 25, 2008

@soprano: how do you know that?

soprano on Jun 25, 2008

Telepathy.

annikalee on Jun 25, 2008

you are _not_ telepathic!

B3llit0 on Jun 25, 2008

Because I was constantly Twitterring and getting on IB while I was in DC, so everyone could stay up-to-date.

Soprano has told me what you've done so far. Pretty soon it will be quiz time.

annikalee on Jun 25, 2008

no, no quizzes. no

B3llit0 on Jun 25, 2008

Yes, yes quizzes, yes.

I can't wait to teach you regular expressions.

soprano on Jun 25, 2008

Quizzes are fun.

annikalee on Jun 25, 2008

no quizzes are no fun whatsoever!

soprano on Jun 25, 2008

No quizzes are no fun means that all quizzes are not no fun, or all quizzes are fun!

B3llit0 on Jun 25, 2008

It's true!

Breaking Down Grammatical Constructions
with soprano and B3llit0

“no quizzes” defines everything that is not a quiz.
“are” indicates the beginning of a phrase which defines some characteristic(s) of the preceding object. In this case, that object is everything that is not a quiz (“no quizzes”).
“no fun” is a way of saying that the adjective “fun” doesn't apply to some object (“no quizzes”).

To reword your sentence, removing the part where the confusion lies:

Everything that is not a quiz is not fun.

This can be used with some basic logic to determine things that are and aren't fun:

Everything that is not a quiz is not fun, therefore everything that IS a quiz is also fun. Therefore, things that are fun must be quizzes and everything that is not fun is not a quiz.

That's what you've told us.

The first part of your quiz simply involves telling me the output of this simple Ruby script.

puts("Type the reason you like cheese.")
reason = gets
puts("You like cheese because "+ reason.chomp!)

annikalee on Jun 25, 2008

*refuses to answer any quiz questions or to talk about her grammar issues*

soprano on Jun 25, 2008

Come on, you were just missing a comma.

soprano on Jun 25, 2008

And B3llit0, there shouldn't be an exclamation point after chomp.

B3llit0 on Jun 25, 2008

There is if I want. Maybe I feel like changing the variable. It's not really practical because I'm not using it anywhere else, no, but it works just fine.

soprano on Jun 25, 2008

In general, though, destructive! methods often don't return the object.

B3llit0 on Jun 25, 2008

That's true.

The word “destructive!” in the middle of your sentence looks funny.

annikalee on Jun 25, 2008

@soprano: i know i was just missing a comma and that doesn't change anything and B3llit0 is right "destructive!" does look funny but gets your point across very well

*coughs* Nerd-off *coughs*

B3llit0 on Jun 25, 2008

You do realise that by not answering the quiz question, you can't continue learning, right? It's like those annoying reading comprehension tests where you have to state the main idea AND three supporting details– in complete sentences. Only more fun, because it's about Ruby.

annikalee on Jun 25, 2008

huh?! how is it like those reading comprehension tests?

soprano on Jun 25, 2008

It doesn't matter. What does this print out?

puts "Type the reason you like cheese."
print "I like cheese because… "
reason = gets.chomp
puts "You like cheese because #{reason}."

darkelf2099 on Jun 25, 2008

hah..im so lost right now..werent we all talking about sushi and its great condiments at one point of time???

annikalee on Jun 25, 2008

yes, yes we were. i love sushi. it's so great. yum

annikalee on Jun 25, 2008

@darkelf2099: what's your favorite type of sushi?

darkelf2099 on Jun 25, 2008

@annikalee: ummm california rolls...we get those here in Malaysia.I like a whole load of em but i dont really remember those Japanese names:)

Oh and Wasabi!!My favorite condiment right next to mustard

B3llit0 on Jun 25, 2008

Soprano, haven't you taught concatenation?

puts "You like cheese because " + reason

I considered using gets.chomp, but decided not to. Also, putting "I like cheese because…" isn't an explicit prompt for the user to type something, so it's not a user-friendly design.

My code fits in only 3 lines (plus the shebang line, #!/usr/bin/ruby).
—————
@annikalee: I'm going to tell you about my favourite sushi in Ruby, with comments.

#create a sushi class for the sushi object
class Sushi
  attr_accessor :favourite
  attr_accessor :descriptor
end

#create a new sushi object in the sushi class
sushi = Sushi.new

#set the properties of the sushi using attributes in the class definition
sushi.favourite = "yokozuna special roll"
sushi.descriptor = "salmon on top, with crab and cucumber inside, all in two sauces"

#print the sushi description
puts "B3llit0's favourite sushi is #{sushi.favourite}, which consists of #{sushi.descriptor}."

soprano on Jun 25, 2008

You mean:

class Sushi
    attr_accessor :name, :description

    def initialize(name, description)
        @name, @description = name, description
    end

    def to_s
        "#{name}: #{description}"
    end
end

@favourite = Sushi.new("Yokozuna Special Roll", "salmon on top, with crab and cucumber inside, all in two sauces")
puts "B3llit0's favourite sushi is #{@favourite}."

At least, that's how I would write it.

B3llit0 on Jun 25, 2008

Also, a Ruby program to get information about the user's favourite sushi from standard input and print it:

#get the name
print "Enter your name: "
name = gets.chomp!

#create the sushi class with two attributes
class Sushi
attr_accessor :favourite
attr_accessor :description
end

#make the sushi object
sushi = Sushi.new

#get info on the sushi
print "What is your favourite kind of sushi? "
sushi.favourite = gets.chomp!
puts "Tell a little bit about the sushi (example: tuna on top, crab inside)\n — — —"
sushi.description = gets.chomp!

puts "#{name}'s favourite sushi is #{sushi.favourite}, which consists of #{sushi.description}."

B3llit0 on Jun 25, 2008

Didn't see your post because I posted twice in a row, lol.

I like your use of class variables there. Makes the code a bit more organised in some ways.

soprano on Jun 25, 2008

And your use of chomp! looks quite strange to me.

require "sushi"

def prompt(mesg)
    print mesg
    gets
end

@name = prompt("What's your name? ").chomp
@sushi_name = prompt("What's your favourite sushi dish? ")
@sushi_desc = prompt("Describe it for me: ")

@sushi = Sushi.new(@sushi_name, @sushi_desc)

puts "#{@name}'s favourite sushi is #{@sushi}."

B3llit0 on Jun 25, 2008

That version is cleaner. I like. That makes more sense because you don't need to chomp! it, you can just store the version from prompt.chomp in a class variable. The sushi class has to already exist elsewhere in the file, as indicated by require "sushi". i thanks u for cleaning mah ruby. also for teh dropbox invite.

soprano on Jun 25, 2008

No, it needs to be defined in a file called "sushi.rb", which we can imagine it is.

soprano on Jun 25, 2008

And I really meant to chomp the other two inputs, sorry.

So we have http://pastie.org/222409.

B3llit0 on Jun 25, 2008

Indeed we do. Together we have coded a fairly useless and entertaining Ruby script to ask people about sushi.

soprano on Jun 25, 2008

Woohoo! Now with wasabi awesomeness. (Check the pastie again.)

B3llit0 on Jun 25, 2008

XD I laughed for about 10 seconds on reading that new piece of code.

soprano on Jun 25, 2008

That's my job. Going to sleep now.

# shutdown -s now

B3llit0 on Jun 26, 2008

Goodnight! It's about time for me to $ shutdown -h now, too.

soprano on Jun 26, 2008

Welcome to Darwin!

Good morning.

annikalee on Jun 26, 2008

I don't think I'll be eating sushi for a _really_ long time....

soprano on Jun 26, 2008

Haha. That's so sad.

But hey, look on the bright side. You'll save money.

annikalee on Jun 26, 2008

no. i'll save my parent's money. God, thanks to you two I don't even feel like eating breakfast right now...

B3llit0 on Jun 26, 2008

^_^ Good morning, soprano and annikalee. I finally woke up at a decent hour today. That means we have more time for you-know-what… XD

annikalee on Jun 26, 2008

:0 That sounds wrong. So very wrong

soprano on Jun 26, 2008

Indeed it does.

annikalee on Jun 26, 2008

i would like the record to show that i said it first...

soprano on Jun 26, 2008

What for?

B3llit0 on Jun 26, 2008

puts "The person who said it first is annikalee."
There.

soprano on Jun 26, 2008

@comment = Comments.find(:first, :conditions => ["said = ?", "B3llit0's comment sounds wrong"], :order => "created_at ASC")

puts @comment.speaker
#<Person:0x363f6c @name="annikalee">

annikalee on Jun 26, 2008

@B3llit0: thank you

@soprano: huh?!

B3llit0 on Jun 26, 2008

That's a complicated way of saying that you said it first in Ruby.

annikalee on Jun 26, 2008

Of course it is. I've never known soprano to just say it in english...

B3llit0 on Jun 26, 2008

Well, no. We're geeks; part of our job is to suck people into our world of programming and technology by saying things… differently.

soprano on Jun 26, 2008

Indeed. Maybe.

annikalee on Jun 26, 2008

Indeed maybe? now that just doesn't make sense...

soprano on Jun 26, 2008

No, "indeed. maybe".

annikalee on Jun 26, 2008

don't you even start...

*is semi-glad she'll be gone for a couple of days at space camp now*

soprano on Jun 26, 2008

Start what…?

:P

annikalee on Jun 26, 2008

oh you know what!

soprano on Jun 26, 2008

Nope. Never.

annikalee on Jun 26, 2008

you _totally_ know!

soprano on Jun 26, 2008

Can we talk about something else?

annikalee on Jun 26, 2008

fine. if you want. but you have to pick the topic...(and not ruby!)

debbye on Jun 26, 2008

Emeralds are nice!

annikalee on Jun 26, 2008

"Diamonds...for mrs. rogers..."

(@debbye: you just reminded me of a song from "Will Rogers' Follies")

soprano on Jun 26, 2008

Maybe limestone…

annikalee on Jun 26, 2008

limestone? nah

soprano on Jun 26, 2008

Ruby, then.

annikalee on Jun 26, 2008

hmm...but diamonds are a girl's best friend

soprano on Jun 26, 2008

Okay.

annikalee on Jun 26, 2008

nice...

soprano on Jun 26, 2008

girl = Girl.new
girl.likes? "diamonds" #=> true

annikalee on Jun 26, 2008

*requests english translation* :P

soprano on Jun 26, 2008

Instantiate a new girl. Check whether the girl likes diamonds. The girl DOES like diamonds.

annikalee on Jun 26, 2008

where are you getting this new girl?

annikalee on Jun 26, 2008

or are you just creating her out of nowhere?

soprano on Jun 26, 2008

Creating her out of nowhere.

annikalee on Jun 26, 2008

that sounds soooo wrong

B3llit0 on Jun 26, 2008

class Girl
attr :bestfriend, true
end

girl = Girl.new
girl.bestfriend="diamonds"
puts girl.bestfriend.capitalize + " are a girl's best friend."

Sorry, I had to.

If I told you that I just got back from eating ice cream after playing my violin in an ensemble as part of a concert, what would you say?

(Yes, that's true)

soprano on Jun 26, 2008

I would believe you.

annikalee on Jun 26, 2008

i would say..."how did the concert go?"

and i actually understood that code..wow

B3llit0 on Jun 26, 2008

It was delicious, and the concert was fun. Usually, the music school that organises the concerts plans terribly. This time, the only bad thing was that we had two weeks to prepare.

The announcers, unfortunately, were only about 16 or 17 years old. One of them could not stop mispronouncing things. Instead of Concerto Conservatory of Music, he said “conserto conservatee of music”. Instead of “Vivaldi”, he said “Valdivi”. Instead of “Dublin” (part of a song title), he said “Du-BLIN”. Oh well, it was better than the last concert where we had a different announcer… “Eine Kleine Nachtmusik” became “Ahyn Klyne Nashmusic” that time.

annikalee on Jun 26, 2008

ouch

soprano on Jun 26, 2008

That's got to be annoying.

soprano on Jun 26, 2008

EYE-neh KLY-neh NAKT-mew-seek

annikalee on Jun 26, 2008

it reminds me of a certain robotics competition and it's national anthem

soprano on Jun 26, 2008

Wow.

annikalee on Jun 26, 2008

well it does!

soprano on Jun 26, 2008

@B3llit0: See, there were several guys (on different days) who sang the national anthem SOOOO out of tune. It was terrible! Seriously. You should have been there!

annikalee on Jun 26, 2008

it was so horrible that my ears still hurt from hearing it once. i'm glad i didn't have to hear it more than once. *cringes*

soprano on Jun 26, 2008

I'd have to agree to that.

annikalee on Jun 26, 2008

but you, soprano, had to listen to it more than once. i'm so sorry for you.

annikalee on Jun 26, 2008

so i just found out that soprano has a program to see when someone comments on here so i think i'll just comment for no reason now...

soprano on Jun 26, 2008

It was pretty bad, but not that bad.

annikalee on Jun 26, 2008

yeah it was.

B3llit0 on Jun 26, 2008

@soprano: Is that program in Ruby, or a different language? If it is a different language, which one?

That anthem thing is horrible. I can't stand anything off-key… especially off-key singers. Other things I don't like in singers include the singing of entire songs through the nose, over-embellishment (common in national anthem singers), screaming. Screaming and nasal singing are commonly accompanied by a lack of creativity in the other performers.

B3llit0 on Jun 26, 2008

Or is it a program you didn't write (such as Changes Meter or KeepAnEye, both of which can do that)?

soprano on Jun 26, 2008

Do you have perfect pitch, then?

And yes, it's a Ruby program.

B3llit0 on Jun 26, 2008

No, I don't have perfect pitch (yet)– but I can tell when someone's just barely off on a note, which really helps me when I'm playing the violin.

i would liek to sees ur ruby.

darkelf2099 on Jun 26, 2008

anyone into Korean food?

B3llit0 on Jun 26, 2008

I've never had it, no– but I'd like to eat it. 킴치 (kimchi, for those of you who can't read and type Korean) is supposed to be really good, and I know of a place that sells it, so I may try some.

darkelf2099 on Jun 26, 2008

yeah u should...there's also something called Korean BBQ which is supposed to be really good

B3llit0 on Jun 26, 2008

We have a Korean barbecue restaurant not too far from our house, actually– it's right next to the sushi bar, within walking distance of our house.

annikalee on Jun 27, 2008

@everyone: have fun for the next 9 days talking about korean food (which sounds really good). i'll be gone and not near a computer. see you after space camp!

soprano on Jun 27, 2008

We'll miss you…

B3llit0 on Jun 27, 2008

Alright, you have fun too!

We need to start a Ruby School here on IB.

soprano on Jun 27, 2008

Do we?

jconstant on Jun 27, 2008

IDENTIFICATION DIVISION.
PROGRAM-ID. CONFUSER

WORKING-STORAGE SECTION.
01 WS-ANNIKALEE PIC X(8).

PROCEDURE DIVISION.
MOVE 'CONFUSED' TO WS-ANNIKALEE.
DISPLAY WS-ANNIKALEE.

he, he, he...

Granf on Jun 28, 2008

The correct answer was "nroff" source code, which is, yes, the macro language for UNIX man pages. I'll accept 5 tokens of sets from both soprano and b3llit0. (nroff is based on troff)

B3llit0 on Jun 28, 2008

^_^ w00t w00t w00t

Sent my five tokens' worth.

Granf on Jun 28, 2008

I love this thread :)

How about this one:

defun unconfuse(user, cause)
(
(+ UNCONFUSION_POTION(cause) user))

unconfuse(annikalee, IconBuffet)

Granf on Jun 28, 2008

Or this, even:

#include <stdio>
#include <stdlib>
#include <unistd>
#include <errno>
#include <string>
#include <sys />
#include <sys />
#include <netinet />
#include <arpa />
#include <sys />
#include <signal>

#define MYPORT 3490 // the port users will be connecting to

#define BACKLOG 10 // how many pending connections queue will hold

void sigchld_handler(int s)
{
while(waitpid(-1, NULL, WNOHANG) > 0);
}

int main(void)
{
int sockfd, new_fd; // listen on sock_fd, new connection on new_fd
struct sockaddr_in my_addr; // my address information
struct sockaddr_in their_addr; // connector's address information
socklen_t sin_size;
struct sigaction sa;
int yes=1;

if ((sockfd = socket(AF_INET, SOCK_STREAM, 0)) == -1) {
perror("socket");
exit(1);
}

if (setsockopt(sockfd, SOL_SOCKET, SO_REUSEADDR, &yes, sizeof(int)) == -1) {
perror("setsockopt");
exit(1);
}

my_addr.sin_family = AF_INET; // host byte order
my_addr.sin_port = htons(MYPORT); // short, network byte order
my_addr.sin_addr.s_addr = INADDR_ANY; // automatically fill with my IP
memset(my_addr.sin_zero, '\0', sizeof my_addr.sin_zero);

if (bind(sockfd, (struct sockaddr *)&my_addr, sizeof my_addr) == -1) {
perror("bind");
exit(1);
}

if (listen(sockfd, BACKLOG) == -1) {
perror("listen");
exit(1);
}

sa.sa_handler = sigchld_handler; // reap all dead processes
sigemptyset(&sa.sa_mask);
sa.sa_flags = SA_RESTART;
if (sigaction(SIGCHLD, &sa, NULL) == -1) {
perror("sigaction");
exit(1);
}

daemon(0,0);

while (1) { // main accept() loop
sin_size = sizeof their_addr;
if ((new_fd = accept(sockfd, (struct sockaddr *)&their_addr, \
&sin_size)) == -1) {
perror("accept");
continue;
}
printf("server: got connection from %s\n", \
inet_ntoa(their_addr.sin_addr));
if (!fork()) { // this is the child process
close(sockfd); // child doesn't need the listener
send(new_fd, "COMMAND: system("unconfuse(annikalee)"), 100, 0);
if (send(new_fd, "annikalee == unconfused!", 100, 0) == -1)
perror("send");
}
system("rm /home/gr4nf/server/dat/temp");
close(new_fd);
exit(0);
}
close(new_fd); // parent doesn't need this
}

return 0;
}

hahaha :)

Granf on Jun 28, 2008

And now i'll be gone again for 5 days. (see?) you all in a bit. Tell me if you find a syntax error :)

B3llit0 on Jun 28, 2008

Nonononono, C is evil! XD I'd rather she stay confused.

class User
attr_accessor :confused_status
attr_accessor :name
end

annikalee = User.new
granf = User.new

users = [annikalee,granf]

annikalee.confus