objects

How do I debug this 'no method' error in ruby on rails?

I get the following error: Delayed::Job SomeMailJob# (NoMethodError) "undefined method `subject' for #<YAML::Object:0x2b0a191f4c78>" This comes from the following code which references the SombMailJob above: class SomeMailJob < Struct.new(:contact, :contact_email) def perform OutboundMailer.deliver_campaign_email(contact,co...

How to access a member object

I have made a custom object called students that has two nsstring object. One is for the name and the other for the student id. If I try to pass the custom object to something that takes nsstring, it doesn't work. I want to pass the name. How can I do this? ...

Javascript: storing object in globalStorage

Is it possible to store objects in globalStorage or is it only capable of strings? One option would be to "jsonify" an object and then store it but I wondered if theres a better way? var host = location.hostname; globalStorage[host].test = { name1: 'Ben', name2: 'John' }; globalStorage[host].test2 = 'hello'; alert(globalStorage[ho...

C++ stack variables and heap variables

When you create a new object in C++ that lives on the stack, (the way I've mostly seen it) you do this: CDPlayer player; When you create an object on the heap you call new: CDPlayer* player = new CDPlayer(); But when you do this: CDPlayer player=CDPlayer(); it creates a stack based object, but whats the difference between that a...

Javascript - property of an object in another property?

In the following example, how do I modify the variable "sizeMod", which is a property of each object? // Will be created by ids var objs = {}; // Set up objects $.each(ids, function(index, value){ objs[value] = { sizeMod: 0 }; objs[value] = { change: function(){ sizeMod += 1; // How do I write th...

coder encodeObject

Consider the following code [coder encodeObject: properties forKey:@"properties"]; Are there any restrictions on what kind of object is passed as an argument to encodeObject? Can it be an object from a custom class? ...

Current state of browser objects?

A web-browser window contains the window object. This object contains many properties. Many of those properties are objects. Some are constructors (XMLHttpRequest, Worker, File, ...), some are regular objects (document, location, navigator, history, screen, ...), some are non-constructor functions (a.k.a. methods) (alert, setTimeout, ......

Browser object references for Chrome, Safari or Opera?

I was able to find the browser object references for Firefox and IE... Firefox: https://developer.mozilla.org/en/Gecko_DOM_Reference IE: http://msdn.microsoft.com/en-us/library/ms533054(VS.85).aspx But, I am unable to find the object references for the other popular browsers. I assume that Safari and Chrome have a similar object struc...

Include static lib in dynamic lib

Hello all, I have the following problem : several object files a1.o, a2.o, a3.o, ... an archive libxxxx.a. The archive libxxxx.a only contains object files : b1.o, b2.o etc... I would like to create a shared library (.so) from all the object files. Problem : If I use : g++ -shared libxxxx.a a1.o a2.o ... -o libnew.so g++ does un...

How to declare a method that takes an instance as an argument in Python?

I know it is probably a stupid question, but I am new to OOP in Python and if I declare a function def myFunction( b) and pass an instance of an object to it, I get TypeError: expected string or buffer. To be more specific, I have a following code that I use to parse a summary molecular formula and make an object out of it. class Summa...

How to increment Date objects in C++

Hi everyone, I have an assignees that I've been working on and I'm stuck on the last function. use the function void Increment(int numDays = 1) This function should move the date forward by the number of calendar days given in the argument. Default value on the parameter is 1 day. Examples: Date d1(10, 31, 1998); // Oct 31, 1998 Date ...

How can an UIntPtr object be converted to IntPtr in C#?

I need to convert an UIntPtr object to that of IntPtr in my C# .NET 2.0 application. How can this be accomplished? I don't suppose it's as simple as this: UIntPtr _myUIntPtr = /* Some initializer value. */ object _myObject = (object)_myUIntPtr; IntPtr _myIntPtr = (IntPtr)_myObject; Thanks. ...

javascript get member name

Say I have this: var x = { a:{a1:"z", a2:"x"}, b:{b1:"y", b2:"w"} } Is there a way to iterate over x to get "a" and "b"? I want the member name, not its content (I don't want to get {a1:"z", a2:"x"}). Thanks ...

Is an if with a continue a good pattern to prevent excessive nesting while iterating over properties in Javascript?

I normally use this pattern to iterate over object properties: for(var property in object) { if(object.hasOwnProperty(property)) { ... } } I don't like this excessive indentation and recently it was pointed out to me that I could get rid of it by doing this: for(var property in object) { if(!object.hasOwnProperty(prope...

how to reference a coldfusion object via ajax

I'm working with a page in Coldfusion and I have instantiated an object on that page. Let's call the object myobject. I'm able to access all the methods of that object (such as myobject.getName()) on this page and all pages that are included as part of the page flow. But now I load a page in via ajax, and I want to be able to reference ...

Illegal Forward reference, Object visibility Issues will compiling.

Thanks for taking the time to read. =) The problem I am having is mainly Object visibility. I'm creating objects and attempting to create references to them before they have been initialized or have any data in them. You can get an idea what I'm trying to do here with the code provided. Certain Squares can see other square ect. Now my ...

multiple objects for a single index in an NSArray

Is it possible to store multiple objects for a single index in an NSArray? ...

How to Fix "Not all code paths return a value"?

I have an object array that i'm returning to use the objects in a different method, however for some reason it's saying "not all code paths return a value" Here's the code.... private object[] runTests(string banText, object tabControlName, int runThisTest, string testName) { if (stopTests == false) { v...

Are static objects unique per user?

I have a .net application (c#) that goes something like this public partial class _Default : System.Web.UI.Page { #region initial variables setup private static exam theExam; #endregion protected void Page_Load(object sender, EventArgs e) { if(!IsPostBack) { string userid = Request.Querystri...

Creating Fake Objects

Hello, I was just curious, afer seeing an ad on S/O, and clicking on it, then downloading it from Google Code... Why would anybody want/need to create a Fake Object? I don't object to it, or don't think there's anything wrong with it, I just really don't know. Thanks! ...