maintenance

How do I write more maintainable regular expressions?

不羁的心 提交于 2019-11-28 14:37:28
问题 I have started to feel that using regular expressions decreases code maintainability. There is something evil about the terseness and power of regular expressions. Perl compounds this with side effects like default operators. I DO have a habit of documenting regular expressions with at least one sentence giving the basic intent and at least one example of what would match. Because regular expressions are built up I feel it is an absolute necessity to comment on the largest components of each

How do I delete old files from a directory while keeping the most recent ones on Windows [duplicate]

随声附和 提交于 2019-11-28 11:34:24
Possible Duplicate: Batch file to delete files older than N days I want to run a scheduled windows task that deletes all files from a directory that are older than 2 weeks. The reason is that these are IIS and Tomcat logs that fill up my server, but I want to keep the most recent logs in case I need to investigate a problem. Does any one know an easy way to do this? Cheers Nige subha exact syntax: FORFILES /p d:\new /d -30 /m * /c "cmd /c del @file" The simplest way would be a .bat run file run weekly or monthly. cd \mylog\dir mkdir archive del /Q .\archive\*.log move *.log .\archive If you

Determining the health/validity of an email address

折月煮酒 提交于 2019-11-28 10:04:37
问题 Routine maintenance on a website often involves verifying that links are valid, flagging bad ones, etc. I know how to match email addresses via a script (especially in the context of a web page where they'd be in mailto: links). My question is how would I verify they're OK without spamming the address? Stripping-off the domain and verifying it's listening on port 25 is a partial answer, but doesn't handle verifying the username/alias. Is there a way to add this to my maintenance scripts for

Deleting millions of rows in MySQL

做~自己de王妃 提交于 2019-11-28 03:22:38
I recently found and fixed a bug in a site I was working on that resulted in millions of duplicate rows of data in a table that will be quite large even without them (still in the millions). I can easily find these duplicate rows and can run a single delete query to kill them all. The problem is that trying to delete this many rows in one shot locks up the table for a long time, which I would like to avoid if possible. The only ways I can see to get rid of these rows, without taking down the site (by locking up the table) are: Write a script that will execute thousands of smaller delete

Visual Studio setup problem - 'A problem has been encountered while loading the setup components. Canceling setup.'

99封情书 提交于 2019-11-28 02:49:22
I've had a serious issue with my Visual Studio 2008 setup. I receive the ever-so-useful error 'A problem has been encountered while loading the setup components. Canceling setup.' whenever I try to uninstall, reinstall or repair Visual Studio 2008 (team system version). If I can't resolve this issue I have no choice but to completely wipe my computer and start again which will take all day long! I've recently received very strange errors when trying to build projects regarding components running out of memory (despite having ~2gb physical memory free at the time) which has rendered my current

Tips for maintaining an internal Maven Repository?

谁都会走 提交于 2019-11-27 19:52:40
问题 I'm interested in maintaining a Maven 2 repository for my organization. What are the some of the pointers and pitfalls that would help. What are guidelines for users to follow when setting up standards for downloading from or publishing their own artifacts to the repository when releasing their code? What kinds of governance/rules do you have in place for this type of thing? What do you include about it in your developer's guide/documentation? UPDATE : We've stood up Nexus and have been very

Syntax check all stored procedures?

时间秒杀一切 提交于 2019-11-27 18:35:56
i want to ensure that all stored procedures are still syntactically valid. (This can happen if someone renames/deletes a table/column). Right now my solution to check the syntax of all stored procedures is to go into Enterprise Manager, select the first stored procedure in the list, and use the procedure: Enter Alt+C Escape Escape Down Arrow Goto 1 It works, but it's pretty tedious. i'd like a stored procedure called SyntaxCheckAllStoredProcedures like the other stored procedure i wrote that does the same thing for views: RefreshAllViews For everyone's benefit, RefreshAllViews: RefreshAllViews

SQL Server xp_delete_file not deleting files

北城余情 提交于 2019-11-27 14:48:51
问题 I'm trying to write some SQL that will delete files of type '.7z' that are older than 7 days. Here's what I've got that's not working: DECLARE @DateString CHAR(8) SET @DateString = CONVERT(CHAR(8), DATEADD(d, -7, GETDATE()), 1) EXECUTE master.dbo.xp_delete_file 0, N'e:\Database Backups',N'7z', @DateString, 1 I've also tried changing the '1' a the end to a '0'. This returns 'success', but the files aren't getting deleted. I'm using SQL Server 2005, Standard, w/SP2 回答1: Had a similar problem,

Visual Studio 2008 / C# : How to find dead code in a project?

依然范特西╮ 提交于 2019-11-27 13:57:08
问题 How do I find dead code in a Visual Studio 2008 C# project? Like unused classes, unused variables or unused resources? 回答1: You can try FxCop, which is integrated in Visual Studio 2008 by the name of Code Analysis. You just have to right click the project file and 'Run Code Analysis'. FxCop is an application that analyzes managed code assemblies (code that targets the .NET Framework common language runtime) and reports information about the assemblies, such as possible design, localization,

Managing highly repetitive code and documentation in Java

橙三吉。 提交于 2019-11-27 06:28:48
Highly repetitive code is generally a bad thing, and there are design patterns that can help minimize this. However, sometimes it's simply inevitable due to the constraints of the language itself. Take the following example from java.util.Arrays : /** * Assigns the specified long value to each element of the specified * range of the specified array of longs. The range to be filled * extends from index <tt>fromIndex</tt>, inclusive, to index * <tt>toIndex</tt>, exclusive. (If <tt>fromIndex==toIndex</tt>, the * range to be filled is empty.) * * @param a the array to be filled * @param fromIndex