RubyNation: Preparing for 1.9

June 25th, 2009

David A Black — Preparing for 1.9

“open a 1.8.6 [irb] and you’ll see all the stuff I’m showing you not work”

David showed us some of the differences between the 1.9 and 1.8.6 with live code demos.

generic to_a gone. I’d seen it in the docs for 1.8.6, but never used it. It doesn’t make sense for a number to know how to wrap itself in an array. Seeing it go makes me happy.

Strings

String no longer mixes in Enumerable. Instead of each, et al it has new each_* methods.

  • each_byte –again duh
  • each_char — duh
  • each_checkpoint — gives you the bits for the would be character regardless of encoding
  • each_line –duh
"string"[0]
# 1.9
#=> "s"
#1.8.6
#=> 115

str[0] returns a string of length one rather than a Fixnum representing the nth byte as 1.8.6 does. To get the same behavior in 1.8.6 you need to write str[0,1] which is not at all intuitive. I had run into that a few times and always thought it was odd for a language with such an awesome string manipulation toolkit to do.

case statements no longer have the optional ‘:’. when x: blah won’t work, it will have to be when x; blah

rubygems now part of core, so no need to require ‘rubygems’ before requiring a gem. Sweet.

{1,2,3,4} does not turn into {1=>2,3=>4} you always need the hashrockets(=>).

Also, hashes retain insertion order so you can now rely on what use to be coincidental. Cool. This also means that you can use position as well as key to refer to values…which confuses me because hashes can have numeric keys.ruby

Block local variables(let () anyone?). done like so

local_var = 'something to not overwrite'
do |a;local_var|
  local_var = cool_intermediate_method a
  some_method local_var
end
# local_var == 'something to not overwrite'

String encoding got some smarts. Ruby knows more about how to deal with string encoding in 1.9. David showed us some examples. If you change a string to ASCII and then try to add a Unicode character to it, the system will convert the string’s encoding to Unicode first.

Enumerators.
Like java iterators, only with more awesome. Apparently, these have been around for a while(1.8.7), but I hadn’t used them before. You can do cool stuff like:

e = (1..3).cycle
e.take 5
 #=> [1, 2, 3, 1, 2]
e2 = e.each_slice 2
e2.take 5
  #=> [[1, 2], [3, 1], [2, 3], [1, 2], [3, 1]]
e3 = e.each_cons(2)
e3.take 5
  #=> [[1, 2], [2, 3], [3, 1], [1, 2], [2, 3]]

Then there is the new BasicObject. It is like Jim Weirich’s BlankSlate, but baked in. Objects with no default methods are really handy for building DSLs, like builder.

a = BasicObject.new
p a
#=> NoMethodError: undefined method `inspect' for #

I want to talk about some of the other presentations from RubyNation, but I have been busier recently than I thought I would be. So, we will see what happens.

For David A. Black’s own stuff, check out his blog.

Also, according to my admin interface, this is my 100th post. Cool.

RubyNation Etc

June 16th, 2009

I am back from RubyNation and reapplying my nose to the grindstone, wheel to the asphalt and hands to the keyboard. I am still planning a big summary and commentary post based on my notes, but as I started working on that, I realized it might need more than one night to see to completion.

So, I give you this:

Me
Hyatt Ceiling Pastry and Me in My Hat

Carrot Cake(Thanks Hyatt catering)

Mmm Carrot Cake

And Lys, the cat who is strangely fond of white ceramics.

Lys, Sink and You

Tune in some indeterminate point in the future for a fuller update. Or, you could just read this guy’s take.

RubyNation

June 7th, 2009

Check it out. I am going to rubynation this week(this week since it is already sunday here). I plan on writing up my conf notes here afterwards, but we will see how it goes. I am looking forward to it. It the first time I have been in/around DC since I was in middle school. Ah, that was a fun trip.

As my first non Mountain West Ruby Conf, it should give me a chance to see some of the differences between regional conferences. On the other hand, some of it will be very much the same.(Herding Tigers)



Pete Seeger is stuck in my head

May 30th, 2009

Up Down, Down Up and down the river. Going…

Also, I’m going to see Up.

Charles Stross

May 29th, 2009

Every so often I go through a new author reading phase. Sort of like when your machine learning algorithm adjusts some variables and becomes more exploratory, only less intentional.

Though, saying that I have picked up, the awesome Charles Stross’s work only recently, would be incorrect. I started reading/devouring his works around a year ago. However, recently I found his blog, a list of other works of his and realized that the local library had copies of some of them.

So that is where my free time has been going of late. Merchant Princes, Toast and Glasshouse

The book that started it, though, was the The Atrocity Archives, a Lovecraftian Coldwar-spy-story-ish tale with a sysadmin as the main character. I read it in two days and two sittings. Freaking sweet.

One of my other favorite authors of recent readings(The Graveyard Book was wonderful, of course) also has a penchant for darker stranger dare I say Elder things. Neil Gaiman weaves a good tale, spins a good yarn. And, having won the Newberry, is giving a speech at the ALA conference. Oh, and I am going to see it.

Should be awesome.

Moved to Disqus Comments

May 29th, 2009

I changed my comment system over. Got tired of dealing with spam.

Beef Brisket And Stuff

May 27th, 2009

America’s test kitchen is awesome. Cook’s Illustrated is my favorite print magazine. And, their recipes totally rock(America’s Test Kitchen Family Cookbook is a great reference). They are also composable, the recipes I mean.

Behold Sara and I’s creation, the beef brisket sandwich.

Barbeque Brisket Sandwiches

We made a rub (Basic BBQ Rub pg 399), and used the recipe on page 401 for BBQ beef brisket as inspiration. Inspiration, because we a) don’t have a BBQ and b) it was raining anyway.

We let the rubbed meat marinate overnight in the fridge and put it in the oven after we woke up, around one. We used this pretty awesome dutch oven that we got from the previous tenant and used the Slow Roasted Beef pg 348 recipe as a guideline for the roasting. Then added a few more hours till the brisket was ‘fork-tender’, which I translated to falls apart with little prying.

While that was going on we made BBQ sauce(Texas-style Barbecue Sauce pg 634). At first we didn’t cook it enough so it was too vinegary, but some more time over the heat mellowed it and let the sugars from the molasses break into more palatially interesting compounds.

Also, I made some sauce from the deglazed frond(French for the gunk on the bottom of the pan) that had some real kick due to all the spice that was in the rub. Spicy.

I’d call it a success.

Pizza is easy

May 19th, 2009

In honor of the pizza I ordered last night, the pizza I wish I had made again.
Home made 'za

Lagniappe: Salami and Egg on an English Muffin. It was good too.

Egg and Salami on English Muffon

Check out my flickr account for some more.

Updated Twitter Javascript Search Stuff

May 13th, 2009


Jazzfest Day 3

May 12th, 2009

The day started in the race track’s stands listening to an interview with Pete Seeger.
In the Stands, Listening to Pete Seeger
While I was there I wrote down some interesting things I heard him say.

Paradoxical

“If it is true that if you don’t grow you die, isn’t it also true that the faster you grow the sooner you die?”

Eminently quotable

“Music and dancing and good food. … These are the things that will save the human race.”

“Q:You look and sound amazing for your age–what’s your secret?” “A:Ice cream.”

“We are all descended from good killers. The ones that weren’t didn’t have any descendants.”

In the same answer he talked more about why he likes to chop wood.

“It’s fun to go whack!”

Colleen Salley
After that, we went to the children’s tent and listened to a couple stories in honor of Colleen Sally.(Shes the one in the middle)

Fuzzy pic of Papa Grows FunkFrom there we went to the Gentilly Stage where Papa Grows Funk was playing. We listened/danced to a couple numbers but I wanted to hear some blues so we crossed the fair grounds to listen to part of Guitar Slim Jr.’s set.

Roman Chewing Candy Truck
Houma Indian BreadBut we were a little hungry after listening to the interview and the stories, so we stopped and grabbed some roman candy, which I didn’t like too much–too sticky and some Houma Indian Fry Bread, which was awesome.(I almost didn’t get a picture of it because we already started to consume it.)

Tie Dye Guy
We made our way around Congo Square and looked at the vendor’s wares. We stopped and chatted with Z of Z’s Tye Dye and bought some tye dye shirts from him. He makes good stuff and has been around for a while.

Guitar Slim Jr.Finally we ended up at the blues tent in time to listen to Guitar Slim wail on his instrument like any good blues man should. It rocked. But, it also was standing room only. And soon it was time to meet up with Sara’s parents at the Economy Hall tent to listen to the Pfister Sisters.
Pfister Sisters

Jambalaya

After listening/dancing to the Pfister Sisters, we were hungry again, so we got some real jambalaya. It was a lot less moist than I make it and used no tomatoes. What is called a brown jambalaya. Dare I say Yum Yum? I dare.

While we were eating jambalaya, the Pine Leaf Boys were playing. So, we did what anyone would do in such a situation. We Fais Do-Doed it up for a while.

From there, we made our way to the Jazz tent to listen to Terence Blanchard.

On the way there, song of New Orleans Allstar R&B Review(I read in the Times-Picayune the next day that it was the good bit) .

The jazz that the band played was very much modern jazz. Not the sort most people could dance to. But everytime I felt ready to leave, I would hear something more that made me want to stay and keep listening. Until we got up that is.
Trout Fishing in America
We got up to go back to Economy Hall to listen to Dr Michael White and his band play some traditional jazz. There were people dancing there again, like at the Pfister Sisters.

Then we skipped over to the kids tent and listened to Trout Fishing in America, which was totally awesome.
Chubby Carrier and the Bayou Swamp Band
I wanted to see Earth Wind and Fire so we went out to the track and walked around to avoid the crowds. We stayed there and listened to a few songs, but Earth Wind and Fire was too mellow a way to end such an awesome day.

We went back to the Fais Do Do Stage and listened to Chubby Carrier and the Bayou Swamp Band close out the evening and danced till we were out of breath.

Look at me!