7/24/2008
LifeCycle Solutions - Home ( the software development blog )
 

<July 2008>
SunMonTueWedThuFriSat
293012345
6789101112
13141516171819
20212223242526
272829303112
3456789

Subscribe to this feed:

RSS 2.0 | Atom 1.0 |CDF





Add to Technorati Favorites

Thursday, November 30, 2006

Here's one feature of ASP.NET 2.0 you may not have heard of- I certainly hadn't until it hit the blogs again recently.  If you drop a file named app_offline.htm in your web application's root folder, then all requests to that application will only return that file.  

Very handy for scheduled downtime, bringing down your app for updates, etc.  Scott Guthrie mentions the trick here, as well as a minor issue to be aware of when designing your app_offline page.

One novel way to implement this is to integrate it into your deployment process.  For example, a simple batch file like this:

copy C:\MyCompany\app_offline_updating.htm C:\InetPub\wwwroot\Demo\ProjectName\app_offline.htm /y

xcopy C:\MyCompany\ProjectName*.* C:\InetPub\wwwroot\Clients\Demo\ProjectName\ /s /q /y

del C:\InetPub\wwwroot\Clients\Demo\ProjectName\app_offline.htm

The batch file can be run manually, or even better- as part of your continuous integration process.  With a little javascript or meta-tag to do automatic refreshes, this is a great way to avoid errors and communicate downtime to users.

Posted by Daniel Root

Tuesday, November 21, 2006

If you're not familiar with Cruise Control .NET, it's a continuous integration server for .NET projects.  What's a continuous integration server?  Well, think of it as a free developer.  It's job description is not enviable:

  • Wait for new code to be checked in by the other developers and make sure it can be compiled.
  • Check the code for best practices.
  • Run unit tests to make sure nothing is broken.
  • Perform any last minute tasks
  • Notify team members of the latest changes.
  • Alert the appropriate people if something fails.

If you think about it, this is really a fitting analogy.  FXCop ensures your code conforms to a large chunk of MS Patterns & Practices.  With NUnit, you write tests to check some part of your code.  This is the same as asking another developer to double-check everything for you.  Finally, MSBuild and CC.NET tasks pick up a ton of other tedious tasks such as deploying a setup package, notifying people of changes, updating the company website, etc.

What this means is that the real developers can focus on the fun stuff: writing code, while "the new guy" does the grunt work.

Posted by Daniel Root

Friday, November 10, 2006

In our ongoing effort to share with you tools that we find useful, here's a throwback to the days of yore:
PowerGREP is a grep-like tool for Windows that allows you to search (and replace) regex patterns in folders (and their subfolders).  My favorite feature of the product is that it will allow you to preview replacements before commiting them.  It's also very fast.
Good utility to have in any toolbox.
Posted by Brian Parks

Thursday, November 02, 2006

I'm posting this mostly because I know I'll forget, but hopefully it'll come in handy for others as well.  One tricky problem in programming is to search by date range against data that also has a date range.  Sounds simple, but this can quickly get confusing.  You must take into account the start and end date of the search criteria, as well as the start and end date of the data.  You must also consider cases where the start date is in the given range, but the end date is not, or visa-versa.  Then there are cases where neither are in the search range.  See, confusing. (Ryan Farley has a good illustration of it all, and is where I finally found my answer)

It helped me to think of it in terms of a timeline, and the search as simply finding the records where the search range intersects with the record range.  As one of the commenters on the above post pointed out, it's easier to exclude the records that don't match. In a SQL, it'd look something like this:

SELECT * FROM Reservations WHERE (NOT((ReservationEnd < @StartDate) or (ReservationStart > @EndDate)))

In plain english: Get the records where the reservation does not end before the start date, or start after the end date.

One other gotcha.  Be sure, when passing the start and end dates into your SQL query from .NET, that you're considering time as well.  Typically, you'll want to search from 12AM to 11:59PM:

Dim startDate As DateTime = New DateTime(CurrentDate.Year, CurrentDate.Month, 1, 0, 0, 0)
Dim endDate As DateTime = New DateTime(CurrentDate.Year, CurrentDate.Month, DateTime.DaysInMonth(startDate.Year, startDate.Month), 23, 59, 59)

Posted by Daniel Root

© 2006 LifeCycle Solutions, LLC | All Rights Reserved