Showing posts with label tricks. Show all posts
Showing posts with label tricks. 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. 

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)



Thursday, 23 June 2011

Excel 2003, 2007 allows maximum 31 characters in a work sheet name

Try to rename a worksheet in Microsoft Office 2003 Excel or Excel 2007 - you will hit a limit of 31 characters. This limit is not directly mentioned in any of the below specifications:

Excel 2007 Specifications and Limits
Excel 2003 Specifications and Limits
Excel 2010 Specifications and Limits

Wednesday, 22 June 2011

Why you shouldn't use Response.End and how to properly use Response.Redirect

Reposnse.Redirect is provided for compatibility with ASP but people still use its default overload which causes ThreadAbortException under the covers. This exception cannot be caught and has performance impact on your web application - look in "Output" or "Immediate" window in your Visual Studio when you do debugging and see this

A first chance exception of type 'System.Threading.ThreadAbortException' occurred in mscorlib.dll
An exception of type 'System.Threading.ThreadAbortException' occurred in mscorlib.dll but was not handled in user code


This is caused by Response.End being internally called by Response.Redirect(someurl).
To avoid it, you may use another overload Response.Redirect(someurl, flase) which doesn't end the response, but it may lead to consequences because the rest of your code behind, after the Redirect, will still be processed.

The solution? Use .End for debugging. Consider using the combination of .Redirect(blah, false) and  HttpContext.Current.ApplicationInstance.CompleteRequest method

Please be warned that the above will end Application, but not Page events chain therefore Page-related events and Postback will still be processed and the page will be rendered, though the client will not see it (need to confirm that)

Sunday, 15 May 2011

How to install VMWare Player after Hyper-V role is enabled in Windows Server 2008

Once you enabled Hyper-V role on Windows Server 2008, you will not be able to install VMWare Player or  Server. First will complain that it cannot be installed on Windows 95, 98 or 2000 - fair enough, but totally misleading - latter will give error message noting that you have to disable Hyper-V.

It appears that you cannot run both hypervisors at the same time, but there is a light of hope.
thanks to this posting: http://blog.baeke.info/blog/_archives/2007/12/18/3416738.html

1) run the following "as administrator" in console - it will give you some GUID
bcdedit /copy {default} /d "No Hypervisor"

2) now copy\paste this GUID into the following:
bcdedit /set {GUID} hypervisorlaunchtype off

3) reboot - now you have a "No Hypervisor" boot option

P.S.: I also disabled all "Hyper-V ... " windows services, probably it was an overkill...