With the release of all Visual Studio 2008, TFS 2008, and SQL 2008, I set about upgrading I set about upgrading my main development laptop. Currently I have VS 2008, Team Explorer 2008 and SQL 2005 client tools installed. I opted to download the full installer for the SP1 updates as opposed to the bootstrapper options. I knew I needed to install VS 2008 SP1 prior to TFS 2008 SP1, but for some reason decided to go with the SQL upgrade first. As I mentioned before, I currently only have the client tools installed, as I like to keep my SQL servers on virtualized development servers. The SQL 2008 installer starts off by checking for .Net 3.5 SP1, and if it does not exist, it will install it on your machine, along with a hotfix for windows installer. After this is complete, you are required to reboot your machine. I opted for the upgrade option, hoping that everything just works. I’m not sure if you can do a side by side install with SQL 2005 client tools and 2008. After selecting my options, an upgrade check is preformed, and it failed because I have not installed VS 2008 SP1 yet. OK, I wanted to install that anyway, so I canceled out and launched the VS 2008 SP1 installer. As with most service packs for Visual Studio it takes awhile to apply, but my experience was more positive then the service packs for VS 2005. No reboot was required, so I moved onto the TFS 2008 SP1 install. So I must have mis-understood or did not read something with the TFS 2008 SP1 installer. It looks like it’s for the server components only, and VS 2008 SP1 handles upgrades to Team Explorer as well. This blog post makes reference to this, and even says that if you are installing Team Explorer on your TFS server, to install VS 2008 SP1. Looking at Help/About Microsoft Visual Studio, I see the version number for VS 2008 is now 9.0.30729.1 SP, and looking at the details for Team Explorer shows the same version number. Jumping back to the SQL 2008 installer, I proceeding with my update. However it wasn’t really an update as much as it was a side by side install. Remember, I was just doing the client tools, had I had the database components installed, I assume that those would have been upgraded. I have a couple of SQL 2005 instances I can try an upgrade on to see what happens. The install went very smoothly and there were no issues. First impressions of the new SQL Management studio are extremely positive. I saw the intelli-sense demo at the launch event, but can’t really test it as I already have SQL Prompt installed. My job as a Pseudo-DBA just got easier.Here are some new features I found. - When running queries, you can view the results in traditional grid view, but also as text (with options to choose your column delimiters), or export to a text (.rpt) file.
- The new activity monitor actually provides useful information (well alot more information then the old one ever did). It reminds me of the task manager in Windows Server 2008. The new activity monitor does not work with SQL 2000, but I will be eliminating all SQL 2000 boxes by the end of September. As 4 line graphs across the top you get % Processor time, Waiting Tasks, Database I/O and Batch Requests/Sec. On the bottom you get 4 collapsible lists: Processes, Resource Waits, Data File I/O and Recent Expensive Queries.
- The database publishing wizard from Visual Studio is now included. Actually there are a lot more options to control how your scripts are generated.
- There are some very nice default reports built in now as well. The reports were an add-on for SQL 2005, but they are now included (and you can of course write your own). Stuff like Disk Usage, Index Usage, etc. I hope I can find a way to schedule these to be emailed.
- New option to generate Create and Drop Script (along with the original separate options of generate create and generate drop). There is also an option to generate as SQL Agent job.
Finally I went ahead and upgraded our TFS server to SP1. First thing I did was install this month’s Windows Updates, as I was going to have to reboot anyway. Next up was Visual Studio 2008 SP1, as I have VS and Team Explorer installed. Unfortunately I was out of room on my system drive so I had to take the extra step of expanding my virtual hard disk first. I rebooted the server, and then proceeded to install TFS 2008 SP1. It looked like everything was going good, but it failed at some point. Turns out the SQL server did not survive the reboot, VS 2008 SP1, or the system drive expansion. Somehow my mssqlsystemresource.ldf file got messed up at some point. The event log error stated “One or more files do not match the primary file of the database.”. I got better information out of the SQL error log which pointed me right to the System Resource ldf. I copied the ldf file from another SQL 2005 server and was back in business. The TFS update proceeded without incident after that. In case you are wondering, you can determine your TFS version by looking at the version of Microsoft.TeamFoundation.Server.dll in %Program Files%\Microsoft Visual Studio 2008 Team Foundation Server\Web Services\Services\bin. For SP1, the version number matches that which is displayed in Visual Studio 2008, or 9.0.30729.1.
My weekly Code Project newsletter had a link to a submission which talked about, and rated various Aspect Orientated Programming (AOP) frameworks for .Net. While I’ve heard about AOP in the past, I haven’t looked into much. What got me off the side lines, was that one of the .Net AOP frameworks, Post Sharp, lists support for the Compact Framework and Silverlight. In my experience, it is rare to see stuff that actually supports the compact framework, so this is a welcome change, however I have not tested it out yet. Before I dive into Post Sharp anymore then I have, I wanted to read up a bit on AOP. WikiPedia has a good article explaining the AOP using AspectJ as the example language. PostSharp itself has a an article that focuses on the .Net Framework as well. What is Aspect Orientated Programming (AOP)? - AOP increases modularity by allowing the separation of cross-cutting concerns
- A concern is a cohesive area of functionality (think encapsulation).
- Cross-Cutting concerns are those concerns which are used in multiple concerns
- Logging is the most typical example of a cross-cutting concern. It itself is a concern (encapsulated functionality), that is used everywhere in your program.
Examples of Cross-Cutting Concerns - Logging
- Exception Handling
- Tracking is dirty on fields
- Auditing
- Security
- Transactions
How does it work (based on Post Sharp) - Implement cross-cutting concerns as classes creating attributes (implementing various interfaces in Post Sharp)
- Decorate your code using your attributes. Attributes can be added at the method, field, class and assembly level. At the class and assembly level you can specify a filter specify which methods or classes to work on.
- When you compile, Post Sharp performs post build processing injecting code into your compile MSIL, producing modified MSIL as the final output.
AOP Frameworks Performance I was originally under the impression that by injecting code at compile time, there would be no performance hit at run time. This is not true, at least in PostSharp using the simple performance test from the user provided samples. The simple performance test sample shows that AOP using Post Sharp incurs a variable performance hit. Running the sample application multiple times shows the first time the post sharp code is hit (view the complied .exe in reflector) it takes 73ms, and then this drops down to 14 ms, compared to 4 ms for the non PostSharp code. On subsequent runs, the first access of the post sharp code takes ~21ms and then drops down to 14ms, while the non PostSharp code remains at 4ms. The sample in question uses the works on a field in a class. The aspect (attribute code) is required to cast an object passed in by the event args to a string. Perhaps generics could help with performance by eliminating the cast? Final Thoughts AOP and PostSharp look like very powerful tools that I would like to take advantage of. Learning from my past mistakes, I need to make sure that I take the time to understand these tools and use them where appropriate and not go overboard with their use. I think a good first step would be to find, or write some examples that implement some basic AOP functionality covering all of the cross-cutting concerns identified above. The only complaint I have so far is that you have to either install PostSharp on your computer, or manually edit every project file that needs post processing. This seems a little heavy handed, but I’m willing to consider it a fair tradeoff. It just makes it hard to do a strictly x-copy deployment of a project/solution. I’ve also been reading up on software architecture, including topics on Separation of Concerns and Loose Coupling. I think it is obvious that AOP can help with the separation of concerns (it’s pretty much stated in the definition). I also get the feeling that it could help with loose coupling, but I haven't seen a good example on that yet. All the examples I have seen would require tight coupling of your aspects (attributes) to something like log4net (in the logging example). Finally, I will need to continue to evaluate performance to determine if it’s a fair tradeoff with increased maintainability of code. I am most concerned on the compact framework side of things, as the processing power that those apps run on is not as great as their desktop counterparts. This is not a knock on PostSharp, but just something to be aware of.
I spent the last day and a half trying to figure out why a query using FOR XML AUTO was returning the wrong result set. Some background is in order. I’m migrating a database from SQL 2000 to SQL 2005, as well as running the same database created from scripts on SQL 2005 but in a different environment. Both databases contain the exact same SQL in the stored procedure that was the source of the problem, but they were returning different result sets. I even restored the database that worked to the server that had the non-working database and saw that the database created from scripts was still working as expected. I figured there was a database level setting causing the issue, so I opened up the database properties for both databases and compared them side by side, except I missed the 3 drop down boxes at the top, specifically the compatibility mode. I finally decided to run the SQL 2005 Update Advisor, which comes on the install media, or available online as a download. After about 10 minutes of checking my database (it was across a remote connection), it found the exact problem I was having, and the fix was to get rid of my derived tables, or set the comparability mode to 90. From the Upgrade Advisor help, here is an example of my original problem. Consider the following table: CREATE TABLE Test(id int);
INSERT INTO Test VALUES(1);
INSERT INTO Test VALUES(2); Now run this query, which produces different results under different compatibility levels. SELECT * FROM
(SELECT a.id AS a, b.id AS b
FROM Test a JOIN Test b ON a.id=b.id)
AS DerivedTest
FOR XML AUTO;
Under Compatibility Level 80 you get:
<a a="1"><b b="1"/></a><a a="2"><b b="2"/></a>
Under Compatibility Level 90 you get:
<DerivedTest a="1" b="1"/><DerivedTest a="2" b="2"/>
The XML under Level 90 is what I was looking for. Remmeber, under SQL 2000, the same query worked fine, it was only under SQL 2005 with Level 80 that I started having problems.
Of course after switching to level 90 I found another bug, and wouldn’t you know it, the compatibility wizard told me about this one as well, I just felt like ignoring it at first. This time it was a problem with a table prefix in an order by clause. Funny thing is, the table prefix didn’t even exist in the stored procedure, but under SQL 2000 it worked fine. Turns out someone else had already fixed the issue in the SQL 2005 version.
While looking for the stored procedure in error (since at first I ignored the warning in the upgrade advisor which even told me what stored procedure), I found a quick way to search stored procedures and functions in SQL 2005. SELECT ROUTINE_NAME, ROUTINE_DEFINITION
FROM INFORMATION_SCHEMA.ROUTINES
WHERE ROUTINE_DEFINITION LIKE '%SearchString%'
Lesson of the day, try using and paying attention to the tools that Microsoft gives you.
Late last year I posted briefly on the SQL Publishing Wizard. I haven’t had a need for this since I reformatted and installed Server 2008 64 bit as my main workstation at work, and wouldn’t you know it, it’s not there now. As usual I headed off to Google and found some posts that pointed to this install path, C:\Program Files\Microsoft SQL Server\90\Tools\Publishing\1.2. Seeing as I am running a 64 bit Windows OS, my path is actually C:\Program Files (x86)\Microsoft SQL Server\90\Tools\Publishing\1.2. Now you could just run SqlPubWiz.exe, or run the VSInt.reg file to add the context menu option in Visual Studio 2008. Not so fast, the registry file doesn’t seem to work as is on a 74 bit OS due to the new subkey, Wow6432Node. I modified VSInet.reg to include the keys the Wow6432node, and in the end got my Publish to Provider context menu option back. Windows Registry Editor Version 5.00 [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\VWDExpress\9.0\Menus] "{40d75537-ce10-4311-a7b0-6b164d80405d}"=",1000,1" [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\VisualStudio\9.0\Menus] "{40d75537-ce10-4311-a7b0-6b164d80405d}"=",1000,1" [HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\VWDExpress\9.0\Menus] "{40d75537-ce10-4311-a7b0-6b164d80405d}"=",1000,1" [HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\VisualStudio\9.0\Menus] "{40d75537-ce10-4311-a7b0-6b164d80405d}"=",1000,1"
My domain controllers, and thus my member servers and workstations were having some serious time drift. I’ve seen +/- 30 minutes this week so far. I found a good article from Microsoft on how to enable a computer (including domain controllers) to sync to an external time source (http://support.microsoft.com/kb/816042). I’m running two instances of Server 2008 server core, so I used the remote registry functionality to set the registry keys for w32time and restarted. I’m syncing to north-america.pool.ntp.org (don’t forget the ,0x1 at the end of our peer list). Since my domain controllers are virtual machines, I also setup one of my physical hosts to sync to an external source as a backup.
It’s been awhile (4 months) since I last update my HTC mogul from the stock ROM that came with the phone to a cooked ROM and leaked radio ROM. Lately my phone has been acting kind of buggy, with having to reset it every morning to get my data connection back. So I decided it’s time to upgrade to the RTM version of the radio, and a new version of DCD’s ROM. I will be highlighting the steps I outlined in my last post Cooked ROMs on the HTC Mogul, which seems to get quite a few hits from the search engines. Here are some additional links with good information: Here are my updated steps for updating my phone - Download all required files
- DCD Rom 3.2.2 (listed in forums not wiki)
- Sprint CAB File
- Olipro 2.4 (I already had this bootloader installed on my phone).
- Titan Radio ROM 3.42.30 (listed in the forums, not wiki)
- Write down your MSID, MSD and AKey settings from ##778#. If you do not know your MSL, you will need to get the SPC program.
- Write down data from ##3282
- Format your non-SDHC (smaller then 2GB Secure Digital Card) as FAT32. I backed up the contents of my SD card and formatted it clean for this process.
- Extract the Titaimg.nbh file from the Sprint Radio Rom rar file and copy to your SD card. The file must be named Titaimg.nbh (notice there is no N, it’s not titaN).
- Load the ROM by launching the boot loader using the power+camera+reset combination
- Wiki states that the update will stop 5 times for 9 seconds each time, so don’t freak out.
- When it says update complete, update success, do a soft reset and the the phone boot. You can verify the Radio version under Device Information in your System Settings page.
- Extract the RUU_signed.nbh from DCD’s 3.2.2 executable you downloaded using winrar. Rename this file TITAIMG.nbh and copy to your SD card overwriting the previous .nbh file.
- NOTE: You are about to wipe all data from your phone so back up what you need.
- Reboot into the boot loader with your SD card loaded.
- Soft reset when you see update complete/update success
- Complete the touch screen calibration, but perform a soft reset before the customization crap starts.
- Run the sprint carrier cab on your device and then reset. This will let you access the ##778# and ##3282# screens. If you can’t use your phone or data connection, access the ## screens and re-enter the data you copied down in step 2
Step 11 thru me for a loop until I remembered I had downloaded that carrier cab and should probably install it. I miss the default gray theme that I had in the last ROM, and it takes awhile to load everything back up on my phone. I hope that my daily reset requirement is no more, or I will be a little disappointed in my time invested in this project.
We have some WSE 2.0 secured Web Services that we are migrating to a new data center. As part of this migration effort I needed to write some automated tests to make sure everything was working. In addition to working with the WSE 2.0 clients our customers have, I also wanted to see what was needed to make the services consumable by WCF clients. After finding this article on WSE 2.0 Interoperability on http://wcf.netfx3.com, it was pretty easy. The main problem I was having was issues with the username token. In WCF some basic concepts were changed, such the removal of password encryption (instead recurring the transport, https for example to handle encryption), and replay detection. Here is the config section from the WSE 2.0 server piece (the diagnostic piece is optional) <microsoft.web.services2>
<security>
<securityTokenManager xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd" qname="wsse:UsernameToken">
<replayDetection enabled="false"/>
</securityTokenManager>
</security>
<diagnostics>
<trace enabled="true" input="logs\InputTrace.webinfo" output="logs\OutputTrace.webinfo" />
</diagnostics>
</microsoft.web.services2>
Here is a sample configuration section for the WCF Client: <system.serviceModel>
<bindings>
<basicHttpBinding>
<binding name="InventorySoap" closeTimeout="00:01:00" openTimeout="00:01:00"
receiveTimeout="00:10:00" sendTimeout="00:01:00" allowCookies="false"
bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard"
maxBufferSize="65536" maxBufferPoolSize="524288" maxReceivedMessageSize="65536"
messageEncoding="Text" textEncoding="utf-8" transferMode="Buffered"
useDefaultWebProxy="true">
<readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384"
maxBytesPerRead="4096" maxNameTableCharCount="16384" />
<security mode="TransportWithMessageCredential">
<message clientCredentialType="UserName" algorithmSuite="Default" />
</security>
</binding>
</basicHttpBinding>
</bindings>
<client>
<endpoint address="https://Server/Directory/Service.asmx"
binding="basicHttpBinding" bindingConfiguration="InventorySoap"
contract="MonitoringServices.Inventory.Wcf.InventorySoap"
name="InventorySoap" />
</client>
</system.serviceModel>
Most of the client configuration was created for me when I added a service reference to my project. The key part is the mode=TransportWithMessageCredential and clientCredntialType = “UserName”.
We have another project underway were we want to rewrite the WSE 2.0 services with WCF while maintaining full compatibility with deployed WSE 2.0 clients. The netfx3 article covers this scenario as well, and it seems like we will be able to accomplish our task. Look for a future post on that endeavor.
Today I tried to use the web recorder in Visual Studio to create some new web tests, but the recorder tool bar would not show in IE. A quick search found Diagnosing and fixing Web Test recorder bar issues, by Michael Taute which had several troubleshooting tips. I ended up changing my home page which is about:blank (and loads when web recorder is launched) to belong to the local intranet zone, as this is where my test site is. That didn’t fix the problem initially, so I deleted the following two registry keys using the 32 bit registry editor (C:\Windows\SysWOW64\regedit.exe): - HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Discardable\PostSetup\Component Categories\{00021493-0000-0000-C000-000000000046}
- HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Discardable\PostSetup\Component Categories\{00021494-0000-0000-C000-000000000046}
You need to make sure all instances of IE are closed before deleting the registry keys. Once I did this, my web recorder was up and running. I’ve left about:blank in the local intranet zone for now.
Once again I need to generate some self signed certs for local development. Installing certificate services in Windows is a bit of an overkill for what I need, however, it would be nice to have a root CA to work with. After some Googling, I found a site, http://ssl4net.com/ which allows you to create a self signed root CA, and then additional certs signed by the CA you created. It is extremely easy to use and once I got the certs I was able to install them without issue. My only concern is that the certs do not appear to be encrypted on their server, nor do they use SSL (seems ironic). However, since I will only be using this for internal use, I have no problems with this. I would be a little cautious if I was going to use to verify my identity to other people. It looks like they might be using open-ssl as the cert creation mechanism, so maybe it’s worth the effort to setting up a VM running linux to generate my own certs in house, but that’s for another day.
|