new

Migration to new domain

I'm working on a drupal 6 site at mydomain.com/drupalsite, and the designer has put a lot of hardcoded image paths in there, for instance a custom img folder in mydomain.com/drupalsite/img. So a lot of the site uses links to /drupalsite/img/myimg1.png. Here's the problem -- the site is eventually moving to finaldomain.com, via pointing...

Are there any other keywords that can be accessed using the global namespace scope resolution operator?

The global new and delete can be used like normal, but you can also prefix the :: operator to them and it will work the same. Are there any other keywords that have this same behaviour? Thanks. ...

How to install Boost on windows?

Hello, I added to c++ includes path to my folder with boost, but even example code from official site, dont work. Should I do smth else? I have got: boost/lambda/lambda.hpp: No such file or directory. EDIT: In Code Blocks I set "settings->compiler and debugger->search directories->compiler" to path to `/boost/. ...

Generic function new with parameter problem.

HI, I have a generic function as shown below. It can be used to show a form by calling showForm(ch); IT works for the second function (new without parameter) ,But if I want to show form but with parameter in the constructor as in the third function (new with parameter) ,then I could not do it .Any one has an idea how to do it? ...

So what really happens when we use 'new' in PHP

So what really happens when someone say 'new' in PHP I believe in C/Java, when new is called, memory is allocated for each instance variables that are needed for an object? (correct me if i am wrong) Is this the same with PHP? ...

Will new operator return NULL?

Possible Duplicate: Will new return NULL in any case? Say i have a class Car and i create an object Car *newcar = new Car(); if(newcar==NULL) //is it valid to check for NULL if new runs out of memory { } ...

Array of objects created dynamically.

Possible Duplicate: How does delete[] know the size of the operand array? Assume i have an array of objects created dynamically Car *newcars = new Car[10]; delete [] newcars; How does the compiler know that there are 10 objects that need to be deleted. ...

JavaScript new keyword and objects scopes

Later today, I was scrolling through ejhon.com slides and I found out the following: Give this code function katana () { this.myvar = true; } katana (); console.info (myvar); Past the moment I compiled the code, I thought that myvar is attached to the katana function. Actually, it gets attached to the window objects, which pollutes t...

Asymmetric behavior for __getattr__, newstyle vs oldstyle classes

Hi, this is the first time I write here, sorry if the message is unfocuessed or too long. I was interested in understanding more about how objects'attributes are fetched when needed. So I read the Python 2.7 documentation titled "Data Model" here, I met __getattr__ and, in order to check whether I understood or not its behavior, I wro...

In Java what happens when an object fails to be instantiated?

I come from a c++ background and I find myself constantly doing this in java: SomeClass sc=new SomeClass(); if(null!=sc) { sc.doSomething(); } What I want to know is what will be in the variable sc if the constructor fails for some reason (like maybe not enough memory). I can' t find a straight answer, and I am worried that I am...

deleting an object in C++

Here is a sample code that I have: void test() { Object1 *obj = new Object1(); . . . delete obj; } I run it in Visual Studio, and it crashes at the line with 'delete obj;'. Isn't this the normal way to free the memory associated with an object? I realized that it automatically invokes the destructor... is this normal? ...

Creating executable scripts with PHP

I'm building a module for a CMS that creates its own PHP files. I've received some feedback that a lot of hosting providers don't allow PHP to have write permissions on directories where PHP scripts can be executed. Although the scripts are not technically "executable" (they're just class definitions), I'm concerned that this module may ...

What is the right way to allocate memory in the C++ constructor?

Which is the right way to allocate memory via new in the C++ constructor. First way in the argument list: class Boda { int *memory; public: Boda(int length) : memory(new int [length]) {} ~Boda() { delete [] memory; } }; or in the body of constructor: class Boda { int *memory; public: Boda(int l...

WPF TabControl - Add New Tab Button (+)

What is the proper way of adding a '+' button tab at the end of all the tab items in the tab strip of a tab control. It should work correctly with multiple tab header rows. It should be at the end of all tab items Tab cycling should work correctly (Alt+Tab) ie the + tab should be skipped. I shouldn't have to modify the source collec...

Modifying a namedtuple's constructor arguments via subclassing?

I want to create a namedtuple which represents the individual flags in a short bitfield. I'm trying to subclass it so that I can unpack the bitfield before the tuple is created. However, my current attempt isn't working: class Status(collections.namedtuple("Status", "started checking start_after_check checked error paused queued loade...

What is the purpose of hiding (using the "new" modifier) an interface method declaration ?

Hello, it's possible to mark a method declaration in an interface as "new" but does it have any "technical" sense or is it just a way to explicitly state that the declaration cannot override a previous one ? For example : interface II1 { new void F(); } interface II2 : II1 { new void F(); } is valid (the C# 4.0 compiler doe...

Is it possible to use a C++ smart pointers together with C's malloc?

Some of my code still uses malloc instead of new. The reason is because I am afraid to use new because it throws exception, rather than returning NULL, which I can easily check for. Wrapping every call to new in a try{}catch(){} also doesn't look that good. Whereas when using malloc I can just do if (!new_mem) { /* handle error */ }. Th...

How do you `realloc` in C++?

Any ideas how to realloc in C++? It seems to be the missing language language - there is new and delete but not resize! I need it because as my program reads more data, I need to reallocate the buffer to hold it. I don't think deleteing the old pointer and newing a new, bigger one, is the right option. Please enlighten me. Thanks, B...

mongoid new versus build

hello frens why mongoid dosen't insert id when calling new on an association, but inserts id when calling build on an association? Is this a bug or this is how it works in mongoid? ...

Copy docx from template and use it as new

Hi everyone, I'm using a "template.docx" to copy to my "newDoc.docx" to use some predefined styles or illustrations. But with this new content, i want to update fields and my table of contents, so it's easy to do it with a vba script, the user don't have to do anything. But i have a problem, i juste want one execution at the first ope...