objects

Design Question - Storing Images as Objects.

Ok, so my site is centric to a lot of dynamic user entered images for different user defined objects throughout. So I have many objects, and those objects have images. Is it good practice to treat images like an object since the "Image Name" and "Image Bytes" columns are repeated many times? Or is it more sensible just to include those...

How much memory does a C#/.NET object use?

I'm developing an application which currently have hundreds of objects created. Is it possible to determine (or approximate) the memory allocated by an object (class instance)? ...

How to use nested Functions in Objects

Suppose you use the following structure: var Args = new Object(); Args.Age = '10'; Args.Weight = '10'; Args.GetAge = function() { return 'I am ' + Age + ' years old'; } Args.GetWeight = function() { return 'I weigh ' + Weight + ' pounds'; } That works great. But is it possible to use a generic so you don't have to create a ...

Programmatically Update an attribute in Core Data

I've looked through all the class documentation for Core Data and I can't find away to programmatically update values in a core data entity. For example, I have a structure similar to this: id | title ============ 1 | Foo 2 | Bar 3 | FooFoo Say that I want to update Bar to BarBar, I can't find any way to do this in any ...

How do we verify elements existence by id in SharePoint lists?

I want to get a item from a list without loading all the items of the list. I know I can do it by calling SPList.getElementbyId(myID), but if I don't know if this myID exists in the list, how do I verify it? Yes I could use SPListItem myItem = myList.Items[myID]; if (myItem == null) { // log that we don't have this item } However, ...

Object and Ternary Operator PHP

Hello, I wanna make use of the Ternary Operator with an object. if($msg == 'hello'){ $o->setHello('hello'); else $o->setHello('bye'); How could I do that? Thanks ...

Building personal CMS - classes and libraries

I'm building my personal CMS and need your advice organizing core functions and classes. I have folders: /shared /classes DB.php Session.php Config.php ... /libraries Arrays.php DateTime.php Email.php ... The files in 'classes' folder contains core classes (one class per fi...

Possible Multi-Instanced Object Problem in PHP

Hi, I'm getting a "Call to a member function process_data() on a non-object in page.class.php on line 35" even though the object has been called. Here is the index.php extraction showing the object being instantised // require our common files require("modules/module.php"); require("registry/objects/datetime.class.php"); require("reg...

PHP Object Creation and Memory Usage

A basic dummy class: class foo { var $bar = 0; function foo() {} function boo() {} } echo memory_get_usage(); echo "\n"; $foo = new foo(); echo memory_get_usage(); echo "\n"; unset($foo); echo memory_get_usage(); echo "\n"; $foo = null; echo memory_get_usage(); echo "\n"; Outputs: $ php test.php 353672 353792 353792 3537...

Using a Function to create an Object in actionscript 3.0

Since actionscript 3.0 is based on ECMAscript it shares some similarities with javascript. One such similarity that I have been playing around with is creating Objects from functions. In javascript to create an object, var student = new Student( 33 ); document.write( student.age ); function Student( age ){ this.age = age; } In a...

WPF databinding: database or objects?

Im trying to create this: Tag1 has the erdered list of objects O1, O3, O2 Tag2 has the erdered list of objects O1, O4 Every time I click a tag, I want to see the list of objects. So clicking Tag1 would show in a listbox: O1 O3 O2 But I would like to keep the auto update so every time I edit or add/delete an object it auto updates (...

unable to register 3rd party dll

I am new to usage of objects in HTML esp dlls I need to use a 3rd party dll in my html page for which I need the classid which was not provided to me. I have tried using the following command to generate the type library and register it. "regasm XXXXXXXX.dll /register /tlb" After I am done with the above statement, I have used oleview...

Problem in releasing memory from an Outlook pst file

I am working on a win app which accesses the Outlook personal folders. Internally, it mounts the personal folder on the Outlook instance and processes the mails and then unmounts the pst. After unmounting the pst, I delete that file. Now the problem is that even after un mounting the pst and releasing memory, when I try to delete the ps...

How to implement reference counted objects in Delphi

I have a graph like structure. I don't know exactly when to destroy the objects in traditional Delphi manner, instead I would like to implement something like reference counted objects. I know that I can use something like object.GetReference and object.Release instead of Free, and use a private variable for reference counting, but is th...

LINQ to XML and LINQ to Objects syntax

Why is: (CheckBox)lstControls.Where(x => x.ID == "some_id").SingleOrDefault(); not as efficient as: (CheckBox)lstControls.SingleOrDefault(x => x.ID == "some_id"); And for a not-so-well-formed XML document and you only know the name of the element you are looking for is this the best statement you can use to find the element: var x...

Function vs Objects Best Practice

Hi, I am wondering whats the best practices regarding functions and objects. For example I want to perform an action called tidy. It will take my data as input and tidy it and return it. Now I can do this in two ways. One using a simple function and the other using a class. Function: $data = tidy($data); Class: $tidy = new Tidy(); $da...

Best way to pass Entity Framework entity collections from the DAL to the Business Layer?

I have a DAL that makes calls to my Entity Framework Model. The calls return things like IOrderedQueryable and IQueryable objects. Should I convert them to something more universal in my DAL, such as List? But I assume that if I don't need to enumerate through the entire collection, this could be wasteful... So whats the best approac...

select child object collection with lambdas

I have the following class objects: public class VacancyCategory { public int ID { get; set; } public string Text { get; set; } public IList<VacancySubCategory> SubCategories { get; set; } } public class VacancySubCategory { public int ID { get; set; } public string Text { get; set; } public VacancyCateg...

closures and objects

Functional programming .. is like classic ( Mark Twain's type). While reading another articles about SICP, where people are talking about the great impact closures had on there thinking, i got reminded of this, which i read ages ago Closures are poor man's objects Objects are poor man's closure ( Can't recall exact source but it was pr...

Object reference in java

consider this simple servlet sample: protected void doGet(HttpServletRequest request, HttpServletResponse response){ Cookie cookie = request.getCookie(); // do weird stuff with cookie object } I always wonder.. if you modify the object cookie, is it by object or by reference? ...