Wednesday, January 28, 2015

Javascript inside C#

https://jint.codeplex.com/ - Jint - Javascript Interpreter for .NET

Tuesday, January 27, 2015

Looking for Route message paramters : found List of InputParameters and OutputParameters for CRM 2011

following the artice by CRM2011 Plugin InputParameter and OutputParameter Helper by Michel Palmer.
The lists does not show output parameters for Route Message.
This did not help much so I added code to my plugin to list the parameters for Route Message.

Monday, January 26, 2015

Convert DocX or Doc to PDF

Using FixIT : Link to an interesting blog entry by Anon(?)
http://wpf4developers.blogspot.de/2014/05/c-convert-docx-to-pdf-document.html


using Word : an Asnwer by Demir. Because of licensing, if you do it in real time, Microsoft demands licensing office for all users in the network !!!!
http://stackoverflow.com/questions/19560170/how-to-convert-docx-to-pdf-in-c-sharp
This should be done in a background process.


Another answer using Word Automation :
http://stackoverflow.com/questions/5431580/convert-html-to-docx-in-c-sharp

Saturday, November 29, 2014

Some JQuery Plugins

JQUERY.PANELSNAPAPUERY.PANELSNAP : Panels that appear on scoll, inluding a side menu

- http://www.jqueryscript.net/demo/jQuery-Plugin-For-Smooth-Scroll-Snapping-panelSnap/demos/


Can be used for Kanban!!!!

JQuery Sidebar - Comes from any side of the screen, can be used for secondary menu or for special options to an experienced user, like shortcuts.


JQuery Plugin for FullPage site, can be used for Presentations. Respond to mouse scroll.
Does not respond to touch events,( yet)

Saturday, November 22, 2014

SharePoint 2013 and Office Web App


Steve Mann installing the OWA server and connecting to SP2013 : http://technet.microsoft.com/en-us/library/ff431687(v=office.15).aspx
Microsoft Tech on installation, configuration and Installation : http://technet.microsoft.com/en-us/library/ff431687(v=office.15).aspx

Angular JS Partial Dynamics Loading Links

Question in a StackOverlow with examples : http://stackoverflow.com/questions/23770096/how-to-easily-render-partial-html-from-a-string-in-angular-js
Fiddler with the example for the solution above, partial loading example with timers : http://jsfiddle.net/8Bf8m/29/

Controller and Controller loading Documentation:
https://docs.angularjs.org/guide/controller

Creating a Visualization App Using the Google Charts API and AngularJS, at SitePoint:

Monday, September 29, 2014

Restoring CRM DB from SQL Server Enterprise edition to SQL Server Standard Edition resulted in Error : contains a partition function 'AuditPFN'

When moving a database from a development environment to a production Environment, We backed up the database and restored it on the production database server which is a Sql Server Standard Edition.

I Got an error when restoring CRM 2013 Database Backup saying the AuditPFN is used in the database and it needs to be removed when using a standard edition server.


The AuditPFN means that a table can be spanned over multiple partitions, something that the Enterprise edition can do and the standard edition can not.  

I hope there will not be any more surprises like this. I must say I was surprised to see the speed of moving the backup file which was some 10's of GB over the network, so doing multiple attempts was not a scary scenario.

the Error Message : 

TITLE: Microsoft SQL Server Management Studio
------------------------------

Restore of database 'AAAAA_MSCRM' failed. (Microsoft.SqlServer.Management.RelationalEngineTasks)

------------------------------
ADDITIONAL INFORMATION:

An exception occurred while executing a Transact-SQL statement or batch. (Microsoft.SqlServer.SmoExtended)

------------------------------

Database 'AAAAA_MSCRM' cannot be started in this edition of SQL Server because it contains a partition function 'AuditPFN'. Only Enterprise edition of SQL Server supports partitioning.
Database 'AAAAA_MSCRM' cannot be started because some of the database functionality is not available in the current edition of SQL Server. (Microsoft SQL Server, Error: 905....


OK, I search the internet and found thess posts:




The MS KB is a global solution but ALTAI just checked the database and found that the AuditPFN is used in just one table so they checked the installation  of CRM on a Standard Edition server. They built the script for that table and view, dropped them on the standard server and re created the table on the enterprise edition. After that, their processed continued.

I am working on a CRM 2013 version, so I will try the ALTAI route first. I will have a CRM database in standard edition to compare the databases.

What I did:
I backed up the database and restored to a new Database.
I started with the check written by ALTAI to find the tables with partitioning option. It was just AuditBase.
Then I reverse engineered all the indexes and constrains, the table and the view, and then removed the AuditPFN options.

Afterwards I re-inserted all the records from the original database after checking there was no change.

The scripts I built is this:

USE [Organization_Backup]
GO

/****** Object:  Table [dbo].[AuditBase]    Script Date: 09/30/2014 03:48:44 ******/
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER ON
GO

CREATE TABLE [dbo].[AuditBase](
[AttributeMask] [nvarchar](max) NULL,
[TransactionId] [uniqueidentifier] NOT NULL,
[Action] [int] NULL,
[ObjectId] [uniqueidentifier] NOT NULL,
[ObjectIdName] [nvarchar](1) NULL,
[UserId] [uniqueidentifier] NOT NULL,
[ChangeData] [nvarchar](max) NULL,
[CreatedOn] [datetime] NOT NULL,
[Operation] [int] NOT NULL,
[AuditId] [uniqueidentifier] NOT NULL,
[CallingUserId] [uniqueidentifier] NULL,
[ObjectTypeCode] [int] NULL
)

GO

ALTER TABLE [dbo].[AuditBase] ADD  DEFAULT (newsequentialid()) FOR [AuditId]
GO

GO

/****** Object:  Index [cndx_PrimaryKey_Audit]    Script Date: 09/30/2014 03:49:12 ******/
CREATE UNIQUE CLUSTERED INDEX [cndx_PrimaryKey_Audit] ON [dbo].[AuditBase] 
(
[CreatedOn] DESC,
[AuditId] DESC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, SORT_IN_TEMPDB = OFF, IGNORE_DUP_KEY = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON)
GO


/****** Object:  Index [fndx_ObjectTypeCode]    Script Date: 09/30/2014 03:51:23 ******/
CREATE NONCLUSTERED INDEX [fndx_ObjectTypeCode] ON [dbo].[AuditBase] 
(
[ObjectTypeCode] ASC
)
WHERE ([ObjectTypeCode] IS NOT NULL)
WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, SORT_IN_TEMPDB = OFF, IGNORE_DUP_KEY = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON)
GO



/****** Object:  Index [ndx_ObjectId]    Script Date: 09/30/2014 03:51:40 ******/
CREATE NONCLUSTERED INDEX [ndx_ObjectId] ON [dbo].[AuditBase] 
(
[ObjectId] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, SORT_IN_TEMPDB = OFF, IGNORE_DUP_KEY = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON)
GO



/****** Object:  Index [ndx_PrimaryKey_Audit]    Script Date: 09/30/2014 03:51:54 ******/
CREATE NONCLUSTERED INDEX [ndx_PrimaryKey_Audit] ON [dbo].[AuditBase] 
(
[AuditId] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, SORT_IN_TEMPDB = OFF, IGNORE_DUP_KEY = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON)
GO



/****** Object:  Index [ndx_PrimaryKey_Audit_Primary]    Script Date: 09/30/2014 03:52:19 ******/
CREATE UNIQUE NONCLUSTERED INDEX [ndx_PrimaryKey_Audit_Primary] ON [dbo].[AuditBase] 
(
[CreatedOn] DESC,
[AuditId] DESC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, SORT_IN_TEMPDB = OFF, IGNORE_DUP_KEY = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
GO



/****** Object:  Index [ndx_UserId]    Script Date: 09/30/2014 03:52:33 ******/
CREATE NONCLUSTERED INDEX [ndx_UserId] ON [dbo].[AuditBase] 
(
[UserId] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, SORT_IN_TEMPDB = OFF, IGNORE_DUP_KEY = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON)
GO













GO




--
-- base view for Audit
--
create view [dbo].[Audit]
 (
    -- logical attributes
    [UserIdName],
    [CallingUserIdName],

    -- physical attributes
    [AttributeMask],
    [TransactionId],
    [Action],
    [ObjectId],
    [UserId],
    [ChangeData],
    [CreatedOn],
    [Operation],
    [AuditId],
    [CallingUserId],
    [ObjectTypeCode],
    [ObjectIdName]
) with view_metadata as
select
    -- logical attributes
    [lk_audit_userid].[FullName],
    [lk_audit_callinguserid].[FullName],

    -- physical attribute
    [AuditBase].[AttributeMask],
    [AuditBase].[TransactionId],
    [AuditBase].[Action],
    [AuditBase].[ObjectId],
    [AuditBase].[UserId],
    [AuditBase].[ChangeData],
    [AuditBase].[CreatedOn],
    [AuditBase].[Operation],
    [AuditBase].[AuditId],
    [AuditBase].[CallingUserId],
    [AuditBase].[ObjectTypeCode],
    [AuditBase].[ObjectIdName]
from [AuditBase] 
    left join [SystemUserBase] [lk_audit_callinguserid] with(nolock) on ([AuditBase].[CallingUserId] = [lk_audit_callinguserid].[SystemUserId])
    left join [SystemUserBase] [lk_audit_userid] with(nolock) on ([AuditBase].[UserId] = [lk_audit_userid].[SystemUserId])

GO


GO

/****** Object: PartitionScheme [AuditPScheme] Script Date: 02/17/2011 12:59:16 ******/

DROP PARTITION SCHEME [AuditPScheme]

GO

DROP PARTITION FUNCTION AuditPFN;

GO