Displaying 20 results from an estimated 5000 matches similar to: "Thread safety in activerecord(?), connection lost to mysql server - simple code sample provided"
2006 Aug 03
2
thread problems
I have a really long series of queries (import from other database*)
that takes about 2 or 3 minutes. I wanted to spawn a thread and put the
job there, but there seems to be some problems with active record and
threads: (this is what I found after googling)
Thread.abort_on_exception = true
=> true
100.times do
Thread.new do
Client.find(:first)
end
end
this throws an exception... So
2006 Jul 07
3
ActiveRecord thread-safety
Hi,
I want to use ActiveRecord outside Rails. The application is
multithreaded, so database access has to be thread-safe. I read in a few
places ActiveRecord in fact should be thread-safe and I gave it a try,
but my findings indicate ActiveRecord is NOT thread-safe.
The following test-script fails every with a lost MySQL-connenction:
require ''rubygems''
require_gem
2006 May 09
5
Solaris migration error:Lost connection to MySQL server
We have installed rails 1.1.2 and Ruby 1.8.4 on solaris. When we attempt
to
run the initial migration we get the following error:
Mysql::Error: Lost connection to MySQL server during query: SELECT
version FROM schema_info
/web/server/pkgs/ruby-1.8.4/lib/ruby/gems/1.8/gems/activerecord-1.14.2/lib/active_record/connection_adapters/abstract_adapter.rb:120:in
`log''
2006 Jun 14
6
Lost Connection to MySQL
Error Message: MyMysql::Error: Lost connection to MySQL server during query:
SHOW FIELDS FROM products
Running Fedora 5, using available Red Hat modules and latest version of Rails.
This problem just appeared. I had been enjoying going through the tutorial "Depot"
when it started displaying this problem. With phpMyAdmin I am able to access the
depot_development data base containing
2005 Dec 22
0
ActiveRecords: save & relationships
Dear all,
How many steps does ''save method'' save in has_many/belongs_to
relationships ?
Just to exemplify, let''s suppose:
School has_many Classes
Classes has_many Students
School.name = ''school''
Class.name = ''class''
Student1.name = ''student1''
Student2.name = ''student2''
Class.students
2006 May 05
1
Help with ActiveRecord
Model:
class AdminQueue < ActiveRecord::Base
set_table_name ''adminqueue''
end
Interacting with it in script/console
>> AdminQueue.new
=> #<AdminQueue:0x240a910 @attributes={"topic_id"=>nil,
"resolved"=>nil, "updated_on"=>nil, "action"=>nil, "type"=>nil,
"post_id"=>nil,
2008 Jun 12
4
Background thread - entension code - switch contexts
Hi,
I am using wxRuby 1.9.7 and Ruby 1.8.6. I have built an extension in C++
and used swig to load it into Ruby interpreter, which works great. The
extension is an often long executing algorithm, and I''ve noticed that if
I fork a new Ruby thread in button clicked event, and in this thread run
the algorithm the application freezes for the time of execution. I have
looked through the
2008 May 29
3
Datasets in R
I?m trying to find datasets that will give me residuals, after applying
the lm function, with no normality, non linearity, and heteroscedacity
so I can try to exemplify
those cases in the linear regression model. Can you give any advice on
what datasets would be appropiate? I can?t use the ones in the alr3
package because those have
already been seen in class.
Thank you very much :-)
natorro
2006 Jul 06
0
Can''t generate AR from script (ActiveRecord::ConnectionNotEstablished)
Generating ActiveRecord instances from the console works fine.
./script/console
Loading development environment.
>> Pim.new()
=> #<Pim:0xb74427dc @attributes={"vpimitem"=>nil}, @new_record=true>
>>
But running this little script:
#!/usr/bin/env ruby
require File.dirname(__FILE__) + ''/../config/boot''
Pim.new()
Will spit out
2006 Jun 27
3
Weird ActiveRecord Foreign Key Problem
Hello to all,
I ran into a weird problem with an ActivRecord. I have a table named
"build_order" with a column named "type" that is a foreign key to a
table called "building_type". In a controller I try to read all the
build_orders with "BuildOrder.find :all" and get the following error and
stack trace:
(eval):1:in `instance_eval'': compile
2006 Jun 23
1
''Series'' Pluralization
Howdy,
I have a model I called ''content_series''. I created it and noticed that
Rails called it ''Sery'', so I added ''series'' to the uncountable thing in
the config, like this:
Inflector.inflections do |inflect|
# inflect.plural /^(ox)$/i, ''\1en''
# inflect.singular /^(ox)en/i, ''\1''
#
2006 Jul 07
1
Pessimistic Locking Plugin Breaks ActiveRecord::Base.count()
After installing the PessimisticLocking plugin I noticed that
ActiveRecord''s count method no longer works (see below). If I remove
the plugin it resolves the problem.
I need both. Any ideas?
I have also read that Pessimistic Locking is now baked into ActiveRecord
in Edge Rails. I have tried Rails 1.1.2 and 1.1.4 and that doesn''t seem
to be the case. Any idea when
2006 Jun 18
0
problems with upload progress plugin
Probably something obvious that im missing but since implementing the plugin
version of upload progress i''m receiving the error beneath, I have included
the relevant controllers refered to by the error. Any help would be much
appreciated;
NoMethodError (undefined method `file_name_temp='' for #<Script:0x55f9d90>):
2006 Oct 01
11
Mongrel woes fixed
Hello all,
For the past couple of weeks I have been spending some time debugging a
couple of issues I was having with Mongrel when I put load on it. I have
seen two distinct issues:
1. Mongrel stopped responding as if in an endless loop.
2. Mongrel crashed when severely loaded.
I believe to have resolved these two issues and have attached patches
which shows the resolution (simple as it is).
2011 Aug 22
1
d, p, q, r - What are the math relations with each other of this functions?
Hi all,
Using the exponential distribution to exemplify: The dexp function is
the PDF (1) and pexp is the CDF (2), that is obtained integrating the
PDF. How can I get the qexp and the rexp? Considering that I have the
PDF, how this two are mathematically related to the PDF?
(1) ke^{-kx}
(2) 1-e^{kx}
Thanks in advance.
2006 Jul 03
2
Agile Web Dev on Rails - ActiveRecord::RecordNotFound Prob
Hi there
I''ve also made a start on the Agile Web Dev using Rails book! I''ve been
hit with a problem when hitting the ''Add to Cart'' button - I get the
following error message:
ActiveRecord::RecordNotFound in StoreController#add_to_cart
Couldn''t find Product without an ID
RAILS_ROOT: ./script/../config/..
Application Trace | Framework Trace | Full
2006 Apr 20
1
has_many.count not accepting options hash
has_many.count does not seem to support an options hash like
ActiveRecord::Base.count does.
Example:
>> AcademicProgram.find(:first).course_requirements.count :conditions
=> "courses.name LIKE ''a%''", :include => :course
=> 40
>> ap.ap_requirements.count :conditions => "courses.name LIKE ''a%''",
:include =>
2006 Apr 17
7
Action Controller: Exception caught
Hi, I''m running the cookbook example from ONLamp.com. I have tried to
test my site and it comes up with the the message on the site:
ActiveRecord::StatementInvalid in RecipeController#index
Mysql::Error: Lost connection to MySQL server during query: SHOW FIELDS
FROM recipes
RAILS_ROOT: ./script/../config/..
Application Trace | Framework Trace | Full Trace
2006 Jul 31
0
rescue_action_in_public useless to capture low level errors
Hi all,
I''m trying to make for nicer system error handling, with the help of
rescue_action_in_public
(see Recipe 47, in ''Rails Recipes'')
PROBLEM:
While it lets me capture an incorrect db name in database.yml (for
example),
with lower level errors like when the DB server is just down, I still
get the default system error screen for MySQL::ERROR :
2006 May 30
7
Stripping HTML tags from a string
Hello,
Is there a common way of stripping html tags from a string? Right now I''m
just calling gsub!(/<.*?>/, ''''), but with a background in PHP and always
having used its strip_tags() method, I wonder if the Rails community has
standardized this fairly common task with something a bit less simpleminded
than my quick fix.
Thanks!
Zack
-------------- next part