Categories
Uncategorized

Enumerating Enumerable: Enumerable#cycle

Welcome to another installment of Enumerating Enumerable, my series of articles in which I attempt to improve upon RubyDoc.org’s documentation for the Enumerable module. So far, I’ve covered the following methods in this series:

  1. all?
  2. any?
  3. collect / map
  4. count

In this installment, I’m going to cover a method added into Enumerable in Ruby 1.9: Enumerable#cycle. It’s particularly poorly-documented in RubyDoc.org, and there isn’t much written about it anywhere else.

Enumerable#cycle Quick Summary

Graphic representation of the \"cycle\" method in Ruby\'s \"Enumerable\" class.

In the simplest possible terms Given a collection, creates an infinitely-repeating ordered source of its items.
Ruby version 1.9 only
Expects An optional block to act on the items in the infinitely repeating until the break statement is encountered.
Returns An Enumerable::Enumerator that acts as the infinite source of the collection’s items.
RubyDoc.org’s entry Enumerable#cycle

Enumerable#cycle and Arrays

When used on an array and a block is provided, cycle passes each item to the block. Once the last array item has been passed to the block, cycle starts over again at the beginning of the array. cycle goes through the array forever unless it encounters a break statement in the block.

# This example is a slightly fancier version of the example
# you'll see at RubyDoc.org
days_of_week = %w{Monday Tuesday Wednesday Thursday Friday Saturday Sunday}
=> ["Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday"]

# This will print the days of the week over and over,
# forever until you stop it with control-c.
days_of_week.cycle {|day| puts day}
=> Monday
Tuesday
Wednesday
Thursday
Friday
Saturday
Sunday
Monday
Tuesday
...

# The cycle can be broken with the "break" statement
days_of_week.cycle do |day|
    puts day
    break if day == "Friday"
end
=> Monday
Tuesday
Wednesday
Thursday
Friday
=> nil

The better use for cycle is when you use it to create an object that spits out the next item in a repeating sequence.

# Let's create an enumerator that we can use to give us
# days of the week in a repeating sequence.
days = days_of_week.cycle
=> #

# Enumerator's "next" method gives us the next day of the week
days.next
=> "Monday"

days.next
=> "Tuesday"

days.next
=> "Wednesday"

# Enumerator's "rewind" method resets the enumerator back
# to the first item
days.rewind
=> # "Monday"

...

# If you keep going, the enumerator will "wrap around" back
# to the beginning
days.next
=> "Saturday"

days.next
=> "Sunday"

days.next
=> "Monday"

How about one more example? We’ll use Enumerable‘s zip method, an array of dinner items and the “days of the week” cycle object to create a meal plan:

# Here's an array of international cuisine
dinners = ["Jerk chicken", "Lamb vindaloo", "Chicken fried steak", \
"Yeung Chow fried rice", "Tonkatsu", "Coq au Vin", "Chunky bacon", \
"Pierogies", "Salisbury steak", "Bibim Bap", \
"Roast beef", "Souvlaki"]
=> ["Jerk chicken", "Lamb vindaloo", "Chicken fried steak",
"Yeung Chow fried rice", "Tonkatsu", "Coq au Vin", "Chunky bacon",
"Pierogies", "Salisbury steak", "Bibim Bap",
"Roast beef", "Souvlaki"]

# Let's draw up a mean plan!
days.zip(dinners) {|daily_meal| p daily_meal}
=> ["Monday", "Jerk chicken"]
["Tuesday", "Lamb vindaloo"]
["Wednesday", "Chicken fried steak"]
["Thursday", "Yeung Chow fried rice"]
["Friday", "Tonkatsu"]
["Saturday", "Coq au Vin"]
["Sunday", "Chunky bacon"]
["Monday", "Pierogies"]
["Tuesday", "Salisbury steak"]
["Wednesday", "Bibim Bap"]
["Thursday", "Roast beef"]
["Friday", "Souvlaki"]

# If we want to store our meal plan, we can do it this way
meal_plan = []
=> []

days.zip(dinners) {|daily_meal| meal_plan << daily_meal}
=> nil

meal_plan
=> [["Monday", "Jerk chicken"], ["Tuesday", "Lamb vindaloo"],
["Wednesday", "Chicken fried steak"], ["Thursday", "Yeung Chow fried rice"],
["Friday", "Tonkatsu"], ["Saturday", "Coq au Vin"],
["Sunday", "Chunky bacon"], ["Monday", "Pierogies"],
["Tuesday", "Salisbury steak"], ["Wednesday", "Bibim Bap"],
["Thursday", "Roast beef"], ["Friday", "Souvlaki"]]

Enumerable#cycle and Hashes

When used on a hash and a block is provided, collect and map pass each key/value pair in the hash to the block, which you can “catch” as either:

  1. A two-element array, with the key as element 0 and its corresponding value as element 1, or
  2. Two separate items, with the key as the first item and its corresponding value as the second item.

Each key/value pair is passed to the block, where the operation in the block is performed on the item. Once the last hash item has been passed to the block, cycle starts over again at the beginning of the hash. cycle goes through the hash forever unless it encounters a break statement in the block.

# Here we'll take the RubyDoc.org example for "cycle"
# but apply it to a hash of the crew of the Enterprise-D
crew = {:captain => "Picard", :first_officer => "Riker", \
:science_officer => "Data", :tactical_officer => "Worf"}
=> {:captain=>"Picard", :first_officer=>"Riker",
:science_officer=>"Data", :tactical_officer=>"Worf"}

# This will print the crew's rank and name over and over,
# forever until you stop it with control-c.
crew.cycle {|crewmember| p crewmember}
=> [:captain, "Picard"]
[:first_officer, "Riker"]
[:science_officer, "Data"]
[:tactical_officer, "Worf"]
[:captain, "Picard"]
[:first_officer, "Riker"]
[:science_officer, "Data"]
[:tactical_officer, "Worf"]
[:captain, "Picard"]
[:first_officer, "Riker"]
[:science_officer, "Data"]
[:tactical_officer, "Worf"]
[:captain, "Picard"]
[:first_officer, "Riker"]
...

# The cycle can be broken with the "break" statement
crew.cycle do |rank, name|
    puts "Rank: #{rank} - Name: #{name}"
    break if rank == :science_officer
end
=> Rank: captain - Name: Picard
Rank: first_officer - Name: Riker
Rank: science_officer - Name: Data
=> nil

We can use the same technique that we used with arrays and use cycle to create an object that spits out the next item in a cycling hash. Each time we get an item from the object, it comes in the form of a two-element array where the first element is the key and the second element is the corresponding value.

# Let's create an enumerator that we can use to give us
# the Enterprise-D crew's rank and name in a repeating sequence.
crewmembers = crew.cycle
=> #

# numerator’s “next” method gives us the next crewmember
crewmembers.next
=> [:captain, "Picard"]

crewmembers.next
=> [:first_officer, "Riker"]

crewmembers.next
=> [:science_officer, "Data"]

# Enumerator’s “rewind” method resets the enumerator back
# to the first item
crewmembers.rewind
=> #

crewmembers.next
=> [:captain, "Picard"]

...

# If you keep going, the enumerator will “wrap around” back
# to the beginning
crewmembers.next
=> [:tactical_officer, "Worf"]

crewmembers.next
=> [:captain, "Picard"]

crewmembers.next
=> [:first_officer, "Riker"]

Let’s try one more example! In this one, we’ll use cycle to create three different enumerators — two made from arrays, one from a hash — to assign cooking chores for the Enterprise-D crew for the next ten days.

# Create an enumerator for days
days = %w{Monday Tuesday Wednesday Thursday Friday Saturday Sunday}.cycle
=> #

# Create an enumerator for dinners
dinners = ["Jerk chicken", "Lamb vindaloo", "Chicken fried steak", \
"Yeung Chow fried rice", "Tonkatsu", "Coq au Vin", "Chunky bacon", \
"Pierogies", "Salisbury steak", "Bibim Bap", \
"Roast beef", "Souvlaki"].cycle
=> #

# Make sure we're starting from the beginning of the crew hash
crewmembers.rewind
=> #

# Let's assign dinner-cooking duties to the crew!
10.times do
    day = days.next
    dinner = dinners.next
    chef = crewmembers.next[1]
    puts "On #{day}, Crewman #{chef} will prepare #{dinner}."
end
=> On Monday, Crewman Picard will prepare Jerk chicken.
On Tuesday, Crewman Riker will prepare Lamb vindaloo.
On Wednesday, Crewman Data will prepare Chicken fried steak.
On Thursday, Crewman Worf will prepare Yeung Chow fried rice.
On Friday, Crewman Picard will prepare Tonkatsu.
On Saturday, Crewman Riker will prepare Coq au Vin.
On Sunday, Crewman Data will prepare Chunky bacon.
On Monday, Crewman Worf will prepare Pierogies.
On Tuesday, Crewman Picard will prepare Salisbury steak.
On Wednesday, Crewman Riker will prepare Bibim Bap.

Categories
Uncategorized

Laptop Losses Total 12,000 Per Week at U.S. Airports

A study of 106 major U.S. airports and 800 business travelers says that 12,000 laptops are lost in airports each week. Less than a third are recovered, and nearly half the travelers say their laptops contain some confidential business information. Most are lost either at security checkpoints or departure gates. How over 600,000 laptops get lost at airports each year is a mystery to me; after my passport and wallet, my laptop is the thing I guard the most when flying.

Categories
Uncategorized

Rainn “Dwight K. Schrute” Wilson as Xena, Warrior Princess

Well, here’s an image that’s just burned itself into my brain: Rainn Wilson (who plays “Dwight K. Schrute” in the American version of The Office) dressed up as Xena, Warrior Princess:

Rainn \"Dwight K. Schrute\" Wilson, dressed up as \"Xena, Warrior Princess\".
Photo courtesy of Miss Fipi Lele.

Here’s the text of the caption:

XENA: WARRIOR PRINCESS

“I always watched Xena because it was oddly titillating, and I kept wanting to see more cleavage. I wanted it to be Baywatch with swords, but it never quite went in that direction.”

Neither did Wilson: Dressed as the warrior princess, he thinks he looks like “the chunky girl from Heart.”

For the sake of comparison, here’s Xena herself, as played by Lucy Lawless:

Xena, Warrior Princess, played by Lucy Lawless

Categories
Uncategorized

RubyFringe Guide: The Lay of the Land, Part 1

Joey\'s Unofficial Ruby Fringe Guide to Toronto - Small logoWelcome to the fourth installment in Joey’s Unofficial RubyFringe Guide to Toronto, a series of offbeat articles to acquaint attendees of the upcoming RubyFringe conference with Accordion City.

There’ve been three articles in the series so far:

  1. Where Did All the Cigarettes Go?
  2. Getting from the Airport to the Hotel
  3. Boozin’ in Accordion City

When I visit a city that’s new to me, I try to get a sense of “the lay of the land”. What sort of areas are around where I’m staying? Which zones come alive at what times of the day? If I started walking in this direction, what sort of neighbourhood would I end up in? Where can I see some interesting stuff, and where will I end up running into something I could easily get at home? These are the sorts of questions that I’ll try to answer for Toronto in these “Lay of the Land” articles. In this article, I’ll look at what’s within a couple of blocks of the conference hotel.

What’s Near the Conference Hotel?

The map below covers the area that’s within about a ten-minute walk of RubyFringe’s conference hotel, the Metropolitan Toronto. The Metropolitan is represented by the red marker with the letter “A” (it’s very Hester Prynne, isnt it?). I’ve added some annotations to give you a general idea of the sorts of neighbourhoods that surround the Metropolitan.

Annotated map of areas around Metropolitan Hotel Toronto

A City of Neighbourhoods, A Pocket of Boring

Accordion City can best be described as a city of neighbourhoods put together like a patchwork quilt, each patch having its own character and offerings. This is good news: it makes life pretty interesting for the locals, and it should be doubly so if you’re visiting.

There’s bad news, I’m afraid: the neighbourhood in which the Metropolitan is located is a pocket of boring. How boring? So boring that this is the most interesting view on the street where the hotel is located:

Chestnut Street, Toronto
The curved backside of New City Hall, as seen from a few paces south of the hotel.

Yup, the immediate area is that boring.

It’s a zone of nondescript office and hospital buildings surrounding Dundas Street, which used to be downtown Chinatown’s main drag back in the 1970s when I was a slip of a lad.

(I say downtown Chinatown because we’ve got three Chinatowns here. I’ll elaborate in a later article.)

Downtown Chinatown moved west towards Spadina Avenue, and the offices rushed in to fill the void. There are still remnants of the old Chinatown that still dot this part of Dundas, but for the real Chinatown action — the restaurants, the shops, the lively street stalls that will gladly sell you a big-ass, smelly-as-ass durian, the “holy crap, Blade Runner came true” Chinatown, you’ll have to walk about ten minutes westward.

The Metropolitan Hotel and Chinese Food

Lai Wah Heen restaurant
Lai Wah Heen Restaurant.

The Metropolitan Hotel is the biggest testament to the fact that the area was once the heart of downtown Chinatown. Most hotels in North America have a primary restaurant that serves your generic “North American” cuisine; the Metropolitan’s all about the Chinese food. Their main dining room, Lai Wah Heen, is a Chinese restaurant that serves some very good food — so good that it’s one of the few hotel restaurants where you’ll see at least as many locals as guests. I’ve been to a Chinese wedding reception in this hotel and it was some of the best wedding reception food I’ve tasted. I’m looking forward to the dim sum conference lunch scheduled for Sunday, July 20th.

Across the street from the Metropolitan is a building that looks like a hotel, but missing the hotel markings. That’s because it used to be the Colonnade Hotel, which used to be the Chinese hotel until the Metropolitan took over (it’s deVilla family tradition to have Chinese food for our wedding rehearsal dinners, and my sister’s was there). It’s now a University of Toronto student residence.

Just East of the Hotel – Yonge and Dundas: The Seething Pit of the Main Drag

Yonge and Dundas Streets, Toronto
Yonge Street, looking north towards the corner of Yonge and Dundas.

Yonge Street (pronounced “young”) is the city’s main north-south street; it divides Accordion City into its east and west halves. The corner of Yonge and Dundas — a very short walk east of the Metropolitan — is pretty much in the geographic centre of the downtown core. You should think of it as the local equivalent of New York City’s Times Square: major retail shopping, “grey market” electronics stores, billboards and lights, bored teenagers, tourists and pizza, pizza, pizza.

Eaton Centre at night
The Eaton Centre, as seen from across the street.

I’ve been to nerd conferences where I’ve wished that there was a computer store handy because I needed something like a cable or a USB key. That’s not going to be a problem at RubyFringe, as there’s both a Best Buy on the southwest corner of Yonge and Dundas and a Future Shop (a Canadian electronics/computer big-box store) on the northeast corner.

(There’s a far more interesting electronics store — Active Surplus — not too far from the hotel. I’ll cover it in a later article.)

If you go south on Yonge, you’ll hit the Eaton Centre, the major downtown shopping mall. It’s got the sort of shops you’d expect at a mall; the only surprise for American visitors is that Sears in Canada isn’t as ghetto as it is in the U.S. (that’s because Sears in Canada took over the Eaton’s chain of department stores after they went under).

Eaton Centre interior
Interior of the Eaton Centre.

It’s tempting to dismiss the Eaton Centre as just another shopping mall, but for a lot of Torontonians, it’s also one of the most-used and useful pedestrian routes in town. Spanning the distance between two subway stations on Toronto’s busiest line, the mall remains open even after its stores are closed (it closes when the subway closes), making it effectively a covered sidewalk for Yonge Street between Dundas and Queen Streets. (Urban planning nerds should see this article for more.)

Just South of the Hotel: Nathan Phillips Square: Wasn’t it Blown Up in Resident Evil 2?

Toronto\'s City Hall
Toronto’s City Hall.

You may have seen Toronto’s City Hall in Resident Evil 2, or perhaps you caught a glimpse of it in either the original series or Next Generation version of Star Trek. It’s architect Viljo Revell’s modernist masterpiece and one of the more distinctive features of our city. It’s worth the short walk over from the hotel, and if you’re into taking pictures, it makes a pretty good subject.

If you walk into City Hall’s lobby and turn to the right, you’ll see this:

City Hall Wall Mural

It’s a wall mural made of thousands of nails. There’s a local tradition: take a penny and drop it into the mural, among the larger nails on the left or right side of the mural. It’s descend, pachinko-like, making a musical noise along the way. Here’s a video:

Just North of the Hotel: Nothing, Really

Well, I wouldn’t say nothing — there are a number of hospital buildings, including some world-class institutions of healing like “Sick Kids” (a.k.a. the Hospital for Sick Children, where Pablum was invented) and the Peter Munk Cardiac Centre.

Atrium of the Sick Kids hospital
The atrium at Sick Kids.

If you’re an architecture nerd, you might find a visit to the atrium of Sick Kids worth a visit — it’s so bright and airy that it’s easy to forget that you’re in a hospital. Having said that, my guess is that the last place you want to end up during your visit to Toronto is a hospital.

Toronto Bus Terminal
Toronto Bus Terminal.

The other place just north of the hotel is the Toronto Bus Terminal. It’s nowhere near as scuzzy as a lot of other big city bus terminals, but the usual parade of off-their-rockers and off-their-meds are often milling about.

Just this evening, while the Ginger Ninja and I were walking past the station, a large woman in a motorized wheelchair started a conversation with us.

“I gotta go to the hospital tomorrow,” she said, as she took a sip from her large frappucino. “I got the diabetes.”

“Sorry to hear that,” we said.

“It’s not funny! I’m goin’ fuckin’ blind from the goddamn diabetes!” She took another sip and poured on the speed, disappearing down the street to stew in her own juices, which I assume are made of high-fructose corn syrup and bad life choices.

There are a couple of conveniences to the north: a Starbucks and a convenience store, both at the corner of Dundas and Elizabeth, a block away from the hotel.

Next Time…

I’ll cover what’s west of the hotel, which is where things get interesting. For starters, there’s this:

OCAD\'s Sharp Centre Building
OCAD’s Sharp Centre Building.

Categories
Uncategorized

Enumerating Enumerable: Enumerable#count

Welcome to the fourth installment of Enumerating Enumerable, a series of articles in which I challenge myself to do a better job of documenting Ruby’s Enumerable module than RubyDoc.org does. In this article, I’ll cover Enumerable#count, one of the new methods added to Enumerable in Ruby 1.9.

In case you missed the earlier installments, they’re listed (and linked) below:

  1. all?
  2. any?
  3. collect / map

Enumerable#count Quick Summary

Graphic representation of the Enumberable#count method in Ruby

In the simplest possible terms How many items in the collection meet the given criteria?
Ruby version 1.9 only
Expects Either:

  • An argument to be matched against the items in the collection
  • A block containing an expression to test the items in the collection
Returns The number of items in the collection that meet the given criteria.
RubyDoc.org’s entry Enumerable#count

Enumerable#count and Arrays

When used on an array and an argument is provided, count returns the number of times the value of the argument appears in the array:

# How many instances of "zoom" are there in the array?
["zoom", "schwartz", "profigliano", "zoom"].count("zoom")
=> 2

# Prior to Ruby 1.9, you'd have to use this equivalent code:
["zoom", "schwartz", "profigliano", "zoom"].select {|word| word == "zoom"}.size
=> 2

When used on an array and a block is provided, count returns the number of items in the array for which the block returns true:

# How many members of "The Mosquitoes" (a Beatles-esque band that appeared on
# "Gilligan's Island") have names following the "B*ngo" format?
["Bingo", "Bango", "Bongo", "Irving"].count {|bandmate| bandmate =~ /B[a-z]ngo/}
=> 3

# Prior to Ruby 1.9, you'd have to use this equivalent code:
["Bingo", "Bango", "Bongo", "Irving"].select {|bandmate| bandmate =~ /B[a-z]ngo/}.size

RubyDoc.org says that when count is used on an array without an argument or a block, it simply returns the number of items in the array (which is what the length/size methods do). However, when I’ve tried it in irb and ruby, I got results like this:

[1, 2, 3, 4].count
=> #<Enumerable::Enumerator:0x189d784>

Enumerable#count and Hashes

As with arrays, when used on a hash and an argument is provided, count returns the number of times the value of the argument appears in the hash. The difference is that for the comparison, each key/value pair is treated as a two-element array, with the key being element 0 and the value being element 1.

# Here's a hash where the names of recent movies are keys
# and their metacritic.com ratings are the corresponding values.
movie_ratings = {"Get Smart" => 53, "Kung Fu Panda" => 88, "The Love Guru" => 15,
"Sex and the City" => 51, "Iron Man" => 93}
=> {"Get Smart"=>53, "Kung Fu Panda"=>88, "The Love Guru"=>15, "Sex and the City"=>51, "Iron Man"=>93}

# This statement will return a count of 0, since there is no item in movie_ratings
# that's just plain "Iron Man".
movie_ratings.count("Iron Man")
=> 0

# This statement will return a count of 1, since there is an item in movie_ratings
# with the key "Iron Man" and the corresponding value 93.
movie_ratings.count(["Iron Man", 93])
=> 1

# This statement will return a count of 0. There's an item in movie_ratings
# with the key "Iron Man", but its corresponding value is NOT 92.
movie_ratings.count(["Iron Man", 92])
=> 0

count is not useful when used with a hash and an argument. It will only ever return two values:

  • 1 if the argument is a two-element array and there is an item in the hash whose key matches element [0] of the array and whose value matches element [1] of the array.
  • 0 for all other cases.

When used with a hash and a block, count is more useful. count passes each key/value pair in the hash to the block, which you can “catch” as either:

  1. A two-element array, with the key as element 0 and its corresponding value as element 1, or
  2. Two separate items, with the key as the first item and its corresponding value as the second item.

Each key/value pair is passed to the block and count returns the number of items in the hash for which the block returns true.

# Once again, a hash where the names of recent movies are keys
# and their metacritic.com ratings are the corresponding values.
movie_ratings = {"Get Smart" => 53, "Kung Fu Panda" => 88, "The Love Guru" => 15,
 "Sex and the City" => 51, "Iron Man" => 93}
=> {"Get Smart"=>53, "Kung Fu Panda"=>88, "The Love Guru"=>15, "Sex and the City"=>51, "Iron Man"=>93}

# How many movie titles in the collection start
# in the first half of the alphabet?
# (Using a one-parameter block)
movie_ratings.count {|movie| movie[0] <= "M"}
=> 3

# How many movie titles in the collection start
# in the first half of the alphabet?
# (This time using a two-parameter block)
movie_ratings.count {|title, rating| title <= "M"}
=> 3

# Here's how you'd do it in pre-1.9 Ruby:
movie_ratings.select {|movie| movie[0] <= "M"}.size
=> 3
# or...
movie_ratings.select {|title, rating| title <= "M"}.size
=> 3

# How many movies in the collection had a rating
# higher than 80?
# (Using a one-parameter block)
movie_ratings.count {|movie| movie[1] > 80}
=> 2

# How many movies in the collection had a rating
# higher than 80?
# (This time using a two-parameter block)
movie_ratings.count {|title, rating| rating > 80}
=> 2

# Here's how you'd do it in pre-1.9 Ruby:
movie_ratings.select {|title, rating| rating > 80}.size
=> 2


# How many movies in the collection have both:
# - A title starting in the second half of the alphabet?
# - A rating less than 50?
# (Using a one-parameter block)
movie_ratings.count {|movie| movie[0] >= "M" && movie[1] < 50}
=> 1

# How many movies in the collection have both:
# - A title starting in the second half of the alphabet?
# - A rating less than 50?
# (This time using a two-parameter block)
movie_ratings.count {|title, rating| title >= "M" && rating < 50}
=> 1

# Here's how you'd do it in pre-1.9 Ruby:
movie_ratings.select {|title, rating| title >= "M" && rating < 50}.size
=> 1

(You should probably skip The Love Guru completely, or at least until it gets aired on TV for free.)

Categories
Uncategorized

b5media: #5 on TechVibes’ Start-Up Canada Index

b5media and Start-Up Index Canada logos

b5media, where I hold the position of Nerd Wrangler, has the position on TechVibes’ Start-Up Index Canada for July 2008.

Here are the top ten entries in the Index:

Rank Site Alexa Compete Average City/Region
1 MetroLyrics 492 381 437 Vancouver
2 Suite101 2,350 491 1,421 Vancouver
3 AbeBooks 6,274 2,428 4,351 Victoria
4 Wikitravel 4,596 4,925 4,761 Montreal
5 b5media 7,071 4,080 5,576 Toronto
6 NowPublic 7,954 6,396 7,175 Vancouver
7 TravelPod 7,997 7,384 7,691 Ottawa
8 Weblo 11,647 10,809 11,228 Montreal
9 amung.us 5,914 20,427 13,171 Alberta
10 iBegin 28,861 13,086 20,974 Toronto

Greg Andrews has been compiling Start-Up Index lists at the tech news site TechVibes for the past half year for nine cities and regions in Canada, including Accordion City. They rank companies not on profit or market share, but on much easier to collect data: web traffic to their sites, based on data from Alexa and Compete. It’s not the best measure of the performance of a company, but it might be a decent indicator of mindshare. The Start-Up Index Canada for July 2008 is his first such index compiled for Canada as a whole.

To qualify for inclusion on the list, a company has to meet the following criteria:

  • Located in Canada
  • Less than 5 years old
  • Not a public company
  • Is a tech company; either hardware, software, web app/service, or mobile

Congrats to my fellow coworkers and b5 bloggers!

Bonus Useless Data

If you were to treat my personal blog, The Adventures of Accordion Guy in the 21st Century as a startup, its average score, based on its Alexa ranking of 54,924 and Compete ranking of 48770, would put it in 21st place on the Start-Up Canada Index.

Categories
Uncategorized

Boozin’ in Accordion City (Joey’s Unofficial RubyFringe Guide to Toronto)

Joey\'s Unofficial Ruby Fringe Guide to Toronto - Small logoWelcome to the third installment in Joey’s Unofficial RubyFringe Guide to Toronto, a series of offbeat articles to acquaint attendees of the upcoming RubyFringe conference with Accordion City.

There’ve been two articles in the series so far:

  1. Where Did All the Cigarettes Go?
  2. Getting from the Airport to the Hotel

In this article, I’ll cover the social lubricant that helps keep a good tech conference going: booze!

The Legal Drinking Age in Ontario: 19

If you look at Wikipedia’s Legal Drinking Age page, there are generally two places with a drinking age of 21 and some regions which ban the sale (and sometimes consumption) of alcohol:

  • A handful of Muslim countries that allow alcohol: Indonesia (except Bali), Oman, Pakistan and United Arab Emirates, and
  • the United States of America

Here in Ontario, as with most of Canada, the legal age drinking age is 19. Underage drinking is permitted at home under adult supervision. No, underage RubyFringers, you cannot come to my house to drink. A number of RubyFringe after-conference events will be taking place in or near licensed establishments, so be sure to bring some government ID with you — a driver’s licence or passport will do.

Where Do You Buy Liquor and Beer in Ontario?

If Ontario has a more civilized legal drinking age, we pay for it in terms of where we can buy it. The sale of beer and liquor is limited — with a few exceptions — to two types of stores:

Logo for LCBO (Liquor Control Board of Ontario) stores

The first type: the LCBO (short for the Liquor Control Board of Ontario), a set of stores run by the Ontario government that carries, spirits, wines and beers.

Storefront for \"The Beer Store\"

The second type: The Beer Store. Its official name is Brewers Retail, but since everyone calls it “The Beer Store”, that’s what they typically display on their storefronts. They sell beer and beer paraphernalia.

Okay, Enough Preamble. Where’s the Alcohol Store Closest to the Hotel?

Of the two types of store, the closest one to the Metropolitan Hotel Toronto is the LCBO at the Atrium on Bay, a shopping centre located a mere two blocks away. If you walk out of the hotel, take a left until you hit Dundas Street, then turn right and walk two blocks. The LCBO is on the lower level, about half a block into the shopping centre. Here’s a map:

Map showing the path from the Metropolitan Hotel Toronto to the LCBO at the Atrium on Bay

This LCBO keeps these hours:

  • Monday – Wednesday: 10:00 a.m. – 9:00 p.m.
  • Thursday – Saturday: 10:00 a.m. – 10:00 p.m.
  • Sunday: 12:00 p.m. – 5:00 p.m.

The Beer Hunter is Your Friend!

The \"Beer Hunter Guy\"

The Beer Hunter is a Google Maps mash-up that shows you the locations and hours of alcohol retail outlets in Ontario, aswell as which stores are open right now. It’s a creation of local web development shop Bad Math, and was recently featured in at New York’s Metropolitan Museum of Modern Art’s exhibit, Design and the Elastic Mind.

I’m Crashing at a Friend’s House. Can I Get Booze Delivered There?

Yes, you can! For a CDN$8.00 delivery charge, The Beer Guy lets you order alcohol online for home delivery in one hour.

Okay, Enough About Stores. What About Bars? Any Good Ones Near the Hotel?

There are a number of bars within walking distance of the hotel. Here are three decent ones that I used to frequent when I lived in the neighbourhood. They’re not cookie-cutter drinking establishments that you can find anywhere, but places with some character and local vibe.

Interior shots of The Village Idiot Pub

The Village Idiot Pub (126 McCaul Street, about 6 minutes’ walk from the hotel). This one’s a hangout for locals as well as art students from the Ontario College of Art and Design or visitors to the Art Gallery of Ontario, both of which are just across the street. The bar has about two dozen higher-end beers on tap, from imports like Guinness, Leffe Brune and Kronenberg 1664 to local microbrews like Waterloo Dark (a favourite of mine) and Brick Honey Brown. The outer walls of the bar are garage doors which are rolled up in the summer to let the air in.

I made some decent coin (and a lot of beer!) busking here during the great blackout of 2003.

The Rex Hotel

The Rex Hotel Jazz and Blues Bar (194 Queen Street West, about 10 minutes’ walk from the hotel). A jazz and blues institution since I was in high school, The Rex is a retro, just-divey-enough place that has a decent selection of beer and live blues and jazz. I’ve seen some pretty good acts here and have stumbled home tipsy many a night from this joint.

Interior of Smokeless Joe

Smokeless Joe (125 John Street, about 12 minutes’ walk from the hotel). This is a place for the serious beer enthusiast. With a half-dozen taps and a couple hundred bottled beers, this tiny, friendly place was my preferred watering hole when I lived in the neighbourhood. If you want some food to go with your beer, they have delicious sandwiches and some pretty good oysters.

I’ve been there on some pretty good dates, such as this one as well as my first date with The Ginger Ninja.

When is Last Call in Ontario?

Bars and pubs have to stop serving alcohol at 2 a.m..

Is There Any Way to Get Served Booze After 2 a.m.?

teapot

I can neither confirm nor deny the veracity of the urban legend of “cold tea”, only that the urban legend exists. It does, after all, exist as an entry in Urban Dictionary.

There are speakeasies in town; the local term for them is “booze cans”. Their locations change over time, and the ones from my days as a single guy probably no longer exist. The best way to locate these places is to ask anyone who works in the entertainment/service industry such as a bartender or waiter; they’re where they go when their shifts end.

Be advised that you’ll get more out of the conference if you get some decent sleep and aren’t hung over…