Showing posts with label tips. Show all posts
Showing posts with label tips. Show all posts

Monday, 30 July 2012

Resize the partition on Windows Server for free and non-destructive

Problem: after cloning smaller hard drive (HDD, 80 Gb) to a larger solid-state drive (SSD, 128 Gb), the partitions on the SSD became exactly the same as on HDD. 40 Gb were "lost". I needed a way to expand the partition on the SSD not loosing the files on it. Did it on Windows Server 2008 x64, with an idea to install that SSD in the laptop where HDD belonged.

Tried these free utilities:
Paragon Partition Manager Free Edition - doesn't work with server OS. Rumours are it also doesn't support dynamic disks
MiniTool Partition Wizard Home Edition 7.5 - doesn't support Windows Server OS.

Solution:



Sunday, 29 July 2012

Updating firmware on OCZ Vertex 4 SSD

After several unsuccessfull attempts to update the firmware on my new SSD - OCZ Vertex 4 - I think I found a way that works.

Monday, 25 June 2012

Enabling CAT.Net to work with Visual Studio 2010

Microsoft recommends using their CAT.Net Security Code Analysis tool as part of the SDL (Software Development Process). Unfortunately, latest released version is CAT.Net v1 CTP. There was CAT.Net 2.0 Beta but it disappeared even from Microsoft's sites due to some incompatibility or missing libraries (where??).

What is left of CAT.Net 2.0 for the community is this video on Channel 9.

CAT.Net 1.0 doesn't work with Visual Studio 2010 unless you manually alter (hack) its config file a little. See below.

  1. Close Visual Studio 2010 IDE
  2. Find this file: %APPDATA%\Microsoft\MSEnvShared\Addins\Microsoft.ACESec.CATNet.AddIn
  3. Edit it in your preferred text editor, adding the line <Version>10.0</Version> right after <Version>9.0</Version>
  4. Open IDE again. Go to Tools->CAT.Net Code Analysis

Hope it helps.

P.S.: there is some information on how to use CAT.Net and OWASP O2 Platform along with Roslyn compiler outside of the IDE. It is all on Dinis Cruz blog.

Update 1: Found a blog post from April 2011 which says this:
At this point in time we are accepting recommendations, suggestions and new features.  However, we do not have any planned updates for the remainder of the fiscal year.  We are going through our FY12 planning and CAT.NET is on the list of requests for next year.  We will know by the end of June if funding has be approved.  At that time we’ll notify people of the budgetary decisions. 

Thursday, 3 May 2012

PhoneGap (Cordova), fail to navigate to index.html

Noticed when debugging Windows Phone 7.1 or 7.5 Mango app made with PhoneGap (Cordova) 1.6.1. The same may apply to earlier versions. Visual Studio 2010.

Error 1: fails to build with the following error


Arg :: path to project\MyProject.csproj
path to solution\ MyProject\BuildManifestProcessor.js(14, 1) Microsoft JScript runtime error : Permission denied
  
C:\Windows\Microsoft.NET\Framework\v4.0.30319\Microsoft.Common.targets(1036,5): error MSB3073: The command "CScript "path to project\ MyProject\/BuildManifestProcessor.js" " path to project\ MyProject\ MyProject.csproj"" exited with code -1.

Reason: CordovaSourceDictionary.xml in the root of the project is read-only. Happened because it was included in the project and then added to source control.
Fix: Make sure that CordovaSourceDictionary.xml is not read-only before doing the build


The file CordovaSourceDictionary.xml  is dynamic, generated on each build by a pre-build event

However, if this file is excluded from the project, you will experience

Tuesday, 1 May 2012

Paste Special in Excel can be broken because of Skype

It appears that Skype Click-to-Call browser plugin somehow interferes with Microsoft Office applications ability to copy-paste. Some other application can be also affected. Paste Special in Excel 2007 \ Excel 2010 suffers most as it looses ability to paste formulas, can paste only text, it looks broken and not working.

Problem: in Excel worksheet, copy a cell with the formula either with Ctrl-C or right-click, copy. Paste into another cell. It pastes text only. copy again, right click on another cell, choose Paste Special - it offers to paste only plain text or unicode, no nice choice of formula, etc

Workaround: if you have Skype installed and any web browser is open - close the browser. May need to re-open Excel work sheet. If it doesn't help - disable or uninstall Skype Click-to-Call browser plugin

Skype confirmed the problem and said they are working on an update

Friday, 27 April 2012

How to change smtp server in TFS2008

Team Foundation Server 2008 is not the most user-friendly application to configure. Here is how to change the smtp server it is using for alerts and other outgoing emails

It is done by changing standard .Net smtp configuration section in the following files, change the host attribute on smtp/network node:

C:\Program Files\Microsoft Visual Studio 2008 Team Foundation Server\Web Services\Services\web.config
C:\Program Files\Microsoft Visual Studio 2008 Team System Web Access\Web\web.config

<configuration>...  <system.net>    <mailSettings>      <smtp deliveryMethod="network" from="teamserver@mydomain.net">        <network host="my.mail.server" port="25" defaultCredentials="true" />      </smtp>    </mailSettings>  </system.net>

Couldn't start Default Web Site on Windows7. Solved

Problem:
You try to start Default Web Site in IIS Manager and it fails with the following error message:


The process cannot access the file because it is being used by another process. (Exception from HRESULT: 0x80070020)


Solution: 
If Skype is running - quit it. Then start the web site! Your Skype was listening on the port 80.

Hint:
Start the Default Web Site before starting Skype.

Happened to me on Windows7 64bit, IIS7, IIS7.5











Wednesday, 11 April 2012

Convert full datetime to start of the day in T-SQL

Nice trick to convert full datetime to just year-month-day portion, resetting hours, minutes, seconds. Works in T-SQL, SQL Server

This statement:
SELECT GETDATE() AS FullDate, DATEADD(day, DATEDIFF(day, '19000101', GETDATE()), '19000101') AS StartOfTheDay

Produces this result:
FullDate StartOfTheDay

2012-04-11 13:51:15.570 2012-04-11 00:00:00.000


Note1: you can put any datetime instead of GETDATE()

Note2: DATEADD(day, DATEDIFF(day, '19000101', GETDATE()), '19000101') is the functional equivalent of DATEADD(day, DATEDIFF(day, 0, GETDATE()), 0)



Tuesday, 27 March 2012

Using WinMerge in VS2010

My recommended tool for Compare and Merge operation in Visual Studio is WinMerge

Here is how to setup Visual Studio 2010 IDE to use it. Assuming you are using Team foundation Server and WinMerge is already installed


In IDE:
Tools->Options
Expand "Source Control"
Click "Visual Studio Team Foundation Server" link
Click "configure User Tools ..." button

click "Modify ..." for each extension
or click "Add ..." to add new one

You may add .* as an extension which will mean any file extension

Compare:
Command: C:\Program Files (x86)\WinMerge\WinMergeU.exe
Arguments: /e /u /wl /wr /dl %6 /dr %7 %1 %2

Merge:
Command: C:\Program Files (x86)\WinMerge\WinMergeU.exe
Arguments: /e /u /wl /dl %6 /dr %7 %1 %2 %4



Wednesday, 28 September 2011

Telerik RadTreeList - how to switch button(s) for an item at runtime

Struggled with this for some time - Wanted to be able to switch Insert and\or Edit buttons on a TreeList control from Telerik at runtime, depending on what its DataItem or NestedLevel is. Here is the solution, using the control's server-side API:


protected void OnMyTreeListItemCreated(object sender, TreeListItemCreatedEventArgs e)
{
//APPROACH #1
if (e.Item.ItemType == TreeListItemType.AlternatingItem || e.Item.ItemType == TreeListItemType.Item)
{
TreeListDataItem item = e.Item as TreeListDataItem;
if (item != null)
{
int level = item.HierarchyIndex.NestedLevel;
//DO THE JOB
LinkButton btnInsert = item["EditCommandColumn"].FindControl("InsertButton_EditCommandColumn") as LinkButton;
LinkButton btnEdit = item["EditCommandColumn"].FindControl("EditButton_EditCommandColumn") as LinkButton;


if (btnInsert != null) { btnInsert.Visible = (level == 0); }
if (btnEdit != null) { btnEdit.Visible = (level > 0); }
}
}



//APPROACH #2
var editableItem = e.Item as TreeListEditableItem;


if (editableItem != null)
{

SomeMyType boo = editableItem.DataItem as SomeMyType;


if (boo!= null && boo.SomeProperty == "SomeValue")
{
//SAME DO THE JOB AS IN #1
}
}

}




}

Tuesday, 27 September 2011

WiX, Troubleshooting "Verify that you have sufficient privileges to install system services" error message



When running an installer created by using WiX (Windows Installer XML), you may sometimes get the following errorService 'Service Display Name' (ServiceName) could not be installed. Verify that you have sufficient privileges to install system services.


This error message, like many other in WiX is totally misleading - it is not about YOUR privileges, it is about how service account is resolved
The WiX ServiceInstall element is used to install Windows services. Its Account attribute should contain the name of the windows account that this windows service is supposed to run under.
This windows user name must be fully qualified - either as a domain or as machine name. This is true even for local accounts.
The solution is to set Account attribute like this:  <ServiceInstall ... Account=".\MyWindowsUser" .... />
Not like this: <ServiceInstall .... Account="MyWindowsUser" .... />



Friday, 2 September 2011

Visual Studio, increase maximum number of code analysis warnings in IDE


When running Visual Studio Code Analysis on a project, you may encounter the following error:

   CA0503: Additional warnings cannot be displayed.

By default, a maximum of 200 warnings are displayed in the Error List.

This can be increased by modifying the following registry value(s):

HKEY_CURRENT_USER\Software\Microsoft\VisualStudio\10.0_Config\Setup\EDev\CodeAnalysisErrorListViolationLimit
HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\VisualStudio\10.0\Setup\EDev\CodeAnalysisErrorListViolationLimit
HKEY_USERS\.DEFAULT\Software\Microsoft\VisualStudio\10.0_Config\Setup\EDev\CodeAnalysisErrorListViolationLimit



for older versions it may be here:
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\VisualStudio\8.0\Setup\EDev\CodeAnalysisErrorListViolationLimit

Microsoft says that 200 is the magic number based on minimum recommended system configuration.

Alternative way is to do it in IDE: 



You can configure the maximum number of errors and warnings that appear for your database project. By default, the maximum number is 200 errors and warnings.

To configure the maximum number of errors and warnings

  1. On the Tools menu, click Options.
  2. In the tree, expand the Database Tools node, and click Database Errors and Warnings.
  3. In Maximum errors and warnings to display, type the maximum number of errors and warnings that you want to appear for your database projects.
  4. Click OK.