Wednesday, November 10, 2010

Inserting Records with Identity column table

So, recently, I needed to insert some static data manually within the staging environment.  I wanted to align the identity column values to be in ascending order but if there are any typos causing my inserts to be rolled back, then the identity values will have gaps because rollback operation does not preserve the next value for identity.  Therefore, using DBCC CHECKIDENT ('<schema>.<tbl_name>', NORESEED), I can find the current value of the seed, while using DBCC CHECKIDENT ('<schema>.<tbl_name>', RESEED,<last_used_value>) sets the identity to the last value. 

Sunday, March 7, 2010

I like to configure my VMWare Guests to manual startup/shutdown because I use the host for both as a management platform and a developer workstation.

To assist me with managing such environment, i use VI Tookit. Only 1.0 is compatible with VMWare Server 2.0, here. Install it on either x86 or amd64 box. Then, add a few lines of configuration to initialize the PSSnapin into your user’s PowerShell profile location:

Add-PSSnapin Vmware.VimAutomation.core
. "C:\Program Files (x86)\VMware\Infrastructure\VIToolkitForWindows\Scripts\Initialize-VIToolkitEnvironment.ps1"

Fire up PowerShell and you can do the following now

Connect-VIServer -Server "vmware_host" -Port 8333
get-vm sqldev2k8 | shutdown-vmguest

Tuesday, February 9, 2010

Keeping up with Microsoft

It seems that Microsoft releases new tools at an alarming rate. It feels like .Net 3.5 and Silverlight were just recently came to market, now Microsoft is at it again. Behold that .Net 4.0 and Visual Studio 2010 are just around the corner. Here is Scott Guthrie’s entry to confirm that, here.

From playing with Beta2 of VS 2010, I am highly looking forward to this release. They’ve made great strides at giving state of the art debugging, and visual design capabilities to developers.

The Beta2 and RC can both be installed side-by-side, so it’s time to play more with new stuff!!!

Thursday, February 4, 2010

Submitting Xml correctly into SOAP envelope

Over time, I became a bit comfortable for web services frameworks to take care of the serialization details. A few days ago, I had to deal with consuming the web service manually and quickly realized that i have not been below trenches in awhile.

The SOAP service has a string parameter which is in fact and xml fragment. Initially, I wrote the soap request in the following format:

<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
  <soap:Body>
    <PersonalizedHelloWorld xmlns="http://tempuri.org/">
      <nameParameter><name>Roman</name></nameParameter>
    </PersonalizedHelloWorld>
  </soap:Body>
</soap:Envelope
Obviously, there is an issue with doing that. Can you spot it?

Well, you must use <![CDATA[]]> escaping syntax in the nameParameter element text. So the it should look like this:

<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
  <soap:Body>
    <PersonalizedHelloWorld xmlns="http://tempuri.org/">
      <nameParameter><![CDATA[<name>Roman</name>]]></nameParameter>
    </PersonalizedHelloWorld>
  </soap:Body>
</soap:Envelope

Tuesday, January 12, 2010

Asp.Net Intrinsic properties

By default the System.Web.UI.Page exposes Session, Request, and Response properties.  However often you may want to access these properties outside of the Page context. The easiest way to do it is to use HttpContext.Current static property to obtain the current request’s HttpContext.  Thus, you can obtain a session variable like this:

HttpContext.Current.Session[“userid”].


Vote for two important CodePlex features

Eric Hexter, from MvcContrib project, has just asked the community to go and vote for a few issues with CodePlex. Here is his blog for reference, http://www.lostechies.com/blogs/hex/archive/2010/01/11/a-call-for-help-vote-for-my-codeplex-issues.aspx. Go Vote!