cleanup

jdbc: when can i close what

currently i have jdbc code with the following basic stucture: get Connection (do the next 4 lines several times, never closing statement) get statement get result set process result set close result set close connection It occurred to me after writing this code that i need to close the statement. 1 what are the effects of not cl...

Is there a need to close file descriptors before exit?

Of course, the immediate answer for most situations is "yes", and I am a firm believer that a process should correctly cleanup any resources it has allocated, but what I have in my situation is a long-running system daemon that opens a fixed number of file descriptors at the startup, and closes them all before exiting. This is an embedd...

SVN says I need to perform cleanup, but the cleanup fails

When I try to commit: Error: Working copy 'D:\Webs\Drupal 6' locked Error: Please execute the "Cleanup" command. When I try to do a cleanup: Cleanup failed to process the following paths: D:\Webs\Drupal 6 Does anyone know how I can solve this problem? Duplicate: http://stackoverflow.com/questions/127932/svn-working-copy-xxx-lock...

SVN Error - Not a working copy

I got quite a few questions about the same topic here on SO. But could not get an useful answer. And none of these questions talk about the exact problem I have. So I thought adding one more question here is ok. Please do not close this as a duplicate ! Recently our svn server was changed and we did a svn switch. Since the working copy ...

Switching methods for a single result.

Heyall, I have a situation where I require to consult different objects in PHP via different methods to find some data. The question regards more about formatting the code than an actual programming issue. What I am trying to do is not using several if's to gather this data like: $data = obj->getData(); if (!isset($data)) $data = othO...

How can I format an entire source tree in Eclipse 3.4 (Ganymede)?

The obvious thing to do would be to: Right-click on the folder that you wish to format. Source > Format Expected results: - All java code in the directory and subdirectories are formatted (using the project specific formatting settings) Actual results: - None of the java is formatted. While we're at it, how can we do a batch clea...

Clean up unwanted code C#

I got a C# application with Visual Studio 2005. The code has some 300KLOC code, which has been raped over 3 years. When I was going through code found out that lot of unused functions/methods/properties. Its not possible to clean the code manually (Requires checking each member and if found no references delete it.) I am looking to au...

Tools for cleaning garbage PHP

I just inherited a 70k line PHP codebase that I now need to add enhancements onto. I've seen worse, at least this codebase uses an MVC architecture and is object oriented. However, there is no templating system and many classes are deprecated - only being called once. I think my method might be the following: Find all the files on t...

C# Code Simplification Query: The Sequential Foreach Loops

Suppose I have some code that looks like this: foreach(type x in list y) { //dostuff1(x) } foreach(type x in list y) { //dostuff2(x) } foreach(type x in list y) { //dostuff3(x) } foreach(type x in list y) { //dostuff4(x) } foreach(type x in list y) { //dostuff5(x) } I cannot combine things into one big for loop like...

Killing a process on exit

My project has an object that creates a process. It this object's Dispose function, it kills the process (or tries to). However, if the program crashes, it leaves the process running and doesn't clean up. Which causes the program to fail next time because it tries to launch the process again and can't get a lock on it. How can I make su...

Tool for cleaning up CSS?

Before publishing a site I have bloat of unused CSS styles. Is there any good tool to detect unused CSS classes, divs? Related Questions: Tool to identify unused css definitions Are there any utilites that will help me refactor CSS ...

Script for Maintaining folders

I am trying to create a script that will keep 5 folders or 6 months worth of folders, whichever is greatest. I would have to use the created date for the 6month part of the script since the naming convention is by version rather than date. would anybody have any ideas about the best way to proceed? Thanks. ...

Intellij reformat on file save

I remember seeing in either IntelliJ or Eclipse the setting to reformat (cleanup) files whenever they are saved. How do I find it (didn't find it in the settings) ...

CruiseControl.net reports SVN locked exception

I am trying to setup a CruiseControl.net (version 1.4.4) server on a machine with Windows XP SP3. The source is contained in an SVN repository on a different server. The svn client I am using was installed through the Cygwin tools. I am able to get CruiseControl.net successfully installed and configured up to getting the Subversion part...

OS; resources automatically clean up

From this answer: http://stackoverflow.com/questions/1058797/when-is-a-c-terminate-handler-the-right-thingtm/1058894#1058894 It would be nice to have a list of resources that 'are' and 'are not' automatically cleaned up by the OS when an application quits. In your answer it would be nice if you can specify the OS/resource and preferably...

How to automatically remove all .orig files in Mercurial working tree?

During merges mercurial leaves .orig file for any unresolved file. But after manually resolving problems and marking a file correct it does not delete the .orig file. Can it be automatically removed by some command? I work on a Mac so I can use something like: find . -iname '*.orig' -exec rm '{}' ';' and alias it or something, but I'...

Tools for Website Content Cleanup?

I am working with a client to migrate a web site from the existing production hardware into a new hardware environment. Now seems like an excellent time to perform an audit and remove any old or obsolete content rather than just blindly copy it again. Are there any good free tools or scripts I can use to compare the web accessible cont...

Is KillTimer necessary?

Hi All! I use SetTimer API and I see a lot of code like this: case WM_DESTROY: // Destroy the timer. KillTimer(hwnd, IDT_TIMER); PostQuitMessage(0); break; Do I have to call KillTimer or the system will automatically free resources on the process exit? Does forgetting to call KillTimer lead to resource leaks? I u...

How do I gracefully exit WinForms app when hitting stop debugging in VS?

I'm writing a system tray Winforms app which does some very important cleanup on Application.ApplicationExit. When I hit the stop button while debugging in Visual Studio, this the process exits, but this cleanup code doesn't get called. Is there some way I can make sure it gets called in this situation? ...

Question about the use and scope of global.asax (for file cleanup after application ends)

Hey guys, I apologize for this basic question, but for the life of me I can't seem to find an answer. I previously asked a question here about how to dynamically store temporary images and handle their cleanup on a web server's file system. (using C# in .NET 3.5) It was suggested that I use a global.asax file to handle this. I just...