cleanup

Auto-cleanup for TortoiseSVN

Sometimes Tortoise requires me to do cleanup for no good reason - meaning I didn't abuse / kill it / stop it in the middle ... IMO this is "normal opertaional flow" and shouldn't require a manual cleanup. Is there a way to not show these cleanup requests to the user but rather just do them silently under the hood and present a consisten...

Cleaning up PHP.

Is there anyway I can clean up if($class == 2 AND $posts >=1){$showpost ="1";} else {$showpost ="$posts"; if($class == 3 AND $posts >=2){$showpost ="2";} else {$showpost ="$posts"; if($class == 4 AND $posts >=3){$showpost ="3";} else {$showpost ="$posts"; if($class == 5 AND $posts >=4){$showpost ="4";} else {$showpost ="$posts"; if($cla...

In Java, should variables be declared at the top of a function, or as they're needed?

I'm cleaning up Java code for someone who starts their functions by declaring all variables up top, and initializing them to null/0/whatever, as opposed to declaring them as they're needed later on. What are the specific guidelines for this? Are there optimization reasons for one way or the other, or is one way just good practice? Are t...

Cleaning up C# code

Is there any tool that cleans up C#.NET code of all the comments, debug statements, documentation when deploying it to a server? I am looking to use this for deployment scenarios...and hopefully should be able to integrate this with CruiseControl.NET or even TFSBuild. Thanks in advance. SK ...

Any way to keep curl's cookies in memory and not on disk

I'm doing some cURL work in php 5.3.0. I'm wondering if there is any way to tell the curl handle/object to keep the cookies in memory (assuming I'm reusing the same handle for multiple requests), or to somehow return them and let me pass them back when making a new handle. Theres this long accepted method for getting them in/out of the...

What does a TortoiseSVN actually cleanup do?

What does a TortoiseSVN actually cleanup do? I have not found a pattern, but I frequently get asked to do a "cleanup" while trying to commit code. UPDATE: If TortoiseSVN knows when its dirty... Why doesn't it run a cleanup itself!?!? ...

C++/CLI managed thread cleanup

Hi. I'm writing a managed C++/CLI library wrapper for the MySQL embedded server. The mysql C library requires me to call mysql_thread_init() for every thread that will be using it, and mysql_thread_end() for each thread that exits after using it. Debugging any given VB.Net project I can see at least seven threads; I suppose my library w...

Are open streams automatically flushed and closed on SIGINT in C?

I've read in a man page that when exit() is called all streams are flushed and closed automatically. At first I was skeptical as to how this was done and whether it is truly reliable but seeing as I can't find out any more I'm going to accept that it just works — we'll see if anything blows up. Anyway, if this stream closing behavior is ...

Unload even on my form?

I want to run a subroutine to clear some things up when the user exits the application. I tried looking for a Form_Unload event or anything similar, is there a way to do this? I open a database connection on Form_Load, and would like to close it when the user exits the app. Thanks. ...

How to clear APC cache without crashing Apache?

If APC stores a lot of entries, clearing them crashes httpd. *If apc_clear_cache('user') takes longer than phps max_execution_time the script calling apc_clear_cache will be terminated by php before the clearing-operation is finished. this seems to leave some handles or sth. that will prevent apache from closing it's proc...

RegEx for cleanup a string

This RegEx is for cleanup user input from a search form $query = preg_replace("/[^A-Za-z0-9 _.,*&-]/", ' ', $query); I need to add the slash as a valid character too, but if I add it, I get an error. I assume I have to escape it but can't find how to do that $query = preg_replace("/[^A-Za-z0-9 _.,*&-/]/", ' ', $query); // doesn't wor...

addShutdownHook and setUncaughtExceptionHandler doesn't work as expected in java

I have a multi-threaded program, where I have one thread to watch over several threads. The functioning is designed like this: Main program does initiation and starts Watcher Thread, in void Main(), I have the line Runtime.getRuntime().addShutdownHook(new Thread(new ShutdownThread(), "Exit Listener")); When I don't start the watcher ...

Why does resharper suggests using readonly in fields that are not changed?

to clearify the question, I'd like to add that I'm not asking why I should choose readonly over const or what are the benefits of readonly over const. I'm asking why to make a field readonly just because it's not changed (at the moment). for example: if I'd write the following class: public class MyClass { public int _i = 5; ...

How do I guarantee cleanup code runs in Windows C++ (SIGINT, bad alloc, and closed window)

I have a Windows C++ console program, and if I don't call ReleaseDriver() at the end of my program, some pieces of hardware enter a bad state and can't be used again without rebooting. I'd like to make sure ReleaseDriver() gets runs even if the program exits abnormally, for example if I hit Ctrl+C or close the console window. I can use ...

Do I need to explicitly destroy JavaScript objects on window unload?

I have a JavaScript widget that is hosted on websites. This widget tracks state in a number of variables in its local namespace. Moreover, it attaches listeners for several events, such as mouse movement. Should I explicitly destroy both state-tracking variables and detach event listeners on window unload? Or is it ok to rely on the bro...

Java library for CSS cleanup

For a rich text editor that has to handle pasted HTML code from MS Office applications, I'm looking for a Java library that cleans up the content of all "style" attributes in HTML elements, so that only some CSS attributes are left: background-color border color font-family font-weight font-style list-style-type text-align text-decorat...

SVN Commit on files changed, deleted, or added outside the svn control

I'm often changing files not from subversion, but from finder, or other sources. Recently, for example, I updated some plugins from a wordpress setup that I've created a local svn repository for, but notably, the plugins, on update are in conflict with what's in the svn. Add to that that I didn't delete or add certain files from svn, a...

close fails on database connections (managed connection cleanup fails) in websphere 7 but not in websphere 6.1

I have a simple method (used in a web application through servlets) that gets a connection from a JNDI name and issues a select statement (get connection, issue select, return result, close the connection etc. in finally). Due to other methods in the application the connection is set as autocommit=false. This method works normally in web...

Automating Disk Cleanup on Windows using commands

Hi, I asked this question on MSDN forum but there was no response.. Maybe I had posted in the wrong forum... So I'm posting it again here, hoping that someone might be able to help me out here... I am trying to run Disk Cleanup in the command prompt (and through a C# program) and so I went through all the available options from this li...

Spring Webflow in Grails keeping plenty of hibernate sessions open

Hi, I have an Internet app running on Grails 1.1.2 and it integrates Spring WebFlow mechanism. The problem is that there are some bots ignoring robots.txt and are entering the flow quite often. Because second step of the flow needs some human intelligence, the bot leaves open flow after the first step. This causes a lot of open flows ...