9/5/2010
LifeCycle Solutions - Home ( the software development blog )
 

<November 2006>
SunMonTueWedThuFriSat
2930311234
567891011
12131415161718
19202122232425
262728293012
3456789

Subscribe to this feed:

RSS 2.0 | Atom 1.0 |CDF






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

Wednesday, October 25, 2006

This is something I downloaded a while back, and use sporadically, but every time I do, I'm amazed.  In a single right-click menu it gives you access to just about any tool a good web developer needs when browsing their app.  Turn off styles/javascript/cache/images/etc for testing.  Switch CSS Media types, edit css on-the-fly.  Outline divs, tables, links, etc.  Validate using a variety of tools- even localhost sites.   The one humble menu item that spurred me to post this, though, is 'Resize To... 800x600'.  Perfect for testing your app on that ginormus monitor.

http://chrispederick.com/work/webdeveloper/

Posted by Daniel Root

Monday, October 23, 2006

Microsoft has released a free utility called XML Notepad that serves as a lightweight, stand-alone XML editor.  Probably not the most full-featured product available, but it does handle schema validation and performs XSL transforms...and the price is right.
Posted by Brian Parks

Thursday, October 19, 2006

It'll be pushed down in Windows Update on Nov. 1, but IE 7 is out of beta now, and can be downloaded here:

http://www.microsoft.com/windows/ie/default.mspx

It'll be interesting to see who switches back and who stays with FireFox.  The main factors for my switch to FF were tabbed browsing and RSS, both of which have been added. 

Posted by Daniel Root

Thursday, October 12, 2006

I was reminded again today how freaking awesome ClickOnce is.  Awesome to the developer, because you run a little wizard and get a deployment package, installation page,  and auto-update (and rollback) functionality.  Awesome for the user because you click a button to install an app, (maybe another to grant it permissions), and get notified whenever it updates.

To bad it doesn't work natively with FireFox.  Fortunately there's a plugin for it until Microsoft gets it working.  The first article also mentions a workaround you can use on your installation page.

Posted by Daniel Root

Saturday, October 07, 2006

There's a ton of free content on MSDN and elsewhere, but these professional courses usually cost about $50 each, and cover a specific task or topic in-depth.  Enjoy!

Posted by Daniel Root

Thursday, October 05, 2006

One of my favorite development tools is Google.  It's better than MSDN's built in search at putting the links I want at the top.  For example, you can search for "site:microsoft.com Some Class, Method, etc." and quickly get MSDN docs on anything that's bugging you.  And what developer hasn't Googled an error message? 

Now there's a new feature in Google labs that lets you search public source code.  Obviously, you'll need to be wary of licensing issues, but if you want to see how a, say, an HttpHandler is used "in the wild", you'd just search lang:C# (or VB.NET, etc), and the keyword. 

One caveat: there's tons of bad code (tm) out there.  Even on MSDN, there are hard-coded connection strings, unclosed readers, and un-disposed disposables galore.  Don't use Google as a crutch for really learning your trade!

Posted by Daniel Root

Monday, October 02, 2006

This is a pretty good article on some security considerations in ASP.NET applications, and how they can be addressed by editing your web.config file.

Posted by Daniel Root

Thursday, September 21, 2006

If you haven't checked out the September drop of the Atlas Control Toolkit (Soon to be renamed ASP.NET AJAX Control Toolkit), you should.   One of the coolest new features is the AnimationExtender, which lets you declaratively animate controls.  Just a few lines of markup buys you cross-browser scripted animation.  Obviously, great potential for abuse and breaking site accessibility, but used sparingly could add some nice effects to your site.

http://atlas.asp.net/atlastoolkit/

Posted by Daniel Root

Need a lightweight paint program?  Paint.NET is a full-featured, fast and free one written in C#.  It hits that sweet spot that Jasc Paint Shop Pro used to: not so bulky that it's overkill for a quick web graphic, but not so feature-limited that you may as well use MS Paint.

http://www.getpaint.net/

Posted by Daniel Root

© 2006 LifeCycle Solutions, LLC | All Rights Reserved