4 hours ago
Jgb-phone_small Jon Gretar B... 1 post

Topic: A Peek at Computer Electronics / Printed version

+1 for printed version.
I hate reading off the screen for too long.

 
11 hours ago
England-small_small Brian Marick 20 posts

Topic: RubyCocoa / Controllers and Cocoa

I’m going to introduce an NSWindowController in the chapter I’m writing right now, where it’ll be used for a preference pane. Since so much of what NSWindowController does is tied to assumptions about a document-centric architecture, I’m planning on putting off most discussion until I have a chapter where I migrate the log from an ephemeral stream of text to a save-able document.

I was planning on moving the log from a stream of text in a text box to an editable tree structured view. I’m starting to wonder if I’ll have the pages to do that, though.

My teaching style tends toward the bottom up, so I’m more likely to show how to use lower-level building blocks before higher-level ones that (often) replace them. I’m not dogmatic about that, though.

 
11 hours ago
England-small_small Brian Marick 20 posts

Topic: RubyCocoa / Drag-and-drop example?

I’ve put a drag-and-drop example onto my plan. It will be dragging a directory from the Finder and dropping it onto a table field that holds a pathname.

Page limit is going to be a problem, so it might not make it in.

 
12 hours ago
Head_small Mike Mangino 91 posts

Topic: Developing Facebook Platform Applications with Rails / fb_comments not working

I think we eventually got this worked out on the Facebooker mailing list. I’ll post the solution here too in case anyone else runs into this.

When using fb:comments and fb:board, the callback url you specify must support both GET and POST requests. If you are using RESTFUL rails, you may need to add a route specifically for the callback as mentioned on page 126 of the most recent beta.

It took me a long time to figure this out. It’s a really subtle and tricky bug.

 
12 hours ago
Head_small Mike Mangino 91 posts

Topic: Developing Facebook Platform Applications with Rails / Using form_tag within FB app and Facebooker routes

I think the problem is in a slightly different place than you think. Your form is generating a POST form.

You showed the code:


 <% form_tag(search_products_url, :canvas => :true) %>
  <%= text_field_tag(:keyword, params[:keyword]) %>
  <% end %>

What you probably want is:


 <% form_tag(search_products_path, :method=>"get") do %>
  <%= text_field_tag(:keyword, params[:keyword]) %>
  <% end %>

Using search_products_url would work as well. (You don’t need to specify :canvas=>true. If the request is from a canvas page, the URL will be for a canvas page)

By default, form_tag creates posts. If you want it to use gets, you need to specify the method.

 
12 hours ago
Samr_small_small Sam Ruby 175 posts

Topic: Agile Web Development with Rails, 3rd Edition / Rails 2.2 features in this book

Assuming that the beta of 2.2 happens shortly, the bulk of the next beta of the book will be based on 2.1.1 and will have been tested against the beta of 2.2. There will be a new chapter which describes how to enable depot for translation, this chapter (only) will require 2.2.

 
14 hours ago
Generic-user-small SoftMind 3 posts

Topic: Agile Web Development with Rails, 3rd Edition / Rails 2.2 features in this book

Hi,

Good News to Share today.

David has just announced this on his blog…” Next upcoming release will be Rails 2.2 beta which is quite close.”

Here’s the link
http://weblog.rubyonrails.org/2008/9/5/rails-2-1-1-lots-of-bug-fixes

Rails 2.1.1 was announced today and this news are covered in that blog.

I was more than happy to see that many folks thinks like me here regarding Rails 2.2 coverage and it would be a great loss to have a book without rails 2.2

Pl. let your support flow here..

Thanks

SoftMind

 
18 hours ago
Generic-user-small Paul Covell 2 posts

Topic: Developing Facebook Platform Applications with Rails / Using form_tag within FB app and Facebooker routes

Ok I have solved the IncorrectSignature error explained above.

The error can be reproduced by using :method => :get in the form_tag (in my case it was instead an unclosed form tag earlier on causing a get request—but the results are the same).

The workaround for getting search terms into the URL seems to be a redirect within the action:


def search
  if request.post?
    redirect_to search_products_url(:keyword => params[:keyword])
    return
  end

  ...
end

This may be unavoidable given the structure of:

Browser <> Facebook <> App

Anyone confirm this?

 
20 hours ago
Generic-user-small Paul Covell 2 posts

Topic: Developing Facebook Platform Applications with Rails / Using form_tag within FB app and Facebooker routes

I am building a search query and so I would like the behavior to be like this:


GET /products/search --> index page + search input box
GET /products/search?keyword=blah&category=blah --> search results + refine search 
GET /products/search?keyword=blah&category=blah&page=3 --> 3rd page, for example

Products is RESTful, so I also use GET /products/<id>/show &c.

routes.rb:

map.resources :products, :collection => { :search => :get }

products_controller.rb:


  def search
    @products = search_results ... # abridged
  end

search.fbml.erb:


  <% form_tag(search_products_url, :canvas => :true) %>
  <%= text_field_tag(:keyword, params[:keyword]) %>
  <% end %>

Generates HTML:


<form action="http://apps.facebook.com/**canvas**/products/search" canvas="true" method="post">
<input id="keyword" name="keyword" type="text" />
</form>

Which, when data is entered, generates a GET to my application (dev log)


Processing ProductsController#search (for 127.0.0.1 at 2008-09-05 12:24:29) [GET]
 Parameters: {"fb_sig_time"=>"1220588633.3177", "category"=>"All", "fb_sig"=>"***", "fb_sig_in_new_facebook"=>"1", "_method"=>"GET", "fb_sig_locale"=>"en_US", "action"=>"search", "fb_sig_session_key"=>"***", "fb_sig_position_fix"=>"1", "fb_sig_in_canvas"=>"1", "fb_sig_request_method"=>"GET", "controller"=>"products", "fb_sig_expires"=>"1220675030", "fb_sig_added"=>"1", "fb_sig_friends"=>"<snip>", "fb_sig_api_key"=>"***", "keyword"=>"share", "fb_sig_user"=>"***", "fb_sig_profile_update_time"=>"1214711945"}

Finally leading to the error:


Facebooker::Session::IncorrectSignature (Facebooker::Session::IncorrectSignature):
    /vendor/plugins/facebooker/lib/facebooker/rails/controller.rb:103:in `verify_signature'
    /vendor/plugins/facebooker/lib/facebooker/rails/controller.rb:88:in `verified_facebook_params'
    /vendor/plugins/facebooker/lib/facebooker/rails/controller.rb:32:in `facebook_params'
    /vendor/plugins/facebooker/lib/facebooker/rails/controller.rb:72:in `capture_facebook_friends_if_available!'
    /vendor/plugins/facebooker/lib/facebooker/rails/controller.rb:25:in `set_facebook_session'
    /usr/local/lib/ruby/gems/1.8/gems/activesupport-2.1.0/lib/active_support/core_ext/object/misc.rb:28:in `returning'
    /vendor/plugins/facebooker/lib/facebooker/rails/controller.rb:23:in `set_facebook_session'
    /vendor/plugins/facebooker/lib/facebooker/rails/controller.rb:167:in `ensure_authenticated_to_facebook'
I am open to other ways of doing it, but I do like having the search parameters in the URL for bookmarking/sending to others.
  • If I reclassify “search” as a “post” in routes.rb then it will work but I have to use another action for the index page and I lose the URLs.
  • If I create a new action “search-update” as a “POST” and then redirect to “search” as a GET, this will work (and it keeps the URL), but it seems both inefficient and fragile.

Is there a correct recipe for this behavior? I assume other people are building searches or other form input not directly related to an ActiveRecord object, so I think more treatment would be generally valuable. In this case, it would be nice to know more about what’s going on under the hood in Facebooker—I know that it is doing some magic to make RESTful routes work in the first place. My next stop is to read the code, but I was hoping to avoid this.

Thanks for any help.

Cheers,
-Paul

 
21 hours ago
Generic-user-small Daniel Bullok 1 post

Topic: Pragmatic Version Control Using Git / moving code between repositories?

Hi.
I just bought the beta book this week. It’s very good. I’ve been hoping to find out how to move code between two repositories, which doesn’t seem to be covered in the book yet (or I somehow missed it). In subversion, I put all of my code in one repository. While working on a project, I very frequently end up writing some code that I’ll eventually use elsewhere. I almost never pull this code out of the project and into a library until I need it for a second project. Subversion makes this quite easy if your project and the library are in the same repository (svn move). You can accomplish the same thing in git if your code is in the same repository, but using a single git repository for all your code isn’t such a good idea. So is there an easy way to move or copy code from one git repository into another while still retaining the history?
Thanks.
-Dan

 
Sep 4, 2008
Generic-user-small Tom Fillmore 1 post

Topic: Agile Web Development with Rails, 3rd Edition / Rails 2.2 features in this book

Ditto – longer beta, add more value to the book with 2.2

BTW – the book rocks.. 8-)

 
Sep 4, 2008
Userpic_small Christopher ... 1 post

Topic: RubyCocoa / Controllers and Cocoa

Rather than defining pure Ruby controller classes, the book should show how to leverage the Cocoa controller classes. For example, the WindowController class descends from Controller rather than NSWindowController; it should really be a subclass of Cocoa’s NSWindowController class, so it can take advantage of the built-in Cocoa functionality.

Similarly, presenting the log via a “tree-structured view” — which on Mac OS X is called an outline view — should be done using an NSTreeController.

Cocoa is not Rails, it’s a distinct framework with its own architecture. Developers, especially those just learning the framework, need to learn to follow the architecture provided by Cocoa to both get the best experience developing with it and take the best advantage of the framework’s features.

 
Sep 4, 2008
Generic-user-small Allen Walker 18 posts

Topic: Developing Facebook Platform Applications with Rails / fb_comments not working

I have tried both specifying a callback and not, neither works. Apparently when the user clicks post it is not posting to the comments tag properly. Anyway here’s my code:

<%=fb_comments(“comments_for_comment_lesson”, true, true, 20,:showform => true, :title => “Comment Lesson Comments”) %>

Straight from the facebooker_tutorial just to try to get it to work.

 
Sep 4, 2008
Generic-user-small Don Albertson 3 posts

Topic: Mastering Dojo / dojo data chapter examples not working

This chapter needed a Q/A team to validate it. So far, with 2 titles that I’ve purchased I’m deeply disappointed in the Pragmatic series. Neither one would qualify as a shippable product.

 
Sep 4, 2008
Generic-user-small Daniel Wiesmann 1 post

Topic: Agile Web Development with Rails, 3rd Edition / Rails 2.2 features in this book

+1 on 2.2 coverage.

 
Sep 4, 2008
Generic-user-small Tan YL 17 posts

Topic: Agile Web Development with Rails, 3rd Edition / highlight effect

lol i solved it u wouldn’t believe how stupid the answer is. i have to make a 2nd @lineprice2 = SglineItem.find(:all, :conditions => “sguser_id =#{params[:ad]}”) after the if loop because the @lineprice is still referencing the old object which had the old list. i knew it wasn’t anything to do with the rjs. thanks for your help sam

 
Sep 4, 2008
Generic-user-small Tan YL 17 posts

Topic: Agile Web Development with Rails, 3rd Edition / highlight effect

sgpanel.html.erb:

< ul class=”panes” id=”panecontrol1”>
< li id=”vendor_pane” class=”pane-selected”>

< div id=”calculator”>
<= render :partial => ‘calculator’, :id=> @sguser.id, :object => {@item,@lineprice}>
< /div>

< /li>
< li id="part_pane" class="pane-unselected">
< /li>
< li id="map_pane" class="pane-unselected">
< /li>
< li id="notes_pane" class="pane-unselected">
< /li>
< ul>

_add_to_cart.html.erb:
<table>
<% for product in @lineprice %>

<% if product.groceries.id == @item.groceries_id %>
   <tr id="highlighted">
   <% else %>
   <tr>
   <% end %>
      <td><%= product.groceries.brand %></td>
     <td><%= product.groceries.name %></td>
     <td><%= product.quantity %></td>
     <td><= qx(product,"c") %>< totalC += qx(product,"c")%></td>
     <td><= qx(product,"n") %>< totalN += qx(product,"n") %></td>
     <td><= qx(product,"s") %>< totalS += qx(product,"s") %></td>
     <td><= qx(product,"g") %>< totalG += qx(product,"g") %></td>
     <td><= qx(product,"ca") %>< totalCa += qx(product,"c") %></td>
     <td>item:<= @item.groceries_id>Product:<%= product.groceries.id %></td>
     <td><= cheapest=product.groceries.supermarket.attributes.except('id', 'groceries_id','created_at','updated_at').values.min %> <= Groceries.namecompare2(product) >< totalCh += cheapest %></td>
 </tr>
<% end %>
<table>
-------------------------

add_to_cart contains the full replacement but the weird thing is that i need to refresh the whole page to see the new product. It just doesn’t make sense. I am nearly doing the same things that u are doing in depot except using mysql instead of a session to store data

 
Sep 4, 2008
Img_mike_small Mike Bailey 1 post

Topic: Agile Web Development with Rails, 3rd Edition / Rails 2.2 features in this book

I’d be happy to wait for 2.2 to be covered.

 
Sep 4, 2008
Samr_small_small Sam Ruby 175 posts

Topic: Agile Web Development with Rails, 3rd Edition / highlight effect

You certainly can replace the page in JS.

Perhaps it is the formatting, and perhaps you haven’t provided enough information.

Your rjs file has two lines. The first refers to an id named ‘calculated’ and a partial named ‘add_to_cart’. I can find neither in the text you have provided. Take a look at your HTML, and make sure that the element with the id named ‘calculated’ includes the portions of the table you want replaced, and that the partial named ‘add_to_cart’ contains a full and suitable replacement.

Once that is in place, the second line should have no problem.

 
Sep 4, 2008
Small_small Steinar Gísl... 1 post

Topic: Erlang in Practice / How do I get EUnit?

Has anyone had trouble using Eunit on Windows?
Tried the source in the bundle for windows, it didn’t work for me.
I also downloaded it using the path above (using cygwin) and build the eunit from scratch and compiled the source (in cygwin), but I keep getting this error

/test_fizzbuzz.erl:none: error in parse transform ‘eunit_autoexport’: {undef, [{eunit_autoexport, parse_transform, .... etc.

when running c(test_fizzbuzz) in the erlang shell.

The error appeaers when I add the line:
-include_lib(“eunit/include/eunit.hrl”).

I am not suburb at reading erlang error messages, so if anyone can point me to the right direction it would be appreciated.

 
Sep 4, 2008
Generic-user-small Tan YL 17 posts

Topic: Agile Web Development with Rails, 3rd Edition / highlight effect

“Or it can send down Javascript instructions which causes either the attribute itself or even an entire row to be inserted into the DOM.”

wait how come in your example its possible to add a new line to the table but in mine i can’t pass a new row in? aren’t we doing essentially the same taking replacing the page with a totally new page and allowing the for loop to get all the objects inside?

 
Sep 3, 2008
2591288292_11cec5acd0_b_small Antonio Subi... 5 posts

Topic: Hello, Android / Update

Thanks for the quick update, Ed!

 
Sep 3, 2008
Generic-user-small Ira Davis 2 posts

Topic: The Ruby Object Model and Metaprogramming / An idea for a future installment

Do you suppose you could cover the metadata for an object? That is if Ruby exposes this. I’ve really enjoyed the series and I think it has helped my understanding of object orientation in general and certainly helped my understanding or Ruby.

 
Sep 3, 2008
Generic-user-small Yvan Cottyn 1 post

Topic: Agile Web Development with Rails, 3rd Edition / Rails 2.2 features in this book

I wouldn’t mind neither to wait a little longer for the printed copy if 2.2 were covered.

 
Sep 3, 2008
Samr_small_small Sam Ruby 175 posts

Topic: Agile Web Development with Rails, 3rd Edition / highlight effect

Good analysis, but wrong conclusion. Permit me to explain.

The data is being saved to the database fast enough. In fact it is saved right when you ask it too. But if you look at your controller, the next thing you do is respond with javascript. That javascript will tell the client how to highlight a field that has a certain id attribute on it, but at no point in this processing does the server actually return an updated page to the client with the new attribute or line in it.

This can be done in a number of ways. Each require manipulating the DOM. The server can send down a partial, if there is JavaScript code on the client that “catches” this and knows where to insert it. Or it can send down Javascript instructions which causes either the attribute itself or even an entire row to be inserted into the DOM.

But at this point, we are going beyond Rails. Rails, of course, will be happy to deliver the partial or the JavaScript, but learning more about Prototype and script.aculo.us may be helpful before tackling this problem. I’m not an expert on those technologies myself – I learned how to do these tasks with raw JavaScript and get by with that knowledge—an approach I wouldn’t recommend to anyone these days.

3329 posts

Page: 1 2 3