search for: singleton

Displaying 20 results from an estimated 428 matches for "singleton".

2006 Aug 23
5
Singleton-like Worker
Hello there, I need a Worker Class to be Singleton-like, that means there must be at maximum one Instance at a time. When a new Request is made to create another worker of this type, it should return and wait for the other instance to be destroyed. what i need to do: i have a worker who needs to do sth with java and openoffice, and it seems when i...
2006 Jul 03
6
Req: Workers as singletons
Hi, it would be nice to be able to specify workers as singletons. By this I mean that every call to the new_worker method returns the same instance of said worker. This can be done transparently either by adding a new argument to new_worker (something like :singleton => true) or adding a new method, like I did in my installation of BackgrounDrb:...
2007 Aug 21
7
mocking singletons
How can I safely mock a singleton without the mocked method living on outside the scope of the test method? I''ve run into this problem with mocking methods on globals (gasp!) in the past by doing something like def mock_my_global original = $my_global $my_global.expects(:foo).returns(''bar'')...
2006 Oct 16
4
Singleton Pattern in RoR
Hi all how can I implement the singleton patter in RoR? thanks -- 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-/JYPxA39Uh...
2006 May 22
2
using Singleton with Prototype
Hello all. I''m writing my own object using prototype and I wonder how you write and call only one instance of class. Can anyone share his idea of singleton? thanks Gregor ---------------------------------------------------- Gdy nadchodzi przełomowy moment w historii, musisz zdecydować, po czyjej stronie będziesz. "X-Men: Ostatni bastion" - w kinach od 26 maja. http://klik.wp.pl/?adr=http%3A%2F%2Fwww.x-men.wp.pl&sid=763
2006 Jul 25
3
Question about how Mongrel process works with singletons
Hi, I have a controller where I access a singleton class that I use to connect to a DRbprocess DrbConnector.instance.some_method I notice that on every request, the constructor is called so it is making a new instance of this singleton. Is this normal? Thanks, Curtis
2012 Mar 16
2
Singleton pattern
Hi all, I know it may not have much sense thinking about a Singleton Pattern in an R application which doesn't use any OOP facilities, however I'm curious to know if anybody faced the same issue. I've been googling but using "singleton pattern" as a key word leads to typical OOP languages like Java or C++ among others. So my problem is that I&...
2009 Oct 08
4
[LLVMdev] Is ExecutionEngine always meant to be a singleton?
Right now, on X86, creating multiple ExecutionEngines in the same process causes an assertion. If it's supposed to always be a singleton, should there be a way to get the process's ExecutionEngine instance? This would, among other things, allow "lli" to execute bitcode that itself uses the ExecutionEngine.
2009 Oct 09
0
[LLVMdev] Is ExecutionEngine always meant to be a singleton?
On Oct 8, 2009, at 9:19 AM, Kenneth Uildriks wrote: > Right now, on X86, creating multiple ExecutionEngines in the same > process causes an assertion. > Yes. This is by design. > If it's supposed to always be a singleton, should there be a way to > get the process's ExecutionEngine instance? > I can't see why. You could make a server to process llvm code. > This would, among other things, allow "lli" to execute bitcode that > itself uses the ExecutionEngine. I think you're doing...
2008 Dec 05
3
"singleton can't be dumped," but not using singleton
An action handler (select_person_by_name) in my controller class assigns into session, and then does a redirect_to. I get the error "TypeError (singleton can''t be dumped):" followed by a stack trace that doesn''t cross my code. Google tells me this is ordinarily caused by assigning a singleton instance into session, but what I''m assigning is an ordinary String. This is verified by logging the value and its class. Fur...
2006 Jun 26
1
ActiveRecord, instance_eval, and PStore
...hone_num "1-800-OBITEME" end Anyway, this works in the console, after instantiating the object with a find() it responds to support_phone_num(). However, back in the controller, I try to save the object in the session and Webrick gives me a 500 error. development.log says: TypeError (singleton can''t be dumped): /usr/local/lib/ruby/1.8/pstore.rb:348:in `dump'' /usr/local/lib/ruby/1.8/pstore.rb:348:in `dump'' /usr/local/lib/ruby/1.8/pstore.rb:326:in `transaction'' /usr/local/lib/ruby/1.8/cgi/session/pstore.rb:90:in `update''...
2006 Aug 24
10
MongrelCluster - How can I make a request to a specific mongrel instance?
In our app we''ve a number of singleton ruby classes that cache static data in hashes, things like string values, system config params, etc). In a webbrick environment this works ok, but we find in production we have a problem because we have 4 caches, one for each mongrel instance. This also isn''t a BIG problem, but our cach...
2006 Oct 16
0
MiddleMan singleton issue in start script
...backgroundrb-devel archives. >This means that in order to reference the new_worker method *in the >instance that is running in the drb server* you can''t do that >directly. In order to spawn other workers from within a worker I >would have to change the MiddleMan class to be a singleton. This way >you could grab the one instance of it and call new_worker on that and >it would work as expected. But the way it is currently setup, you >don''t have a reference to the Main MiddleMan instance from within >your workers. > I don''t think making the Middl...
2012 May 24
4
Manually modifying an hclust dendrogram to remove singletons
...hat I hope someone can help me with. Consider the classic hclust example: hc <- hclust(dist(USArrests), "ave") plot(hc) I would like to cut the tree up in such a way so as to avoid small clusters, so that we get a minimum number of items in each cluster, and therefore avoid singletons. e.g. in this example, you can see that Hawaii is split off onto its own at quite a high level. I would like to avoid having a single item clustered on its own like this. How can I achieve this? I have tried manually modifying the tree using dendrapply but have not been able to produce a valid so...
2018 Jan 30
2
Samba 4.7.4 + bind9 DLZ /backend/ dropping delegated domain
No, I'm reading the dlz_bind9.c code. I've found and fixed the problem. It turns out that using a reference counted singleton is a bad idea. The singleton is defunct after reload. If we simply create a new state object and destroy the old one as bind is trying to let us do, things work out fine. This works, at least, for bind9.9. I cant test with the older (9.8), so it is possible that the singleton approach was necessa...
2005 Mar 30
2
Beginner question: serverside singletons?
...cious of all the behind-the-scenes magic going on in Rails. But I''ll bury my misgivings and give this thing a whirl :). Anyway, a question: with Java servlets (and servlet-based frameworks) I''m used to being able to initialize some "expensive" stuff at app startup as singletons and then store them away (servlet context, JNDI, whatever) for later use by the app request-handling code. Now, this is obviously impossible with straight cgi-script style Rails with separate script invocations per request, but can I do something like this with Webrick, mod_ruby etc? As a conc...
2007 Mar 13
1
Opening the singleton class of mocked objects
I wrote a plugin [1] a while ago that lets me do validations on a single AR instance. Instead of defining validations in an AR class, I can define them on a AR instance''s singleton class: class << @video validates_presence_of :title end One of my specs mocks Video.find, and the above code is run on the mock object. When I run the spec, I get the expected undefined method `validates_presence_of'' for #<Class:#<Spec::Mocks::Mock:0x33772e4>> The...
2013 Sep 08
0
PhD Studentship: Geographically Weighted Geodemographics [University of Liverpool]
Supervisors: Dr Alex Singleton; Professor Chris Brunsdon Industrial Partner: Office for National Statistics Applicants are invited for a PhD studentship at the University of Liverpool within the ESRC North West DTC. The studentship will be supervised by Dr Alex Singleton and Professor Chris Brunsdon in the Department of Geograp...
2008 May 07
2
Can I add a singleton action to @controller in a test?
All, I want to create a mock action to test a filter in a functional test, e.g.: # Simplified example def test_my_filter # Singleton action def @controller.foo assert # something end ActionController::Routing::Routes.draw do |map| map.connect '':controller/foo'', :action => ''foo'' end get :foo end My log files show that no action responds to foo, so I think I...
2006 Apr 08
6
Deploy with Capistrano Win32 -> Linux
...`new'' c:/ruby/lib/ruby/gems/1.8/gems/net-ssh-1.0.8/lib/net/ssh/transport/services.rb:1 21:in `register_services'' c:/ruby/lib/ruby/gems/1.8/gems/net-ssh-1.0.8/lib/net/ssh/transport/services.rb:1 15:in `call'' c:/ruby/lib/ruby/gems/1.8/gems/needle-1.3.0/lib/needle/lifecycle/singleton.rb:42 :in `call'' c:/ruby/lib/ruby/gems/1.8/gems/needle-1.3.0/lib/needle/lifecycle/singleton.rb:40 :in `synchronize'' c:/ruby/lib/ruby/gems/1.8/gems/needle-1.3.0/lib/needle/lifecycle/singleton.rb:40 :in `call'' c:/ruby/lib/ruby/gems/1.8/gems/needle-1.3.0/lib/needle/service-p...