Mostrar / Ocultar Avisos

Author Archive

Live Blogging from the F1 Web Challenge

Well it’s 8:30 am and we are about to get started with 24 hours of hard core web development. I’ll be updating our progress throughout the day.

Team Ruby.mnTeam setup

8:55 am Opening comments
8:57 am Our non-profit is Little Brother: Friends of the Elderly
12:07 pm Lunch break with a Rock Band challenge

There are some hard core Rock Band players here. I hope our rookie team can do well, and by that I mean not place last. I think we’ll do well. Here’s the band…

Vocals: Robert Fischer
Guitar: Nate Kadlac
Drums: Andy Tinkhan
Bass: Kathleen O’Brien, from Little brothers

Drum Master AndyRobert Rocks OnThe Band

So far we’re in 2nd place…

6:58 pm Dinner time. Mmmm Chipotle.

Here is the official flickr stream for the event >> Photo me, baby!

Notice how Team Ruby.mn is properly featured?

Alicia and Nate have created a sweet site design that just blows away Little Brother’s current site. Justin and I are hacking away at the CMS. Lars is maxing out his credit cards with the online donations. Andy has written a book of RSpec tests. And Coung and Robert are building the volunteer sign-up. Everything is still parts is parts but everything is progressing nicely.

8:17 pm Little Brothers brought in a surprise for us. We got a clown. No one else got a clown. We rule.

Lars and MagicPink BunnyOur ClownMonkey Coder

12:02 am Half way there. I’m tired.

12:32 am Domino’s Pizza just delivered. Why did I think it was a good idea?

3:27 am Sierra Bravo just gave out some raffle prizes. I won “The Ultimate MAtix Collection” in HD-DVD. I don’t have an HD-DVD player yet and someone just told me Blue-Ray won the format war so I got that going for me. Which is nice.

5:12 am Can’t. Speak. In. Complete… Sentences…

7:05 am I just noticed the sun in coming up. I’ve been awake for 25 hours now. So tired…

9:35 am The site looks sweet. We’re just putting on the final touches and preparing for our demo.

9:44 am Time for a photo check-in.
Count Down

THIS IS NO PLACE FOR THE WEAK!

Sleeping Dude.

TEAM RUbY.mn hard at work.

Team Ruby.mn

10:51 am 1h 10 m left. Subversion commits are flying all over the place. Robert is also live blogging the end.

11:42 am Our final revision, number 161, was just checked in. Here are the stats for our project…

+----------------------+-------+-------+---------+---------+-----+-------+
| Name                 | Lines |   LOC | Classes | Methods | M/C | LOC/M |
+----------------------+-------+-------+---------+---------+-----+-------+
| Controllers          |   579 |   467 |      16 |      58 |   3 |     6 |
| Helpers              |    32 |    29 |       0 |       1 |   0 |    27 |
| Models               |   356 |   294 |      11 |      36 |   3 |     6 |
| Libraries            |   455 |   315 |       2 |      27 |  13 |     9 |
| Integration tests    |    46 |    40 |       1 |       2 |   2 |    18 |
| Functional tests     |   304 |   246 |      12 |      39 |   3 |     4 |
| Unit tests           |   242 |   201 |       7 |      31 |   4 |     4 |
+----------------------+-------+-------+---------+---------+-----+-------+
| Total                |  2014 |  1592 |      49 |     194 |   3 |     6 |
+----------------------+-------+-------+---------+---------+-----+-------+
  Code LOC: 1105     Test LOC: 487     Code to Test Ratio: 1:0.4

Fix: MySQL 5 on Mac OS X Leopard

This past weekend I bought a new MacBook and, of course, it has Leopard for the OS. As I was installing all of the development tools I need I kept having issues when trying to run MySQL 5.0.51. I installed from the Mac OS X packages.

After consulting google I came across Ted Hogan’s site. He explained that is was a permissions issue between “/usr/local/mysql/data” and the current logged in user. His fix is listed below.

You can get to this through the finder by using the “Go to Folder” dropdown item from the Finder’s “Go” menu. Just type in /usr/local and go from there. Also, you can modify the permissions by command-I (info dialog) at the bottom (Sharing & Permissions.) Be sure to click the options button (gear box at bottom) and select “Apply to enclosed items” as well.

F1 Overnight Website Challenge

F1 Overnight Website ChallengeYesterday I found that my team was selected for the Sierra Bravo F1 Overnight Website Challenge. I’m pretty excited about it. The teams get to stay up all night coding like fiends while powered by free Red Bull, Peace Coffee, Buffalo Wild Wings, and Chipotle with an occasional break for a Guitar Hero contest. My team is one representing the Ruby Users of Minnesota (RUM) and we have some top quality developers. I hope I measure up.

One part nerd Olympics, one part community service project and one part race-against-the-clock — Sierra Bravo’s F1 Overnight Website Challenge presented by VISI will partner deserving Minnesota non-profits with teams of talented web developers for 24 hours of fun collaboration culminating in a fully operational website for each participating non-profit. - Sierra Bravo website

Here is the link to team Ruby.mn. I’m the one with the party hat.

RESTful_Easy_Messages

So three month ago I released my first Rails plug-in, Easy_Messages (EZM), and I was pleasantly surprised by the response, excited that people were actually using my code. Then I became paranoid as people were actually using my code! Since then I worked briefly on a project which was written with REST in mind and was forced to look into it. Up to that point I had been doing my best to not meet REST in the hallway as I was a little scared by him. I don’t know why? After watching the Peepcode screencast by Geoffrey Grosenbach, everything clicked and I realized that I could make the code for EZM much better. The end result is this plug-in. I hope you find it useful.

The code is hosted at GitHub.

Here’s how to install the plug-in. (Rails 2.1 required for git plug-ins)

./script/plugin install git://github.com/sschroed/restful_ezm.git

Here’s how to run the generator.

For standard html views: ./script/generate messages erb
For haml[1] views: ./script/generate messages haml

[1] You will need to install the haml plug-in for the views to render properly.

I’ve tried to decouple as much of the code as I could with this release. If you used Easy_Messages you’ll remember most of the code was stuck in the plug-in directory. With REZM the generator will put a controller, helper, model, tests, and a few other support files right into your project for easy access. To see the entire list view the FILELIST in plugins/restful_easy_messages. There is still a tiny bit of code in the plug-in though.

If you are using Rick Olson’s RESTful_Authentication you can get REZM up and running with minimal setup as I pulled it from a project that uses it.

First, update the user model.

Then add the REZM routes.

NOTE: Routes have been changed in the lastest release on GitHub. The User is no longer needed. This break backwards compatibility, unfortunately. Thanks to Gravis for the update.

Now run db:migrate and you should be good to go.

But what if you didn’t use restful_authentication? Having to use Acts_As_Authenticated for EZM was the biggest complaint that I heard so I made REZM with hooks for you to switch out R_A if you want. Open lib\restful_easy_messages_controller_system.rb to do so. Just replace the current_user and login_required methods with calls to similar ones in your application.

I believe that is it. Oh wait, there is also an Atom feed for the inbox!

If you wish to try out REZM I’ve set up a sample app. You can message the user “sam” if you want to test writing a mesasge.

***** Click to play with the REZM Sample App. *****

Thanks to…

**Geoffrey Grosenbach for the REST PeepCode

**Matt Beedle for writing and releasing Acts_As_Emailable which was my starting point with Easy_Message and now RESTful_easy_messages.

** Rick Olson for writing and releasing all of his plug-ins.

** Dr. Nic Williams for his multiple-openids-per-user-sample-app which I used as a starting point for the REZM sample app which I’ll put up soon.

** Ben Curtis for his OpenID sample app which Dr. Nic based his.

Lastly, please recommend me if you like RESTful_Easy_Messages.
Recommend Me

Simple Syntax for XML node looping

Sometimes I really hate .Net blogs and C# websites.

All I wanted was the syntax to loop through the nodes of an XML document. You’d think that would be easy to find.

WRONG!

My search lead me to many long winded dissertations on to use XML for web services or someone’s home grown SAX implementation but no simple syntax that wasn’t buried in 1000 lines of code. Seriously, who is going to read 1000 lines of code in a blog post?

Anyway, I’ve distilled it below. I know it’s simple. But, I couldn’t find simple. Maybe my google skillz are lacking.

This code assumes you have “customer” nodes within your XML document and each customer has an attribute called “name”.

I realize the above code reassigns nodeValue each time through the loop, but I just wanted to show the syntax for retrieving an attribute value.

Installing ImageMagick and MiniMagick on Windows

I know this has been documented in other places so this is mostly for my own sanity. I want to use the attachment_fu plug-in by Rick Olson for my rails app to upload user avatars. I also want to resize the images and create a series of smaller thumbnails for use throughout the site.

Steps to install ImageMagick

  1. Download the Windows binary of ImageMagick. I used ImageMagick-6.3.5-4-Q16-windows-dll.exe
  2. Run the ImageMagick installer (The file you just downloaded) and accept the defaults.
  3. Open a command prompt to verify the install was successful
  4. Type >convert logo: logo.miff
  5. Type >imdisplay logo.miff
  6. If all went well with the install a little picture of blue wizard should appear.

Steps to install MiniMagick

  1. Install the gem from the command prompt with the command gem install mini_magick. You may be asked to install a few required dependencies. Say yes.
  2. Wait for the download and install to complete.

You should be good now to install attachment_fu, but that is beyond the scope of this article. Use the links below for more information

References:

Easy_Messages

A few weeks ago I was looking for Rails plug-in to provide simple messaging between users on a website. I came across Acts_As_Emailable by Matt Beedle. It was a good start but only gave me a model and some methods but I would still need to flesh out a controller and some views for my little private messaging project to be complete. The result of that work is this plug-in, Easy_Messages. I took Acts_As_Emailable as a starting point and added some controller methods, a few views, a helper, and some named routes.

Below are the installation instructions. This is my first Rails plug-in so let me know if you find something to refactor. I’m open to constructive criticism.

The code is hosted at RubyForge.

UPDATE I: I have created a new branch for 0.51, please use that one for the latest stable release

UPDATE II: I have removed the docs from branch 0.51 and placed them online here: http://easymessages.samuelschroeder.com. Now the generator should work like a charm

svn://rubyforge.org/var/svn/easymessages/branches/RB-0.51

The run the generator to create the model, migration, helper, and views.

script/generate easy_messages message account

Note: Easy_Messages assumes you have Acts_As_Authenticated installed with the defaults of a model named User and a controller named Account. And you must use the above line exactly. I have grand aspirations of making the generator fully dynamic someday but for now you’ll have to deal.

The generator should produce this output.

exists app/models/
exists app/helpers/
exists app/views/account
create app/models/message.rb
create app/helpers/easy_messages_helper.rb
create app/views/account/message_view.rhtml
create app/views/account/messages.rhtml
create app/views/account/send_message.rhtml
exists db/migrate
create db/migrate/###_create_easy_messages_messages.rb

Yes, I realize the redundant naming but once/if I get the dynamic generator going it would say ###_create_easy_messages_[MessageClassNames]s.

Now you have to do three manual changes to your code. First, add “easy_messages” to apps/model/user.rb.

Second, add “authenticated_commands” to apps/controllers/account_controller.rb.

Finally, you need to copy the named routes from vendor/plugins/easy_messages/config/easy_messages_named_routes.rb to config/routes.rb.

That should be it for the setup. So start your development server and point your brower to..

http://localhost:3000/account/inbox

There is also a complete RDoc listing in vendor/plugins/easy_messages/doc

Thanks to…

**Matt Beedle for writing and releasing Acts_As_Emailable.

** Rick Olson for writing and releasing the kick-ass Acts_As_Authenticated plug-in. It was been such a help when starting new projects.

Recommend Me

ASP.Net 2.0 and It’s Crazy Strict Install Order OR Be Careful When Installing Windows Components

Recently, I re-imaged my work machine and had to re-install all of my development tools. See here for a list. The one thing I did pay attention to was to make sure IIS was installed before Visual Studio and ASP.Net 2.0. If you do it backward you’re in for a fun filled day of error messages leading your nowhere. But, I did it right so I didn’t have to worry.

Then this morning everything went to hell and the very descriptive errors appeared and I spent a few hours googling and trying some of the Kbases at Microsoft. Nothing worked until I tried this which states the cause as…

The most probable cause for this error is that you must have installed Internet Information Services (IIS) after the installation of Microsoft .NET Framework 2.0.

But remember I did do it in the right order. Right? To make a long boring story short I was messing around with adding and removing some Windows Components from the Add/Remove Programs wizard and sowhere along the line it must have reinstalled part of IIS. Either that or the Network Gnomes are back.

The Simple Development Life

I recently installed a new hard drive on my development PC and thought it would be a good time to refresh my environment since it was suffering from Windows rot. Man, was that experience an eye opener as to the tools I use. Here is my alphabetized list.

I had to install more things like mail clients, printers, etc. as well. I just found it amazing at the number of tools I have to use in my professional life

Trying to Install Ruby Gems On Windows Though a Proxy Server

As with most larger businesses we have a corporate firewall which can lead to small annoyances, such as not being able to connect to rubyforge.org to download new gems. I recently had a new hard drive installed at work so, of course, I had to spend too much time reinstalling all of my development tools. Visual Studio 2005 takes way too long, btw.

Yesterday, I spent a good hour trying to get Rails with the standard gem install rails –include-dependencies. No luck due to our firewall. So I checked the ruby gems doc to find the correct install parameters. Still no luck. No matter which combination I tried to tell gem to look remotely through the proxy server it still wouldn’t go. So I asked the Google to help out and after reading through blog entries and message boards I stumbled upon one that talked about setting environment variables in linux. Well, I’m a windows guy so that didn’t help much but it gave me the idea to try and set a Windows environment variable. What the hell, right?

So, I added a User Variable for my account called http_proxy with the value of http://<proxyserveraddress>:8080, rebooted, ran plan old vanillia gem install rails –include-dependencies, and magically, it worked. See below the fold for details.

Read the rest of this entry »