streda 14. novembra 2012

Unable to access the IIS metabase

When you change web hosting enviroment in Visual Studio 2012 from build-in IIS Express to locally installed IIS 8, this error message may occur.


Simple solution: Run Visual Studio "As Administrator", even you are local Administrator.

utorok 13. novembra 2012

SharePoint 2010 error: The user does not exist or is not unique

Simple solution for SharePoint 2010: 

Everywhere You will be prompted to specify
account credentials, set it in full format [COMPUTER NAME]\[UserName] or [DOMAIN NAME]\[UserName].


štvrtok 13. septembra 2012

How to create and enable fulltext for documents on MS SQL Server 2008

This is real working example:
database name = sps
database owner name = sps
table name = DR_BLOBSTORAGE
column name with content = CONTENT
PK = SID
PK index name = DBL_PK

You need to have a table with this three types of columns
CREATE TABLE [dbo].[DR_BLOBSTORAGE](
    [SID] [dbo].[SID] NOT NULL,
    [CONTENT] [image] NULL,
    [DOC_TYPE] [varchar](10) NULL,
 CONSTRAINT [DBL_PK] PRIMARY KEY CLUSTERED
(
    [SID] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]




1. Check if fulltext is enabled on the database and enable it.
USE sps
if (select DATABASEPROPERTY(DB_NAME(), N'IsFullTextEnabled')) <> 1
exec sp_fulltext_database N'enable'


2.  Create fulltext catalog with name spsdr_catalog, case insensitive.
CREATE FULLTEXT CATALOG [spsdr_catalog] WITH ACCENT_SENSITIVITY = OFF
AUTHORIZATION [sps]
.

Later, you can manage it here in MS SQL Management Studio


3. Get all languages possible to index.
SELECT * FROM sys.fulltext_languages
 
 3. Create fulltext index
CREATE FULLTEXT INDEX ON [dbo].[DR_BLOBSTORAGE]
(
        CONTENT                         --Full-text index column name
        TYPE COLUMN DOC_TYPE    --Name of column that contains file type information
        Language 1051                 --1051 is LCID for the Slovak language
)
    KEY INDEX DBL_PK
    ON spsdr_catalog
    WITH CHANGE_TRACKING OFF, NO POPULATION;



4. Start population (indexing)
ALTER FULLTEXT INDEX ON [dbo].[DR_BLOBSTORAGE]
   START FULL POPULATION;


5. Check population status:
select objectproperty(object_id('[dbo].[DR_BLOBSTORAGE]'), 'tablefulltextpopulatestatus') as TableFullTextPopulateStatus

0 = Idle.
1 = Full population is in progress.
2 = Incremental population is in progress.
3 = Propagation of tracked changes is in progress.
4 = Background update index is in progress, such as automatic change tracking.
5 = Full-text indexing is throttled or paused. 


Starting status will be 1, but after a while  (depending of  the count of  documents already in database) it will change to 0.

6. Test fulltext search
select * from dr_blobstorage  where  contains(CONTENT,'Test')  

enjoy

MichalC

streda 27. júna 2012

For vs. Foreach performance when iterating a generic list

The simplest way is "Test it"!

Performance test:


Code Snippet
  1. class Program
  2.     {
  3.         static void Main(string[] args)
  4.         {
  5.             
  6.             List<int>  list= new List<int>();
  7.             for(int i =0; i < 10000000 ; i++)
  8.             {
  9.                 list.Add(i);
  10.             }
  11.  
  12.             int sum = 0;
  13.             Stopwatch sw = new Stopwatch();
  14.             sw.Start();
  15.             for (int i = 0; i < list.Count; i++)
  16.             {
  17.                 sum += list[i];
  18.             }
  19.  
  20.             sw.Stop();
  21.             Console.WriteLine(" FOR {0}", sw.Elapsed.ToString());
  22.             sw.Reset();
  23.  
  24.             sum = 0;
  25.             sw.Start();            
  26.             foreach (int item in list)
  27.             {
  28.                 sum += item;
  29.             }
  30.             sw.Stop();
  31.             Console.WriteLine(" FOREACH {0}", sw.Elapsed.ToString());
  32.             sw.Reset();
  33.  
  34.             Console.ReadLine();
  35.         }
  36.     }

10 items:
FOR 00:00:00.0000040
FOREACH 00:00:00.0000018

1000 items:
 FOR 00:00:00.0000131
 FOREACH 00:00:00.0000098

100 000 items:
FOR 00:00:00.0010038
FOREACH 00:00:00.0007952

10 000 000 items:
FOR 00:00:00.1031941
FOREACH 00:00:00.0819216

Conclusion:
When you don't need to manipulate items in collection, use Foreach, otherwise For.



utorok 26. júna 2012

How to shutdown Windows 8

1.) From "classic" Desktop

There isn’t an intuitive way. Just press Alt + F4 on your keyboard and the Shut Down dialog will appear. Before using this shortcut method, make sure all running applications are closed.



2.) From Metro:

Put your mouse at the bottom-right corner of the screen until the new menu appears.
Or press Win + C (better way)!!


 Click Setting

 Now click Power button to access Shutdown