Saturday, October 15, 2011

Database table indexes with type and size

The following query retrieves index names and shows type and size of indices.

SELECT
sysSchma.name AS SchemaName
, sysObj.name AS TableName
, sysIndx.name AS IndexName
, sysIndx.type_desc AS IndexType
, sysPartStat.used_page_count * 8 AS IndexSizeKB
, CAST(sysPartStat.used_page_count * 8 / 1024.00 AS Decimal(10,3))
AS IndexSizeMB
FROM sys.dm_db_partition_stats AS sysPartStat
INNER JOIN sys.indexes AS sysIndx
ON sysPartStat.[object_id] = sysIndx.[object_id]
AND sysPartStat.index_id = sysIndx.index_id
AND sysIndx.type_desc <> 'HEAP'
INNER JOIN sys.objects AS sysObj
ON sysObj.[object_id] = sysPartStat.[object_id]
INNER JOIN sys.schemas AS sysSchma
ON sysObj.[schema_id] = sysSchma.[schema_id]
AND sysSchma.name <> 'SYS'
-- WHERE partition_stats.[object_id] = object_id('dbo.TableName')
ORDER BY SchemaName, TableName, IndexName, IndexType

Share/Bookmark

Monday, September 5, 2011

Dumpbin.exe - a tool to provide info about DLLs (x86 or x64)

Dumpbin.exe is one of tools with ability to provide information about the format and symbols in executable, library, and DLL files.

There are some options which you can utilize with Dumpbin.exe utility like /ALL, /DISASEM, /SUMMARY, /SYMBOLS, ...

If you want to see a DLL is compiled in x86 or 64 bit you can use /HEADERS option in command line:

dumpbin /headers MyCompany.MyDepartment.MyNameSapece.MyAssembly.dll

To be able to call DumpBin.exe in command line, you better extend PATH to be able to call it from anywhere: (The path is depend on your system)
  • SET PATH=%PATH%;C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\bin;C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE;
or
  • SET PATH=%PATH%;C:\Program Files\Microsoft Visual Studio 10.0\VC\bin;C:\Program Files\Microsoft Visual Studio 10.0\Common7\IDE;

Share/Bookmark

Visual Web Developer 2010 Express on NetBook

I tried to install Visual Web Developer 2010 Express on my Netbook
  • Intel Atom N550 (1.5GHz, 1MB L2 Cache)
  • 1 GB DDR3 RAM
  • 250 GB HDD
The folowing items installed and it took a few hours!
  • Microsoft .NET Framework 4
  • SQL Server Express 2008 R2
  • Visual Web Developer 2010 Express
  • Visual Studio 2010 SP1 Code (SP1 only installation)
  • Visual Studio 2010 SP1 KB983509
  • IIS 7.5 Express
  • SQL Server System CLR Types
  • SQL Server Native Client
  • Microsoft SQL Server Compact 4.0
  • SQL Server 2008 R2 Management Objects
  • Web Deployment Tool 2.1
  • Microsoft Visual Studio 2010 SP1 Tools for SQL Server Compact 4.0 Installer for New Installtion
  • Microsoft Visual Studio 2010 SP1 Tools for SQL Server Compact 4.0 Installer
  • Microsoft Visual Studio 2010 SP1 Tools for SQL Server Compact 4.0
  • ASP.NET MVC 3 Tools Update Installer
  • Microsoft Visual Studio 2010 SP1 Tools for ASP.NET Web Pages
  • ASP.NET MVC 3 Tools Update Language Packs Installer
  • ASP.NET MVC 3 Tools Update Language Packs
  • Visual Web Developer Express 2010 SP1
  • Microsoft Visual Studio 2010 SP1 Tools for SQL Server Compact 4.0 Installer for Repair
It worked but for sure it's very slow on this machine.


Share/Bookmark

Saturday, June 18, 2011

SQL - SSMS Server Name list removal (duplicate items)

SQL 2005:
C:\Documents and Settings\\Application Data\Microsoft\Microsoft SQL Server\90\Tools\Shell\mru.dat

SQL 2008:
C:\Documents and Settings\\Application Data\Microsoft\Microsoft SQL Server\100\Tools\Shell\SqlStudio.bin

- Close all instances of SSMS
- Delete or rename above file
- Open SSMS
Share/Bookmark

Sunday, May 1, 2011

Ext JS (JavaScript library)

Ext JS is a JavaScript library for building interactive web applications using techniques such as Ajax, DHTML and DOM scripting. Ext includes interoperability with jQuery and Prototype.

Ext JS provides an easy-to-use, rich user interface, much like you would find in a
desktop application. This lets Web developers concentrate on the functionality
of Web applications instead of the technical caveats.

"The Ext JS library started out as an extension to the moderately popular, yet very
powerful Yahoo User Interface library, providing what the YUI library lacked: an
easy-to-use API (Application Programming Interface), and real world widgets.
Even though the YUI Library tried to focus on the 'User Interface', it didn't contain
much that was useful right out-of-the-box."

Share/Bookmark

Sunday, February 27, 2011

Windows Service or ASP.NET - System.Security.SecurityException when writing to Event Log

The solution was to give NetworkService and LocalService read (Full) permission on the EventLog/Security key.

To resolve you need to give the NetworkService/LocalService or ASP.NET user permission to read from the event log registry entries.

1. Select Start - Run, then enter: regedt32
2. Navigate to the following key:
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Eventlog\Security
3. Right click on this entry and select Permissions.
4. Add the NetworkService/LocalService/ASPNET user.
5. Give it Read (Full) permission.
Share/Bookmark

Sunday, February 20, 2011

A little about ASP.NET MVC

ASP.NET MVC is a fascinating technology that provides an alternative to Web forms for building Web applications. Instead of building pages using server controls that provide relatively little control over the HTML they produce, MVC gives you complete control. ASP.NET MVC is based on the Model-View-Controller pattern. It’s good to mention that there are almost no limitations in how you provide data to an MVC application. I'll write more about ASP.NET MVC soon.
Share/Bookmark

.NET - Web services design tip

When a request comes in the receiver un-wraps it to figure out what objects got call.

"Do not include business logic in Web service implementation"
Instead, include objects that Web service instantiates and uses, in this way the whole
implementation is cleaner. The reason of implementing the business logic in elsewhere is because of being able to test them separately, implement them separately, and keep the things easier for maintenance and debugging.
Share/Bookmark

Saturday, February 12, 2011

C# - Static constructor cannot be overloaded

Static constructors are called before any other class members are called and called once only.Their main purpose is to initialize only the static members of a class. Static constructors cannot be overloaded.
Share/Bookmark

Sunday, January 23, 2011

C# - Static Constructors

• You declare a static constructor by "static" keyword in front of the constructor name.
• To initialize static fields in a class you can use static constructor.
• A static constructor is called before an instance of a class is created
• A static constructor is called before a static member is called.
• A static constructor is called before the static constructor of a derived class.
• A static constructor does not take access modifiers or have parameters.
• A static constructor cannot be called directly.
• They are called only once.
• Can't access anything but static members.

class MyClass
{
// Static constructor
static MyClass()
{
//...
}
}

Share/Bookmark

Sunday, January 9, 2011

Visual Studio 2010 runs faster when the Windows Automation API 3.0 is installed

Applications that use Windows Automation APIs can significantly decrease Microsoft Visual Studio IntelliSense performance if Windows Automation API 3.0 is not installed. For example, the Windows pen and touch services can significantly decrease Visual Studio IntelliSense performance if Windows Automation API 3.0 is not installed.
http://support.microsoft.com/kb/981741
Share/Bookmark

Sunday, January 2, 2011

http://twitter.com/fbayanati


Tweets
Share/Bookmark

T-SQL Copy database diagrams to another database

Unlike stored procedure, functions, tables, views, ... MS Sql server doesn't have an easy way to script or create database diagrams. It keeps all the diagrams in [sysdiagrams] system table.

SELECT *
FROM sysdiagrams

USE newDb
GO

INSERT INTO sysdiagrams
([name], pricipal_id, version, definition)
SELECT [name], pricipal_id, version, definition
FROM #tempDiagrams

Share/Bookmark