April 2004 - Posts
So this is very interesting and very cool...I went to my profile (just clickin' around) on Code Project and I noticed that I have a blog! :| All members do! How cool is that? All those people that want a blog, but don't want to setup their own now have a blog if they've signed up on Code Project before. Very cool. Definitely like the format too. It's just their thread engine, so comments can be threaded, etc, right? Damn cool...way to go CP! :)
As you can see by the new image on the left-hand side of my blog (for those of you reading this from an aggregator, it's the “I'll be there.” TechEd image), I will be at TechEd. I will be representing the MVP Program and hanging out in the lounge area quite a bit. If you have any questions or just want to hang out and chat it should be a fun place to be when you don't feel like going to a session. ;)
I'll also be at sessions checking things out, etc. Hope to meet some new people, learn some things and have some fun! :)
Seeing these at the Summit this year was awesome! Now I'm seeing more about them coming up here and there.
This week I bought the Microsoft Blue Tooth Mouse. Very cool and I'm looking forward to getting more devices that use Blue Tooth.
So I'm reading about PMCs and come across this...
<quote location=“Portable Media Centers: Frequently Asked Questions“>
Q. How do I get my music, videos and pictures onto the device?
A. Your entertainment will be easily and automatically transferred to your Portable Media Center using smart sync technology delivered in a future release of Windows Media Player. Smart sync technology will enable automatic, intelligent synchronization of music with next generation portable music players as well as synchronization of music, photo, TV content, and movies with Portable Media Centers.
That's really cool, but will they have blue tooth or something in them so i don't even have to think about syncing it? If I just carry my PMC around in my bag everywhere I go, when I get home and set it down in the same room as my MCE box, I think it should stay in a “standby” mode using only battery to listen for a blue tooth signal (I am so not a blue tooth expert so I don't know what I'm talking about with regards to the details of how it works). In MCE 2005, I could set that certain TV shows or certain photo albums or music albums, artists, etc should be automatically sync'd with my PMC is it detects that it's in the room. This synchronizing I think would be immediate (maybe based off of how busy my main MCE box was or not).
Basically what I'm saying is, “I want to have my PMC sync'd automatically without ever thinking about it or remembering that I need to sync it before I go on a trip.”
Whatever technology is necessary (again, I'm not blue tooth expert so I don't even know if that's the appropriate technology), make it happen, Microsoft...that would be so freakin' cool!
Julie's talking about the problems with the main feed being just too much. I see Marcie is too. I'm in total agreement (not to mention the “huge“ size of the feed...around 200KB right now. Do a little math and that's a lot of bandwidth). In fact, even more it was as big as it is now, but was still big, I gave up on blogging temporarily! :P From sometime in November of last year until just a week or two ago I did not open up SharpReader once! I'm a very slow reader, so when I'm looking at blogs, I have to limit what I'm really going to read through otherwise I'll waste too much time. That was my problem last November. I was subscribed to a lot of “main feeds”. The ASP.NET Blogs were the worst (as in most lengthy). Now that I'm back I absolutely refuse to subscribe to any feeds like that. True, I may miss out on some things, but at least I'll keep sane and not “waste” my entire day reading (I would want to, if I got paid to do it :P).
One thing that I think would make it easier for us to scale back the main feed here is to have “Show in Main Feed” be part of the Category, not the Post itself (or both if that suits your fancy). Then I only have to think about whether or not I think it should show up on the main feed once, not every single post.
Thinking about all of this also brings up another thought on blogging. Why are categories not a part of RSS itself? Sure, we can subscribe to a feed that is only the posts for a particular category, but that can be really limiting. For example, say there's a SQL Server Microsoft employee blogging. S/he has 3 categories: CLR, Personal & T-SQL. (Side Note: Where are the Microsoft employees from the SQL Server team? Am I blind? Are they too busy with Yukon?) There are two problems with subscribing to categories from their blog:
- If I'm not interested in their personal posts, then I have to subscribe to 2 separate feeds, further clogging up my feed list.
- Let's say I noticed by scanning through his/her blog that most of their personal entries I am interested in, but some of them I am interested in. I can't miss the entires I'm interested in just because I'm not interested in all of them.
So then the only logical thing to do is subscribe to the entire feed, but now I have even more stuff to clutter up my already full “RSS Inbox”. Still though, what I think is more helpful in getting the information I want (which is the whole point, right?) is to have Categories be a part of RSS, so my eyes can more quickly figure out whether or not I want to continue reading the post. If the title is marginal on whether or not I'd like to read it and I see right there in my reader that the category is Personal, I could instantly skip it, saving me time to read something more relevant to what I'm interested in. I think have Category feeds is good, I just think it's not enough.
This usually isn't necessary, but I'm setting up some Views for a customer doing some reports in Access and the customer needed two fields, one with just the Date and another with just the Time. At first search on Google, it came up with using the DATEPART Function to get each part of the date or time and concatinating those parts together to get what I wanted. Not only was that pretty disgusting, it didn't pad the minutes or seconds (couldn't find an easy way to pad them myself either). So, after doing some more searching, I found that CONVERT can take a 3rd optional parameter of style. Unfortunately you can't do your own custom styles, but right off the bad it takes care of the date and doing some extra work I can get the time format I want like this...
CONVERT(char(10), MyDateTime, 101) AS [Date],
WHEN DATEPART([hour], MyDateTime) > 12 THEN CONVERT(varchar(2), (DATEPART([hour], MyDateTime) - 12))
WHEN DATEPART([hour], MyDateTime) = 0 THEN '12'
ELSE CONVERT(varchar(2), DATEPART([hour], MyDateTime))
) + ':' +
CONVERT(char(2), SUBSTRING(CONVERT(char(5), MyDateTime, 108), 4, 2)) + ' ' +
WHEN DATEPART([hour], MyDateTime) > 12 THEN 'PM'
) AS [Time]
I'm not saying this is the best way, just something I did that seems to work! :) I'm more posting this for myself when I forget how to do it later, but maybe it will help someone as well (this is the first time I've ever needed to do this).
Ad Hoc Reporting Tool to Elevate Future of Microsoft’s SQL Server Business Intelligence Offering
This is great!
If you're a developer like me, you probably sometimes think of cool ideas while you're at work that aren't really work related. Maybe you might also think of something you need to do tonight once you get home or a grocery item you forgot to get and need to pick up. How do you remind yourself at home to do whatever it is you need to get done? For me, I just send myself an e-mail to my home address so I'll see it and remember what I need to do.
To help try to make it a bit more automated, I thought, “hey, why not create a script to turn those e-mails into tasks.” So over lunch today that's exactly what I did.
All you have to do is open up the VBScript Editor and plop this code in there...
Sub CustomMailMessageRule(Item As Outlook.MailItem)
Const ToDoPrefix = "TODO:"
Dim Subject As String
Dim DueDate As String
Dim Task As Outlook.TaskItem
If MsgBox("A ToDo Item has been received. Would you like to create a Task for it?", vbYesNo, "ToDo Item Received") = vbYes Then
Subject = Item.Subject
If Left(Subject, Len(ToDoPrefix)) = ToDoPrefix Then
Subject = Trim(Right(Subject, Len(Subject) - Len(ToDoPrefix)))
If Subject <> "" Then
Set Task = Application.CreateItem(olTaskItem)
If HasDueDate(Subject) Then
DueDate = GetDueDate(Subject)
Task.DueDate = DueDate
Task.Subject = Trim(Left(Subject, Len(Subject) - Len(DueDate) - 2))
Task.Subject = Subject
Task.Body = Item.Body
Task.StartDate = Now
Function HasDueDate(Subject As String)
HasDueDate = Right(Subject, 1) = "#"
Function GetDueDate(Subject As String)
Dim DueDate As String
Dim Temp As String
Dim CurPos As Integer
CurPos = Len(Subject) - 1
Temp = Mid(Subject, CurPos, 1)
While Temp <> "#"
DueDate = Temp & DueDate
CurPos = CurPos - 1
Temp = Mid(Subject, CurPos, 1)
GetDueDate = DueDate
After that, just create a new rule, have it be applied to all incoming messages (or limit it to messages with the word “TODO“ in the subject, tell it to run a script on the message (select the script you just added) and tell it to permanently delete the message when it's done.
What this will do then is any e-mail that comes in that starts with “TODO:“, will have a Task created for it. As you might be able to tell from the code, you can also put a DueDate at the end of the Subject (surrounded by “#“) so it will set the DueDate. Unfortunately, you'll see that the security pop-up comes up which really stinks, but I thought I'd share this anyway because it's better than manually creating Tasks yourself! :)
I'm not sure what all versions of Outlook this works with (maybe just 2003, I don't know), but I created it on 2003. Please feel free to take this code and improve upon it and share it with everybody. This was just a lunchtime project! :P
I'm building something for a client and they wanted to display Save and Cancel links every 12 rows in the output of a Repeater. I remembered the SeparatorTemplate and went with that. Setup an HtmlTableRow in it, then wrote the following code in the ItemDataBound Event to only display the Separator every 12 rows.
If e.Item.ItemType = ListItemType.Separator Then
DirectCast(e.Item.FindControl("trSeparator"), HtmlControls.HtmlTableRow).Visible = e.Item.ItemIndex + 1 Mod 12 = 0
Unfortunately this code doesn't work. I REALLY should've known this already, but I did not. The Mod operator happens before the + operator does, so you need to add parentheses to get this to work properly.
If e.Item.ItemType = ListItemType.Separator Then
DirectCast(e.Item.FindControl("trSeparator"), HtmlControls.HtmlTableRow).Visible = (e.Item.ItemIndex + 1) Mod 12 = 0
And for anyone asking why I just didn't do Mod 11 without the + 1 in there...two words, CODE CLARITY, so don't be givin' me any crap for it, I did it on purpose! :P
There's really no point to this entry other than to say that Rafael (MVP Lead for the .NET MVPs [Academic, C#, VB, etc]) is a great guy. I wish everyone could meet him. He's a very cool guy that really cares about his MVPs and does a great job with us. Not to mention he's just an all around cool guy in general! For all of you who have met him, you know what's up...werd... :P
Now back to your regular blogging schedule...
This evening, I've been struggling with how to deal with storing times in the database and having them display correctly to users based off of their current time zone. The System.TimeZone Class is unfortunately not enough and really only deals with the current machine, which would be handy in a WindowsForms app, but not in ASP.NET since the machine where the code runs is not the machine the user makes the requests from). This Class will however make it so if the user is browsing anonymously we can display the correct time.
First off, you'll want to always pass in all your dates and times through your Stored Procedures using DateTime.UtcNow. This will make all of your times based off of GMT, so regardless of where your server sits, you have a base time to start everything from.
For anonymous users, you can simply do this when displaying a time on any page:
This will show the correct time based off of the time zone the server lives in currently. For the actual logged in user who has already specified what Time Zone they live in you have to do some more work (i.e. Microsoft, please expand on the TimeZone Class so translating times based off of different Time Zones is easier). I found this handy set of classes called the Time Zone Conversion Classes (file located here) to use and they work pretty darn well.
There are some good discussions about the original source code that project was based on as well. Using the TimeZoneInfo Class you can get a list of all the Time Zones on the machine (pulls from the registry) and be able to calculate the correct time based off of the user's time zone they specify. Again, hopefully they'll get around to adding this stuff in the Framework for Whidbey (maybe they have already...guess I should check sometime)
More Posts Next page »