Friday, February 09, 2007

SQL Server 2005: View all permissions

select dp.NAME AS principal_name, dp.type_desc AS principal_type_desc, o.NAME AS object_name,

p.permission_name, p.state_desc AS permission_state_desc

from sys.database_permissions p

left OUTER JOIN sys.all_objects o on p.major_id = o.OBJECT_ID

inner JOIN sys.database_principals dp

on p.grantee_principal_id = dp.principal_id


(found somewhere on web)

Thursday, February 08, 2007

ParameterizedThreadStart

ParameterizedThreadStart is to pass parameter to new starting Thread.

you can pass only one parameter of type object. the function definition should have one in param of type object.

Passing Parameter to Thread


In .NET 2.0, there is a new delegate, ParameterizedThreadStart, which takes
a parameter of type object. You can create a thread using an instance of
this delegate instead of just ThreadStart, and a new overload to Thread.Start
allows you to specify the value to be passed to the new thread. This is simple, but only accepts
a single parameter and isn't type-safe (just like the options when using thread pool threads).
The earlier code could then be rewritten as:



[In some method or other]

Thread t = new Thread (new ParameterizedThreadStart(FetchUrl));

t.Start (myUrl);



[And the actual method...]

static void FetchUrl(object url)

{

// use url here, probably casting it to a known type before use

}



http://www.yoda.arachsys.com/csharp/threads/parameters.shtml





powered by performancing firefox

BizTalk Macros or FILE adapter

%datetime%

%datetime_bts2000%

%datetime.tz%

%DestinationParty%

%DestinationPartyID%

%DestinationPartyQualifier%

%MessageID%

%SourceFileName%

%SourceParty%

%SourcePartyID%

%SourcePartyQualifier%

%time%

%time.tz%



http://geekswithblogs.net/benny/archive/2006/12/24/101980.aspx





powered by performancing firefox

Friday, February 02, 2007

update WSS 3.0 List through Email



http://www.wssdemo.com/Pages/Email.aspx



Thursday, February 01, 2007

Debugging Windows Service

#if (DEBUG)

Service service = new Service();

service.Start(); //define a public method: public void Start(){OnStart(null);}
System.Threading.Thread.Sleep(System.Threading.Timeout.Infinite);

#endif

Deserialize to Object from XML Config File in .NET 2.0

static EventLogConfig GetEventLogConfig {

get {

XmlSerializer mySerializer = new XmlSerializer(typeof(EventLogConfig));

XmlNodeReader reader = new XmlNodeReader(Settings.Default.EventLogConfig.DocumentElement);



return (EventLogConfig) mySerializer.Deserialize(reader);



}

}






powered by performancing firefox

Modify application settings in .NET 2.0

(Settings1.Settings) you can't change application settings in code. You can only change user
settings. To change the application settings, you need to write your
own code to open the configuration file as any xml file and modify it

http://blogs.msdn.com/mohamed_sharafs_blog/archive/2006/12/12/using-application-user-settings-in-c-2-0.aspx