new

Creating A New SaveFileDialog

After a lot of thought and consideration, and Google-ing, I'm hell-bent on creating my own SaveFileDialog. But I do not know where to start and since I haven't seen anything around the web, I would like to know if anybody has done this before, and what I should look into, or how I might go about doing this? Any help would be greatly app...

Overriding "new" and Logging data about the caller

I'm trying to write a memory profiler and so far have been able to get my custom functions to work for malloc, free, new and delete. I tried using __FILE__ and __LINE__ to log the originator inside the overloaded new method, but (as expected) it just gives the details of where the overloaded function is. Is there a way to get the details...

Can you use the C# new keyword to expand properties on an interface?

I understand how the "new" keyword can hide methods in a derived class. However, what implications does it have for classes that implement interfaces that use the keyword? Consider this example, where I decide to expand an interface by making its properties read/write. public interface IReadOnly { string Id { get; } } pub...

[phpunit] mock newly created instance?

hi i have old code which didnt use TDD now i want to write a test for a function which looks like this function somefunction($someargs){ // do a few checks on $someargs $database = new DB_PG(); $result = $database->select($query); // do some changes on result return $result; } since im not much expirienced with ph...

Giving an instance of a class a pointer to a struct

I am trying to get SSE functionality in my vector class (I've rewritten it three times so far. :\) and I'm doing the following: #ifndef _POINT_FINAL_H_ #define _POINT_FINAL_H_ #include "math.h" namespace Vector3D { #define SSE_VERSION 3 #if SSE_VERSION >= 2 #include <emmintrin.h> // SSE2 #if SSE_VERSION >= 3 #inc...

Creating a singleton from any given class in javascript

I have written the following function that permits creation of singleton classes from given classes: function SingletonFrom(Constructor) { return function() { var self = arguments.callee; if (self._instance === undefined) { switch (arguments.length) { // this is ugly case 0: self._instanc...

How to create a new source code branch using TFS API?

Hi I am trying to create a new branch using the API, and have used both PendBranch() and CreateBranch(). The problem with CreateBranch() is it commits immediately and I want to be able to add comments as the branch is checked in. So, I what I did is shown below. Basically I get all the information like server item and local item to be ...

Serialization of a derived class that hides a base property

I have a class like this MyClass : BaseClass string new FirstName When I try to serialize this class I get the following error message Member SQLClientAdapter.Columns of type hides base class member Adapter.Columns of type ...Use XmlElementAttribute or XmlAttributeAttribute to specify a new name. The recomendation did not work. ...

JavaScript: How to create a new instance of a class without using the new keyword?

I think the following code will make the question clear. // My class var Class = function() { console.log("Constructor"); }; Class.prototype = { method: function() { console.log("Method");} } // Creating an instance with new var object1 = new Class(); object1.method(); console.log("New returned", object1); // How to write a factory wh...

Operator new and bad_alloc on linux

On Linux, malloc doesn't necessarily return a null pointer if you're out of memory. You might get back a pointer and then have the OOM killer start eating processes if you're really out of memory. Is the same true for c++'s operator new or will you get the bad_alloc exception? ...

Is there any danger in calling free() or delete instead of delete[]?

Possible Duplicate: ( POD )freeing memory : is delete[] equal to delete ? Does delete deallocate the elements beyond the first in an array? char *s = new char[n]; delete s; Does it matter in the above case seeing as all the elements of s are allocated contiguously, and it shouldn't be possible to delete only a portion of the ...

Add a row dynamically in TableView of iphone

Hi all, I need to add a new row in the tableview when i select a row in the table. Am i suppose to use the following method??? - (void)insertRowsAtIndexPaths:(NSArray *)indexPaths withRowAnimation:(UITableViewRowAnimation)animation What shoud i write inside the method to add a new row.? Please do help me, Thanks in advance Shibin....

What is the 'new' keyword in JavaScript?

What exactly is the new keyword in JavaScript? Javascript is not a object oriented programming languges and thebefore there are no classes, so it's probably not for creating instances of objects... ...

Asp.net page crashes other asp pages

I have a couple Asp.net pages that use a few database connections - the problem is when these two pages are separately loaded they crash all the other .asp pages but none of the .aspx pages. I get this error however for the asp pages that don't load: HTTP/1.1 New Session Failed ...

Pointer won't return with assigned address

I'm using Qt Creator 4.5 with GCC 4.3 and I'm having the following problem that I am not sure is Qt or C++ related: I call a function with a char * as an input parameter. Inside that function I make a dynamic allocation and I assign the address to the char *. The problem is when the function returns it does not point to this address any...

Add new data into PHP JSON string

Hello. I have $data as JSON encoded data and I have this string: $new_data = "color:'red'"; that needs to be added to $data so that I can read it from it as a json string. How can I achieve this ? Thank you. ...

Subsonic: How to add new properties and populate its data using Linq

I extend the Order Class generated by activerecord: public partial class Order { private string _refCustomer; public string RefCustomer { get { return _refCustomer; } set{_refCustomer =value;} } } Then, I tried to populate Order's data: var info = (from o in db.Orders join...

problems with operator new when allocating arrays

Hello! I'm having prblems with my C++/openGL program. at some point of code, like these(it's a constructor): MyObject(MyMesh * m, MyTexture* t, float *c=NULL, float *sr=NULL, int sh=100){ texture=t; mesh=m; subObjects=NULL; texCoords=NULL; if (texture!=NULL){ texCoords=new float[mesh->numSurfacePoints*2]; the new throws an std::bad...

bad_alloc exception when trying to print the values

I've debugged my other problem back, to the MyMesh constructor. In this code: if (hollow) { numTriangles = n*8; triangles=new MyTriangle[numTriangles]; if (smooth) numSurfacePoints=n*8; else numSurfacePoints=n*12; surfacePoints=new SurfacePoint[numSurfacePoints]; }else { numTriangles = n*4; triangles=new MyTr...

iPhone create folder inside documents folder

Hello, i just want to create new folders in the documents folder of my iPhone app does anybody know how to do that ? appreciate your help! ...