Questions tagged [resource-management]

142 questions
4
votes
2 answers

HttpContext.GetGlobalResourceObject always returns null

I created two files in the App_GlobalResources folder: SiteResources.en-US.resx SiteResources.sp-SP.resx Both contain a value for "SiteTitleSeparator". Here is what I am trying to do (The following line always returns null): string sep =…
3
votes
2 answers

Do (POSIX) Operating Systems recover resources after a process crashes?

Let's assume we have a process that allocates a socket listening on a specific port, does something with it and then terminates abnormaly. Now a second process starts and wants to allocate a socket listening on the same port that was previously held…
Johannes Rudolph
  • 35,298
  • 14
  • 114
  • 172
3
votes
2 answers

Do I have to manually shut down an Executor at application exit?

Suppose I have an Executor executor; somewhere in my application. Is it sufficient to just say setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); as usual and let "the system" deal with it, or do I have to register a listener and call…
fredoverflow
  • 256,549
  • 94
  • 388
  • 662
3
votes
3 answers

Do you clean before you make mess? On putting cleanup code inside finally block

I have a question concerning exception handling and resource management and I was wondering if anybody could share their opinion. I need to perform a sequence of actions: read app settings, setup the environment, do the stuff and then eventually…
lukem00
  • 859
  • 8
  • 17
3
votes
1 answer

Generic handle class

I stumbled onto this problem: Using unique_ptr to control a file descriptor. The std::unique_ptr is not really appropriate for a general handle. So is the more general class template class…
user877329
  • 6,717
  • 8
  • 46
  • 88
3
votes
2 answers

How to make sure resource is released, with nested object hierarchy?

I have code (simplified) like this: class A { B b = new B(); void close() { b.close(); } } class B { Closeable mustBeClosed = new Closeable() { { System.out.println("create"); } …
Nan Wang
  • 65
  • 6
3
votes
1 answer

Do WPF Windows Dispose() their DataContexts?

If I set the DataContext of a Window to something that implements IDisposable, will it be Dispose()d when the Window is closed?
Shea Levy
  • 5,237
  • 3
  • 31
  • 42
3
votes
1 answer

Are Iteratees safe for managing resources?

Suppose I were reading from an InputStream. How I would normally do it: val inputStream = ... try { doStuff(inputStream) } finally { inputStream.close() } Whether or not doStuff throws an exception, we will close the InputStream. How I…
Paul Draper
  • 78,542
  • 46
  • 206
  • 285
2
votes
1 answer

Changing ResourceManager (Make it Updatable)

I have a project in MVC 3 (Razor) For localization we are using Strongly typed resources. We want to have possibility to update translation that already exist "on-line". It means, that it should be possible to edit translation on the website. (e.g.…
Piter
  • 29
  • 2
2
votes
1 answer

Using __del__ properly when referencing external resources

I am dealing with an external library that does not handle its resources in a pythonic way. The library is natively a C++ library with a Python wrapper around it. Whenever a library function returns a C++ object, what I actually get is a string…
BlindDriver
  • 627
  • 3
  • 14
2
votes
6 answers

Closing a resource stored in Option[ ]

I have a resource object stored in an option. private var ochan: Option[Channel] = None At some point during program execution, ochan is set to Some(channel). I'd like to close the channel (via invoking the method close) and set the option to None…
Andy
  • 5,108
  • 3
  • 26
  • 37
2
votes
2 answers

how does Spark limit the usage of cpu cores and memory?

How does Spark limit the usage of cpu cores and memory?Does it use cgroups? How about Yarn?
2
votes
1 answer

Resize image when uploading to server or when serving from server to client?

My website uses many images. On a weak day users will upload hundreds of new images. I'm trying to figure out what is the best-practice for manipulating sizes of images. This project uses Node.js with gm module for manipulating images, but I don't…
2
votes
2 answers

Initialize object from another one in C++

In my project I have Resource objects which can be loaded and reloaded from different formats. Loading algorithms are implemented in different ResourceLoader subclasses. class Resource { private: // Not for client access Type1…
Niello
  • 83
  • 6
2
votes
1 answer

Managing database and connection lifetime

In Qt there are a few steps that need to be finish until a database access can be done. The very first step is to add a database by connection name: QSqlDatabase::addDatabase("QMYSQL", connectionName); After this I can use open() and close() to…
Silicomancer
  • 8,604
  • 10
  • 63
  • 130