Categories
Uncategorized

Open Source Language Roundtable Webcast: Wednesday, July 22nd

oscon_language_roundtable

O’Reilly’s conference on Open Source, OSCON, takes place this week in San Jose, California. One of the events taking place at OSCON is the Open Source Language Roundtable, the abstract for which appears below:

We all have our favorite languages in our tool-belt, but is there a ‘best’ overall language? If anyone can hash that out, it will be the members of this roundtable discussion, some of the stars of the open source language space. This wide-ranging session, hosted and moderated by the O’Reilly Media editorial staff, and broadcast live on the web, will try to identify the best and worst features of each language, and which are best for various types of application development.

The roundtable will me moderated by O’Reilly Media’s James Turner and will cover the following languages, listed below with the corresponding panelist:

  • Java: Rod Johnson (SpringSource)
  • Perl: Jim Brandt (Perl Foundation)
  • PHP: Laura Thomason (Mozilla)
  • Python: Alex Martelli (Google)
  • Ruby: Brian Ford (Engine Yard)

You can catch this roundtable even if you’re not going to be at OSCON because O’Reilly is webcasting the event. It takes place this Wednesday, July 22nd at 10pm EDT (7 pm Pacific) and is expected to run 90 minutes. It costs nothing to catch the webcast and you’ll even be able to ask the panelists questions via chat, but you’ll need to register.

Categories
Uncategorized

LearnHub: Powered by Rails, Searches with Bing

This article also appears in Canadian Developer Connection.

Introducing LearnHub

learnhub_home_pageLearnHub’s home page.

If you’re a student applying to colleges and universities and are looking for help with the process, you should try LearnHub. Based in Toronto, LearnHub is a social learning network that helps students to prepare for standardized tests, assists with finding places to study abroad and provides career counseling. LearnHub’s site has hundreds of thousands of pages of free content, including the world’s largest bank of questions that appear in the GMAT and SAT standardized tests. The site has a large following among students worldwide, particularly in India, and has partnerships with 25 universities to recruit domestic and international students.

learnhub

With those hundreds of thousands of pages, LearnHub needed to provide a way for students to find what they’re looking for. They provide a search function, and it’s powered by Bing.

The people at LearnHub are part of that sector of Toronto tech that’s into Ruby on Rails, open source and founding startups. Founders John Philip Green and Malgosia Green are a husband-and-wife team who are known for building web applications for education and have been active members of Toronto’s tightly-knit open source tech community since the earliest DemoCamps. John caught Rails fever after trying it out and decided to rewrite a major application using it. The core development team of Wesley Moxam, Carsten Nielsen and Libin Pan are fixtures of the local Toronto’s on Rails scene; a gathering of local Rubyists doesn’t feel complete without them.

So what are they doing, using Bing?

Site-Wide Search

learnhub_dev_management_teamThe main room at LearnHub’s offices. Management are to the left, developers to the right.

In the beginning, they went with their first instinct, which was to use Google. “We launched in March 2008,” said co-founder John Philip Green, “and we needed to provide site-wide search, so we went with Google. We signed up, and for a few hundred bucks a year, we got a search function that covered about 5,000 pages. It seemed like a pretty big number, and we thought that would be more than enough to cover our site.”

They soon found that the results weren’t what they expected. “We weren’t getting good results. We’d use our site-wide search to search for something that we knew was in our site, and it wouldn’t show up in the results.” The same search would work just fine if you did it from Google.com, but not from their Google-powered search function. “The results just weren’t relevant, and we also had a limited number of queries,” John said.

learnhub_management_dev_teamThe main room at LearnHub’s offices. That’s management in the foreground, developers in the back.

LearnHub’s page count grew quickly and beyond the 5,000 pages covered by their arrangement with Google. “Going up to a bigger package was expensive;” John said, “it would have cost a couple thousand for 50,000 pages, and we were already at hundreds of thousands.”

“We could’ve gotten the functionality for free, but that’s only an option when you show ads in the search results, and the ads that showed up were for our competitors.”

learnhub_sales_teamLearnHub’s sales team.

There was another problem: Google’s site search returned its results as a web page. In order to make LearnHub’s site-wide search’s results page have the same look and feel as the rest of the site, they had to stick the Google results in an iframe. “And even then, what was inside the iframe didn’t match the rest of the page,” added John.

They started looking at other options for implementing LearnHub’s site-wide search, including running their own spider. “We really didn’t want to do that,” said programmer Wesley Moxam.

Enter Bing

wes_moxamLearnHub developer Wesley Moxam.

While looking around at search options, Wesley found the Live Search API, which is now known as the Bing API. “It was free, well-designed and spits out JSON,” he said. “Google requires a JavaScript interface or SOAP, and SOAP libraries in Ruby are painful.”

“It took a day to implement and get it up and running,” said Wesley, “The entire switch-over project happened over three days, with us working on it on and off, while we were doing other tasks. Best of all, we get consistent results – the results from the API are the same results you’d get if you just used the Bing site.”

“Bing’s API is simple and straightforward. You call it, you get the results, you take those results and use them how you like,” he continued. “It’s good. It’s hard to explain good software; good software is inherently simple.”

Here’s a screenshot of a LearnHub search results page for the search term “accordion” – and yes, the word appears on a handful of Learnhub pages!

LearnHub search results page for the search term "accordion" LearnHub’s search results page for the term “accordion”.

LearnHub have benefited from using Bing to power their site-wide search, and they’ve decided to share the wealth. Wesley’s working on refactoring the Ruby library he wrote to act as a wrapper for the Bing API and open source it for anyone to use. It should be available later this summer. He’ll announce it when it’s released, and I’ll announce it here.

The Bing API

Bing logo

It’s easy to harness the power of Bing in your applications, whether for desktop, web or mobile.

The first step is to get an AppID, which is a string that uniquely identifies you as a registered Bing application developer. Go to the Bing Developer Center, sign in with your Windows Live ID (which you can get for free) and follow the link to created a new AppID. You’ll be asked to supply some very basic information about your application and to review the Bing API’s Terms of Use. If you provide the information and agree to the Terms of Use (which I summarize in plain English below), you’ll get an AppID.

Once you have an AppID, you can start experimenting right away with the Bing API. All you need to do is start typing URLs with the format below into your browser’s address bar:

http://api.search.live.net/xml.aspx?AppID=<AppID>&query=<SearchTerms>&sources=<SourceTypes>

where:

  • <AppID> is the AppID assigned to you
  • <SearchTerms> are your urlencoded search terms
  • <SourceTypes> specifies the type(s) of search results you want. The different sourcetypes are explained in the table below:
SourceType Description Example Search Terms
Web Searches for web content accordion – returns web pages containing the term “accordion”
Image Searches for images on the web accordion – returns images of accordions
News Searches news stories accordion – returns news articles about accordions
InstantAnswer Searches Encarta online what is an accordion – returns the definition of “accordion”

convert 1.6 kilometres to miles – returns “0.9941939 miles”

sin(30 degrees) – returns “0.5”

Spell Searches Encarta Dictionary for spelling suggestions accordian – returns “accordion” 
Phonebook Searches phonebook entries accordions in Toronto – returns location results for “accordions in Toronto”
RelatedSearch Returns query strings most similar to yours accordion – returns results like “{piano accordion; button accordion; accordion store}”
Ad Returns advertisements to incorporate with results (use this to make money with you Bing-powered application) accordion – returns ads relevant to the keyword “accordion”

 

The default format for results is XML, and that’s the format you get when typing in API calls in your browser. You can also have the results returned as JSON or SOAP if you prefer.

You can find out more about the Bing API in the Bing API section of MSDN.

Bing’s Terms of Use, Explained as Simply as Possible

Here’s a quick explanation of Bing’s Terms of Use for those of us without a law degree. It’s adapted from the Bing documentation and provides a quick summary of what application developers using the Bing API must do and cannot do (besides the obvious "I promise not to use the API to plan a terrorist attack, run a drug smuggling ring or help the band Nickelback take forceful despotic rule of planet Earth").

What you must do:

  • You must display all the results you request. No filtering!
  • You must display your results in the context of a user-facing application or website.
  • You must display attribution to Bing in a manner compliant with our branding rules. Currently, you may determine the specific manner in which you display attribution. A link to http://www.live.com with the query echo is a suggested example.
  • You must restrict your usage to less than 7 queries per second per IP address. You may be permitted to exceed this limit under some conditions, but this must be approved through discussion with the folks at api_tou@microsoft.com.
  • If you interleave data from any source other than the API with data from the API, you must clearly

    differentiate the respective sources. (Yes, you can interleave Bing results with other data!)

What you cannot do:

  • You cannot use API results for search engine optimization (SEO). In particular, using the API for rank checks is explicitly prohibited.
  • You cannot display advertisements in positions other than the mainline and sidebar.
  • You cannot change the order of the results the API returns from a SourceType other than Web. (In other words, you can re-order results from standard searches for web pages!)

Bing Your Apps!

From there, the sky’s the limit. The Bing API is very straightforward and easy to use, it costs nothing to use it, and as someone who’s been using Bing as his default search engine since its beta period, the results it provides are great. Go forth and Bing your apps!

Categories
Uncategorized

The “employment.nil?” Ruby Job Fair

employment_nil_floor

One of the pillars of the Toronto developer scene is the Ruby/Rails community. They’re an active, engaged, hard-working bunch who work without the direct benefit of a large organization like The Empire or its resources (they do, through people like Yours Truly and Nik Garkusha, Microsoft Canada’s open source go-to guy, get some indirect support). They – through the efforts of people like Pete Forde and the Ruby local heroes at Unspace – know how to maximize grassroots organization and harness them into industry-leading events like last year’s RubyFringe and the upcoming FutureRuby conference.

meghann_and_pete

It should therefore not be a surprise that when Pete and company got the idea to help out their fellow Ruby developers during the econopocalypse with a job fair – employment.nil? — they’d take the standard techie job fair formula, turn it upside down and make it their very own. They chose the Gladstone Hotel in Toronto’s hip West Queen West neighbourhood, which is better known as a venue for karaoke, rock bands and burlesque (in fact, I’ve performed in all three kinds of shows there) than for computer and IT-related employment fairs.

 unspace

This was not your typical job fair. It didn’t have any of the fancy display stands that you normally see on the exhibition floor at tech conferences. Instead, both job-seekers and small companies were told to build poster board displays, a la high school science fairs.

shindig

Another rule: no computers allowed! Even iPhone apps were considered “cheating”. The closest you were allowed to get was using whiteboards or pen and paper for “live coding”. This wasn’t about staring at computer screens, but people talking to other people – people who were passionate about the Ruby programming language and its associated frameworks, libraries and communities.

postrank

An excerpt from the sign-up page for employment.nil?:

Let’s face it: it’s better to be a Ruby developer than a car manufacturer in 2009, but things have definitely slowed down — for everyone. And yet, there are solid reasons why this is an excellent time to start new projects, launch companies, and create new markets. By definition, Ruby has been adopted by creative individuals that grew frustrated with risk averse bureaucracies.

We believe that there are huge number of opportunities to be found during this economic downturn, both for freelance developers and aspiring entrepreneurs alike. As with most tragic historical near-misses, there are just a huge number of connections that aren’t made even in our own collective back yard.

terry_smith

More from the job fair’s site:

That said, we also believe that Ruby people are determined self-starters that aren’t afraid to self-promote. Anything worth doing in life requires hard work and sacrifice. Sadly, while many developers are patient and willing to think orthogonally, we rarely get an opportunity to practice the other more social skills which make us desirable as team members, project managers, and co-founders. Unless we overcome our shyness and learn to speak eloquently about our experience and skill sets, we have nobody to blame for our work prospects but ourselves.

Our solution is to gather students, developers, development companies, and of course project leaders and company founders for a good old-fashioned career fair.

As you can see from the photos, there were different kinds of booths set up. There were those for companies looking to hire some Ruby developers…

mulder_consulting

and those deidicated to showcasing some interesting application of Ruby, such as lojacking iPhones:

tony_thompson

…or HacklabTO’s own Jed Smith showing how we harness Ruby to drive our laser (yes, we’ve got a laser etcher/cutter!):

ruby_laser_awesome 

And some booths were set up by Ruby programmers showcasing their own work and who were looking for a job:

talha_syed_1

 talha_syed_2

dan_mcgrady

The event wasn’t just noticed by the Ruby community, who filled the room throughout the 11 a.m. to 6 p.m. course of the event. Late in the afternoon, Ontario’s Minister of Small Business and Consumer Services, Harinder S. Takhar, paid a visit to the job fair.

meghann_pete_minister

Pete, ever the gracious event curator, took Mr. Takhar to several booths, introducing him to their owners, who were only too happy to show the Minister their Ruby-related work. Here’s Andrew Burke of Shindig, showing him the projects he’s taking on in his independent software consultancy:

andrew_minister

Here’s Kieran Huggins showing Mr. Takhar his work in MyTTC.ca:

minister_kieran

I’m sure that grassroots high-tech events with a strong “indie” aesthetic are outside the Minister’s everyday experience, but he seemed pretty impressed with the event: a dedicated group of nerds building software and careers using only laptops, stuff you can download for free and their brain cells.

minister_presentation

Here’s Pete explaining the local Ruby developer scene and the concept of open source software to Mr. Takhar:

pete_minister

And here’s Mr. Takhar presenting Pete with an award of recognition for Unspace for putting the event together. At that point, I broke out the accordion and played For He’s a Jolly Good Fellow, partly for the Minister for showing up on a Saturday afternoon, but partly for Pete for putting the event together.

 pete_minister_certificate

Here’s a close-up of the award:

award_of_recognition

It reads:

Award of Recognition

On behalf of the Government of Ontario,
I am delight to extend my congratulations on the
Employment.nil?
First Toronto Ruby Job Fair

Unspace Interactive Inc.

Our government recognizes the importance of new and creative opportunities for
business. Building a business requires vision and dedication. I applaud your work and
success in web consulting through your team of industry-leading developers and
designers under one roof.

Please accept my best wishes for continued success.

Harinder S. Takhar
Minister of Small Business and Consumer Services
June 06, 2009

Congratulations to Pete, Meghann Millard, all the folks from Unspace and the Toronto Ruby community on a job well done!

The Photo Gallery

I took a lot of photos at employment.nil? and shared them in a Flickr photoset, which you can also view in the slideshow below:


Created with Admarket’s flickrSLiDR.

Categories
Uncategorized

“employment.nil”

"employment.nil" posterIn case you’re:

  • a programmer who works with the Ruby programming language
  • looking for work
  • available to get down to Toronto’s “West Queen West” neighbourhood soon

you might want to do what I’m doing in a couple of minutes (as of this writing): heading down to the Gladstone Hotel (1214 Queen Street West, at Dufferin) to get a look at employment.nil, which bills itself as “the first Toronto Ruby job fair”.

Organized by the fine folks at Unspace, who are also organizing the upcoming FutureRuby conference and FailCamp (where I’ll be the MC), employment.nil isn’t your typical computer programmer job fair. No computers are allowed! They’re going to be strict about it – even the use of iPhone applications is verboten. Bring printouts of your resume and some scratch paper to do “live coding”. I’m going to bring my mini-whiteboard and dry-erase markers.

See you there!

Categories
Uncategorized

“employment.nil” – The Toronto Ruby Job Fair

employment_nil

If programming in Ruby is your thing and you’re looking for work or workers, you should mark Saturday, June 6th on your calendar. That’s when employment.nil, Toronto’s first Ruby job fair, takes place at the Gladstone Hotel.

Organized by Pete Forde and the folks at Unspace – the local Ruby heroes behind things like the FutureRuby conference – employment.nil is an old-school job fair for Ruby programmers. In fact, it’s so old-school that no computers of any kind are allowed. If you’re looking for work, bring printouts of your code and be ready to write out ideas with pen and paper. If you’re looking for people to work for you, you can set up a booth, grade school science fair-style.

Want to find out more? Check out the employment.nil article in Rethink, Unspace’s blog.

Categories
Uncategorized

Named Parameters in Method Calls: Python Si, Ruby No

"Hello My Name Is" sticker In an earlier article, Default and Named Parameters in C# 4.0 / Sith Lord in Training, I wrote about how C# 4.0 – that’s the version coming out with the next release of Visual Studio, known as Visual Studio 2010 – is going to provide support for named parameters.

In that article, I also incorrectly stated that Ruby supported named parameters. Luckily, Jörg W Mittag spotted my mistake an corrected me in a comment. I’ve since corrected the article and thought I’d show you how I got it wrong in the first place.

Ruby and My Named Parameter Goof

I had a vague recollection of Ruby accepting named parameters. I figured I’d be empirical and fired up irb – the Ruby REPL shell – and put together a quick little method to see if the recollection was correct:

# Ruby 1.8.6
def test_named_params(first, second)
    puts "#{first}\n#{second}"
end

Once put together, I made some test calls to the method:

# irb session (Ruby 1.8.6) irb(main):> test_named_params("alpha", "beta") alpha beta

=> nil irb(main):> test_named_params(first = "alpha", second = "beta") alpha beta

=> nil

Seeing that the interpreter didn’t choke on that named parameter call, I thought to myself “Vague recollection confirmed, Ruby supports named parameters!” and wrote the blog article.

Had my brain actually been firing on all cylinders, I would’ve given the method a proper test by providing the named parameters out of the order in which they appear in the method signature. Here’s what I would’ve seen:

# irb session (Ruby 1.8.6)
irb(main):> test_named_params(second = "alpha", first = "beta")
alpha
beta

=> nil

Uh-oh. If named parameters worked, the first output line would be “beta” and the second would be “alpha”. Clearly something’s wrong with my recollection.

Let’s try some non-existent named parameters – say, ones involving current entertainemtn news headlines — just to see what happens:

# irb session (Ruby 1.8.6)
irb(main):> test_named_params(lindsay_lohan_dui = "alpha",
jim_cramer_smackdown = "beta")

alpha

beta

=> nil

Even with nonsensical named parameters, the method is still accepting the values in order. Why is that?

Just about everything in Ruby has a return value (which can be anything, including nil). You can see for yourself in irb – here’s a quick do-nothing method definition:

irb(main)> def doNothing
irb(main)> end
=> nil

As you can see. defining a method returns a value of nil.

As Jorg pointed out, Ruby assignment statements return a value: the value used in the assigment. Once again, for proof, I’ll use an example from an irb session. In the example below, assigning the string "alpha" to the variable first also returns the string "alpha":

# irb session (Ruby 1.8.6)
irb(main):> first = "alpha"
=> "alpha"

In the call to test_named_params, the Ruby interpreter was interpreting my “named parameters” as assignment statements. first = "alpha" evaluates to plain old "alpha", but so does second = "alpha" (and for that matter, so does lindsay_lohan_dui = "alpha"). Each assignment statement in my parameter list was evaluated, and then those values were passed to method in positional order.

Python Supports Named Parameters

After getting the comment from Jorg and correcting my article, I wondered why I thought Ruby supported named parameters. Then it hit me – it’s Python.

So I fired up the Python REPL and put together this quick little method:

# Python 3.0
def test_named_params(first, second):
    print("%s\n%s" % (first, second))

And this time, I decided to be a little more thorough in my testing:

# Python 3.0 REPL
>>> test_named_params("alpha", "beta")
alpha
beta

>>> test_named_params(first = "alpha", second = "beta")
alpha
beta

>>> test_named_params(second = "alpha", first = "beta")
beta
alpha

And some additional searching on the web confirmed that yes, Python method calling does in fact support named parameters.

So in conclusion, when it comes to named parameters, it’s Python si, Ruby no…and C# pronto.

Categories
Uncategorized

FutureRuby and Failcamp: Register Now!

futureruby

Last year, the folks at Unspace held a fantastic Ruby conference called RubyFringe. They took the standard conference format, threw out the stuff they didn’t like, amplified the stuff they loved and kept the attendance down to around Dunbar’s number. The end result: quite possibly the best geek conference I’ve ever attended (a lot of the other attendees would concur). I wrote quite extensively about RubyFringe in this entry, and here are my notes from the conference:

This year, they’re holding a slightly different conference called FutureRuby. They’ve described it as bill it as “an opportunity to prepare for the future by learning from the mistakes of the past”, and promise us that it won’t just be RubyFringe warmed over – we shouldn’t expect to find the same things in the same places! Here’s what the FutureRuby site says:

We are the artists, philosophers, and troublemakers. We realize that the fringe of today is
the mainstream of tomorrow. We grease the engines of progress, even when we’re working outside of the machine.

FutureRuby isn’t a Ruby conference, but a conference for Rubyists. This is a call to order – a congress of the curious characters that drew us to this community in the first place. We have a singular opportunity to express a long-term vision, a future where Ruby drives creativity and prosperity without being dampened by partisan politics.

FutureRuby runs from Friday, July 10th at 5:00 p.m. and officially end on Sunday, July 12th at around 11:55 p.m.. FutureRuby will also be paired with FailCampTO, which will take place on Thursday, July 9th (I’ll be MCing this event, and I’ll talk more about it in another post).

The early bird tickets for FutureRuby, which sell for CAD$700, are already gone. The regular rate tickets, which sell for CAD$800, are still available, but probably not for long. If you want to attend FutureRuby, I strongly recommend that you go to the FutureRuby registration page and sign up right now.