Profile

Ajax.Updater and javascript

by Michael Cindrić
17 Mar 2009

Ran into a little problem today which made me think for a second. I have a Javascript function that runs once a calendar control is closed. It just passes a parameter to a action which renders a view nothing fancy.

So my onClose function looks like so

function onClose(cal) {
    var p = cal.params;
    new Ajax.Updater('overlapping', '/visits/new', {
      parameters: { start_date:  p.in...<a href="http://www.sentia.com.au/blog/ajaxupdater-and-javascript"> continue</a>

Profile

Rails 2.3 is out

by Michael Cindrić
17 Mar 2009

Finally Rails 2.3 is out. Officially its tagged as 2.3.2 from memory. So what are you waiting for update already. Just run the following command in your terminal and your on your way. Sorry windows users find your own way

 sudo gem install rails

Check out the release notes here

If you need users the accept the terms of services and privcay policy or your rails application there is a simple way to handle this without a database field or javascript. It's using the validation methods built into rails. Simply add the following code to your User model for example

validates_acceptance_of :terms_of_service

Then in your view add the following to your vie... continue

If your like me and use terminal on you mac you might find yourself wanting to move to a point on the line you just typed. Well there is a simple way that l know at least. Just press and hold the "Option" key and click your mouse anywhere on the line and your cursor will move there.

I know there might be a better way without going back to the evil mouse but, l just don't know it.

Google has some of the best charts on the web. If you ever wanted to have cool pie charts like google here is a simple way to do it. Simply add the following to your application_helper.rb file.

  def google_pie_chart(data, options = {})
    options[:width] ||= 250
    options[:height] ||= 100
    options[:colors] = %w(0DB2AC F5DD7E FC8D4D FC694D FABA32 704948 968144 C08FBC ADD97E...<a href="http://www.sentia.com.au/blog/rendering-google-pie-chart-in-rails"> continue</a>

Profile

Fixing the enter key in ASP.NET with jQuery

by Michael Cindrić
4 Mar 2009

One of the fundamental problems with ASP.NET WebForms is the fact that you can only have one form per page. This jumps up and bites you when you have a set of fields and a button and you want the enter key to submit the form.

In ASP.NET 2.0 they came out with a "fix" for this. You can wrap your fields in a Panel and set the default button:

``` continue

Profile

Setting up gravatar's in your rails app

by Michael Cindrić
4 Mar 2009

Gravatars allow users to configure an avatar to go with a users email address at a central location: http://gravatar.com. Gravatar-aware websites can then look up and display each user's preferred avatar, without having to handle avatar management. This makes life easy on the developer and the user only has to manage one central location.

First step is to get the plugin

ruby scr...<a href="http://www.sentia.com.au/blog/setting-up-gravatars-in-your-rails-app"> continue</a>

Profile

Timezone support in Rails 2.1+

by Michael Cindrić
3 Mar 2009

Setting up Timezone support in the past was a pain, but now with rails 2.1 and above it's easy and done in minutes. Here is what you need to do

# config/environment.rb
config.time_zone = "Pacific Time (US &amp;amp; Canada)"

# controllers/application.rb
before_filter :set_user_time_zone

private
def set_user_time_zone
  Time.zone = current_user.time_zone if logged_in?
end
...<a href="http://www.sentia.com.au/blog/timezone-support-in-rails-21"> continue</a>