clean-up

cleaning up missed geocoding (or general advise on data cleaning)

I've got a rather large database of location addresses (500k+) from around the world. Though lots of the address are duplicates or near duplicates. Whenever a new address is entered, I check to see if it is in the database already, and if so, i take the already existing lat/long and apply it to the new entry. The reason I don't link t...

C# Code Simplification Query: The Null Container and the Foreach Loop

I frequently have code that looks something like this: if (itm != null) { foreach (type x in itm.subItems()) { //dostuff } } //do more stuff In situations where //do more stuff is omitted, it is very easy to avoid the extra foreach loop. By exitting scope using the appropriate command (depending on what is going o...

Removing created temp files in unexpected bash exit

I am creating temporary files from a bash script. I am deleting them at the end of the processing, but since the script is running for quite a long time, if I kill it or simply CTRL-C during the run, the temp files are not deleted. Is there a way I can catch those events and clean-up the files before the execution ends? Also, is there s...

PHP: how to get only the words between a parenthesis () and clear everything else

Hi, I have an array with some info.. for example: "(writer) &" or "with (additional dialogue)". I want to clean this so I only get the text between the parenthesis () and clear everything else result: "writer" or "additional dialogue" how can I do this?? Thanks!! ...

What tools can be used to help clean up and shore up a sloppy .NET codebase

I don't intend this to be subjective, but if the answers can be seasoned a little with advice or direction I would appreciate it :) Over the past couple years my job has been to develop and now maintain/extend a fairly large application. The application was among the first .NET projects ran by our department and for nearly the whole de...

How to clean up a doubly-linked many-to-many relationship?

First of all, I'm not sure if the title accurately describes what I'm referring to, so feel free to leave a comment on what to call this, or just rename if yourself if you have the rep. Let's say for example I have 2 classes, Book and Library. A Library contains a property that is a list of all the Books it owns. A Book has a property...

How to programmatically really clean Delete files?

So you are about to pass your work-computer to some of your colleague. How do you make sure you really delete all your personal data? Re-formatting, Re-installing OS will not really solve the problem. I searched around and found some programs does "Wipe out" disks. This caught me thinking how does those programs work? I mean, What al...

Find unused function in vc2008?

how to find unused functions in a c++ project vc2008 ...

Removing Junk Characters from Ruby String

I am trying to clean up a string that I get from a website using mechanize here is an except from the string with the junk characters "Mountain</b></a><br>ΓÇÄ1hr&nbsp;39minΓÇÄΓÇÄ - Rated&nbsp;PGΓÇÄΓÇÄ - Action/Adventure/Science&nbsp;fictionΓÇÄΓÇÄ - EnglishΓÇÄ - <a href=" Does any one know where they characters come from and how I can...

Is there an automated way to remove XAML default properties?

Are there any automated tools that will parse through XAML code and clean out values that are explicitly declared to their defaults? Example: <Grid Margin="0,0,0,0" Height="Auto" Width="Auto"> I would expect to be reduced to: <Grid> ...

C# EventHandler Beautiful Code (How To?)

Hi, I admit, it is kind of tiny, but I am looking for better ways to do the following code blocks. They should be self explaining... private void listBoxItem_PreviewMouseDown(object sender, MouseButtonEventArgs e) { var listBoxItem = sender as ListBoxItem; if (listBoxItem != null) { var clickO...

Automatic HTML Standardization?

Is there a .NET utility out there to take an HTML snippet (not a whole document) and output a compliant standard HTML equivalent? IE, both <b>die Bundesliga Mannschaften</b> and <span style="font-weight:bold">die Bundesliga Mannschaften</span> both resolve to the same thing. I'm not trying to repair anything, just standardize some well...

Is HtmlCleaner thread safe?

I can't find an answer on their website. Do you have any idea if HtmlCleaner is thread safe or not? I have a multiple threads that need to use it but I don't know if I can safetly reuse an instance of the HtmlCleaner object. Have you ever used it? any idea? ...

Cleaning up Objective-C code

When working on complex problems, I find myself trying all sorts of solutions and, while doing my best to stay organized, the code can get quite messy. Objects may be changed and no longer be of use, while other times I may add snippets of code that do not end up being used by the program but are taking up space and possibly memory. Asi...

Cleaning up PHP, and cleaning up unnecessary code.

I'm still new to certain PHP functions. Is there any way I can clean up the following code, because I know all of this is just unnecessary, and it's giving me a headache. Everything after the if statement is the same for each set of code. if($class == "2"){if ($posts >= 1){ $sql = "UPDATE users SET posts=posts+1,tposts=tposts+1,poin...

using JSTL to build tables

I'm using this JSTL code to generate an HTML table. Every other row is given a different class so we can give the table stripes. I know we can do this easily with CSS3 but I have to support old browsers. Anyway this is the code I use - it seems very heavy - is there an easier way to do it? <c:set var="oddEven" value="true" /> <c:forEac...

How do I automatically clean up code in C++?

I'm working as a TA in an introductory programming class, and the students tend to submit their programs as either one line, or without any indentation. Is there any tool that allows me to insert indents and things like that automatically? (We're using C++ and VisualStudio) ...

How to properly stop a multi-threaded .NET windows service?

I have a windows service written in C# that creates a truck load of threads and makes many network connections (WMI, SNMP, simple TCP, http). When attempting to stop the windows service using the Services MSC snap-in, the call to stop the service returns relatively quickly but the process continues to run for about 30 seconds or so. The...

Jquery unwrap() method?

There is a great method in jquery called wrap() that will wrap a selected element inside a new element, like so: Start with: <p>I wish I was wrapped!</p> Add code: $("p").wrap("<div></div>"); End with: <div><p>I wish I was wrapped!</p></div> But what I need is something that will unwrap, so that the above process is reversed....

Truncate mediawiki

Hi all, I'm working with the mediawiki API ( e.g. http://en.wikipedia.org/w/api.php) and I would like to be able to 'truncate' the mysql tables in order to reset the local installation while keeping some tables (users, ?...). What would be the SQL queries ? I would say: tuncate all the tables but ${PREFIX}_user and update ${PREFIX}_us...