junwei's profileRichard's footprint on ....PhotosBlogListsMore ![]() | Help |
|
Richard's footprint on .NETSeptember 29 anoyed trojan virusanoyed trojan! I was surfing last night when my browser prompt me one window, immediately followed is something like voice broadcast began to anoy me. My ituite told me that it must be some kind virus. So I have to stop to scan the memory for virus, within several minites, some trojan was detected and was reported that it damaged my system file. Then I rebooted my computer and did full scan for the drive, checked security settings on my computer, the user account & group policy, the windows firewall, the shared resources, the security patches, after almost one hour's work, finally, the trojan was cleared completely.
But there is one thing that I confused, how I got my computer infected? I checked my browser history and found no clue. August 04 dev skill lesson plansC# dev skill lesson plans for the next 2 weeks.
1. anonymous method & delegate
2. LINQ
3. lamda expression
4. extension method
5. query expression
this time, focus on anonymous method & delegate.
delegate
1. delegate's signature consists of parameters and return type.
2. each method which matches delegate's signature can be assigned to the delegate.
3. covariance allows delegate defining a general return type and one method which has matched the signature and more derived return type can be assigned to it, yet contravariance allows defining a general parameter type when declaring delegate.
4.generic delegate can be used with typical design patterns
anonymous method
1. essentially a way pass code block as delegate parameter, reducing the unnecessary overhead. May 30 System.Threading.TimerIn one of our system, there is a task which demands to check the incoming mail task periodically and send it out if any. Since it is a sole task, no need to much communicated heavily between threads, just scan the database mail table to pull out these task and send. Compared the currently existing three different APIs in .NET, one is mainly for windows form application, one is for accurate and complex server multiplethread application, and the third one is the lightweight timer for simple thread task, it is System.Threading.Timer. I chose the last one as my solution. Here I put the presudo codes for further reference.
System.Threading.Timer timer = new System.Threading.Timer(new TimerCallback(WorkerClass.ExecuteMailTask));
timer.Change(1000,0); // specify start timer after 1 second
...
in my WorkerClass, I define one static method ExecuteMailTask to stop timer temporarily and execute the mail task. the following is the preseudo codes
ExecuteMailTask(object state)
{
Trace.WriteLine(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") +"mail monitor task is running on thread #"+Thread.CurrentThread.ManagedThreadId);
System.Threading.Timer t = (System.Threading.Timer)state; t.Change(Timeout.Infinite, Timeout.Infinite);// first stop the timer teporarily
... // necessary codes to pull out mail data
t.Change(0,20000); //restart the timer
}
I have omitted the exeption handling codes, in a product enviroment, wrap above codes in a try ...catch.. finally block will be an apropriate choice when robustness is considered.
April 08 FilegroupThe first edition of SQLServer I used is SQLServer 2000. Filegroup had existed at that time, but actually I don't start to explore this feature until these several days. Under default circumstance, the database engine would create one database data file and one log file both of which belong to the PRIMARY filegroup which is also the default filegroup if not specified. The main purpose of employing filegroup is to ease the burden of the database management typically including backup&restore activities. Filegroup usage with multiple disk drivers will gain performance improvement, for example, you have the sample table data spread accross three data file, A.ndf, B.ndf and C.ndf all of which reside in the same filegroup and have each of file reside on different disk driver. Then you will gain better I/O capacity and performance when the sample table data is accessed since the multiple disk heads will in paralle read these 3 drives. That's the reason behind the scene that employing filegroup improve performance.
Also you possibly use filegroup when do table partition during which you first create partition function to designate the partition range, then you create partition schema use the first steps' partition function and direct the database engine that data should go to different filegroups, thirdly you corelates the schema with the concreate table.
Go over the syntax for adding or modify filegroup(file)
use master;
go;
alter testdb;
add filegroup FG_1;
modify filegroup FG_1 default;
add file
(
name=Data1
filename=E:\demo\fg.ndf
size=10MB
maxsize=500MB
filegrowth=10MB
),
(
name=Data2
...
) to filegroup FG_1 March 24 positioned elementI am involved in the div+css layout design since it is so popular and is becoming standard for web front end UI design. Today I reread thru the 9th section of CSS2 on w3.org. this section is focus on the visual formatting model one of which is about positioned element typically about relative&absolute position. Here are several important statements excerpt from this section.
1. The containing block of one positioned box is established by the nearest positioned ancestor, or if none exists, the initial containing block.
so what's a positioned box? normally it is a block element like div with position css style attribute set to non static value. What's initial containing block? also in the above doc, it says the root of document tree generates the containing block, aka initial containing block.
2. In CSS2.1, a box may be laid out according three positioning schemes, normal flow, float and absolutely positioning. the relative positioning is included in the normal flow scheme, in the absolute positioning scheme, a box is removed from the normal flow entirely and assigned a position with respect to its containing block.
|
|
||||
|
|