Compilier directive attributes.
Add the attribute [MethodImplAttribute(MethodImplOptions.NoInlining)] to a c# method to stop the compiler inlining it.
A collection of useful bits of code, advice and informative advice
Add the attribute [MethodImplAttribute(MethodImplOptions.NoInlining)] to a c# method to stop the compiler inlining it.
To create an Event for a Asp.Net Page or Control you need the following elements:
1. The event object
private static readonly object EventFoo = new object();
2. The EventHandler (that you will add delegates to)
[Description(""), Category("Action")]
public event EventHandler Foo
{
add
{
base.Events.AddHandler (FooPage.EventFoo, value);
}
remove
{
base.Events.RemoveHandler (FooPage.EventFoo, value);
}
}
3. OnFoo is the method that will be invoked whenever the event is to be fired.
protected virtual void OnFoo (EventArgs e)
{
if (this.Events != null)
{
EventHandler handler = (EventHandler) Events[FooPage.EventFoo];
if (handler != null)
{
handler(this, e);
}
}
}
Now you can add handlers to Foo as you would with any other Event (for example Page_Load)
Spotted on the Slashdot blog
Slashdot | Could Microsoft Buy Red Hat?: "Re:GPL? (Score:5, Funny)
by Anonymous Coward on Monday May 16, @02:37PM (#12545816)
If Microsoft bought Red Hat, wouldn't this mean that Microsoft would be under the GPL when it comes to releasing software?
I'm glad you asked that, because I collect stupid questions and I hadn't seen that one before.
A common question is how to force background colors to show when printing web sites. Normally the answer is; you can't but by using an IE filter such as the following the desired effect can be reached:
Some things to remember:
Here's a nice script that a colleague found takes the grunt work out of transfering data from one database to another. After running this (and changing the SourceDatabase and TargetDatabase variables) you'll get a set of insert scripts that you can copy n' paste (with a little clean up if there were any schema changes between the two databases) and run on your server (at your own risk ;) ).
Certainly takes the grunt work out of migrating a database.
DECLARE @data_source varchar(8000)
DECLARE @data_target varchar(8000)
SELECT @data_source = 'SourceDataBase'
SELECT @data_target = 'TargetDataBase'
DECLARE @table_name varchar(8000)
DECLARE table_cursor CURSOR FOR
SELECT sysobjects.name FROM sysobjects WHERE sysobjects.xtype = 'U' AND sysobjects.name <> 'dtproperties'
OPEN table_cursor
FETCH NEXT FROM table_cursor INTO @table_name
WHILE @@FETCH_STATUS = 0
BEGIN
DECLARE @column_list varchar(8000)
SELECT @column_list = ''
DECLARE @column_identity bit
SELECT @column_identity = 0
DECLARE @column_name varchar(8000)
DECLARE @column_status tinyint
DECLARE column_cursor CURSOR FOR
SELECT syscolumns.name, syscolumns.status FROM sysobjects INNER JOIN syscolumns ON sysobjects.id = syscolumns.id WHERE sysobjects.xtype = 'U' AND sysobjects.name = @table_name
OPEN column_cursor
FETCH NEXT FROM column_cursor INTO @column_name, @column_status
WHILE @@FETCH_STATUS = 0
BEGIN
SELECT @column_list = (@column_list + '[' + @column_name + '], ')
IF ((@column_status & 128) = 128) SELECT @column_identity = 1
FETCH NEXT FROM column_cursor INTO @column_name, @column_status
END
CLOSE column_cursor
DEALLOCATE column_cursor
IF (@column_identity = 1) PRINT 'SET IDENTITY_INSERT ['+ @table_name + '] ON'
PRINT 'INSERT INTO [' + @data_target + ']..[' + @table_name + '] (' + LEFT(@column_list, LEN(@column_list) - 1) + ') SELECT ' + LEFT(@column_list, LEN(@column_list) - 1) + ' FROM [' + @data_source + ']..[' + @table_name + ']'
IF (@column_identity = 1) PRINT 'SET IDENTITY_INSERT ['+ @table_name + '] OFF'
FETCH NEXT FROM table_cursor INTO @table_name
END
CLOSE table_cursor
DEALLOCATE table_cursor
Interesting site on Visual Sourcesafe - hopefully will be useful to the 'Bugaloo' project. Korby Parnell's WebLog - Visual SourceSafe