Archive

Archive for January, 2009

How to put a carriage return in with Find-Replace Dialog?

January 16, 2009 Imran Akram Leave a comment

Today we had a funny situation, my friend generated some sql from his custom code and it needed to have a ‘Go’ statement in between,, because it had create procedure statements in it. So after a bit of googling, I found out that you can use Microsoft Word for it and use the ^p character in the Find-replace dialog to convert some text like we did. Find Create Replace with” Go ^p Create

hope some of you might find it useful someday!

How to get the name and definition of all Stored Procedures in a Database?

January 16, 2009 Imran Akram Leave a comment

Today I wanted to get the script of all the Stored procedures in a database. I used this query to do so. Pretty much self explanatory is this, isn’t it?

Use [myDatabaseName]

SELECT ROUTINE_NAME, ROUTINE_DEFINITION
FROM INFORMATION_SCHEMA.ROUTINES
WHERE ROUTINE_TYPE=’PROCEDURE’

How to remove ReadOnly Attribute from a file?

January 15, 2009 Imran Akram Leave a comment

Hello friends,

Here’s a nice little piece of code you can use to change file attributes of a particular file, its particularly useful when you’re trying to delete a read only file.

string savedCardFilePath = “My absolute file path”;

if (File.Exists(savedCardFilePath))
{
/*
* Remove readonly attribute off of the file if it exists before execution
*
**/
if(File.GetAttributes(savedCardFilePath) == FileAttributes.ReadOnly)
File.SetAttributes(savedCardFilePath, FileAttributes.Normal);
File.Delete(savedCardFilePath);
}

TinyMCE not working on IE 7

January 1, 2009 Imran Akram Leave a comment

Happy new year folks,  09′ started off for me with a very strange bug. I was working on a form and decided to use TinyMCE in it for multi-line text editing and it was working A-OK in FF3, Chrome and Safari but not on IE 7. God that was a real pain in the butt going through all the javascript and I had absolutely no idea what was happening. It turned out that I had

<script language=”javascript” type=”text/javascript” src=”../tinymce/jscripts/tiny_mce/tiny_mce.js”></script>

this line in both master page and content page. I removed one of them and walla! it started working.

I hope some of you folks might find this post useful some day!

Cheers.