Loosing can become a painful habit

I was just watching our(Sri Lankan) Cricket team under performing in back to back ODI's. It was really painful to watch. Cant believe this was the team went so close to win the World cup few months back. It was more painful to watch how Sanga, Mathews struggle to just hit the ball to a gap and grab a single. Just simply everything is wrong.

No big expectations guys just score more than 250 in next three matches that's enough.

Stored Procedures

I was surprised, however, when a Does Not Compete happened during an interview for a database developer position. My question was fairly straightforward: tell me about your experience with stored procedures.

“I’m very familiar actually,” the candidate answered, “I’m currently working at Home Depot because I’ve had a hard time finding developer work, and everything there has a procedure, and there are so many forms to fill out. If you want to use the forklift to help a customer, you have to get it approved by your supervisor.”

I wasn’t sure how to respond, and that was OK. He just kept going, and going and going, describing in painful detail what his day-to-day duties were. Finally, he finished with “and that’s my experience with Store Procedure.”

The interview didn’t go very far after that.


Microsoft Dynamics CRM 4 - How to change a custom attribute's datatype

Yesterday I was trying to import a customization from one CRM 4 environment to another. There I faced an issue with same attribute being duplicated in both environments with two different data types. Due to a still unknown technical issue we can not delete any attributes from these environments. So the only option for me was to change the data type of the attribute in one environment to equal the both the data types. As the CRM 4 does not allow to change custom attribute types from the interface I had to do this from the back end (database).

Below is the query I use to do this;

UPDATE attribute
attributetypeid = GUID of the data type
WHERE name = attributename

You can find the data type guid's from attributetypes table.

PS : You will also have to change the datatype of the perticular column in the perticular table manually.

How to make your PDF files speak in Acrobat Reader

If you ever wondered how to make your PDF files speak, there is a very simple way of doing this. This has been there since the version 6.0 of Acrobat Reader.

First you have to press "Shift + Ctrl + V", this will enable Read Out Loud function in acrobat reader. Now you will see Read Out Loud menu item under View menu. In this you can select the reading options, alternativly you can start/stop reading using following key combination;

Shift + Ctrl + B- Read the whole document
Shift + Ctrl + V - Read the current page only
Shift + Ctrl + C- Pause
Shift + Ctrl + E- Stop

The voice will be your choosen voice in the text to speach section in the control panel. You can download alternative voices from here for free .

This is really cool and  a very helpful feature.


MS CRM 4 Form Printing - "This form has been changed and must be saved before printing"

I have come across an issue with Printing a CRM 4 form today. The messege "This form has been changed and must be saved before printing" appeared when I tried to print a form even though the form data is already saved.
After digging into the problem I found that this perticular form had two custom controls (textbox and a command button), because of this CRM was assuming this form has unsaved (isdirty true) data.
There is a workaround to solve this issue by changing the printing javascript in the main form script file.
First you have to log in to the CRM applicaiton server and go to the following location;
In this location you can find a file named "form.crm.htc". Open this file and find the print function which should look like this;

function Print()
if (isDirty())
var sId = _oSubmitForm.crmFormSubmitId.value;
openStdWin(prependOrgName("/_forms/print/print.aspx?objectType=" + _oSubmitForm.crmFormSubmitObjectType.value + "&id=" + sId + "&title=" + CrmEncodeDecode.CrmUrlEncode(parent.document.title)), "print" + buildWinName(sId));

You can edit the above function to skip the isdirty check for the perticular entity which has custom controls. This will bypass the above mentioned messege and will go directly to printing. Change would be to the if condition for isdirty checking which should be the following;

if (isDirty() && _oSubmitForm.crmFormSubmitObjectType.value != 112)

112 is the objecttypecode for Case, you can change this to your disered entities objecttypecode. Hope this will help you, please drop a comment if you have any issues.


Happy New Year 2010!

TSQL – Retrieve only numbers in a string

With related to my earlier post which demonstrated how to retrieve only numbers in a string using C#, this is how you can do it using TSQL in SQL Server. This will be also become handy if you want to do this in a backend process (SP, Trigger, etc). This is a UDF which you can reuse in your TSQL codes.

/****** Object:  UserDefinedFunction [dbo].[fn_filternumbers]    Script Date: 11/27/2009 17:59:56 ******/

ALTER FUNCTION [dbo].[fn_filternumbers]
@Src nvarchar(255)
RETURNS nvarchar(255)

declare @Res nvarchar(255)
declare @i int, @l int, @c char
select @i=1, @l=len(@Src)
SET @Res = ''
while @i<=@l
   set @c=upper(substring(@Src,@i,1))
    IF  @c IN ('0','1','2','3','4','5','6','7','8','9')
        SET @Res = @Res + @c
   set @i=@i+1


You can use this function in the following manner;

select  telephone, dbo.fn_filternumbers(telephone) from users

This will return telephone numbers by removing white spaces, characters and will only return numbers. (i.e +94 (475) 849 984 would return 94475849984)

Please feel free to drop a comment if you have any question on this.


Blog Directory - OnToplist.com