In the never ending quest for the ultimate RSS feed reader, I just installed Sage for Firefox. This Firefox extension resides inside the browser and integrates directly with Firefox’s live bookmarks. RSS feeds are displayed in a browser tab. The formatting is based on either an embedded CSS stylesheet, and or an external sheet.
Once installed, Sage requires one change. The default stylesheet does’t handle advanced HTML formatting in the entry all that well. Of course, not too suprising, a Safari like stylesheet has been developed for Sage. The stylesheet resides here at DeviantArt.com. Oh, and to give credit where credit is due, I found about the Safari stylesheet at StarvingArtist.
I was using RssBandit prior. Don’t get me wrong, RssBandit is a fine application, but, it’s another application. There’s just so many apps one man can run. In fact, if it wasn’t for the fact that Thunderbird can’t sync with my BlackBerry, I would migrate off of Outlook. Anyway, enjoy Sage.
datetime comparisons in T-SQL aren’t always a walk in the park. One of the most annoying things that someone would need to overcoming is filtering solely on the year, month, and day component of a datetime field. This is further complicated by how .NET initializes a DateTime object.
When a DateTime object is instantiated without secifying the time, it is set to 12:00AM (midnight). When you pass the DateTime object to an SqlParameter, the following is sent over the wire:
exec GetContracts @CreationDate = 'Aug 13 2004 12:00:00:000AM'
A further complication is that even if you pass creationDate.ToShortDateString() (assuming of course that your DateTime object in code is ‘creationDate’) to the Value of your SqlParameter, the afortementioned value is still passed to the stored procedure. This is because the stored procedure parameter is typed as datetime. Now, how do you overcome this?
With values in the table such as ‘2004-08-13 13:02:44.767’, you’ll never be able to match ‘Aug 13 2004 12:00:00:000AM’, and therefore no rows will be returned. The way I have overcome this problem is to make use of DATEDIFF and the dayofyear DATEPART. By using the following in your WHERE clause:
DATEDIFF(dayofyear, @CreationDate, Contracts.CreationDate) = 0
This will return 0 whenever the day of the year is the same in both the table, and the stored procedure parameter. Any other day will either cause DATEDIFF to return a non-zero value. You can also use this if you want everything from this date and on (or before) by changing the comparitor to > or < as appropriate. Sproc on!
The ability to page in SQL Server is one of those things that everyone wants, but can’t quite seem to get from Microsoft. Many ideas have been posted, each claiming to be _the_ way to do it. In the spirit of mine is better than yours, I’ve implemented my own paging scheme.
A feature that is in the upcoming version of SQL Server is the ability to supply a variable to the TOP keyword. Well, as it turns out, this functionality does exist in SQL Server 2000. The only difference is the syntax. To limit the number of rows returned from a query based on a variable is to use SET ROWCOUNT @Foo. Don’t forget, however, to reverse that after the query by setting ROWCOUNT to 0.
The principle of which this works is that I return all of the primary keys in a table into a table datatype up to and including the record that i want to start at. Then I grab that value by selecting the TOP 1 from that temp table, ordering by the value, descending. Now I have the starting primary key value.
At this point, it’s a matter of looping through the records, row by row until I have filled my cache table with a single page’s worth of data. Once that is complete, I return the contents of the cache table. In addition, in the form of an OUTPUT param, I return the total number of rows in the table. I have this value as a result of a sanity check that stops the proc if we are requesting a page of data that is past the end of the table.
I hope this sproc finds you well.
if ( null != route)
really pisses me off.
My friend Andy asked me a few minutes ago how to recover from inadvertantly deleting a Forms Designer generated .resx file. In order to recover from this unfortunate happenstance, I had him do the following:
- Open the .csproj file in his editor of choice.
- Locate the <File> element that references the .resx file.
- Delete the element.
- Close up shop and relaunch the project file in VS.NET
- Open the form in the designer. The .resx file will be regenerated by the IDE.
- Drink a beer.
After completing those afformentioned steps, the sun shined, the birds sang, and all things were good. 🙂
I’ve started to work with Visual Studio 2005 Beta 1. I installed it into a Virtual PC 2004 VM running Windows XP SP1a. In the process of trying new things out, I discovered the new ASP.NET Web Site Administration Tool. This is a web app that allows for easier configuration of Security, Profile, Application, and Provider settings. It was with the provider settings that I encountered a problem.
ASP.NET 2.0 is packaged with two providers for ASP.NET settings, AspNetSqlProvider and AspNetAccessProvider. The corresponding database for AspNetSqlProvider is created with the aspnet_regsql.exe utility. This utility only creates the database, tables, views, and stored procedures. This utility does nothing about granting a SQL Server login permissions to any of those objects. This became apparent when I was 100% unsucessful in testing the AspNetSqlProvider from the admin interface.
After spending an enormous amount of time working blind (SQL Server 2005 Express is only packaged with osql.exe, and no GUI tools such as Query Analyzer, SQL Profiler, or Enterprise Manager), I was able to crack the code. I ran the aspnet_regsql.exe as such:
C:WINDOWSMicrosoft.NETFrameworkv2.0.40607>aspnet_regsql.exe -E -S (local) -A all -sqlexportonly aspnet_regsql.sql
This just created a script (and did not execute it against the server) for the local instance of SQL Server with support for all features. I looked at the roles that are created and realized that I needed to add at least myself (a local admin) to the most privileged user role. The reason why I knew this was because the admin website is running as a descrete app (not in IIS, but rather WebDev.WebServer.EXE), and it was running as me, according to the Task Manager. So, armed with this pearl of wisdom, I then executed the following against the ‘aspnetdb’ database in osql.exe.
1> use aspnetdb
2> sp_addrolemember N'aspnet_Membership_FullAccess', 'BUILTINAdministrators'
As I expected, when I tested the SQL Server Provider again, it worked. One big thing I learned here was how to drive SQL Server completely from a command line interface. So, at least I learned something.
I have just finished writing an Outlook 2003 addin for automating the process of uploading pictures and creating weblog entries. Once you have the addin installed, all you have to do is email a picture as an email attachment to an email address that starts with “modblog” (and of course have Outlook pickup this email). The addin then FTP’s the image to the server, and creates a weblog entry using the Blogger API.