16 Jul 2008, 06:40
Generic-user-small

RyanL (10 posts)

(from Everyday Active Record > multi model form for attachments)

i will look through and try to back trace the data from the log. Thanks for the tip. It strange, the other data in event will be updated, so its calling the update action. Its so weird.

page:
Parameters: {“commit”=>”Update”, “authenticity_token”=>”...”, “_method”=>”put”, “action”=>”update”, “id”=>”2-advertising”, “controller”=>”admin/pages”, “page”=>{“body”=>”Adveritsing\r\n--—”, “title”=>”Advertising”, “existing_attachment_attributes”=>{“396”=>{“uploaded_data”=>”“}}}}

event:
Parameters: {“commit”=>”Update”, “authenticity_token”=>”...”, “_method”=>”put”, “event”=>{“event_info(2i)”=>”7”, “name”=>”hello world”, “event_info(3i)”=>”11”, “event_info(4i)”=>”10”, “event_info(5i)”=>”30”, “description”=>”Hello lovely World! This is a test!”, “existing_attachment_attributes”=>{“426”=>{“uploaded_data”=>”“}, “421”=>{“uploaded_data”=>”“}}, “featured_event”=>”1”, “event_info(1i)”=>”2008”}, “action”=>”update”, “id”=>”4-hello-world”, “controller”=>”admin/events”}

16 Jul 2008, 06:05
Avatar_mw_large_pragsmall

Christophe Porteneuve (63 posts)

(from Prototype and script.aculo.us > prototype toggle with image rollover?)

Well, that’s a way to have it work. I dislike inline event handlers, but they sure work in this case. And just changing the src attribute when reacting to events is bound to be faster and feel smoother than a full-blown update call that will cause a larger DOM update.

What I don’t really get is why you keep using update with static contents instead of having the markup present in the page already, perhaps hidden to start with, and just toggle visibilities…

16 Jul 2008, 04:36
Ryanirelan_headshot_48x48_pragsmall

Ryan Irelan (218 posts)

(from Building a Dynamic Website with ExpressionEngine > How to make exp tags red in TextMate)

BTW, I’m using the BBEdit theme with the Inconsolata font. Some people find it easier to follow along if everything is the same color. :)

16 Jul 2008, 03:25
Generic-user-small

ramkaka (31 posts)

(from Developing Facebook Platform Applications with Rails > infinite sessions in old profile)

Hey,

For the new profile, we can request users to add infinite_sessions by setting promptpermission in the form. How do we do this for the old profile? promptpermission does not seem to work for the old profile.

Thanks.

16 Jul 2008, 02:09
Photo_34_pragsmall

Eric Wiley (3 posts)

(from Building a Dynamic Website with ExpressionEngine > How to make exp tags red in TextMate)

Excellent. Thanks, Ryan!

16 Jul 2008, 01:00
Alain_o_dea_pragsmall

Alain O'Dea (41 posts)

(from Erlang in Practice > How do I get EUnit?)

I solved this by going into Terminal and typing the following:
svn co http://svn.process-one.net/contribs/trunk/eunit eunit

cd eunit
make
cd ..
sudo mv eunit /opt/local/lib/erlang/lib/eunit-2.0b1

After this EUnit was available for me to continue Episode 5. Dropping a library folder — like eunit — containing an ebin into erlang/lib appears to function like dropping a JAR in a Java ext directory.

16 Jul 2008, 00:30
Alain_o_dea_pragsmall

Alain O'Dea (41 posts)

(from Erlang in Practice > Episode 5: Code Style Debate)

analyze/1 written using if expression:

analyze(N) ->
  if
    N rem 15 == 0 ->
      fizzbuzz;
    N rem 5 == 0 ->
      buzz;
    N rem 3 == 0 ->
      fizz;
    true ->
      N
  end.

analyze/1 written using pattern matching and guards:

analyze(N) when N rem 3 =:= 0 andalso N rem 5 =:= 0 -> fizzbuzz;
analyze(N) when N rem 3 =:= 0 -> fizz;
analyze(N) when N rem 5 =:= 0 -> buzz;
analyze(N) -> N.

generate_sequence/2 written using a case expression:

generate_sequence(Pid, N) ->
  case is_number(N) of
    false ->
      exit({badarg, N});
    true ->
      Pid ! {generate, self(), N},
      receive
        {ok, Result} ->
          Result
        after 1000 ->
          {error, timeout}
      end
  end.

generate_sequence/2 written using pattern matching and guards:

generate_sequence(Pid, N) when is_integer(N) ->
  Pid ! {generate, self(), N},
  receive
    {ok, Result} ->
      Result
    after 1000 ->
      {error, timeout}
  end;
generate_sequence(_, N) -> exit({badarg, N}).

generate_fizzbuzz_list/1 written using explicit recursion:

generate_fizzbuzz_list(N) ->
  generate_fizzbuzz_list(1, N, []).

generate_fizzbuzz_list(Pos, N, Accum) when Pos =< N ->
  generate_fizzbuzz_list(Pos + 1, N, lists:append(Accum, [analyze(Pos)]));
generate_fizzbuzz_list(Pos, N, Accum) when Pos > N->
  Accum.

generate_fizzbuzz_list/1 written using list comprehensions:

generate_fizzbuzz_list(N) ->
  [analyze(Value) || Value <- lists:seq(1, N)].

What do you think?

15 Jul 2008, 23:54
Ryan_bates_cropped_pragsmall

Ryan Bates (60 posts)

(from Everyday Active Record > multi model form for attachments)

The HTML looks correct. Are you certain the page model is behaving correctly? It’s very strange one model would behave differently than another. There must be some difference between the two.

If you problem is with what is being saved to the database on edit, then start at the database SQL query which saves the attachment and work your way back. Check your log to see what queries and parameters are being sent in the request. And put “logger.debug …” tracers in your app to see if you are getting the file attachment data.

This way you can find out exactly where the attachment file data is getting lost which should narrow down your problem.

15 Jul 2008, 22:25
Ryanirelan_headshot_48x48_pragsmall

Ryan Irelan (218 posts)

(from Building a Dynamic Website with ExpressionEngine > How to make exp tags red in TextMate)

Hey, Eric. Thanks for the message and I’m glad you’re enjoying the series! I’m using a custom EE bundle to make the code highlight (and for shortcuts). You can get it here:

http://www.chrisruzin.net/entry/textmate_expres…

15 Jul 2008, 21:52
Generic-user-small

Steve Sanders (1 post)

(from Agile Web Development with Rails (2nd edition) > file sharing)

I am looking for options for file sharing at my web site. I would like something similar to the file sharing solution at http://www.9dx.com but I am looking for something that is free. I don’t care about web site design, I’m interested in file uploading. I need a way for people to submit art work to me which I can then evaluate and post on my web site. Some of the art can be rather large, more than 20 megabytes. If anyone can recommend a solution or has experience with a solution I would be very appreciative.