Monday, September 28, 2009

VMware vSphere Client on Windows 7

VMware vSphere client doesn't work if you have a Windows 7 pc.

When you try to connct to an Esx server or a Virtual Center server, you'll give these errors:

  • Error parsing the server "nome del server" "clients.xml" file.
  • The type initializer for 'VirtualInfrastructure.Utils.HttpWebRequestProxy' threw an exception.

But with this workaround, the program will works fine:

  1. Edit the VpxClient.exe.config file:
    <?xml version="1.0" encoding="utf-8"?>

    <configuration>

    <system.net>

    <connectionManagement>

    <clear/>

    <add address="*" maxconnection="8" />

    </connectionManagement>

    </system.net>

    <appSettings>

    <add key = "protocolports" value = "https:443"/>

    </appSettings>

    <runtime>

    <developmentMode developerInstallation="true"/>

    </runtime>

    </configuration>
  2. Create in C:\Program Files\Vmware\Infrastructure\Virtual Infrastructure Client\Launcher folder (or in the folder qhere you have installed the software) a subfolder called Lib. In this subfolder copy the system.dll .Net file from a non Windows 7 box (see above)
  3. Crete a new system variable named DEVPATH with value C:\Program Files\Vmware\Infrastructure\Virtual Infrastructure Client\Launcher\Lib


Now the program works fine

PS: A copy of the configuration and of the system.dll file are downloadable here.

Wednesday, June 24, 2009

SQL Server Log File Shrink for all databases on a server

If you use SQL Server, you certainly now that the grow up of transacion log file (.ldf file) is a serious problem.

The faster method to resize the transaction log is to do a shrink.

But if there are N databases on a server, a DBA has to repeat the operation for N times. So, I've created this T-Sql script with that you can automatically execute this operation for all databases on a server.


EXECUTE sp_msforeachdb
'USE ?;
DUMP TRANSACTION ? WITH NO_LOG;
DECLARE @LogLogicalName nvarchar(100);
SELECT @LogLogicalName = file_name(2);
DBCC SHRINKFILE(@LogLogicalName, 100);'


sp_msforeachdb: an undocumented microsoft stored procedure that allow to execute T-SQL code on each database on a DB server.

?: the database name given from stored procedure.

file_name(2): a function that return the logical name of db transaction log file.


Wednesday, June 3, 2009

Disable a button after click (Asp.Net)

To disable a button after click, to avoid that a user re-click on it before the completion of the operation, we have tu use javascript.
The problem is that the disable javascript function remove the postback ability of the button.

To bypass this problem, we can use the following code, writing it into Page Load event:

Me.btn.Attributes("onclick") = "this.disabled = true; " & Page.GetPostBackEventReference(btnSub).ToString

Into this code, btn is the id of the button and btnSub is the routine that normally handles btn.Click event

Thursday, May 14, 2009

Windows Server 2008 and Shared Folders

Working with shared folders on Windows Server 2008 operating system server, there could be some problems:

The system detected a possible attempt to compromise security. Please ensure that you can contact the server that authenticated you.

To work around this problem, make sure that client computers use the cryptography algorithms that are compatible with Windows Server 2008. You may have to request software updates from the product vendors.

If you cannot install software updates because a service outage will occur, follow these steps:

1.       Log on to a Windows Server 2008-based domain controller.

2.       Click Start, click Run, type gpmc.msc, and then click OK.

3.       In the Group Policy Management console, expand Forest: DomainName, expand DomainName, expand Domain Controllers, right-click Default Domain Controllers Policy, and then click Edit.

4.       In the Group Policy Management Editor console, expand Computer Configuration, expand Policies, expand Administrative Templates, expand System, click Net Logon, and then double-click Allow cryptography algorithms compatible with Windows NT 4.0.

5.       In the Properties dialog box, click the Enabled option, and then click OK.

Notes

o        By default, the Not Configured option is set for the Allow cryptography algorithms compatible with Windows NT 4.0 policy in the following Group Policy objects (GPO):

§         Default Domain Policy

§         Default Domain Controllers Policy

§         Local Computer Policy

By default, the behavior for the Allow cryptography algorithms compatible with Windows NT 4.0 policy on Windows Server 2008-based domain controllers is to programmatically prevent connections from using cryptography algorithms that are used in Windows NT 4.0. Therefore, tools that enumerate effective policy settings on a member computer or on a domain controller will not detect the Allow cryptography algorithms compatible with Windows NT 4.0 policy unless you explicitly enable or disable the policy.

o        Windows 2000 Server-based domain controllers and Windows Server 2003-based domain controllers do not have the Allow cryptography algorithms compatible with Windows NT 4.0 policy. Therefore, pre-Windows Server 2008-based domain controllers accept security channel requests from client computers even if the client computers use the old cryptography algorithms that are used in Windows NT 4.0. If security channel requests are intermittently processed by Windows Server 2008-based domain controllers, you will experience inconsistent results.

6.       Install third-party software updates that fix the problem, or remove client computers that use incompatible cryptography algorithms.

7.       Repeat steps 1 through 4.

8.       In the Properties dialog box, click the Disabled option, and then click OK.

Important For security reasons, you should set the option for this policy back to Disabled.


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.