Saturday, May 9, 2009

jQuery Intellisense in Visual Studio 2008 (VS 2008)

To enable intellisense completion for jQuery within VS you'll want to follow three steps:


Step 1: Install VS 2008 SP1

VS 2008 SP1 adds richer JavaScript intellisense support to Visual Studio, and adds code completion support for a broad range of JavaScript libraries.

You can download VS 2008 SP1 here.


Step 2: Install VS 2008 Patch KB958502 to Support "-vsdoc.js" Intellisense Files

Few weeks ago Microsoft shipped a patch that you can apply to VS 2008 SP1 that causes Visual Studio to check for the presence of an optional "-vsdoc.js" file when a JavaScript library is referenced, and if present to use this to drive the JavaScript intellisense engine.

These annotated "-vsdoc.js" files can include XML comments that provide help documentation for JavaScript methods, as well as additional code intellisense hints for dynamic JavaScript signatures that cannot automatically be inferred. You can download it here.


Step 3: Download the jQuery-vsdoc.js file

Microsoft worked with the jQuery team to put together a jQuery-vsdoc.js file that provides help comments and support for JavaScript intellisense on chained jQuery selector methods. You can download both jQuery and the jQuery-vsdoc file from the official download page on the jQuery.com site.

Save the jquery-vsdoc.js file next to your jquery.js file in your project (and make sure its naming prefix matches the jquery file name). For example, if the jQuery library file is jquery.1.2.6.js, the vsdoc file will be named jquery-.1.2.6-vsdoc.js


You can then reference the standard jquery file with an html <script/> element like so:

<script src="../Folder/jquery.1.2.6.js" type="text/javascript"></script>

When you do this VS will now look for a -vsdoc.js file in the same directory as the script file you are referencing, and if found will use it for help and intellisense.

Thursday, April 23, 2009

Uninstalling System Center Essential (SCE) 2007

If you’re evaluating SCE or plan on moving SCE to new hardware it is important to understand how to correctly remove SCE from your environment prior to starting a new installation. We have performed many reinstallations while developing our SCE installation procedures and I thought I would share the steps.


Delete SCE Managed Computers Group from Active Directory

Start > Run > dsa.msc
Right-click on DomainName and click Find…
Type SCE Managed Computers into the Name box and click Find Now
Right-click SCE Managed Computers in the results pane and click Delete
Close Active Directory Users & Computers


Delete Group Policies

If you performed a default installation of System Center Essentials you will have two group policy objects that were automatically created for you. Follow these steps to delete the group policies.

Start > Run > gpmc.msc
Expand DomainName > Group Policy Objects in the left pane
Right-click SCE Managed Computers Group Policy (…) and click Delete
Right-click System Center Essentials All Computers Policy and click Delete
Close Group Policy Management Console


Delete Service Connection Point (SCE)

The following procedure requires ADSI Edit.

Start > Run > adsiedit.msc
Right-click ADSI Edit in the left pane and click Connect…
Select Default naming context in the Select a well known Naming Context box and click OK
Right-click Default naming context in the left pane and select New > Query…
Type SCESCP in the Name box
Click the Browse… button, select DomainName , and click OK
Paste (&(objectCategory=serviceConnectionPoint)(cn=SCESCP)) into the Query String box and click OK
Highlight and then expand Default naming context in the left pane
Select SCESCP in the left pane
Right-click CN=SCESCP in the middle pane and click Delete
Leave ADSI Edit open for the next step


Delete Service Connection Point (SDKServiceSCP)

Right-click Default naming context in the left pane and select New > Query…
Type SDKSCP in the Name box
Click the Browse… button, select DomainName , and click OK
Paste (&(objectCategory=serviceConnectionPoint)(cn=SDKServiceSCP)) into the Query String box and click OK
Highlight and then expand Default naming context in the left pane
Select SDKSCP in the left pane
Right-click the appropriate CN=SDKServiceSCP entry in the middle pane and click Delete

Identifying the appropriate entry to delete in step 7 above requires finding the entry that corresponds to the name of the SCE server to be removed. Look at the distinguished name column in the middle pane to locate the right computer name.

Thursday, April 16, 2009

Asp.Net Menu and Internet Explorer 8 (IE8)

If you use Asp.Net Menu control, you have surely noticed that with Internet Explorer 8 there are a problem with submenus.

Microsoft give out a patch for webservers IIS to fix that problem, but for me there is a better solution: working with CSS.

The Css Class to create is very simple:

.IE8Fix
{
z-index: 100;
}

and then you ave to apply it to DynamicMenuStyle tag:

<asp:Menu ID="MioMenu1" runat="server" ... >
...
<DynamicMenuStyle CssClass="IE8Fix" />
...
<asp:Menu>

Tuesday, April 7, 2009

SQL Server 2008 Row Constructors

SQL Server 2008 Row Constructors

SQL Server 2008 come with “Row Constructor”. It helps to write more compact code in less time.
With the use of Row Constructors its possible to insert some rows in a table using a single INSERT instruction:

INSERT INTO dbo.Customers(custid, companyname, phone, address)
VALUES
(1, 'cust 1', '(111) 111-1111', 'address 1')
,(2, 'cust 2', '(222) 222-2222', 'address 2')
,(3, 'cust 3', '(333) 333-3333', 'address 3')
,(4, 'cust 4', '(444) 444-4444', 'address 4')
,(5, 'cust 5', '(555) 555-5555', 'address 5');



In aggiunta a questa possibilità, now VALUES clause also works with other commands. In simple words, its possible to rewrite some SELECt with UNION operator as a single SELECT…VALUES:

SELECT *
FROM
(VALUES
(1, 'cust 1', '(111) 111-1111', 'address 1')
,(2, 'cust 2', '(222) 222-2222', 'address 2')
,(3, 'cust 3', '(333) 333-3333', 'address 3')
,(4, 'cust 4', '(444) 444-4444', 'address 4')
,(5, 'cust 5', '(555) 555-5555', 'address 5')
) AS C(custid, companyname, phone, address);

Thursday, March 5, 2009

Transparent redirect (HTML)

Sometimes we have to create a redirect for a web application or a web site. Usually, the browser address bar change its text, so users see the redirection.

But there is a very simple way to redirect user to another site/domain without the change of the address bar: just create a page like this

<html>
    <head>
    </head>
    <frameset>
        <frame name="main" src="http://www.newdomain.it">
    </frameset>
    <body>
    </body>
</html>

PS: There are some other ways to do this, but all uses javascript. This is the only method that doesn't use scripts or other.