Search Results

Search found 13616 results on 545 pages for 'rights management'.

Page 170/545 | < Previous Page | 166 167 168 169 170 171 172 173 174 175 176 177  | Next Page >

  • c++ overloading delete, retrieve size

    - by user300713
    Hi, I am currently writing a small custom memory Allocator in c++, and want to use it together with operator overloading of new/delete. Anyways, my memory Allocator basicall checks if the requested memory is over a certain threshold, and if so uses malloc to allocate the requested memory chunk. Otherwise the memory will be provided by some fixedPool allocators. that generally works, but for my deallocation function looks like this: void MemoryManager::deallocate(void * _ptr, size_t _size){ if(_size heapThreshold) deallocHeap(_ptr); else deallocFixedPool(_ptr, _size); } so I need to provide the size of the chunk pointed to, to deallocate from the right place. No the problem is that the delete keyword does not provide any hint on the size of the deleted chunk, so I would need something like this: void operator delete(void * _ptr, size_t _size){ MemoryManager::deallocate(_ptr, _size); } But as far as I can see, there is no way to determine the size inside the delete operator.- If I want to keep things the way it is right now, would I have to save the size of the memory chunks myself? Any ideas on how to solve this are welcome! Thanks!

    Read the article

  • Why exactly is calling the destructor for the second time undefined behavior in C++?

    - by sharptooth
    As mentioned in this answer simply calling the destructor for the second time is already undefined behavior 12.4/14(3.8). For example: class Class { public: ~Class() {} }; // somewhere in code: { Class* object = new Class(); object->~Class(); delete object; // UB because at this point the destructor call is attempted again } In this example the class is designed in such a way that the destructor could be called multiple times - no things like double-deletion can happen. The memory is still allocated at the point where delete is called - the first destructor call doesn't call the ::operator delete() to release memory. For example, in Visual C++ 9 the above code looks working. Even C++ definition of UB doesn't directly prohibit things qualified as UB from working. So for the code above to break some implementation and/or platform specifics are required. Why exactly would the above code break and under what conditions?

    Read the article

  • When do I need to deallocate memory? C++

    - by extintor
    I am using this code inside a class to make a webbrowser control visit a website: void myClass::visitWeb(const char *url) { WCHAR buffer[MAX_LEN]; ZeroMemory(buffer, sizeof(buffer)); MultiByteToWideChar(CP_ACP, MB_ERR_INVALID_CHARS, url, strlen(url), buffer, sizeof(buffer)-1); VARIANT vURL; vURL.vt = VT_BSTR; vURL.bstrVal = SysAllocString(buffer); // webbrowser navigate code... VariantClear(&vURL); } Do I need to do some memory deallocation here?, I see vURL is being deallocated by VariantClear but should I deallocate memory for buffer? I've been told that in another bool I have in the same app I shouldn't deallocate anything because everything clear out when the bool return true/false, but what happens on this void?

    Read the article

  • Why does MS SQL Mgmt Studio Express keep forgetting my passwords?

    - by Ryan
    I have about had it with this tool, I check the save password box at the login dialogue but it just doesn't work. Sometimes it will for a few days, and then the password will just be gone. Nearly every time I load this thing up I have to track down the password again and type it in. Is there some password rule in the database that would be causing this? This is driving me absolutely crazy.

    Read the article

  • How to allocate memory in another process for windows mobile

    - by Serafeim
    I'd like to read the contents of another process listview control in windows mobile. To do this, I need a pointer to some free memory to that process in order to put the values there (and then read them from my process). This can be done in normal Windows or Win32 with the VirtualAllocEx function. However, this function is not supported in windows mobile ! Can you recommend me a way to allocate that memory?

    Read the article

  • C# memory / allocation cleanup

    - by Number8
    Some near-code to try to illustrate the question, when are objects marked as available to be garbage-collected -- class ToyBox { public List<Toy> Toys = new List<Toy>(); } class Factory { public ToyBox GetToys() { ToyBox tb = new ToyBox(); tb.Toys.Add(new Toy()); tb.Toys.Add(new Toy()); return tb; } } main() { ToyBox tb = Factory.GetToys(); // After tb is used, does all the memory get cleaned up when tb goes out of scope? } Factory.GetToys() allocates memory. When is that memory cleaned up? I assume that when Factoy.GetToys() returns the ToyBox object, the only reference to the ToyBox object is the one in main(), so when that reference goes out of scope, the Toy objects and the ToyBox object are marked for garbage collection. Is that right? Thanks for any insights...

    Read the article

  • Structure of open source project's repository

    - by hokkaido
    I'm in the beginning of starting a small open source project. When cloning the main repository one gets a complete build environment with all the libraries and all the tools needed to make an official installer file, with correct version numbers. I like the fact that anyone who wants to contribute can clone the repository and get started with anything they want. But I'm thinking this makes it to easy for Evil People to create malicious installers and release into the wild. How should it be structured? What do you recommend including in the repository, versus keeping on the build server only?

    Read the article

  • How to release audio properly? (AVAudioPlayer)

    - by Aluminum
    Hello everyone! I need help with my iOS application ^^,. I want to know if I'm releasing AVAudioPlayer correctly. MyViewController.h #import <UIKit/UIKit.h> @interface MyViewController : UIViewController { NSString *Path; } - (IBAction)Playsound; @end MyViewController.m #import <AVFoundation/AVAudioPlayer.h> #import "MyViewController.h" @implementation MyViewController AVAudioPlayer *Media; - (IBAction)Playsound { Path = [[NSBundle mainBundle] pathForResource:@"Sound" ofType:@"wav"]; Media = [[AVAudioPlayer alloc] initWithContentsOfURL:[NSURL fileURLWithPath:Path] error:NULL]; [Media play]; } - (void)dealloc { [Media release]; [super viewDidUnload]; } @end

    Read the article

  • How do software projects go over budget and under-deliver?

    - by Carlos
    I've come across this story quite a few times here in the UK: NHS Computer System Summary: We're spunking £12 Billion on some health software with barely anything working. I was sitting the office discussing this with my colleagues, and we had a little think about. From what I can see, all the NHS needs is a database + middle tier of drugs/hospitals/patients/prescriptions objects, and various GUIs for doctors and nurses to look at. You'd also need to think about security and scalability. And you'd need to sit around a hospital/pharmacy/GPs office for a bit to figure out what they need. But, all told, I'd say I could knock together something with that kind of structure in a couple of days, and maybe throw in a month or two to make it work in scale. If I had a few million quid, I could probably hire some really excellent designers to make a maintainable codebase, and also buy appropriate hardware to run the system on. I hate to trivialize something that seems to have caused to much trouble, but to me it looks like just a big distributed CRUD + UI system. So how on earth did this project bloat to £12B without producing much useful software? As I don't think the software sounds so complicated, I can only imagine that something about how it was organised caused this mess. Is it outsourcing that's the problem? Is it not getting the software designers to understand the medical business that caused it? What are your experiences with projects gone over budget, under delivered? What are best practices for large projects? Have you ever worked on such a project?

    Read the article

  • TFS vs SVN

    - by Binoj Antony
    I am about to start a project (.NET) and need to decide between TFS and SVN. I am more used to SVN(with tortoise client), CVS and VSS. Does TFS have all features available in SVN Have any of you switched from SVN to TFS and found it worthwhile? Also it looks like we may need Visual Studio if we need to work with TFS. [Edit] Money is not a consideration since we already have the licenses for TFS in place. And I am more interested in the Source Control features of TFS vs SVN, of course other features list is also welcome.

    Read the article

  • Qt: QStackedWidget solution

    - by Martin
    I'm building a Qt application that have about 30 different views (QWidgets). My idea is to use a QStackedWidget to make it easy to switch between the different views in the application. I have two different solutions of how to implement this and use as little memory as possible when the user navigates through the application. Solution 1: Everytime I need to show a view I check if it is already in the stack. (The user might open the same view many times, maybe a view showing an item from a database). If the view is in the stack already it doesn't need to be created again and I can just show the view. The good thing with this solution is that I reuse the views (widgets) so they only need to be created once. This is good as the UI and other stuff should look the same everytime the user show a view, so why not reuse it? The problem with this solution is that every view has childrens. Maybe an object, a QList with objects or other things. A good thing with Qt is that you can use the parent-children mechanism so that the children will be deleted when the parent is deleted. As I never delete the parent (view) I need to handle this myself as the children might need to be deleted from different times when the view is shown. (Maybe the view show a list with objects and the list should be updated from a database each time the view is shown.) Solution 2: Everytime I need to show a QWidget I create a new one and show it. When it is not shown anymore, I delete it from memory. This is a quite easy solution. And as I delete the views when they are not shown both the view and it's children should be deleted from memory so it shouldn't increase memory, am I right? Which one of the solutions do you recommend?

    Read the article

  • Does anyone else think instance variables are problematic in database-backed applications?

    - by Ben Aston
    It occurs to me that state control in languages like C# is not well supported. By this, I mean, it is left upto the programmer to manage the state of in-memory objects. A common use-case is that instance variables in the domain-model are copies of information residing in persistent storage (i.e. the database). Clearly this violates the single point of authority principle, and "synchronisation" has to be managed by the developer. I envisage a system where instead of instance variables, we have simple public access/mutator methods marked with attributes that link them to the database, and where reads and writes are mediated by a framework that decides whether to hit the database. Does such a system exist? Am I completely missing the point, or is there some truth to this idea?

    Read the article

  • SHFileOperation replace file dialog

    - by JHowzer
    Currently, SHFileOperation has some confirm file replacement dialog boxes that ask the user if they would like to replace a file or not. I find these useful, but I would like to be able to modify the scenario in which they occur. Instead, I would like to compare the file contents first with a bool compareFile() function I wrote. Then, if the files are identical the file replacement dialog box will not come up. Assuming, I already have a working compareFile() function, is there a way for me to do this? Thank you for your time.

    Read the article

  • iphone: memory problems after refactor

    - by agilpwc
    I had a NIB with several view controllers in it. I modified the code and used Interface Builder decomose interface to get all the view controllers in their own Nib. But now with empty core data database, I'm getting "message sent to deallocated instance" errors. Here is the code flow: From the RootViewController this is called: if (self.dogController == nil) { DogViewController *controller = [[DogViewController alloc] initWithNibName:@"DogViewController" bundle:nil]; self.dogController = controller; [controller release]; } self.dogController.managedObjectContext = self.managedObjectContext; [self.navigationController pushViewController:self.dogController animated:YES]; Then in a dogController a button is pressed to insert a new object and the following code is excuted and the error hits on the save, according to the trace NSManagedObjectContext *context = [self.fetchedResultsController managedObjectContext]; NSEntityDescription *entity = [[self.fetchedResultsController fetchRequest] entity]; NSManagedObject *newManagedObject = [NSEntityDescription insertNewObjectForEntityForName:[entity name] inManagedObjectContext:context]; // If appropriate, configure the new managed object. [newManagedObject setValue:[NSDate date] forKey:@"birthDate"]; [newManagedObject setValue:@"-" forKey:@"callName"]; // Save the context. NSError *error = nil; if (![context save:&error]) { Then the error produced in the console is * -[JudgeViewController numberOfSectionsInTableView:]: message sent to deallocated instance 0x598e580 I'm racking my brain for hours and I can't figure out where my minor changes made something messed up. Any ideas?

    Read the article

  • Creating and releasing objects in the same method, while using self as delegate

    - by user200341
    In objective-c you are responsible for releasing objects you allocate, but what happens when you allocate an object in a method, assign self as the objects delegate, and then release the object. The callbacks from the newly created (and released) object fails at this point, or rather, doesn't happen. - (void)doSomething { MyObj *myObj = [[MyObj alloc] init]; myObj.delegate = self; [myObj performOperation]; [myObj release]; } - (void)callbackMethodFromMyObj:(NSString *)message { NSLog(message); } I can't release the object until the callback has occurred, and I can't avoid releasing the object in the same method that creates it (because it exists outside the scope). One way of doing it would be to pass the object along in the call-back and release it in the callback, but is this the right way to go about this?

    Read the article

  • How to handle 30k files in a project which requires them?

    - by Jeremiah
    Visual Studio 2010 RC - Silverlight Application We have a library of images that we need to have access to. They are given to us from a vendor (through an installer) and they are not in a database, they are files in a folder (a very large monster of a folder). We do not control when the images change, so the vendor needs to be able to override them individually. We get updates frequently enough from this vendor to state that these images change "randomly" and without our (programmer) knowledge. The problem: I don't want 30K images in SVN. Heck, I don't even want to imagine them in my Solution. However, our application requires them in order to run properly. So, our build/staging servers need access to these images (we have two build servers). The Question: How would you handle it when your application will not work as specified without access to each of 30k images and you don't control when those images change? I'm do not want to have a crazy large SVN repository. Because I don't know when any of these images change, I really don't want them in my solution (definitely do not want a large solution, either). I also don't want a bunch of manual steps to do every time these images change. Our mantra, up to this point, has always been, any developer could download from SVN, compile and run our app. These images are going to kill that mantra. I'm tempted to make a WCF service that will return images if they exist and a dummy image if they don't. This way all dev boxes will return a dummy image and our build/staging/production boxes will return real images (ones that actually have the vendor's image installer installed on). This has to be a solved problem. What have other people done to handle these types of problems? I'm open to suggestions.

    Read the article

  • Pomodoro technique & other ways to increase personal productivity? Any ideas?

    - by Jayson
    I recently came across Pomodoro Technique as a way to increase productivity, get in the zone, and in general feel a sense of accomplishment at setting some short programming goals and achieving them. So far I have enjoyed it and the sense of accomplishment I get after seeing a bunch of short goals add up at the end of the day to a lot of work done on a programming project. I'm looking for other ideas similar or not to the pomodoro technique to add a little variety to achieving goals, personal productivity, get in the programming zone, etc. Any ideas or techniques that are expressed formally such as in the pomodoro paper, that are not trite fluffy maxims?

    Read the article

  • NSMutableArray for Object which has NSString property causes memory leak

    - by user262325
    Hello everyone I hope to add objects to a NSMutableArray "myArray", The NSMutableArray is the array for FileObj which has a NSString property "fileName" #import <UIKit/UIKit.h> @interface FileObj : NSObject { NSString *fileName; } -(void) setfileName:(NSString *)s ; -(NSString *) getfileName ; @end // // File.m// #import "File.h" @implementation FileObj -(void) setfileName:(NSString *)s ; { fileName=s; } -(NSString *) getfileName ; { return fileName; } @end I initialize the myArray here: NSMutableArray *temarray; temarray=[[NSMutableArray alloc] init]; self.myArray=temarray; [temarray release]; the codes to add object to myArray FileObj *newobj=[[FileObj alloc]init ]; NSString *fieldValue2 = [[NSString alloc] initWithUTF8String:@"aaaa"]; [newobj setfileName:fieldValue2]; [myArray addObject:newobj]; [fieldValue2 release]; //**if I enabled the line, it will cause crash** //**if I disable the line, it will cause memory leak** [newobj release]; Welcome any comment Thanks interdev

    Read the article

  • What tools do you have at your disposal as a manager to promote a way of thinking

    - by John Leidegren
    This question goes beoynd just programming, but I'd like to get some input on this, if that's okay with the community. Preferably from people that do a lot of coding themselves but also manage other people coding. My problem is this. We have all these ideas that we know is good for the overall strategy of the company and the problem is not figuring out what to do, it's to come about this change. Just telling someone to do things differently isn't enough and it's hard to promote a mind set that is shared within all of the company, (this will take time). If I could jump forward I'd like it if we could create a very nurturing company culture that promotes these ideals cross all areas but I'm not sure what tools to use. And by tools I mean anything I'm legally permitted to do. e.g. we could talk about, we could arrange traning sessions, we could spend more time in meeting (talk about it more), we could spend more time designing, we could spend more time pair-programming, we could add/remove incentive or we could encurage more play. Ultimately if we did all of these things what will be the recurring theme that ties this together. I'd like to be able to answer the question -- why should we do things like this? -- and come up with an answer that explains how important it is to think about our ideals from begining to end. I've puposly avoided to talk about or specifics of the situtation becuase I believe that it narrows things down too much. But I guess, by know you either know how to answer this question or you're as confused as I am ;) I'd love to hear from people who had to bring about a change in order to go from chaos to order, or fix something in the organization which wasn't working. And I'd like to hear it from the perspective of the developer and designer. -- or -- You could simply weigh in on what are the most important qualities in an organization encurage or stimulate rigid fun development cycle from start to finish?

    Read the article

< Previous Page | 166 167 168 169 170 171 172 173 174 175 176 177  | Next Page >