clean-up

What is the best free way to clean up Word HTML?

Please provide the single best option you are aware of. ...

Remove unused references (!= "using")

How can I find and delete unused references in my projects? I know you can easily remove the using statements in vs 2008, but this doesn't remove the actual reference in your projects. The referenced dll will still be copied in your bin/setup package. ...

XML node name clean up code

I am trying to create an XML file based on data fields from a table, and I want to have the nodes named based on the value in a field from the table. The problem is that sometimes values entered in that column contain spaces and other characters not allowed in Node names. Does anyone have any code that will cleanup a passed in string an...

Why should you remove unnecessary C# using directives?

For example, I rarely need: using System.Text; but it's always there by default. I assume the application will use more memory if your code contains unnecessary using directives. But is there anything else I should be aware of? Also, does it make any difference whatsoever if the same using directive is used in only one file vs. most/...

How to simplify this code (generates a random int between min and max base on unsigned int)?

The code is return min + static_cast<int>(static_cast<double>(max - min + 1.0) * (number / (UINT_MAX + 1.0))); number is a random number obtained by rand_s. min and max are ints and represent minimum and maximum values (inclusive). If you provide a solution not using unsigned int as a number, please also explain how to make it be r...

Tools for finding unused references

Are there any good tools or tricks for determining if there are any referenced but unused dependencies (such as dlls) in a project? My specific case is C# .net3.5. ...

Can I Define Exceptions to Eclipse cleanup rules?

Most often the cleanup rules (Preferences > Java > Code Style > Clean Up) in Eclipse work perfectly and create nice-looking code. But sometimes, especially with comments and concatenated string snippets (like inline SQL queries), the cleanup just messes things up, and destroys my formatting. Is there a way to say to Eclipse "Don't touc...

Persuading developers to fix smelly but working code?

In our company, developers always have dozens of important tasks assigned and tight deadlines in which to complete them. In this environment, a code review often shows that their program will execute correctly but is "smelly", i.e. hard to read, hard to maintain and a potential breeding ground for bugs. How do you persuade developers (...

Is there a way in VBA to know about variables that aren't being used?

Is there a tool, method or setting in VBA to warn about variables that have been DIMmed, but aren't being used? ...

Use Compiler/Linker for C++ Code Clean-up

I'm using VS2008 for a C++ project. The code is quite old and has passed through many hands. There are several classes hierarchies, functions, enums and so on which are no longer being used. Is there a way to get the compiler/linker to list out identifiers which have been declared or defined but are not being referred to anywhere? ...

Cleaning up .NET HTML generation

I am looking to clean up some of the HTML generated by a .NET 2.0 TreeView controller. Switching to another version/model is not an available option. My first crack yielded an extended TreeView, with an overridden Render that Regex'd out the text I didn't need and output to the page. The problem was when I tried to collapse/expanded n...

CSS cleaner

I've taken over looking after a fairly complex site developed by another company, and frankly it's a mess. One of my problems is that there seems to have been no discipline when writing the html so that although they have used css extensively, there are half a dozen css files and a cursory analysis reveals that there is a significant nu...

Unlocking SVN working copy with unversioned resources

I have a repository which contains some unversioned directories and files. The server running svn was recently changed and since the checkout was done using the url svn://OLD-IP, I relocated my svn working copy, this time to the url svn://NEW-DOMAIN-NAME. Now since there are some unversioned resources, the switch did not happen properl...

How do I find and remove unused classes to cleanup my code?

Is there a quick way to detect classes in my application that are never used? I have just taken over a project and I am trying to do some cleanup. I do have ReSharper if that helps. ...

MSSQL Database Cleanup - How do you find unused objects (Tables, Views, Procs, Functions)

Lets say you have inherited a MS SQL 2000 or 2005 database, and you know that some of the Tables, Views, Procs, and Functions are not actually used in the final product. Is there some kind of internal logging or another mechanism that could tell me what objects are NOT being called? or have only been called a few times versus thousand...

Is there an inverse to Git's octopus merge?

Git has a much-touted(?) octopus-merge capability that can merge many heads into one. But is there something that would do just the opposite, make several simultaneous branches out of one node? Let's assume that I have a bunch of code for a project, and I just started using Git. Some of the features are complete in that project, others...

How would you write this query?

I'm looking to refactor the below query to something more readable and modifiable. The first half is identical to the second, with the exception of the database queried from (table names are the same though.) SELECT Column 1 AS c1, ... Column N AS cN FROM database1.dbo.Table1 UNION SELECT 'Some String' as c1...

Find PHP Orphan Page

I've inherited a PHP application that has "versions" of pages (viewacct.php, viewacct2.php, viewacct_rcw.php, etc). I want to discover which of these pages are called from other pages in the application and which are not. Is there a tool available that will help with that? ...

Is there a way to make sure a background process spawned by my program is killed when my process terminates?

Basically the child process runs indefinitely until killed in the background, and I want to clean it up when my program terminates for any reason, i.e. via the Taskmanager. Currently I have a while (Process.GetProcessesByName("ParentProcess").Count() > 0) loop and exit if the parent process isn't running, but it seems pretty brittle, a...

Should I always/ever/never initialize object fields to default values?

Code styling question here. I looked at this question which asks if the .NET CLR will really always initialize field values. (The answer is yes) But it strikes me that I'm not clear that it's a always a good idea to have it do this. My thinking is that if I see a declaration like this: int myBlorgleCount = 0; I have a pretty goo...