Monthly Archives: May 2007

Atchoum – A static website framework

Introducing the most easy to deploy framework!



Markaby + Builtin WEBrick server for debuging + HTML file dumper for deploying = Atchoum

gem install atchoum --source http://code.macournoyer.com

4 Comments

Filed under ruby

DevTeach : The .NET place to be

Just came back from DevTeach day 2. Wow! So much great speakers. A year ago, I would never had tough that Montreal was a place for such a great event. I’m pretty proud to’ve been a part of it.

Now! Enough for the flattering.

First I attended Claudio Lassada’s Tips & Tricks to boost up productivity session. He presented a couple of tools to speed up things (slickrun, jot, sysinternals). But I still think the key is only to go mousless, everything else will follow (And I think launchy is a lot better then slickrun). Among other things he promoted dual screens, weekly brown bag meeting, in which you share tricks you’ve learned, and CodeRush (I prefer ReSharper). Still it was really entertaining and a great start for the day.

Then I jumped to the Agile room where I stayed all day. Scott Bellware kicked it off with a talk on Behaviour-Driven-Design. The whole session was about refactoring a real world example using a TDD approach. He then presented BDD as a way to make test code more english-like and self documenting. It was a great presentation and a real convincing one. He talked about RSpec and NUnit.Spec but not as much as I would have expected. He sure looks like a bright guy (read: he’s bald). During that same presentation Jeremy Miller had some noticeable comments:

If its hard to test change it!

Yeah testability is one important thing when you don’t have the flexibility of a dynamic language.

After that was Oren Eini on Rhino Mocks. Even tough it was hard to understand what he was saying at first (strong Israel accent I guess) it was worth the effort. He made pretty obvious all the powers of Rhino Mocks. One other amazing things was how fast he was coding. I first tough it was a recorded video played with boosted speed. Not! He’s a true ReSharper jedi! He ended on a thoughtful note:

watch out for test paralysis

In other words: keep your tests flexible so they don’t break all the time.

Lunch was filet de porc in some brown sauce. Vegetables? Yes! Great I was hungry! Dessert was strange tough: looked like ice cream but was really a cake with strawberry toping inside. Still it was okay plus I had some great talks. Finished my coffee and I was up and running.

During lunch, in another room (yeah, really while lunch was served!!!) there was a talk about pair programming by two girls from Oxygen Media. Great talk, too bad I came too late (I was hungry!) I missed the rabbit story, what was that about ?

Then was Udi Dahan on What to Test and When. Udi is such a great speaker, so much energy when he talks, he sounded like Anthony Robbins on software testing. He focused on the importance of testing every aspect of the software on each iteration, specially the risky parts: performance, security, complex business logic and external interfaces.

Finally, Oren Eini finished it up with a MonoRail tribute. I don’t know if the crowd cough the brilliance of MonoRail, only 2 people, including I, had used Ruby on Rails! I tough Oren approach for a first dive into MonoRail was brilliant. He started with a browser and pointed to http://localhost/home/index.devteach then followed the exception messages for adding a controller, an action and a template. Talk about descriptive error messages!
The funniest quote of the day is definitely when he pointed out some recent comment on brail’s template, made by developers on an earlier talk:

This is Perl, I’m not doing Perl!

funny!

1 Comment

Filed under C#, Castle, conference, montreal

Build your own internet home yourself with WEBrick

The amazing Bob the Builder I’ve been playing with WEBrick yesterday night and found it pretty easy to use. Here are a couple of my discoveries.

First, you don’t need to download any gem, webrick is part of ruby core! How cool is that ?

To start a new http server:

require 'webrick'
s = WEBrick::HTTPServer.new(
  :Port            => 2000,
  :DocumentRoot    => Dir::pwd
)

trap("INT") { s.shutdown }
s.start


and go to http://localhost:2000

That might soon get boring, add a little more dynamic!

include WEBrick
s = HTTPServer.new(:Port => 2000)

class HelloServlet  < HTTPServlet::AbstractServlet
  def do_GET(req, res)
    res.body = "<HTML>hello, world from #{req.path}.</HTML>"
    res['Content-Type'] = "text/html"
  end
end
s.mount("/hello", HelloServlet)

trap("INT") { s.shutdown }
s.start


try http://localhost:2000/hello or http://localhost:2000/hello/bob

Starting to see the picture ?

You could also mix static http file service with servlets:

...
class MixedUpServlet  < WEBrick::HTTPServlet::DefaultFileHandler
  def initialize(server, my_app)
    super(server, my_app)
    @my_app = my_app
  end
  def service(req, resp)
    if /(\w+).action$/ =~ req.path
      res['Content-Type'] = "text/html"
      res.body = @my_app.send $1
    else
      @local_path = Dir::pwd + "/#{req.path}"
      do_GET(req, resp)
    end
  end
end
s.mount("/", MixedUpServlet, my_app)
...


Now any request to something.action will call the corresponding my_app method any other file will be served as usual.

Hope you have as much fun as I had playing with this and let me know what you come up with !

Small footnote: this code is not safe to be used as is on todays freaky-dangerous-not-safe internet! Do not copy-paste and deploy. If you’re serious about building your application from the ground up, I suggess you take a look at Mongrel which offers much better performance.

1 Comment

Filed under ruby

No more excuses not to try ruby

If you tought:

I don’t wanna try ruby, it’s too hard to install, too long to download and it makes my feet smell like Oka cheese.

Better find another thing to complain about, with raggi’s Ruby for Windows in Under 700 bytes (and executable!).

Drop this in a batch file and run to get an interactive ruby interpreter:

@echo tryurl="http://tryruby.hobix.com/irb?cmd=";function wget(url,hdrs){var http=WScript.CreateObject("Microsoft.XMLHTTP");http.open("GET",url,false);for(var k in hdrs){http.setRequestHeader(k,hdrs[k]);};http.send("");return http.responseText;}sess=wget(tryurl+escape("!INIT!IRB!"),{});WScript.Echo("Interactive Ruby ready. (send ^D to exit)");WScript.StdOut.Write(">> ");WScript.StdIn.Read(0);while(true){cmd=WScript.StdIn.ReadLine();resp="";ps=">> ";if(cmd=="04")break;if(cmd){resp=wget(tryurl+escape(cmd).replace('+','%2B'),{'Cookie': '_session_id='+sess});ps="..";if(resp){WScript.StdOut.Write(resp);ps=">>";}}WScript.StdOut.Write(ps+" ");}>t.js
@cscript//Nologo t.js&del t.js

and read this

via (_why)

What’s your excuse now for not giving ruby a try ?

1 Comment

Filed under links, ruby

Better late then ever : joining twitter

While I was eating today, someone came by and stole my delicious Pad Thai. He swore I wouldn’t have it back unless I join Twitter…

Well, I was ungry!

You can add me as a friend in the name of all the Pad Thai supporters that didn’t had as much chance as I had!

1 Comment

Filed under Misc, web 2.0

09 F9 11 01 -CENSORED- 56 88 C0

John C. Dvorak said something pretty interested in the last This Week in Tech podcast about the whole controversial DRM key.

They [lawyers] popularized this. Mp3 would still be underground if it wasn’t for all these lawsuits.

-around 17:24

Who can use this key anyway ? Hey, we are geeks, we are techy and I don’t know how I could have used this and I don’t think it’s worth the time and effort. But now that almost everyone knows about this key, lots of people will try to make use of it.

What do you think ? Are these laywers making it worst ?

2 Comments

Filed under links, podcast

Don’t start coding with games

It’s rare to come accross a serious _why post theres days, but with the recent launch of his Hackety Hack IDE for kids came this toughtful post about why teaching kids programming with games is wrong.

Also, here’s a cool video about the new web 2.0:

(via TS)

TheFunded, controversy in the VC world:
The Funded
(via TC)

Leave a comment

Filed under links