Badminton on Rails
RSS icon Home icon
  • Young Wizards

    Posted on July 17th, 2007 Raymond Law No comments

    The Wizards summer camp in Las Vegas has concluded and Glenn Consor has a recap of how our draft picks fare in five games.

    I have always trusted Ernie Grunfeld to make good personnel decisions. He’s done it in New York and Milwaukee, and he has proven it here in Washington. It looks like Dominic McGuire is a steal at 47th. I expected Nick Young to do a little better, but he is ok.

    The tough part to me is choosing between Aaron Miles and Juan Carlos Navarro. Navarro has been a star in the Spanish league, but Aaron Miles has proven himself in the summer league. Personally I would stick with Navarro because he has more of an upside, in case Young needs time to adjust to the NBA and Stevenson still can’t recover his shooting touch since last year’s playoff. Navarro can definitely score in a lot of ways. Our 2 guard has got to help out Arenas.

  • IP geocoding

    Posted on July 17th, 2007 Raymond Law No comments

    rayvinly.com can now geocode your IP address into physical location, and zoom in to make it a little more user friendly. It is using hostip.info to do the IP geocoding.

  • rayvinly.com goes live

    Posted on July 15th, 2007 Raymond Law 1 comment

    My hobby site at http://rayvinly.com finally goes live. You can create your own badminton club or find an existing club to play.

    I only added a few clubs so far because I can’t possibly manage all the existing clubs in the world. I am hoping all the badminton lovers, club owners, organizers, players, … will be able to maintain and update the clubs to make it as helpful as possible.

    Check it out.

  • iPhone drag and drop

    Posted on July 15th, 2007 Raymond Law 1 comment

    I had a chance to play with the iPhone at an Apple store yesterday. I found that if you go to Google Map or any Google Map mashup in Safari, you can’t drag the map! This is because the iPhone interprets your finger dragging as dragging the web page, not the Google Map on the web page.

    The Google Map integrated into the iPhone itself works great though. Is this a bug or am I just missing something? Hopefully Apple fixes this soon because this means all websites that have drag and drop like Ta-da list are not usable (though I have not tried Ta-da list on the iPhone).

    Update: Just headed over to the iPhone Developer Site. According to Apple’s Web Development Guidelines:

    “A few other things to keep in mind about fingers as an input device:
    * There are no gestures to perform cut, copy, paste, drag-and-drop, and text selection operations.
    * The width of a finger limits the density of links on a page. If the links are too close, your users won’t be able to choose a single one.”

    So the answer is no, at least for now.

  • Add FeedFlare to Typo

    Posted on July 13th, 2007 Raymond Law No comments

    Set up your FeedFlare preferences, open themes/scribbish/views/articles/_article.rhtml, and add the following line:

    <script src="http://feeds.feedburner.com/~s/rayvinly?i=<%= link_to_permalink(article,article.title) %>" type="text/javascript" charset="utf-8"></script>

    right before the

    <ul class="meta">

    tag.

  • Using FeedBurner with Typo

    Posted on July 12th, 2007 Raymond Law 1 comment

    You want to run your Typo blog feed through FeedBurner.

    First, go to your blog’s admin page and click on the DESIGN tab. Drag the XML Syndication item from Available Items to Active Sidebar items. Choose either RSS 2.0 or Atom 1.0 according to what you choose when setting up FeedBurner. I selected Articles only because that’s what I want. Remember to click on the Publish changes button.

    In your Typo app, modify vendor/plugins/xml_sidebar/views/content.rhtml to the following:

      <% if articles -%>
      <li><a href="<Your FeedBurner URL>" rel="alternate" type="application/rss+xml"><img src="http://www.feedburner.com/fb/images/pub/feed-icon16x16.png" alt="" style="vertical-align:middle;border:0"/></a>&nbsp;<a href="<Your FeedBurner URL>" rel="alternate" type="application/rss+xml">Subscribe</a></li>
      <% end %>

    Of course you can use whatever image you like. The one shown above is linked to FeedBurner’s standard feed icon. You can use FeedBurner’s Chicklet Chooser to get the HTML code to paste into content.rhtml.

    Another way is to set up a redirect using mod_rewrite in your Apache configuration (thanks to Robby):

      # Redirect typo feeds to FeedBurner
      RewriteCond %{HTTP_USER_AGENT} !^FeedBurner.*$
      RewriteRule /xml/(atom|rss|rss20)/feed.xml$ http://feeds.feedburner.com/rayvinly [R=temp,L]

    In both cases, make sure you go to your blog admin’s SETTINGS tab, scroll to the bottom and click on Empty Fragment Cache.

    Now go to your blog page and click on that Subscribe link to see your FeedBurner feed.

  • Using Textile Editor Helper (TEH) in an Ajax environment

    Posted on July 10th, 2007 Raymond Law 1 comment

    This post shows how to use the Textile Editor Helper via Ajax so that you can retrieve the editor and update its content dynamically instead of a full page reload.

    First follow Mohit’s tutorial to build a Rails app before continuing.

    Now you are ready to add Ajax support to TEH.

    1. Include TEH support (textile-helper.js and textile-helper.css) in your layout (layouts/items.rhtml)

      <%= textile_editor_support %>

    2. Change edit.rhtml to the following

    <h1>Editing item</h1>
     
    <%= link_to_remote "Show the Ajax editor", :url => { :action => :get_ajax_editor } %>
    <div id="ajax_editor"></div>
    <div id="ajax_result"></div>
     
    <%= link_to 'Show', :action => 'show', :id => @item %> |
    <%= link_to 'Back', :action => 'list' %>

    3. Change _form.rhtml to the following

    <% remote_form_for :item, :url => { :action => :update, :id => @item } do |f| -%>
     
    <%= error_messages_for 'item' %>
     
    <!--[form:item]-->
    <p><label for="item_name">Name</label><br/>
    <%= f.text_field 'name'  %></p>
     
    <p><label for="item_descr">Descr</label><br/>
    <%= textile_editor 'item', 'descr' -%></p>
    <!--[eoform:item]-->
    <%= textile_editor_initialize -%>
     
      <%= submit_tag 'Edit' %>
    <% end -%>

    4. Add _ajax_result.rhtml

    <p><b>Name:</b> <%=h @item.name %></p>
    <p><b>Description:</b> <%= @item.descr %></p>

    5. Change items_controller.rb to the following

      def get_ajax_editor
        @item = Item.find(:first)
     
        render :update do |page|
          page.replace_html 'ajax_editor', :partial => 'form'
        end
      end
     
      def update
        @item = Item.find(params[:id])
     
        render :update do |page|
          if @item.update_attributes(params[:item])
            page.replace_html 'ajax_result', :partial => 'ajax_result', :object => @item
          else
            page.replace_html 'ajax_result', 'Item failed to be updated.'
          end
        end
      end

    Now run:

    > script/server

    Go to http://localhost:3000/items , create a new item and click on the Edit link to see how it works. Enjoy!