Re: [Radiant] Slow page load times

2011-01-23 Thread Carl Youngblood
Thanks a lot for taking the time to respond, Will. I have commented out
those lines and restarted Apache, but I'm still experiencing the same exact
thing. I have confirmed that the ruby processes I see spiking in htop are
new ones, so I'm certain that my changes are being read.

Thanks,
Carl

On Sun, Jan 23, 2011 at 8:50 PM, William Ross w...@spanner.org wrote:

 On 23 Jan 2011, at 19:04, Carl Youngblood wrote:

 Hello, we're running a Radiant installation and we're experiencing
 very slow load times. Here's our site:

 http://transfigurism.org

 We're running it on a linode 512 vm. The site uses the
 radiant_rss_reader extension to construct many different snippets. I
 was wondering if this was the problem, but have checked the RSS cache
 and verified that it is not retrieving the RSS feeds again if they've
 been cached within the set interval (currently 1 hr).


 From a brief look it seems that the rss-reader extension disables all page
 caching. It does this in a rather inadvisable way (by amending the Page
 class itself rather than defining a specialist subclass) but since your site
 is primarily an RSS-aggregator, fixing that wouldn't help much.

 The extension is quite old and I expect the decision dates back to the old
 radiant cache: with Rack::Cache in front of the whole thing it doesn't make
 sense any more. Simply commenting out these lines in lib/rss_reader.rb:

   def cache?
 false
   end

 should make a big difference.

 best,

 will






 But it seems that whenever I initiate a refresh from the browser,
 pages take about 30 seconds to load. Almost all of this time appears
 to be spent in ruby. When I click refresh, the CPU load spikes to
 about 60% for the duration of this 30s period and then at the end the
 page appears suddenly, implying that bandwidth and browser rendering
 are not the bottlenecks.

 When I click around in the site after going through these slow load
 times for all the pages, they come up very suddenly, leading me to
 believe that they are being served from the radiant cache at that
 point.

 My first question is, is there a way to make it so that a browser
 refresh does not cause the radiant cache to be invalidated? I would
 like to set up an hourly cron job that spiders the web site to
 basically prime the cache and make it so that real-world requests
 are served up quickly from the cache instead of having to be re-parsed
 and rendered by radiant.

 Second question is, why is my site taking so long for radiant to
 render? It doesn't strike me as an especially complex layout? Is my
 radiant process running out of memory or something? Any
 recommendations on apache and/or db configurations that would help
 here?

 Thanks,
 Carl





Re: [Radiant] Slow page load times

2011-01-23 Thread Carl Youngblood
Thanks for the advice Anton. Pages are coming up fast when they are accessed
with a referer header and when they have recently been generated by Radiant.
But they are taking 30s when I type the URL in directly and when I click
refresh in a browser. All this 30s is spent by Radiant generating the page.
No content has yet been sent to the browser at that point, so I am certain
that it is not a browser rendering issue. As soon as the radiant process
finished parsing and compiling the content, the CPU load drops to 1% and the
page is displayed immediately in my browser. All of which points to an issue
on the server side.

The 30 second load time is a secondary problem, but far worse is the fact
that direct hits and browser refreshes cause Radiant to go through all that
unnecessary parsing again. I would like them to merely check when the page
was generated last and not do anything if it's been less than an hour.

On Mon, Jan 24, 2011 at 1:44 AM, Anton J Aylward
radi...@antonaylward.comwrote:

 Carl Youngblood said the following on 01/23/2011 02:04 PM:
  When I click around in the site after going through these slow load
  times for all the pages, they come up very suddenly, leading me to
  believe that they are being served from the radiant cache at that
  point.

 I'd suggest looking into the various developer tool plugins for Firefox.
 What you described here may be an artefact of the browser, not the
 server, caching things like graphics and CSS.

 I found that having the CSS served up as a page, while convenient for
 development, meant more work on the server and database.  Similarly with
 graphics if they needed resizing.

 Once they are cached *in the browser* they don't need to be fetched again.

 You should ask yourself why a page that hasn't been accessed before
 would be in the radiant cache?  When I try your site, hitting a page
 I've not visited before, it comes up fast.


 --
 Quality is free, but only for those who are willing to pay heavily for
 it.- Tom Demarco, Peopleware



Re: [Radiant] Slow page load times

2011-01-23 Thread Carl Youngblood
On Sun, Jan 23, 2011 at 8:50 PM, William Ross w...@spanner.org wrote:

 From a brief look it seems that the rss-reader extension disables all page
 caching. It does this in a rather inadvisable way (by amending the Page
 class itself rather than defining a specialist subclass) but since your site
 is primarily an RSS-aggregator, fixing that wouldn't help much.

 The extension is quite old and I expect the decision dates back to the old
 radiant cache: with Rack::Cache in front of the whole thing it doesn't make
 sense any more. Simply commenting out these lines in lib/rss_reader.rb:

   def cache?
 false
   end

 should make a big difference.


William, I just thought of something. We're running Radiant 0.8.0. Would
this affect your advice at all?

Thanks,
Carl


[Radiant] Using cucumber to test an extension

2011-02-12 Thread Carl Youngblood
I'm writing a radiant extension and wanting to use cucumber to test
some of my controllers and views. Since the extension generator seemed
to generate some pretty outdated cucumber stuff, I decided to generate
a standard rails app and run the cucumber rails generator on it, just
to see what kind of code it produced. I then copied this code into my
extension. In env.rb, it has this line near the top:

require File.expand_path(File.dirname(__FILE__) + '/../../config/environment')

I updated this line to point to the right place, since the code is
running inside my extension. I also invoke cucumber using a rake task,
which uses bundler to include all the necessary Radiant stuff.

However, upon running this task, I get the following error:

uninitialized constant Radiant::Configuration::RADIANT_ROOT (NameError)

I'm confused by this, because radiant has already been required in the
context of the Rakefile. I even added the radiant stuff again to the
top of the cucumber env.rb file, just in case. But it didn't seem to
help.

Anyone have any ideas for where I might be going wrong?

Thanks,
Carl


[Radiant] Re: Using cucumber to test an extension

2011-02-12 Thread Carl Youngblood
Never mind. I guess something about invoking the cucumber binary left
out a whole bunch of required dependencies. I was about to fix this by
putting the following code in the rakefile and invoke the tests from
there:

require 'cucumber'
require 'cucumber/rake/task'

namespace :spec do

...

  desc Run the Cucumber features
  Cucumber::Rake::Task.new(:integration) do |t|
t.cucumber_opts = features --format pretty
  end

On Sat, Feb 12, 2011 at 4:39 PM, Carl Youngblood c...@youngbloods.org wrote:
 I'm writing a radiant extension and wanting to use cucumber to test
 some of my controllers and views. Since the extension generator seemed
 to generate some pretty outdated cucumber stuff, I decided to generate
 a standard rails app and run the cucumber rails generator on it, just
 to see what kind of code it produced. I then copied this code into my
 extension. In env.rb, it has this line near the top:

 require File.expand_path(File.dirname(__FILE__) + '/../../config/environment')

 I updated this line to point to the right place, since the code is
 running inside my extension. I also invoke cucumber using a rake task,
 which uses bundler to include all the necessary Radiant stuff.

 However, upon running this task, I get the following error:

 uninitialized constant Radiant::Configuration::RADIANT_ROOT (NameError)

 I'm confused by this, because radiant has already been required in the
 context of the Rakefile. I even added the radiant stuff again to the
 top of the cucumber env.rb file, just in case. But it didn't seem to
 help.

 Anyone have any ideas for where I might be going wrong?

 Thanks,
 Carl



[Radiant] Re: Forms Within Custom Tags and Authentication (InvalidAuthenticityToken)

2011-02-28 Thread Carl Youngblood
Thanks for sharing. I'm trying to use this code but getting a Symbol
as array index error because
response.instance_variable_get(:@session) is returning an array, not a
hash. Any tips? I would be anxious to see more of your login solution
if you don't mind, since I'm trying to solve the same problem.

Thanks,
Carl

On Feb 21, 8:52 am, Cleverlemming cleverlemm...@gmail.com wrote:
 I created a custom tag  for my MailChimp list sign-ups using the
 Hominid gem. I ran into a bit of a challenge with the fact that there
 doesn't seem to be a way to use form helpers inside a custom tag as
 custom tags use %{ to escape html, which means that a rails % tag is
 misinterpreted as part of another escape clause. I found one post that
 claimed form helpers could be used in custom tags but there was no
 example of usage.

 It's easy to use html within a custom tag, but a straight html form
 will raise a InvalidAuthenticityToken error as the authenticity token
 is not explicitly supplied. I used the following hack to create a
 submittable form within a custom tag:

 input name=authenticity_token type=hidden
 value=#{response.instance_variable_get(:@session)[:_csrf_token]} /

 This creates the same output as when a form helper tag is used and the
 form submits. I just have to type r:subscribe / to get my form to
 appear on any page.

 Hope this is useful and it saves someone some time.


[Radiant] Authentication for one Section of Site

2011-03-01 Thread Carl Youngblood
I found this topic on the mailing list from a few years ago. I'm
building an extension that supports site user registration and login.
I would like to be able to support two ways of restricting access to
page content. I would like to create a different page type that would
require login to be seen, such as:

class SecurePage  Page
end

and I'd like to create tags for displaying content only if a user is
logged in and only if a user is not logged in, such as:

r:if_authenticatedSecret information/r:if_authenticated
r:unless_authenticatedPublic information/r:unless_authenticated

Previous suggestions on this thread said that it would be best (due to
the caching mechanism) to use a separate controller for secure pages
and create routes such that all pages hosted under a certain subdir
slug were protected:

http://groups.google.com/group/radiantcms/msg/c6d0c6da863e33a5

But this seems like it would conflict with my goal of securing content
by page type and by tags, or at least that it would make the system a
little kludgier--secure pages or pages with partially secure content
would need to be hosted under a separate subdir. Can any of you who
are more familiar with Radiant think of a good way of modifying the
existing site controller for this functionality? My preference would
be to modify the existing controller as minimally as possible so that
all of Radiant's other functionality continued to work normally on
these secure pages.

Thanks,
Carl


[Radiant] Re: Authentication for one Section of Site

2011-03-01 Thread Carl Youngblood
Never mind, I think I got enough ideas from looking at Aslak
Hellesøy's ba extension.

On Tue, Mar 1, 2011 at 1:49 PM, Carl Youngblood c...@youngbloods.org wrote:
 I found this topic on the mailing list from a few years ago. I'm
 building an extension that supports site user registration and login.
 I would like to be able to support two ways of restricting access to
 page content. I would like to create a different page type that would
 require login to be seen, such as:

 class SecurePage  Page
 end

 and I'd like to create tags for displaying content only if a user is
 logged in and only if a user is not logged in, such as:

 r:if_authenticatedSecret information/r:if_authenticated
 r:unless_authenticatedPublic information/r:unless_authenticated

 Previous suggestions on this thread said that it would be best (due to
 the caching mechanism) to use a separate controller for secure pages
 and create routes such that all pages hosted under a certain subdir
 slug were protected:

 http://groups.google.com/group/radiantcms/msg/c6d0c6da863e33a5

 But this seems like it would conflict with my goal of securing content
 by page type and by tags, or at least that it would make the system a
 little kludgier--secure pages or pages with partially secure content
 would need to be hosted under a separate subdir. Can any of you who
 are more familiar with Radiant think of a good way of modifying the
 existing site controller for this functionality? My preference would
 be to modify the existing controller as minimally as possible so that
 all of Radiant's other functionality continued to work normally on
 these secure pages.

 Thanks,
 Carl



[Radiant] How to render a double tag

2011-03-05 Thread Carl Youngblood
Hey guys, I'm writing some custom tags and I'm a little confused by
something. I think I've figured out how to call terminal single tags from
within other tags, but how do I do this with a double tag that potentially
has stuff inside it that needs to be rendered? Should I call render_snippet
on the whole thing or can I somehow call tag.render but expand the content
between the outer tags?

For example, I have an input tag:

r:my_extension:input object=site_user field=name type=text
 span class=errorr:error//span
/r:my_extension:input

I want to create another tag that generates a whole login form, which
includes multiple instances of this input tag. But I'm not sure how to do
it.

r:my_extension:login_form /

So far, I have:

tag 'my_extension:login_form' do |tag|
  if tag.double?
content = tag.expand
  else
tag_options = {
  'object' = 'site_user',
  'field' = 'name',
  'type' = 'text'
}
content = %{p#{tag.render('input', tag_options)/p...} # how do I
call tag.render
  # but also put
stuff inbetween
  # the opening
and closing tags?
  end
  content
end

Thanks in advance for your help!

Carl


[Radiant] Purchases/donations/subscriptions extension

2012-01-17 Thread Carl Youngblood
I'm looking for a radiant extension that will let us create
subscription links for recurring donations to our organization. I've
been thinking it would be awesome to have it use Stripe. Anyone seen
anything like this? Anyone else interested in something like this? If
I don't find something, I may just develop it myself.

Thanks,
Carl


[Radiant] Re: Security Update to Rails 2.3.15?

2013-01-11 Thread Carl Youngblood
How about for those running 0.8.0 somewhere? I don't see an intializers 
directory in my config dir.

Thanks,
Carl

On Wednesday, January 9, 2013 10:28:00 AM UTC+1, Toine Diepstraten wrote:

 Hi,

 an important security update for Rails 2.3 was released, read more about 
 it here:


 http://weblog.rubyonrails.org/2013/1/8/Rails-3-2-11-3-1-10-3-0-19-and-2-3-15-have-been-released/


 As I understand Radiant uses a vendor Rails 2.3.14 version. How can one 
 update Radiant to use the security fixed Rails 2.3.15 version?

 Thanks for any suggestions.

 Best,
 Toine