I have a Post object that I want to access on a page that also contains an iframe. I also need to access the same post object from within the iframe. Does anybody know if there's any way of doing this without having to access the database again to find the post objec (like in the code below)t?
get '/:id' do @post = Post.get(params[:id]) slim :show end
get '/iframe/:id' do @post = Post.get(params[:id]) slim :iframe end
> I have a Post object that I want to access on a page that also contains an
> iframe. I also need to access the same post object from within the iframe.
> Does anybody know if there's any way of doing this without having to access
> the database again to find the post objec (like in the code below)t?
> get '/:id' do
> @post = Post.get(params[:id])
> slim :show
> end
> get '/iframe/:id' do
> @post = Post.get(params[:id])
> slim :iframe
> end
> --
> You received this message because you are subscribed to the Google Groups
> "sinatrarb" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/sinatrarb/-/xVNy0-TDBjAJ.
> To post to this group, send email to sinatrarb@googlegroups.com<javascript:_e({}, 'cvml', 'sinatrarb@googlegroups.com');>
> .
> To unsubscribe from this group, send email to
> sinatrarb+unsubscribe@googlegroups.com <javascript:_e({}, 'cvml',
> 'sinatrarb%2Bunsubscribe@googlegroups.com');>.
> For more options, visit this group at
> http://groups.google.com/group/sinatrarb?hl=en.
Thanks for the reply. That's the only other idea I had of doing it (but I hadn't thought of how to code it, so thanks :)
I guess using JSON would be good if I start updating the iframe with Ajax later. I was hoping there might be another way of avoiding hitting the database twice without having to use sessions and/or JSON, but I guess that the iframe has to be loaded as a separate request.
On Saturday, August 11, 2012 7:14:09 PM UTC+1, DAZ wrote:
> Hi,
> I have a Post object that I want to access on a page that also contains an > iframe. I also need to access the same post object from within the iframe. > Does anybody know if there's any way of doing this without having to access > the database again to find the post objec (like in the code below)t?
> get '/:id' do > @post = Post.get(params[:id]) > slim :show > end
> get '/iframe/:id' do > @post = Post.get(params[:id]) > slim :iframe > end
i suggest
- you consider communicating from parent to iframe; in js, with JSON which
is easier if you are the same domain
- or reconsider hitting database twice; not a big deal.
- or reconsider using iframes.
On Sun, Aug 12, 2012 at 11:52 PM, DAZ <daz4...@gmail.com> wrote:
> Hi Jason,
> Thanks for the reply. That's the only other idea I had of doing it (but I
> hadn't thought of how to code it, so thanks :)
> I guess using JSON would be good if I start updating the iframe with Ajax
> later. I was hoping there might be another way of avoiding hitting the
> database twice without having to use sessions and/or JSON, but I guess that
> the iframe has to be loaded as a separate request.
> Thanks again, cheers,
> DAZ
> On Saturday, August 11, 2012 7:14:09 PM UTC+1, DAZ wrote:
>> Hi,
>> I have a Post object that I want to access on a page that also contains
>> an iframe. I also need to access the same post object from within the
>> iframe. Does anybody know if there's any way of doing this without having
>> to access the database again to find the post objec (like in the code
>> below)t?
>> get '/:id' do
>> @post = Post.get(params[:id])
>> slim :show
>> end
>> get '/iframe/:id' do
>> @post = Post.get(params[:id])
>> slim :iframe
>> end
>> --
> You received this message because you are subscribed to the Google Groups
> "sinatrarb" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/sinatrarb/-/zwMCk6RvHtcJ.
> To post to this group, send email to sinatrarb@googlegroups.com.
> To unsubscribe from this group, send email to
> sinatrarb+unsubscribe@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/sinatrarb?hl=en.
I agree with Alper's suggestions, and mainly the third: *reconsider using
iframes*.. but, if they are really necessary, you can use memcache to store
the response body.. so, you will store the response body in the memcache
when you do the first request, and retrieve the body from memcache when you
do the second request (iframe)
On Sun, Aug 12, 2012 at 5:10 PM, Alper Akgün <alperak...@gmail.com> wrote:
> i suggest
> - you consider communicating from parent to iframe; in js, with JSON which
> is easier if you are the same domain
> - or reconsider hitting database twice; not a big deal.
> - or reconsider using iframes.
> On Sun, Aug 12, 2012 at 11:52 PM, DAZ <daz4...@gmail.com> wrote:
>> Hi Jason,
>> Thanks for the reply. That's the only other idea I had of doing it (but I
>> hadn't thought of how to code it, so thanks :)
>> I guess using JSON would be good if I start updating the iframe with Ajax
>> later. I was hoping there might be another way of avoiding hitting the
>> database twice without having to use sessions and/or JSON, but I guess that
>> the iframe has to be loaded as a separate request.
>> Thanks again, cheers,
>> DAZ
>> On Saturday, August 11, 2012 7:14:09 PM UTC+1, DAZ wrote:
>>> Hi,
>>> I have a Post object that I want to access on a page that also contains
>>> an iframe. I also need to access the same post object from within the
>>> iframe. Does anybody know if there's any way of doing this without having
>>> to access the database again to find the post objec (like in the code
>>> below)t?
>>> get '/:id' do
>>> @post = Post.get(params[:id])
>>> slim :show
>>> end
>>> get '/iframe/:id' do
>>> @post = Post.get(params[:id])
>>> slim :iframe
>>> end
>>> --
>> You received this message because you are subscribed to the Google Groups
>> "sinatrarb" group.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msg/sinatrarb/-/zwMCk6RvHtcJ.
>> To post to this group, send email to sinatrarb@googlegroups.com.
>> To unsubscribe from this group, send email to
>> sinatrarb+unsubscribe@googlegroups.com.
>> For more options, visit this group at
>> http://groups.google.com/group/sinatrarb?hl=en.
> --
> You received this message because you are subscribed to the Google Groups
> "sinatrarb" group.
> To post to this group, send email to sinatrarb@googlegroups.com.
> To unsubscribe from this group, send email to
> sinatrarb+unsubscribe@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/sinatrarb?hl=en.
-- Carlos Eduardo L. Lopes
Skype: carloslopespollares | Twitter: @_carloslopes
> I agree with Alper's suggestions, and mainly the third: *reconsider using
> iframes*.. but, if they are really necessary, you can use memcache to
> store the response body.. so, you will store the response body in the
> memcache when you do the first request, and retrieve the body from memcache
> when you do the second request (iframe)
> On Sun, Aug 12, 2012 at 5:10 PM, Alper Akgün <alperak...@gmail.com> wrote:
> i suggest
> - you consider communicating from parent to iframe; in js, with JSON which
> is easier if you are the same domain
> - or reconsider hitting database twice; not a big deal.
> - or reconsider using iframes.
> On Sun, Aug 12, 2012 at 11:52 PM, DAZ <daz4...@gmail.com> wrote:
> Hi Jason,
> Thanks for the reply. That's the only other idea I had of doing it (but I
> hadn't thought of how to code it, so thanks :)
> I guess using JSON would be good if I start updating the iframe with Ajax
> later. I was hoping there might be another way of avoiding hitting the
> database twice without having to use sessions and/or JSON, but I guess that
> the iframe has to be loaded as a separate request.
> Thanks again, cheers,
> DAZ
> On Saturday, August 11, 2012 7:14:09 PM UTC+1, DAZ wrote:
> Hi,
> I have a Post object that I want to access on a page that also contains an
> iframe. I also need to access the same post object from within the iframe.
> Does anybody know if there's any way of doing this without having to access
> the database again to find the post objec (like in the code below)t?
> get '/:id' do
> @post = Post.get(params[:id])
> slim :show
> end
> get '/iframe/:id' do
> @post = Post.get(params[:id])
> slim :iframe
> end
> --
> You received this message because you are subscribed to the Google Groups
> "sinatrarb" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/sinatrarb/-/zwMCk6RvHtcJ.
> To post to this group, send email to sinatrarb@googlegroups.com.
> To unsubscribe from this group, send email to
> sinatrarb+unsubscribe@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/sinatrarb?hl=en.
> --
> You received this message because you are subscribed to the Google Groups
> "sinatrarb" group.
> To post to this group, send email to sinatrarb@googlegroups.com.
> To unsubscribe from this group, send email to
> sinatrarb+unsubscribe@googlegroups.com.
> For more options, visit this group at http://gro<http://groups.google.com/group/sinatrarb?hl=en>
> --
> Carlos Eduardo L. Lopes
> Skype: carloslopespollares | Twitter: @_carloslopes
> --
> You received this message because you are subscribed to the Google Groups
> "sinatrarb" group.
> To post to this group, send email to sinatrarb@googlegroups.com<javascript:_e({}, 'cvml', 'sinatrarb@googlegroups.com');>
> .
> To unsubscribe from this group, send email to
> sinatrarb+unsubscribe@googlegroups.com <javascript:_e({}, 'cvml',
> 'sinatrarb%2Bunsubscribe@googlegroups.com');>.
> For more options, visit this group at
> http://groups.google.com/group/sinatrarb?hl=en.
I agree with you too, but, store the response body inside a session like
Jason said is overkiil too, because it will consumes a lot of traffic,
decrease performance and other issues that we are now.. memcache is just an
option that works, but it's true that it's too much for a too simple
thing..
On Mon, Aug 13, 2012 at 11:31 AM, Jason Rogers <jacaete...@gmail.com> wrote:
> I think that introducing Memcache for something like this is overkill. If
> Memcache will be leveraged in some other way, that's another story.
> On Monday, August 13, 2012, Carlos Eduardo L. Lopes wrote:
>> I agree with Alper's suggestions, and mainly the third: *reconsider
>> using iframes*.. but, if they are really necessary, you can use memcache
>> to store the response body.. so, you will store the response body in the
>> memcache when you do the first request, and retrieve the body from memcache
>> when you do the second request (iframe)
>> On Sun, Aug 12, 2012 at 5:10 PM, Alper Akgün <alperak...@gmail.com>wrote:
>> i suggest
>> - you consider communicating from parent to iframe; in js, with JSON
>> which is easier if you are the same domain
>> - or reconsider hitting database twice; not a big deal.
>> - or reconsider using iframes.
>> On Sun, Aug 12, 2012 at 11:52 PM, DAZ <daz4...@gmail.com> wrote:
>> Hi Jason,
>> Thanks for the reply. That's the only other idea I had of doing it (but I
>> hadn't thought of how to code it, so thanks :)
>> I guess using JSON would be good if I start updating the iframe with Ajax
>> later. I was hoping there might be another way of avoiding hitting the
>> database twice without having to use sessions and/or JSON, but I guess that
>> the iframe has to be loaded as a separate request.
>> Thanks again, cheers,
>> DAZ
>> On Saturday, August 11, 2012 7:14:09 PM UTC+1, DAZ wrote:
>> Hi,
>> I have a Post object that I want to access on a page that also contains
>> an iframe. I also need to access the same post object from within the
>> iframe. Does anybody know if there's any way of doing this without having
>> to access the database again to find the post objec (like in the code
>> below)t?
>> get '/:id' do
>> @post = Post.get(params[:id])
>> slim :show
>> end
>> get '/iframe/:id' do
>> @post = Post.get(params[:id])
>> slim :iframe
>> end
>> --
>> You received this message because you are subscribed to the Google Groups
>> "sinatrarb" group.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msg/sinatrarb/-/zwMCk6RvHtcJ.
>> To post to this group, send email to sinatrarb@googlegroups.com.
>> To unsubscribe from this group, send email to
>> sinatrarb+unsubscribe@googlegroups.com.
>> For more options, visit this group at
>> http://groups.google.com/group/sinatrarb?hl=en.
>> --
>> You received this message because you are subscribed to the Google Groups
>> "sinatrarb" group.
>> To post to this group, send email to sinatrarb@googlegroups.com.
>> To unsubscribe from this group, send email to
>> sinatrarb+unsubscribe@googlegroups.com.
>> For more options, visit this group at http://gro<http://groups.google.com/group/sinatrarb?hl=en>
>> --
>> Carlos Eduardo L. Lopes
>> Skype: carloslopespollares | Twitter: @_carloslopes
>> --
>> You received this message because you are subscribed to the Google Groups
>> "sinatrarb" group.
>> To post to this group, send email to sinatrarb@googlegroups.com.
>> To unsubscribe from this group, send email to
>> sinatrarb+unsubscribe@googlegroups.com.
>> For more options, visit this group at
>> http://groups.google.com/group/sinatrarb?hl=en.
> --
> --
> Jason Rogers
> --
> You received this message because you are subscribed to the Google Groups
> "sinatrarb" group.
> To post to this group, send email to sinatrarb@googlegroups.com.
> To unsubscribe from this group, send email to
> sinatrarb+unsubscribe@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/sinatrarb?hl=en.
-- Carlos Eduardo L. Lopes
Skype: carloslopespollares | Twitter: @_carloslopes
How does using the session consume a lot of traffic? You're going to make
the same amount of HTTP requests whether you use a session, memcache, or
hit the database every time. (You save yourself only one request if you
communicate between the iframe and parent window via JavaScript.) If the
size of the body is what you're concerned about, again it'll be the same if
you go back to the server despite what implementation you use on the
backend.
carlos.el.lo...@gmail.com> wrote:
> I agree with you too, but, store the response body inside a session like
> Jason said is overkiil too, because it will consumes a lot of traffic,
> decrease performance and other issues that we are now.. memcache is just an
> option that works, but it's true that it's too much for a too simple
> thing..
> On Mon, Aug 13, 2012 at 11:31 AM, Jason Rogers <jacaete...@gmail.com>wrote:
>> I think that introducing Memcache for something like this is overkill. If
>> Memcache will be leveraged in some other way, that's another story.
>> On Monday, August 13, 2012, Carlos Eduardo L. Lopes wrote:
>>> I agree with Alper's suggestions, and mainly the third: *reconsider
>>> using iframes*.. but, if they are really necessary, you can use
>>> memcache to store the response body.. so, you will store the response body
>>> in the memcache when you do the first request, and retrieve the body from
>>> memcache when you do the second request (iframe)
>>> On Sun, Aug 12, 2012 at 5:10 PM, Alper Akgün <alperak...@gmail.com>wrote:
>>> i suggest
>>> - you consider communicating from parent to iframe; in js, with JSON
>>> which is easier if you are the same domain
>>> - or reconsider hitting database twice; not a big deal.
>>> - or reconsider using iframes.
>>> On Sun, Aug 12, 2012 at 11:52 PM, DAZ <daz4...@gmail.com> wrote:
>>> Hi Jason,
>>> Thanks for the reply. That's the only other idea I had of doing it (but
>>> I hadn't thought of how to code it, so thanks :)
>>> I guess using JSON would be good if I start updating the iframe with
>>> Ajax later. I was hoping there might be another way of avoiding hitting the
>>> database twice without having to use sessions and/or JSON, but I guess that
>>> the iframe has to be loaded as a separate request.
>>> Thanks again, cheers,
>>> DAZ
>>> On Saturday, August 11, 2012 7:14:09 PM UTC+1, DAZ wrote:
>>> Hi,
>>> I have a Post object that I want to access on a page that also contains
>>> an iframe. I also need to access the same post object from within the
>>> iframe. Does anybody know if there's any way of doing this without having
>>> to access the database again to find the post objec (like in the code
>>> below)t?
>>> get '/:id' do
>>> @post = Post.get(params[:id])
>>> slim :show
>>> end
>>> get '/iframe/:id' do
>>> @post = Post.get(params[:id])
>>> slim :iframe
>>> end
>>> --
>>> You received this message because you are subscribed to the Google
>>> Groups "sinatrarb" group.
>>> To view this discussion on the web visit
>>> https://groups.google.com/d/msg/sinatrarb/-/zwMCk6RvHtcJ.
>>> To post to this group, send email to sinatrarb@googlegroups.com.
>>> To unsubscribe from this group, send email to
>>> sinatrarb+unsubscribe@googlegroups.com.
>>> For more options, visit this group at
>>> http://groups.google.com/group/sinatrarb?hl=en.
>>> --
>>> You received this message because you are subscribed to the Google
>>> Groups "sinatrarb" group.
>>> To post to this group, send email to sinatrarb@googlegroups.com.
>>> To unsubscribe from this group, send email to
>>> sinatrarb+unsubscribe@googlegroups.com.
>>> For more options, visit this group at http://gro<http://groups.google.com/group/sinatrarb?hl=en>
>>> --
>>> Carlos Eduardo L. Lopes
>>> Skype: carloslopespollares | Twitter: @_carloslopes
>>> --
>>> You received this message because you are subscribed to the Google
>>> Groups "sinatrarb" group.
>>> To post to this group, send email to sinatrarb@googlegroups.com.
>>> To unsubscribe from this group, send email to
>>> sinatrarb+unsubscribe@googlegroups.com.
>>> For more options, visit this group at
>>> http://groups.google.com/group/sinatrarb?hl=en.
>> --
>> --
>> Jason Rogers
>> --
>> You received this message because you are subscribed to the Google Groups
>> "sinatrarb" group.
>> To post to this group, send email to sinatrarb@googlegroups.com.
>> To unsubscribe from this group, send email to
>> sinatrarb+unsubscribe@googlegroups.com.
>> For more options, visit this group at
>> http://groups.google.com/group/sinatrarb?hl=en.
> --
> Carlos Eduardo L. Lopes
> Skype: carloslopespollares | Twitter: @_carloslopes
> --
> You received this message because you are subscribed to the Google Groups
> "sinatrarb" group.
> To post to this group, send email to sinatrarb@googlegroups.com.
> To unsubscribe from this group, send email to
> sinatrarb+unsubscribe@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/sinatrarb?hl=en.
Yes, if you make only one request (parent), store the body inside a
session, and fill the iframe with the body that is already in the session,
i agree that this is the best option..
but i don't know if this works because i rarely work with iframes :/
On Mon, Aug 13, 2012 at 3:04 PM, Jason Rogers <jacaete...@gmail.com> wrote:
> Interesting.
> How does using the session consume a lot of traffic? You're going to make
> the same amount of HTTP requests whether you use a session, memcache, or
> hit the database every time. (You save yourself only one request if you
> communicate between the iframe and parent window via JavaScript.) If the
> size of the body is what you're concerned about, again it'll be the same if
> you go back to the server despite what implementation you use on the
> backend.
> On Mon, Aug 13, 2012 at 10:39 AM, Carlos Eduardo L. Lopes <
> carlos.el.lo...@gmail.com> wrote:
>> I agree with you too, but, store the response body inside a session like
>> Jason said is overkiil too, because it will consumes a lot of traffic,
>> decrease performance and other issues that we are now.. memcache is just an
>> option that works, but it's true that it's too much for a too simple
>> thing..
>> On Mon, Aug 13, 2012 at 11:31 AM, Jason Rogers <jacaete...@gmail.com>wrote:
>>> I think that introducing Memcache for something like this is overkill.
>>> If Memcache will be leveraged in some other way, that's another story.
>>> On Monday, August 13, 2012, Carlos Eduardo L. Lopes wrote:
>>>> I agree with Alper's suggestions, and mainly the third: *reconsider
>>>> using iframes*.. but, if they are really necessary, you can use
>>>> memcache to store the response body.. so, you will store the response body
>>>> in the memcache when you do the first request, and retrieve the body from
>>>> memcache when you do the second request (iframe)
>>>> On Sun, Aug 12, 2012 at 5:10 PM, Alper Akgün <alperak...@gmail.com>wrote:
>>>> i suggest
>>>> - you consider communicating from parent to iframe; in js, with JSON
>>>> which is easier if you are the same domain
>>>> - or reconsider hitting database twice; not a big deal.
>>>> - or reconsider using iframes.
>>>> On Sun, Aug 12, 2012 at 11:52 PM, DAZ <daz4...@gmail.com> wrote:
>>>> Hi Jason,
>>>> Thanks for the reply. That's the only other idea I had of doing it (but
>>>> I hadn't thought of how to code it, so thanks :)
>>>> I guess using JSON would be good if I start updating the iframe with
>>>> Ajax later. I was hoping there might be another way of avoiding hitting the
>>>> database twice without having to use sessions and/or JSON, but I guess that
>>>> the iframe has to be loaded as a separate request.
>>>> Thanks again, cheers,
>>>> DAZ
>>>> On Saturday, August 11, 2012 7:14:09 PM UTC+1, DAZ wrote:
>>>> Hi,
>>>> I have a Post object that I want to access on a page that also contains
>>>> an iframe. I also need to access the same post object from within the
>>>> iframe. Does anybody know if there's any way of doing this without having
>>>> to access the database again to find the post objec (like in the code
>>>> below)t?
>>>> get '/:id' do
>>>> @post = Post.get(params[:id])
>>>> slim :show
>>>> end
>>>> get '/iframe/:id' do
>>>> @post = Post.get(params[:id])
>>>> slim :iframe
>>>> end
>>>> --
>>>> You received this message because you are subscribed to the Google
>>>> Groups "sinatrarb" group.
>>>> To view this discussion on the web visit
>>>> https://groups.google.com/d/msg/sinatrarb/-/zwMCk6RvHtcJ.
>>>> To post to this group, send email to sinatrarb@googlegroups.com.
>>>> To unsubscribe from this group, send email to
>>>> sinatrarb+unsubscribe@googlegroups.com.
>>>> For more options, visit this group at
>>>> http://groups.google.com/group/sinatrarb?hl=en.
>>>> --
>>>> You received this message because you are subscribed to the Google
>>>> Groups "sinatrarb" group.
>>>> To post to this group, send email to sinatrarb@googlegroups.com.
>>>> To unsubscribe from this group, send email to
>>>> sinatrarb+unsubscribe@googlegroups.com.
>>>> For more options, visit this group at http://gro<http://groups.google.com/group/sinatrarb?hl=en>
>>>> --
>>>> Carlos Eduardo L. Lopes
>>>> Skype: carloslopespollares | Twitter: @_carloslopes
>>>> --
>>>> You received this message because you are subscribed to the Google
>>>> Groups "sinatrarb" group.
>>>> To post to this group, send email to sinatrarb@googlegroups.com.
>>>> To unsubscribe from this group, send email to
>>>> sinatrarb+unsubscribe@googlegroups.com.
>>>> For more options, visit this group at
>>>> http://groups.google.com/group/sinatrarb?hl=en.
>>> --
>>> --
>>> Jason Rogers
>>> --
>>> You received this message because you are subscribed to the Google
>>> Groups "sinatrarb" group.
>>> To post to this group, send email to sinatrarb@googlegroups.com.
>>> To unsubscribe from this group, send email to
>>> sinatrarb+unsubscribe@googlegroups.com.
>>> For more options, visit this group at
>>> http://groups.google.com/group/sinatrarb?hl=en.
>> --
>> Carlos Eduardo L. Lopes
>> Skype: carloslopespollares | Twitter: @_carloslopes
>> --
>> You received this message because you are subscribed to the Google Groups
>> "sinatrarb" group.
>> To post to this group, send email to sinatrarb@googlegroups.com.
>> To unsubscribe from this group, send email to
>> sinatrarb+unsubscribe@googlegroups.com.
>> For more options, visit this group at
>> http://groups.google.com/group/sinatrarb?hl=en.
> --
> You received this message because you are subscribed to the Google Groups
> "sinatrarb" group.
> To post to this group, send email to sinatrarb@googlegroups.com.
> To unsubscribe from this group, send email to
> sinatrarb+unsubscribe@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/sinatrarb?hl=en.
-- Carlos Eduardo L. Lopes
Skype: carloslopespollares | Twitter: @_carloslopes
And i was concerning about traffic because if do you have a large body,
make requests with a session that has a big size isn't good (imho, and in
my humble experience :) )
On Mon, Aug 13, 2012 at 3:23 PM, Carlos Eduardo L. Lopes <
carlos.el.lo...@gmail.com> wrote:
> Yes, if you make only one request (parent), store the body inside a
> session, and fill the iframe with the body that is already in the session,
> i agree that this is the best option..
> but i don't know if this works because i rarely work with iframes :/
> On Mon, Aug 13, 2012 at 3:04 PM, Jason Rogers <jacaete...@gmail.com>wrote:
>> Interesting.
>> How does using the session consume a lot of traffic? You're going to make
>> the same amount of HTTP requests whether you use a session, memcache, or
>> hit the database every time. (You save yourself only one request if you
>> communicate between the iframe and parent window via JavaScript.) If the
>> size of the body is what you're concerned about, again it'll be the same if
>> you go back to the server despite what implementation you use on the
>> backend.
>> On Mon, Aug 13, 2012 at 10:39 AM, Carlos Eduardo L. Lopes <
>> carlos.el.lo...@gmail.com> wrote:
>>> I agree with you too, but, store the response body inside a session like
>>> Jason said is overkiil too, because it will consumes a lot of traffic,
>>> decrease performance and other issues that we are now.. memcache is just an
>>> option that works, but it's true that it's too much for a too simple
>>> thing..
>>> On Mon, Aug 13, 2012 at 11:31 AM, Jason Rogers <jacaete...@gmail.com>wrote:
>>>> I think that introducing Memcache for something like this is overkill.
>>>> If Memcache will be leveraged in some other way, that's another story.
>>>> On Monday, August 13, 2012, Carlos Eduardo L. Lopes wrote:
>>>>> I agree with Alper's suggestions, and mainly the third: *reconsider
>>>>> using iframes*.. but, if they are really necessary, you can use
>>>>> memcache to store the response body.. so, you will store the response body
>>>>> in the memcache when you do the first request, and retrieve the body from
>>>>> memcache when you do the second request (iframe)
>>>>> On Sun, Aug 12, 2012 at 5:10 PM, Alper Akgün <alperak...@gmail.com>wrote:
>>>>> i suggest
>>>>> - you consider communicating from parent to iframe; in js, with JSON
>>>>> which is easier if you are the same domain
>>>>> - or reconsider hitting database twice; not a big deal.
>>>>> - or reconsider using iframes.
>>>>> On Sun, Aug 12, 2012 at 11:52 PM, DAZ <daz4...@gmail.com> wrote:
>>>>> Hi Jason,
>>>>> Thanks for the reply. That's the only other idea I had of doing it
>>>>> (but I hadn't thought of how to code it, so thanks :)
>>>>> I guess using JSON would be good if I start updating the iframe with
>>>>> Ajax later. I was hoping there might be another way of avoiding hitting the
>>>>> database twice without having to use sessions and/or JSON, but I guess that
>>>>> the iframe has to be loaded as a separate request.
>>>>> Thanks again, cheers,
>>>>> DAZ
>>>>> On Saturday, August 11, 2012 7:14:09 PM UTC+1, DAZ wrote:
>>>>> Hi,
>>>>> I have a Post object that I want to access on a page that also
>>>>> contains an iframe. I also need to access the same post object from within
>>>>> the iframe. Does anybody know if there's any way of doing this without
>>>>> having to access the database again to find the post objec (like in the
>>>>> code below)t?
>>>>> get '/:id' do
>>>>> @post = Post.get(params[:id])
>>>>> slim :show
>>>>> end
>>>>> get '/iframe/:id' do
>>>>> @post = Post.get(params[:id])
>>>>> slim :iframe
>>>>> end
>>>>> --
>>>>> You received this message because you are subscribed to the Google
>>>>> Groups "sinatrarb" group.
>>>>> To view this discussion on the web visit
>>>>> https://groups.google.com/d/msg/sinatrarb/-/zwMCk6RvHtcJ.
>>>>> To post to this group, send email to sinatrarb@googlegroups.com.
>>>>> To unsubscribe from this group, send email to
>>>>> sinatrarb+unsubscribe@googlegroups.com.
>>>>> For more options, visit this group at
>>>>> http://groups.google.com/group/sinatrarb?hl=en.
>>>>> --
>>>>> You received this message because you are subscribed to the Google
>>>>> Groups "sinatrarb" group.
>>>>> To post to this group, send email to sinatrarb@googlegroups.com.
>>>>> To unsubscribe from this group, send email to
>>>>> sinatrarb+unsubscribe@googlegroups.com.
>>>>> For more options, visit this group at http://gro<http://groups.google.com/group/sinatrarb?hl=en>
>>>>> --
>>>>> Carlos Eduardo L. Lopes
>>>>> Skype: carloslopespollares | Twitter: @_carloslopes
>>>>> --
>>>>> You received this message because you are subscribed to the Google
>>>>> Groups "sinatrarb" group.
>>>>> To post to this group, send email to sinatrarb@googlegroups.com.
>>>>> To unsubscribe from this group, send email to
>>>>> sinatrarb+unsubscribe@googlegroups.com.
>>>>> For more options, visit this group at
>>>>> http://groups.google.com/group/sinatrarb?hl=en.
>>>> --
>>>> --
>>>> Jason Rogers
>>>> --
>>>> You received this message because you are subscribed to the Google
>>>> Groups "sinatrarb" group.
>>>> To post to this group, send email to sinatrarb@googlegroups.com.
>>>> To unsubscribe from this group, send email to
>>>> sinatrarb+unsubscribe@googlegroups.com.
>>>> For more options, visit this group at
>>>> http://groups.google.com/group/sinatrarb?hl=en.
>>> --
>>> Carlos Eduardo L. Lopes
>>> Skype: carloslopespollares | Twitter: @_carloslopes
>>> --
>>> You received this message because you are subscribed to the Google
>>> Groups "sinatrarb" group.
>>> To post to this group, send email to sinatrarb@googlegroups.com.
>>> To unsubscribe from this group, send email to
>>> sinatrarb+unsubscribe@googlegroups.com.
>>> For more options, visit this group at
>>> http://groups.google.com/group/sinatrarb?hl=en.
>> --
>> You received this message because you are subscribed to the Google Groups
>> "sinatrarb" group.
>> To post to this group, send email to sinatrarb@googlegroups.com.
>> To unsubscribe from this group, send email to
>> sinatrarb+unsubscribe@googlegroups.com.
>> For more options, visit this group at
>> http://groups.google.com/group/sinatrarb?hl=en.
> --
> Carlos Eduardo L. Lopes
> Skype: carloslopespollares | Twitter: @_carloslopes
-- Carlos Eduardo L. Lopes
Skype: carloslopespollares | Twitter: @_carloslopes
carlos.el.lo...@gmail.com> wrote:
> And i was concerning about traffic because if do you have a large body,
> make requests with a session that has a big size isn't good (imho, and in
> my humble experience :) )
> On Mon, Aug 13, 2012 at 3:23 PM, Carlos Eduardo L. Lopes <
> carlos.el.lo...@gmail.com> wrote:
>> Yes, if you make only one request (parent), store the body inside a
>> session, and fill the iframe with the body that is already in the session,
>> i agree that this is the best option..
>> but i don't know if this works because i rarely work with iframes :/
>> On Mon, Aug 13, 2012 at 3:04 PM, Jason Rogers <jacaete...@gmail.com>wrote:
>>> Interesting.
>>> How does using the session consume a lot of traffic? You're going to
>>> make the same amount of HTTP requests whether you use a session, memcache,
>>> or hit the database every time. (You save yourself only one request if you
>>> communicate between the iframe and parent window via JavaScript.) If the
>>> size of the body is what you're concerned about, again it'll be the same if
>>> you go back to the server despite what implementation you use on the
>>> backend.
>>> On Mon, Aug 13, 2012 at 10:39 AM, Carlos Eduardo L. Lopes <
>>> carlos.el.lo...@gmail.com> wrote:
>>>> I agree with you too, but, store the response body inside a session
>>>> like Jason said is overkiil too, because it will consumes a lot of traffic,
>>>> decrease performance and other issues that we are now.. memcache is just an
>>>> option that works, but it's true that it's too much for a too simple
>>>> thing..
>>>> On Mon, Aug 13, 2012 at 11:31 AM, Jason Rogers <jacaete...@gmail.com>wrote:
>>>>> I think that introducing Memcache for something like this is overkill.
>>>>> If Memcache will be leveraged in some other way, that's another story.
>>>>> On Monday, August 13, 2012, Carlos Eduardo L. Lopes wrote:
>>>>>> I agree with Alper's suggestions, and mainly the third: *reconsider
>>>>>> using iframes*.. but, if they are really necessary, you can use
>>>>>> memcache to store the response body.. so, you will store the response body
>>>>>> in the memcache when you do the first request, and retrieve the body from
>>>>>> memcache when you do the second request (iframe)
>>>>>> On Sun, Aug 12, 2012 at 5:10 PM, Alper Akgün <alperak...@gmail.com>wrote:
>>>>>> i suggest
>>>>>> - you consider communicating from parent to iframe; in js, with JSON
>>>>>> which is easier if you are the same domain
>>>>>> - or reconsider hitting database twice; not a big deal.
>>>>>> - or reconsider using iframes.
>>>>>> On Sun, Aug 12, 2012 at 11:52 PM, DAZ <daz4...@gmail.com> wrote:
>>>>>> Hi Jason,
>>>>>> Thanks for the reply. That's the only other idea I had of doing it
>>>>>> (but I hadn't thought of how to code it, so thanks :)
>>>>>> I guess using JSON would be good if I start updating the iframe with
>>>>>> Ajax later. I was hoping there might be another way of avoiding hitting the
>>>>>> database twice without having to use sessions and/or JSON, but I guess that
>>>>>> the iframe has to be loaded as a separate request.
>>>>>> Thanks again, cheers,
>>>>>> DAZ
>>>>>> On Saturday, August 11, 2012 7:14:09 PM UTC+1, DAZ wrote:
>>>>>> Hi,
>>>>>> I have a Post object that I want to access on a page that also
>>>>>> contains an iframe. I also need to access the same post object from within
>>>>>> the iframe. Does anybody know if there's any way of doing this without
>>>>>> having to access the database again to find the post objec (like in the
>>>>>> code below)t?
>>>>>> get '/:id' do
>>>>>> @post = Post.get(params[:id])
>>>>>> slim :show
>>>>>> end
>>>>>> get '/iframe/:id' do
>>>>>> @post = Post.get(params[:id])
>>>>>> slim :iframe
>>>>>> end
>>>>>> --
>>>>>> You received this message because you are subscribed to the Google
>>>>>> Groups "sinatrarb" group.
>>>>>> To view this discussion on the web visit
>>>>>> https://groups.google.com/d/msg/sinatrarb/-/zwMCk6RvHtcJ.
>>>>>> To post to this group, send email to sinatrarb@googlegroups.com.
>>>>>> To unsubscribe from this group, send email to
>>>>>> sinatrarb+unsubscribe@googlegroups.com.
>>>>>> For more options, visit this group at
>>>>>> http://groups.google.com/group/sinatrarb?hl=en.
>>>>>> --
>>>>>> You received this message because you are subscribed to the Google
>>>>>> Groups "sinatrarb" group.
>>>>>> To post to this group, send email to sinatrarb@googlegroups.com.
>>>>>> To unsubscribe from this group, send email to
>>>>>> sinatrarb+unsubscribe@googlegroups.com.
>>>>>> For more options, visit this group at http://gro<http://groups.google.com/group/sinatrarb?hl=en>
>>>>>> --
>>>>>> Carlos Eduardo L. Lopes
>>>>>> Skype: carloslopespollares | Twitter: @_carloslopes
>>>>>> --
>>>>>> You received this message because you are subscribed to the Google
>>>>>> Groups "sinatrarb" group.
>>>>>> To post to this group, send email to sinatrarb@googlegroups.com.
>>>>>> To unsubscribe from this group, send email to
>>>>>> sinatrarb+unsubscribe@googlegroups.com.
>>>>>> For more options, visit this group at
>>>>>> http://groups.google.com/group/sinatrarb?hl=en.
>>>>> --
>>>>> --
>>>>> Jason Rogers
>>>>> --
>>>>> You received this message because you are subscribed to the Google
>>>>> Groups "sinatrarb" group.
>>>>> To post to this group, send email to sinatrarb@googlegroups.com.
>>>>> To unsubscribe from this group, send email to
>>>>> sinatrarb+unsubscribe@googlegroups.com.
>>>>> For more options, visit this group at
>>>>> http://groups.google.com/group/sinatrarb?hl=en.
>>>> --
>>>> Carlos Eduardo L. Lopes
>>>> Skype: carloslopespollares | Twitter: @_carloslopes
>>>> --
>>>> You received this message because you are subscribed to the Google
>>>> Groups "sinatrarb" group.
>>>> To post to this group, send email to sinatrarb@googlegroups.com.
>>>> To unsubscribe from this group, send email to
>>>> sinatrarb+unsubscribe@googlegroups.com.
>>>> For more options, visit this group at
>>>> http://groups.google.com/group/sinatrarb?hl=en.
>>> --
>>> You received this message because you are subscribed to the Google
>>> Groups "sinatrarb" group.
>>> To post to this group, send email to sinatrarb@googlegroups.com.
>>> To unsubscribe from this group, send email to
>>> sinatrarb+unsubscribe@googlegroups.com.
>>> For more options, visit this group at
>>> http://groups.google.com/group/sinatrarb?hl=en.
>> --
>> Carlos Eduardo L. Lopes
>> Skype: carloslopespollares | Twitter: @_carloslopes
> --
> Carlos Eduardo L. Lopes
> Skype: carloslopespollares | Twitter: @_carloslopes
> --
> You received this message because you are subscribed to the Google Groups
> "sinatrarb" group.
> To post to this group, send email to sinatrarb@googlegroups.com.
> To unsubscribe from this group, send email to
> sinatrarb+unsubscribe@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/sinatrarb?hl=en.
On Mon, Aug 13, 2012 at 4:30 PM, Jason Rogers <jacaete...@gmail.com> wrote:
> True. 2 requests for a large body can be time- and bandwidth-consuming.
> The question becomes "what's too large?", which is where profiling is key.
> --
> Jason Rogers
> On Mon, Aug 13, 2012 at 2:26 PM, Carlos Eduardo L. Lopes <
> carlos.el.lo...@gmail.com> wrote:
>> And i was concerning about traffic because if do you have a large body,
>> make requests with a session that has a big size isn't good (imho, and in
>> my humble experience :) )
>> On Mon, Aug 13, 2012 at 3:23 PM, Carlos Eduardo L. Lopes <
>> carlos.el.lo...@gmail.com> wrote:
>>> Yes, if you make only one request (parent), store the body inside a
>>> session, and fill the iframe with the body that is already in the session,
>>> i agree that this is the best option..
>>> but i don't know if this works because i rarely work with iframes :/
>>> On Mon, Aug 13, 2012 at 3:04 PM, Jason Rogers <jacaete...@gmail.com>wrote:
>>>> Interesting.
>>>> How does using the session consume a lot of traffic? You're going to
>>>> make the same amount of HTTP requests whether you use a session, memcache,
>>>> or hit the database every time. (You save yourself only one request if you
>>>> communicate between the iframe and parent window via JavaScript.) If the
>>>> size of the body is what you're concerned about, again it'll be the same if
>>>> you go back to the server despite what implementation you use on the
>>>> backend.
>>>> On Mon, Aug 13, 2012 at 10:39 AM, Carlos Eduardo L. Lopes <
>>>> carlos.el.lo...@gmail.com> wrote:
>>>>> I agree with you too, but, store the response body inside a session
>>>>> like Jason said is overkiil too, because it will consumes a lot of traffic,
>>>>> decrease performance and other issues that we are now.. memcache is just an
>>>>> option that works, but it's true that it's too much for a too simple
>>>>> thing..
>>>>> On Mon, Aug 13, 2012 at 11:31 AM, Jason Rogers <jacaete...@gmail.com>wrote:
>>>>>> I think that introducing Memcache for something like this is
>>>>>> overkill. If Memcache will be leveraged in some other way, that's another
>>>>>> story.
>>>>>> On Monday, August 13, 2012, Carlos Eduardo L. Lopes wrote:
>>>>>>> I agree with Alper's suggestions, and mainly the third: *reconsider
>>>>>>> using iframes*.. but, if they are really necessary, you can use
>>>>>>> memcache to store the response body.. so, you will store the response body
>>>>>>> in the memcache when you do the first request, and retrieve the body from
>>>>>>> memcache when you do the second request (iframe)
>>>>>>> On Sun, Aug 12, 2012 at 5:10 PM, Alper Akgün <alperak...@gmail.com>wrote:
>>>>>>> i suggest
>>>>>>> - you consider communicating from parent to iframe; in js, with JSON
>>>>>>> which is easier if you are the same domain
>>>>>>> - or reconsider hitting database twice; not a big deal.
>>>>>>> - or reconsider using iframes.
>>>>>>> On Sun, Aug 12, 2012 at 11:52 PM, DAZ <daz4...@gmail.com> wrote:
>>>>>>> Hi Jason,
>>>>>>> Thanks for the reply. That's the only other idea I had of doing it
>>>>>>> (but I hadn't thought of how to code it, so thanks :)
>>>>>>> I guess using JSON would be good if I start updating the iframe with
>>>>>>> Ajax later. I was hoping there might be another way of avoiding hitting the
>>>>>>> database twice without having to use sessions and/or JSON, but I guess that
>>>>>>> the iframe has to be loaded as a separate request.
>>>>>>> Thanks again, cheers,
>>>>>>> DAZ
>>>>>>> On Saturday, August 11, 2012 7:14:09 PM UTC+1, DAZ wrote:
>>>>>>> Hi,
>>>>>>> I have a Post object that I want to access on a page that also
>>>>>>> contains an iframe. I also need to access the same post object from within
>>>>>>> the iframe. Does anybody know if there's any way of doing this without
>>>>>>> having to access the database again to find the post objec (like in the
>>>>>>> code below)t?
>>>>>>> get '/:id' do
>>>>>>> @post = Post.get(params[:id])
>>>>>>> slim :show
>>>>>>> end
>>>>>>> get '/iframe/:id' do
>>>>>>> @post = Post.get(params[:id])
>>>>>>> slim :iframe
>>>>>>> end
>>>>>>> --
>>>>>>> You received this message because you are subscribed to the Google
>>>>>>> Groups "sinatrarb" group.
>>>>>>> To view this discussion on the web visit
>>>>>>> https://groups.google.com/d/msg/sinatrarb/-/zwMCk6RvHtcJ.
>>>>>>> To post to this group, send email to sinatrarb@googlegroups.com.
>>>>>>> To unsubscribe from this group, send email to
>>>>>>> sinatrarb+unsubscribe@googlegroups.com.
>>>>>>> For more options, visit this group at
>>>>>>> http://groups.google.com/group/sinatrarb?hl=en.
>>>>>>> --
>>>>>>> You received this message because you are subscribed to the Google
>>>>>>> Groups "sinatrarb" group.
>>>>>>> To post to this group, send email to sinatrarb@googlegroups.com.
>>>>>>> To unsubscribe from this group, send email to
>>>>>>> sinatrarb+unsubscribe@googlegroups.com.
>>>>>>> For more options, visit this group at http://gro<http://groups.google.com/group/sinatrarb?hl=en>
>>>>>>> --
>>>>>>> Carlos Eduardo L. Lopes
>>>>>>> Skype: carloslopespollares | Twitter: @_carloslopes
>>>>>>> --
>>>>>>> You received this message because you are subscribed to the Google
>>>>>>> Groups "sinatrarb" group.
>>>>>>> To post to this group, send email to sinatrarb@googlegroups.com.
>>>>>>> To unsubscribe from this group, send email to
>>>>>>> sinatrarb+unsubscribe@googlegroups.com.
>>>>>>> For more options, visit this group at
>>>>>>> http://groups.google.com/group/sinatrarb?hl=en.
>>>>>> --
>>>>>> --
>>>>>> Jason Rogers
>>>>>> --
>>>>>> You received this message because you are subscribed to the Google
>>>>>> Groups "sinatrarb" group.
>>>>>> To post to this group, send email to sinatrarb@googlegroups.com.
>>>>>> To unsubscribe from this group, send email to
>>>>>> sinatrarb+unsubscribe@googlegroups.com.
>>>>>> For more options, visit this group at
>>>>>> http://groups.google.com/group/sinatrarb?hl=en.
>>>>> --
>>>>> Carlos Eduardo L. Lopes
>>>>> Skype: carloslopespollares | Twitter: @_carloslopes
>>>>> --
>>>>> You received this message because you are subscribed to the Google
>>>>> Groups "sinatrarb" group.
>>>>> To post to this group, send email to sinatrarb@googlegroups.com.
>>>>> To unsubscribe from this group, send email to
>>>>> sinatrarb+unsubscribe@googlegroups.com.
>>>>> For more options, visit this group at
>>>>> http://groups.google.com/group/sinatrarb?hl=en.
>>>> --
>>>> You received this message because you are subscribed to the Google
>>>> Groups "sinatrarb" group.
>>>> To post to this group, send email to sinatrarb@googlegroups.com.
>>>> To unsubscribe from this group, send email to
>>>> sinatrarb+unsubscribe@googlegroups.com.
>>>> For more options, visit this group at
>>>> http://groups.google.com/group/sinatrarb?hl=en.
>>> --
>>> Carlos Eduardo L. Lopes
>>> Skype: carloslopespollares | Twitter: @_carloslopes
>> --
>> Carlos Eduardo L. Lopes
>> Skype: carloslopespollares | Twitter: @_carloslopes
>> --
>> You received this message because you are subscribed to the Google Groups
>> "sinatrarb" group.
>> To post to this group, send email to sinatrarb@googlegroups.com.
>> To unsubscribe from this group, send email to
>> sinatrarb+unsubscribe@googlegroups.com.
>> For more options, visit this group at
>> http://groups.google.com/group/sinatrarb?hl=en.
> --
> You received this message because you are subscribed to the Google Groups
> "sinatrarb" group.
> To post to this group, send email to sinatrarb@googlegroups.com.
> To unsubscribe from this group, send email to
> sinatrarb+unsubscribe@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/sinatrarb?hl=en.
-- Carlos Eduardo L. Lopes
Skype: carloslopespollares | Twitter: @_carloslopes