|
I am trying to populate a nested field, product_name, it an Item.
In my Item model:
class Item < ActiveRecord::Base attr_writer :product_name belongs_to :order belongs_to :product def product_name #Product.find_by_id(self.product_id) #=> returns...
Started by doctororange on
, 3 posts
by 3 people.
Answer Snippets (Read the full thread at stackoverflow):
Product.find_by_id(self.product_id).name #=> complains that 'name' is being called on nil.
|
|
Hi,
I am trying to decompress some MMS messages sent to me zipped. The problem is that sometimes it works, and others not. And when it doesnt work, the python zipfile module complains and says that it is a bad zip file. But the zipfile decompresses fine...
Started by Espen Christensen on
, 3 posts
by 3 people.
Answer Snippets (Read the full thread at stackoverflow):
That is, you should use
zippedfile = open('%stemp/tempfile.zip' % settings.MEDIA_ROOT, 'wb+')
You might have to close and reopen the file, or maybe seek to the start... .
You should very probably open the file in binary mode, when writing zipped data into it .
|
|
I have a /domains directory in which I have entries such as
theawesomesite.com 0.2.v.theawesomesite.com 0.3.v.theawesomesite.com
And after testing 0.3, I'll set the main domain to alias the new version. Works really nice. Now, I want to be able to delete...
Started by ironfroggy on
, 4 posts
by 4 people.
Answer Snippets (Read the full thread at superuser):
Your suggestion made me think about it searching in the directories after deleting... .
EDIT by Asker: Or, the -prune flag, as I don't care about the contents at all .
Try adding the -depth flag, to process each directory's contents prior to the directory itself .
|
Ask your Facebook Friends
|
I have a nice interface, and I want to implement one member of it in a base class so the clients can derive from the base class and have less boiler-plate to write. However, even though declared abstract, the compiler complains that the class does not...
Started by Anteru on
, 4 posts
by 4 people.
Answer Snippets (Read the full thread at stackoverflow):
TaskDefinitionBase needs to include CreateTask - if you don't want to implement it, just mark the method... .
You must add an abstract stub of the method:
public abstract ITask CreateTask(TaskId id);
Inheritors can then override it to implement the interface .
|
|
I recently moved my Eclipse workspace directory and now Subclipse complains every time I open a file, dumping to the console something like:
Path is not a working copy directory
svn: ' [original (pre-move) directory path] ' is not a working copy
No such...
Started by David Moles on
, 5 posts
by 5 people.
Answer Snippets (Read the full thread at stackoverflow):
Alternatively, you may try deleting the .metadata directory and....
Did you move the whole workspace or just the content?
Also, you can try creating new workspace from scratch and check out the whole project again .
Hard to say without further information.
|
|
I'm using ubuntu 9.10 and I installed java and tomcat using the package manager. When I went to run startup.sh, it first complains about catalina.out not being there and not being writable. I fixed that and it doesn't complain about that (why isn't that...
Started by DJTripleThreat on
, 3 posts
by 3 people.
Answer Snippets (Read the full thread at stackoverflow):
It contains stuff like what port is the server going to listen at, where are the applications being deployed, and other related stuff... .
Try using server.xml located at:
/etc/tomcat6/server.xml
server.xml is the configuration file for the application server .
|
|
Hi there!
Given the following code:
#include <boost/noncopyable.hpp> enum Error { ERR_OK=0 }; struct Filter : private boost::noncopyable { Filter() {} virtual ~Filter() {} virtual int filter(int* data) const = 0; }; struct SpecialFilter : public...
Started by Niels P. on
, 4 posts
by 4 people.
Answer Snippets (Read the full thread at stackoverflow):
Problems like this are why I think solutions like boost::non_copyable are a bad idea - there are simpler ways of saying you don't want ... .
Firstly, remove the private derivation from SpecialFilter - it is not necessary, as Filter is already not copyable .
|
|
Why does ReSharper complain when a method can become static, but is not?
Is it because only one instance of a static method is created (on the type) and thus save on performance?
Started by Andreas Grech on
, 9 posts
by 9 people.
Answer Snippets (Read the full thread at stackoverflow):
That saves cpu cycles necessary for ....
No (zero) instances of the class need to be created to use the method if it is declared as static.. .
That's another reason it's cheaper.
You don't have to push "this" onto the function's stack for a static method .
|
|
Here is my code:
import java.net.*; import java.io.*; import java.util.*; import org.jibble.pircbot.*; public class WebSocket { public static int port = 12345; public static ArrayList<WebSocketClient> clients = new ArrayList<WebSocketClient>...
Started by giggsey on
, 3 posts
by 3 people.
Answer Snippets (Read the full thread at stackoverflow):
Could you check if the initial handshake was completed before sending frames? The handshake... .
Does it happen on the very first message? or only on the subsequent ones? If the latter, there is something wrong with how you are terminating the first message .. .
|
|
I have a rather complex J2EE app I don't have any documentation for and I am trying to get it to run.
I have gotten the ant build script to compile a EAR file that contains a WAR file, but this application even though I get "successfully deployed" on ...
Started by Ville M on
, 6 posts
by 6 people.
Answer Snippets (Read the full thread at stackoverflow):
Why not simply put all the Jars that you had available at build time, into the EAR?
If you're having to debug this by trial and error, you can look at the... .
I'd assume you managed to get this application put together and compiled in an IDE, maybe Eclipse .
|