Skip to content


Rails Summer of Code – Week 5

Welcome to Rails Summer of Code. I’m leading at University of Texas in Austin class through the excellent Agile Web Development with Rails (beta version for Rails 3).a

Rails Summer of Code, Week 5, July 22, 2010 from Cindy Royal on Vimeo.

Rails3 Summer of Code – Week 5

This week I cover data flow from the view to the controller, including forms, links, buttons, routes, view_helpers, RESTful routes, paths, and a while lot of other goodies. I wind up the presentation with cryptographic hashes and their uses in user authentication, and other areas.

Posted in Ruby On Rails. Tagged with , , , , , .

Rails Summer of Code – Week 4

Welcome to Rails Summer of Code. I’m leading at University of Texas in Austin class through the excellent Agile Web Development with Rails (beta version for Rails 3).

Rails Summer of Code, Week 4, July 15, 2010 from Cindy Royal on Vimeo.

This week I cover error handling in ruby (begin-rescue-end) and rails (logger and object.errors) I then move to talk about (Asynchronous Javascript) Ajax in general including common caveats,  I then talk about Ajax with rails 3.

UT on Rails3 – Week 4

For those of you interested in webSockets which I breifly touched on:
Check out this jQuery websocket library . You can also use the Juggernaut plugin if you’re using Ruby on Rails.
In this presentation, i mention facebook chat, and observers but it does appear that websockets are being used http://www.facebook.com/note.php?note_id=14218138919 .

Posted in Ruby On Rails, Web Development. Tagged with , , , .

Rails Summer of Code – Heroku Deployment Assignment

Your mission is to get a website up and running online using Heroku. To prove it’s your site, you need to put your name on the site. If you don’t want to use the Depot application, you can use the Demo application, or just upload your own scaffold. I’m not looking for anything fancy, just an application that renders.

Right now the default heroku server doesn’t support rails3, so we will need to do some minor modifications, the direct documentation can be found here:  http://docs.heroku.com/rails3#serving-static-assetshttp://docs.heroku.com/bamboo ,  and  http://docs.heroku.com/quickstart

For a play by play of how to do it follow these directions, and post to the list if you have any questions:

1) Get your application working

2) Add this line of code to : config/environments/production.rb

config.serve_static_assets = true

3) Then you need to install git On a Mac, Windows, or UNIX/Linux
4) In terminal (or command prompt) navigate to your application then execute:

git init
git add .
git commit -m "new app"

5) Sign up through heroku then install the heroku gem:

sudo gem install heroku
heroku keys:add
  Enter your Heroku credentials.
  Email: joe@example.com
  Password:
  Uploading ssh public key /Users/joe/.ssh/id_rsa.pub

6) Deploy your app (still in terminal)

heroku create --stack bamboo-ree-1.8.7 --remote trybamboo
git push trybamboo master

7) Confirm the application is still working by going to the url listed in the output of your terminal. Like:  http://glowing-wind-35.heroku.com/ you will also want to migrate the database:

heroku rake db:migrate --stack bamboo-ree-1.8.7 --remote trybamboo

8) Once you have any errors ironed out, then migrate your heroku install to the main server:

heroku stack:migrate bamboo-ree-1.8.7
git push heroku master
heroku rake db:migrate

9) If you got an error in (8) then you may need to force a rebuild if you didn’t make changes to your code:

heroku stack:migrate bamboo-ree-1.8.7
echo >> Rakefile && git commit -a -m "migrating to bamboo stack"
git push heroku master

10) Now when you make any changes to your application and want to re-deploy you can:

git add .
git commit -m "summary of my changes here"
git push heroku master

Give that a shot, and let me or the group know if you have any problems.  I expect to see an application online per-student by Wednesday evening. That means I expect lat minute questions on the mailing-list by Tuesday. (hint: try it right now, seriously quit watching cartoons, take 10 minutes and deploy an app…its fun! )

Good luck and happy heroku-ing.

Posted in Ruby On Rails. Tagged with , , , , , , .

Rails Summer of Code – Week 3

Welcome to Rails Summer of Code.  I’m leading at University of Texas in Austin class through the excellent Agile Web Development with Rails (beta version for Rails 3).

Rails Summer of Code, Week 3, July 8, 2010 from Cindy Royal on Vimeo.

This week I cover functional testing, has_many, belongs_to, HABTM, has many :through, and the association database structure. I finish up the section with some impromptu hacking to demonstrate how you can move controller logic to the model, to create re-usable code chunks.

Posted in Ruby On Rails, Uncategorized. Tagged with , , .

Rails Summer of Code – Week 2

Welcome to my Rails Summer of Code Series. Week 2

Rails Summer of Code, Week 2, July 1, 2010 from Cindy Royal on Vimeo.

Welcome to Rails Summer of Code.  I’m leading at University of Texas in Austin class through the excellent Agile Web Development with Rails (beta version for Rails 3). This second week I focused on ruby data structures, and the difference between class and instance methods. I then talked about migrations, scaffolding, generators, validation, and unit tests. Recommended Reading: Chapters 3, 4 & 5

Posted in Ruby On Rails. Tagged with , , , , , , , , .

Rails Summer of Code – Week 1

Welcome to Rails Summer of Code.  I’m leading at University of Texas in Austin class through the excellent Agile Web Development with Rails (beta version for Rails 3). This first week I introduce DRY, Convention over Configuration, MVC Architecture, ORMS, the concept of a RESTful web service, and briefly discuss ruby versus rails. Recommended Reading: Chapters 1 & 2

Rails Summer of Code – Week 1, June 24, 2010 from Cindy Royal on Vimeo.

Rails Summer of Code – Week 1, June 24, 2010 from Cindy Royal on Vimeo.

This is a first run class, so if you have some constructive criticisms, let me know!

Get your your book, watch the video, and get your Rails on!

Posted in Ruby On Rails. Tagged with , , , , , , .

Authlogic oauth_button in Rails 3

I’ve been playing with oauth in rails 3 recently, and using the Authlogic-Oauth gem. Everything worked, but when i used the ViewHelper oauth_button, it rendered the raw html text on the page instead of  the button. After a quick check it turns out that for some reason rails doesn’t think the view is creating “html safe” text. You can fix this by changing this helper method:

<gem env install path>/gems/authlogic-oauth-1.0.8/lib/authlogic_oauth/helper.rb

def oauth_button(name, options = {})
 "<input type='submit' value='#{options[:value]}' name='#{name}' id='user_submit' class='#{options[:class]}'/>".html_safe
end

Good luck and happy Oauth-ing!

Richard Schneeman

Disposable Email

Posted in Ruby On Rails. Tagged with , , , , , .

Idea – Colorblind Graph Helper

As some of you may know, i’m slightly colorblind, not enough to run stop-lights, but enough to not be considered for the Naval Academy. Anywhoo, nothing frustrates me more, than running finding the exact information I need, only to have it safely hidden behind very close colors in a graph. For example take a look at this post on benchmarking web servers. Not only are some of the colors very close shades, the lines are close together which makes this about as helpful as a cat playing piano to me.

Side note: neither the X or Y axis are labeled with units, a personal pet peave of mine…thank youGeorgia Tech ME department.

So what would I propose to help out my color-blind brethren? What about an online utility that took a picture, and mapped its RGB values to a coordinate system, then overlayed a clickable interface, so when i clicked on the color in the legend, all other pixels on the screen of the same RGB value would flash, or change colors to something user selectable. That would be AMAZING!! Is that dark green, or blue? Who cares! The one i’m interested in is flashing! It wouldn’t just be useful to color blind people, but to anyone with an indecipherable graph on their hands! Making graphs easy to read, and still containing all useful information is very difficult, so I’m sure this scenario occurs more often than not.

How hard would it be, what tools would i use? I ‘m not 100% sure. Ideally, the mapping would occur server-side, i’m fairly comfortable with RMagick, then the overlay and color changing would occur client side, maybe some awesome javascript image manipulation library. The point is, this would be super helpful to me, and maybe kinda sorta helpful to other people. Would any other color-blind (or not) people be interested in this type of functionality? Any other types of color-blind conundrums a similar situation may be able to help out?

Power to the (color-blind-ish) people!!

Posted in Uncategorized.

Stack Overflow Style Notifications – Using Jquery

Have you seen Stack Overflow? Besides the great content, they have excellent user interface elements that flow seamlessly together. When you visit, an orange notification bar instantly jumps out at you, yet is easily dismissed. I thought this was a great example of notifications done right, so I wondered how I might achieve a similar effect.

First lets take a look into my approach, and then I’ll talk about my implementation.

Stack overflow notification demo

Download Files View Demo

The Approach

The notifications use an animation to grab the users attention. For the animation I decided to use the jquery javascript library. It is very easy to use and has several pre-built animations such as fadeIn and fadeOut.

Once a user dismisses a notification they should never see it again. To remember when a user dismisses the notification, I decided to use http cookies.  These cookies allow us to save a value in the user’s browser, so when the user clicks dismiss they create a cookie on their local machine. Then the next time they visit the webpage, the page will see that they already have the cookie, and the notification will not be displayed.

Alternatively, if the webpage required a log-in, then I could have stored this data in a database and associated it with a user, but by utilizing cookies I can apply this technique to any web page without the need for any server side scripting (PHP, Ruby on Rails, etc.).

After looking into several ways to get and set cookies I decided to use the jquery cookies plugin which allowed me to dynamically set cookies without a page refresh.

Now that you know my approach to the problem lets take a look at the implementation.

The Implementation

For the fade in fade out animation I used Jquery. You can use the GoogleAPI copy of the library by placing this code in your webpage:

 <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js" type="text/javascript"></script>

Next I downloaded the jquery cookies plugin and included it in my webpage. To create a cookie named notificationBar and give it the value “closed” we can use the plugin and execute this command:

$.cookie('notificationBar', 'closed');

After we have created the notificationBar cookie we can get its value by executing this command:

$.cookie('notificationBar');

this command will now return the value “closed”.

Next I added the html for the notification that will be displayed:

<div id = "topannounce" class = "announce" style = "display:none;">
   This Is a Notification from <a href = "http://thinkbohemian.com" target = "_blank">ThinkBohemian</a>
    <a href = "#" onclick = "$.cookie('notificationBar', 'closed');
        $('#topannounce').fadeOut('slow')">X</a>
 </div>

By default it is hidden using:

style = "display:none;"

Using jquery we can fadeIn the notification unless the notificationBar cookie has been set to “closed“.  To accomplish this I added these lines of javascript to the page:

<script type="text/javascript">
 $(document).ready(function(){
   if ($.cookie('notificationBar') != 'closed') {
     $('#topannounce').fadeIn('slow');
   }
 });
 </script>

Then I styled my HTML with a little CSS, and the effect was complete. My webpage has its very own dismissible notification bar:  View the demo of the notification in action.

Richard Schneeman: @ThinkBohemian

I used this effect to notify visitors to  WhySpam.Me, my disposable email service,  about the launch of ShadyEmail.com, the fun way to hide your email and make it questionably suspicious.

Posted in Web Development, javascript, jquery. Tagged with , , , , , , , , , , , , .

How I got WhySpam.Me from Page Rank 0 to 4 in Four Months

Back in January I got serious about improving, my disposable email app, WhySpam.Me’s search engine ranking. I started religiously checking Hacker News and paying specific attention to search engine optimization (SEO) articles. Since then i’ve gone from page rank (PR) zero to four in a little under four months, you can see for yourself using prchecker or rapidSiteCheck. This is the story of how I did it:

Page Rank 0 to 4 in Four Months

Posted in Musings, Web Development, systems administration. Tagged with , , , , , .