Writing documentation is not something I like to do. People always like to list the reasons why you should document, and today, I was reminded of why documentation is important, and was thankful that I had put forth the effort to write the documentation. I am working on re-writing a piece of static code that handles the rules for processing data, into a more dynamic approach uses the WF rules engine. I had started this several months ago, and according to my notes, worked on this last, July 12. Finally, after 2 months, I have been able to get back to work on the rules, and thanks to the documentation I had been writing (in the form of notes), I was able to get back up to speed fairly quickly. I think the key in this instance, was to write down notes as I came thought of them. Usually I hate writing stuff down when I'm in the early stages, because it always changes. However, this time writing notes down as I went has helped out allot, and so far, has not had to be updated as much. So remember, the next you are debating about writing something down, it may not just be for the benefit of the next developer who comes along, it may be for your own benefit.
This is just a quick post of web testing against popup's and Ajax using the included tools in Visual Studio Test edition. In my current project we are using Telerik controls for our web application. We are trying to take advantage of the rich Ajax support offered by the Telerik controls, but had concerns over a lack of support from the web testing tools. I decided to do a quick test, and much to my surprise, I was able to do a great deal of testing using just the web recorder in visual studio. Our UI has alot of pages with Ajax enabled grids, and to edit the record, you click a button on the row, and a window pops up up with all the details. I was able to edit the record in the popup window, save, use the ValidateText feature, close the window, have the grid update, and again, use the Validate Text feature to make sure the change persisted. According to the resources I have listed below, I was going to have alot more trouble then I did, and would probably need to use fiddler to catch the http traffic and inject it into my web test. So far, that has not been the case, I can only hope it continues to be this easy. I will update this post if/when I start to run into issues. Resources:
I wish I could do more then just rehash other people's posts. However, one of the purposes for this blog is a place for me to write down stuff I'd like to visit in the future (such as sample code). Scott has posted his forth installment in a series he entitles "The Weekly Source Code". Of the links posted this week, the ones that I plan on looking into more are: - WPF Contrib - Contrib for WPF. I'm not using WPF in any projects at the moment, however, this contrib looks like it could jump start some sample applications at home. A good way to get started with WPF.
- Wintellect Power Collections - From the web site, and Scott's post: "
Some of the collections included are the Deque, MultiDictionary, Bag, OrderedBag, OrderedDictionary, Set, OrderedSet, and OrderedMultiDictionary." Ones that I am going to save for when a need arises: The reason I am interested in the mail ones, are that I will be sending out email notifications in my current project, thru BizTalk. In order to test the application, I will need to be able to login to test mailboxes and retrieve messages. While .Net has some built in support for email, 3rd party libraries can't hurt.
?? Operator Scott's most recent post on LINQ, showed me that I still have alot to learn about C#. The ?? operator was casually thrown into the mix as if it were as common as +, =, or a semi-colon (;). It took a couple of searches on Google to find what I wanted, but I finally found a page on MSDN that lists all of the C# operators in 2.0, and the one I was looking for. The ?? operator returns the left-hand operand if it is not null, or else it returns the right operand. int? x = null; //This will assign the value of -1 to y int y = x ?? -1; //Change x to an integer, and it will be assigned to y x = 5; y = x ?? -1; //y now = 5 Extension Methods in .Net 3.5 Another tidbit I ran across, was the introduction of extension methods in C# 3.5. Basically, extension methods allow you to create a method that is associated with a type, such that you can call it (and have intelli-sense support), as if it was defined as a method if the type's definition. For example, the Subtract() method of the DateTime type, is defined in the type. With extensions, you can add some code to define a method foo(), such that you can do something like DateTime.foo(); Extension methods are most closely compared to similar functionality in Ruby. I found an example on Phil Haack's blog which I tried out myself, and reproduced below (note to self, learn how to format code examples nicely). namespace ExtensionMethods { public static class Extenders { public static DateTime Ago(this TimeSpan value) { return DateTime.Now.Subtract(value); }
public static TimeSpan Minutes(this int value) { return new TimeSpan(0, value, 0); } }
class Program { static void Main(string[] args) { Console.WriteLine(20.Minutes().Ago()); //With Extensions Console.WriteLine(DateTime.Now.Subtract(new TimeSpan(0, 20, 0))); //Without Extensions Console.ReadLine(); } }
}
I got intelli-sense on after typing Minutes(), but no intelli-sense on 20. I was also curious to scope, and where extension methods will need to be placed, and how to access them. Moving the Extenders class outside of the main namespace, I got compile a compile time error stating that int doesn't have a Minutes method (standard 2.0 error), as well as text indicating that there were no extension methods (new for 3.5 obviously). Adding a using statement allows the code to compile. I then tried duplicating my extension namespace and adding a 2nd using statement, and got the expected compile error about ambiguous methods. To me, I can see trouble in the future with conflicting Extension Methods in different namespaces. It doesn't look like you can use a fully qualified name either.
This MSDN article gives some technical info on Extension Methods (it's an article containing info on several new language features). Here is some of what I got:
- Extension methods are declared by specifying the keyword this as a modifier on the first parameter of the methods.
- Extension methods can only be declared in static classes.
- Instance methods take precedence over extension methods, and extension methods imported in inner namespace declarations take precedence over extension methods imported in outer namespace declarations.
There is some debate going on in the comments section of the blog post where I got the example from. Some people seem to think that while easier to read (debatable itself), it makes for harder to maintain code. Others claim it breaks OO principles.
See Also: ScottGu's post on Extension Methods
The latest version of Google Earth (4.2), which adds a feature to look at the sky, has a hidden feature as well. Marco's Blog reports that a flight simulator is now included in Google Earth. To enter the flight simulator, press Ctrl+Alt+A. Here is a list of commands. There is supposed to be joystick support, and possibly force feed back, you can also use the mouse to control Aileron and elevators. I tried it out for a few minutes, and I could see where it could get addictive. It's not MS Flight Simulator, but it is free, and doesn't take up gigabytes of storage space on your HD. Also, it's a little easier to hide on your work computer ;) Download Google Earth Here (Just click agree to the ToS).
A friend of mine recently inquired about how he could gain access to an old Windows server he had running, for forgot the admin password. I pointed him towards this software, which I have successfully used in the past. There is a new version since the last I checked that now supports Vista, and more disk controllers. I was starting to run into some newer laptops from HP with SATA controllers, which did not have drivers included on the password reset disk. Hopefully this new version will have those drivers.
I recently came across an article on UTC to store date/time values. A decision made on a current project I am working on was to use UTC for client applications. However, the dates stored in SQL currently not in UTC. I guess I've just gotten used to the GetDate() function in SQL. A more appropriate function for our application would be the GetUtcDate(), which will return the current date/time in UTC format. From the article: The primary advantage of storing date/time values in UTC is that it makes the data transportable. To see what I mean, imagine that following scenario: you have an eCommerce website that is being hosted in a web server located in the Pacific time zone (UTC -8) and this application stores the date and time orders were placed in server time. Say a user, Bob, makes an order on August 1, 2007 at 9:00 AM UTC -8. After many months of phenomenal growth, you decide to switch to a larger web hosting company, one on the east coast where the time zone is UTC -5. Since the date/time is stored in server time, Bob's previous order still shows that it was made on August 1 2007 at 9:00 AM. But since we are now in UTC -5, it is as if Bob's order was made three hours earlier than it really was (since when it was 9:00 AM on August 1, 2007 in the west coast it was really 12:00 noon on the east coast). The author then goes into explain how you can fix the above issue by doing an update on the data to correct the time, which he refers to as "Ick", and I will have to agree with that. You don't want to, nor should you have to ever update a time stamp type property. The next example uses various time zones to illustrate the problem of converting from one time zone to another (not to mention DST and SDT). Since we plan on eventually offering localized versions of our Web Application, displaying all times in CST/CDT is not idea. Not to mention the change from daylight savings time to stand time makes the way we display data currently, very confusing. Things seem out of order at best. Well, I'm off to update my use of GetDate to GetUTCDate. Be sure to read the full article. Note: I found this article originally from ScottGu's RSS feed. However, the actual blog doesn't have the UTC article listed under Asp.Net, or listed at all.
All I wanted to do was make an ISO of a CD so that I could keep it on my server for use with VMware Server. I didn't think it should be that hard, I have Nero 7 ultra edition, surely that can create a prefect ISO copy. Nope, no go, couldn't find the option to create anything other then a Nero image file. Onto ISO buster, which I had installed a long time ago. I'm pretty sure I used it to create an ISO before, but it just wasn't working out. I was able to create an iso, but it wasn't bootable like the original. /sigh Off to Google to search. 4th hit on a search for free iso tool led me to DoISO whish is a GPL ISO Creation utility. A quick download and install, and I was off and running. Creation process was a success, selected it as my image for my VM CD-ROM drive, and, didn't boot. Back to Google, and found ISO Recorder. Lists support for XP and Vista, and it is free. So far so good, however, looking at the user guide, it struck me, that I already had this installed, I had just forgot about it. Trial #3 for making an ISO was then underway. Success, created the ISO, and it was bootable. Summary: ISO Recorder created a perfect ISO copy from a CD. Note to self, check to see what you already have installed before going off in search of something else.
This is my first post for my new blog, and it will be short, as I've just spent most of the night getting everything setup. So far I am very happy with dasBlog. I just need to get email submission working, and move all my old posts over. Hopefully this post I'm writing in Live Writer will work, so I can cross that (test with Live Writer) off my to do list. Speaking of Live Writer. After using it for less then 5 minutes, I like what I see. I can't wait to install it at work as well and begin contributing en-mass to the blog sphere! Blog To-Do List: - Move old blogs from personal site
- Move new blogs from work site
- Setup some type of nightly backup of this blogs content to my local computer
- Get email submission working
- Define Categories (Check to see if it's easy to rename a category)
- Define additional Macros
Update: Just tested updating a previous entry using Live Writer. If you see this, it worked.
Scott posted another edition of his "Weekly Source Code" where he lists open source projects that he finds interesting. The idea is to examine the source to find ways to improve your own coding, by finding examples of what to do, and what not to do. One of the projects listed was Fog Creek's Co-Pilot software, which is a remote help desk software that works across firewalls. The client code, based on VNC, is available under the GPL. Reading thru their tech page, they talk about implementing a version of the STUNT protocol. The STUNT protocol, put simply, is a way to do direct Internet connections across NAT, bypassing the need for a proxy or reflector (Co-Pilot's term) piece of server software. The main advantage to the STUNT approach is that it is much faster since you are not going thru an intermediary. STUNT reminds me of one of the methods used by Skype to establish connections. While they didn't use the term STUNT, it was very similar in concept. This is particularly interesting for me due to my current project, and some of the communication requirements we have for our products. The idea of a direct connection, possibly to a VNC type application listening on the other end would make trouble shooting a whole lot easier....assuming we were not trouble shooting network connectivity.
|