[Rails] Directing command output to a view

2009-09-27 Thread Petr Janda

Hi all,

Ive recently designed a system that is started from the command line.
ie.
/usr/local/bin/system.rb

The system is a long running task that outputs messages via "puts" to
the shell as its being executed.

I need to run this command from a rails application so that 1) it doesnt
block .ie user gets a "please wait" screen 2) and more importantly I
want the output of the command sent in real-time or near real-time to
the view, under the "please wait" message. And when the command exits,
the user is redirected to another view.

Any ideas whats the best way to do this?

Petr
-- 
Posted via http://www.ruby-forum.com/.

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] JRuby/glassfish v3 logging problem

2009-04-19 Thread Petr Janda

Hi all,

Ive just tried to run my app with jruby and glassfish. It seems to work
mostly fine, except one weird thing. Glassfish turns over
log/development.log when its size hits 1.9MB, renames it to something
like

development.log_2009-04-20T13-57-30

but never creates a fresh development.log and at that moment the
glassfish server just stops working.

What im doing is basically cd into my application's RAILS_ROOT, and
execute glassfish_rails.

My OS is FreeBSD 7.2

Any ideas?
-- 
Posted via http://www.ruby-forum.com/.

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Re: Background tasks + multi processing

2009-04-19 Thread Petr Janda

Wouter de Bie wrote:
> I wouldn't run a long running process directly from your controller, 
> since rails first renders all stuff that should be sent to the client 
> (html/xml/js/etc) before it actually sends it. This means that the 
> complete controller action should be finished to show something in your 
> browser.
> I think that the best way to go is to use something that is able to 
> spawn background processes (like Starling).

I'm aware of different solutions to run a background job. However, the 
problem is how to make 4 background jobs MPSAFE, all of them working on 
the same Hash. Any ideas?

Petr
-- 
Posted via http://www.ruby-forum.com/.

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Background tasks + multi processing

2009-04-19 Thread Petr Janda

Hi all,

Ive recently been trying to figure out a way to make a long running
background task scale accross all CPUs in Ruby on Rails, since
multi-processing (not multi-threading) seems like the way to go.

A theoretical example would be:

# code in controller

def do_something
   @mydata = Hash.new

   # Start 4 background processes
   # and start adding data to @mydata
   # Page loads while the processes are working, displaying
   # something like "We are currently processing your data"
end

Question is how to handle reading/writing to @mydata safely because 4
processes would be trying to read/write to it? What is the best way to
approach this problem?

Thanks,
Petr
-- 
Posted via http://www.ruby-forum.com/.

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Re: Passenger caching in development mode, wtf?

2009-04-15 Thread Petr Janda

Ok i resolved it, after hours of trying to figure it out, i noticed that 
the cause is having config.threadsafe! enabled in development mode. For 
some reason it causes caching to get enabled. This option should be 
documented better.

Petr
-- 
Posted via http://www.ruby-forum.com/.

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Re: Passenger caching in development mode, wtf?

2009-04-14 Thread Petr Janda

This makes no difference. The problem is with mongrel is that I need the 
devel applications to be accessible even when im not developing, ie. 
client review. And id need to make a start up script in case i reboot 
the server to make all the mongrels start up. Its just hassle. 
dispatch.cgi/fcgi was ideal for simple setup in development mode where 
speed usually doesnt matter.


PP Junty wrote:
> perhaps here:
> 
> http://www.modrails.com/documentation/Users%20guide.html#RailsSpawnMethod
> 
> but can't you use mongrel for development and passenger for production?
> 
> Petr Janda wrote:
>> I just tested with Ruby 1.8 and its the same behaviour.
>> 
>> An clues people?

-- 
Posted via http://www.ruby-forum.com/.

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Re: Passenger caching in development mode, wtf?

2009-04-14 Thread Petr Janda

I just tested with Ruby 1.8 and its the same behaviour.

An clues people?
-- 
Posted via http://www.ruby-forum.com/.

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Passenger caching in development mode, wtf?

2009-04-14 Thread Petr Janda

Hi all,
I updated an application to Rails 2.3.2(and ruby 1.9.1) and installed
Passenger, after learning that it turns production mode on by default, i
changed that to development mode. Logs are correctly being saved to
development.log so i should definately be in development mode, right?

Well NO! Any change to my code has to be followed by a restart of the
application due to some caching that I dont want.

Now that they are removing CGI support too, just how the hell am I
supposed to be making a website in development mode without having to
restart 500 times a day


Thanks
Petr
-- 
Posted via http://www.ruby-forum.com/.

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Mongrel and application's public path problem

2009-03-31 Thread Petr Janda

Hi all,

Im trying to fix a path problem. My app was developed while using
fastcgi. When I did FileUtils.mkdir it created a new directory under the
public directory in my application.

Now in production we use mongrel + mongrel_cluster, BUT the directory is
created in the application's directory in "/usr/websites/myapp" instead
of "/usr/websites/myapp/public".

What do I have to do to fix this?

Petr
-- 
Posted via http://www.ruby-forum.com/.

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Just how the hell do you set Cache-Control max-age?

2009-03-23 Thread Petr Janda

Hi all,

Ive been googling for couple of hours and I just cant figure it out. I
want to set the max-age value to 300 for the WHOLE application,
regardless of development or production mode.

Is there anyone that knows?

Petr
-- 
Posted via http://www.ruby-forum.com/.

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Re: Multi-Site sessions

2009-03-20 Thread Petr Janda

Anyway, session_domain works as expected. Thanks!

Petr
-- 
Posted via http://www.ruby-forum.com/.

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Re: Multi-Site sessions

2009-03-20 Thread Petr Janda

No its not because one box cannot handle the load, but because certain
activities the users would be doing are best done on a separate
high-performance box(other than the normal web-server).
-- 
Posted via http://www.ruby-forum.com/.

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Multi-Site sessions

2009-03-20 Thread Petr Janda

Hi all,
Im developing an application that runs on multiple physical boxes (and
thus different hostnames). Both of the boxes will run the same
application (connecting to a shared postgres server). What I need is
when someone logs in on box 1 (ie. box1.domain.com), and then traverses
via a link to box 2 (ie. box2.domain.com), he or she will not have to
login again.

How can I do this?

Thanks
Petr
-- 
Posted via http://www.ruby-forum.com/.

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---