|
Ashwani_kumar wrote: But what is the practical use of Reflection.
There are many uses of reflection.
NUnit uses reflection to work out what unit tests to run, and also how to interpret some of the results (for example, you can attribute a test with [ExpectesException()] which is also finds through reflection)
Serializing and Deserializing classes uses reflection to build or extract information from the XML file.
DotNetNuke uses reflection to take information from the database and populate the business objects. A more powerful example of the same idea is NHibernate.
Reflection is useful in factory patterns in order to instantiate the correct class.
The list goes on and on and on.
ColinMackay.net
"Man who stand on hill with mouth open will wait long time for roast duck to drop in." -- Confucius
"If a man empties his purse into his head, no man can take it away from him, for an investment in knowledge pays the best interest." -- Joseph E. O'Donnell
|
|
|
|
|
Hi all,
I was wondering if its possible to share the same code over multiple sub domains?
Basically what I want to do is to offer rebranded subdomains with a seperate css and home page, but running off the same code base and DB. So each subdomain would have its own default.aspx & css files, but everything else would be running off common code. Would this be possible?
Thanks in advance for any tips!
Dave
|
|
|
|
|
Perhaps if you set up an application with subfolders containing the pages for the subdomains, and for each subdomain set up a web without an application. I haven't tried this, so I don't know if it would work at all.
---
b { font-weight: normal; }
|
|
|
|
|
Hi, I have started using Background Worker Component of C# 2005 Express and I am enjoying it. I thought I dont need to learn MultiThreding Theorys as I am comfortable to use it. But I was wondering, If I command to background worker, they cant do their task at the same time. The first one finishes its task and then 2nd one starts. So, I am thinking, was it supposed to be like that or I am missing something in my code.
Cant I do 2 simultaneous work at the same time with background worker ?
Thanks
Emran
-- modified at 23:24 Saturday 4th February, 2006
|
|
|
|
|
Each BackgroundWorker component executes an operation on a separate thread, so AFAIK calling the components' RunWorkerAsync() methods should create 2 parallel threads.
/ravi
My new year's resolution: 2048 x 1536
Home | Music | Articles | Freeware | Trips
ravib(at)ravib(dot)com
|
|
|
|
|
Hi,
thanks for reply.
Ok, then What is the difference between regular multithreaded programming and using Background worker ! Is the background worker is direct replacement of using thread coding !!
|
|
|
|
|
Yeah, it's a more convenient way to do things asynchronously.
Regards
Senthil
_____________________________
My Blog | My Articles | WinMacro
|
|
|
|
|
emran834 wrote: Is the background worker is direct replacement of using thread coding
Yes. As S. Senthil Kumar said, it's a more convenient way of writing code to perform a task in a separate thread. Among other things, BackgroundWorker provides a convenient interface for receiving progress notifications and cancelling the task.
/ravi
My new year's resolution: 2048 x 1536
Home | Music | Articles | Freeware | Trips
ravib(at)ravib(dot)com
|
|
|
|
|
I am writing a program that backups files/directories to a specified destination directory. To make the program a little more useful I would like to have it backup the files automatically at a certain time during the day. The only way of doing this that I can think of is using a timer that runs in the background, but I am assuming there is a more efficient approach
Any help is appreciated.
|
|
|
|
|
Sean, your approach of using a timer seems like a sound one. However, be aware that there are three types of timers in the FCL. See this[^] MSDN article for a nice explanation.
/ravi
My new year's resolution: 2048 x 1536
Home | Music | Articles | Freeware | Trips
ravib(at)ravib(dot)com
|
|
|
|
|
OK i'll check it out thanks.
|
|
|
|
|
You may also consider supporting command line arguments in your backup program.
This way different backups could be launched via batch file or by using Windows Scheduler.
Just remember that when using the scheduler under WinXP, you specify the User whos credentials are used to run the task and that account MUST have a password set.
Hope this helps.
Regards
Wayne Phipps
____________
Time is the greatest teacher... unfortunately, it kills all of its students
View my Blog
|
|
|
|
|
Thanks to both of you.
I eventually found an article right here at the code project on timers that has just what I am looking for.
Thanks again,
Sean
|
|
|
|
|
Hi,
I am getting an error in SQL UPDATE statement when user enters single quote character in textbox.
I used following regex to remove the single quote before submitting to SQL UPDATE Statement.
But still SQL is catching that single quote everytime even after filtering from regex. Very wondering. Can you tell me why is this happening !!
string question = rtxtInterViewQuestionSTAR.Text.Replace("\'", "").Trim();
string question = Regex.Replace(question, "\'", "", RegexOptions.Singleline | RegexOptions.Multiline).Trim();
UpdateCommand.CommandText = @"UPDATE star_interview_qa SET question ='" + question + "', strategy = '" + strategy + "', situation_task = '" + situation + "', action = '" + action + "', result = '" + result + "', sequence_no = " + sequence_noTextBoxSTAR.Text + " WHERE (id=" + lblIDqASTAR.Text + ")";
thanks and regards
EMRAN
|
|
|
|
|
emran834 wrote: I am getting an error in SQL UPDATE statement when user enters single quote character in textbox
This is a symptom of code that is highly susceptable to a SQL Injection Attack. A way that a malicious user could attack your database through the application. You may want to read SQL Injection Attacks and Tips on How to Prevent Them[^]
The above article will explain why this happens, and how to fix it and improve the security of your application's database access.
ColinMackay.net
"Man who stand on hill with mouth open will wait long time for roast duck to drop in." -- Confucius
"If a man empties his purse into his head, no man can take it away from him, for an investment in knowledge pays the best interest." -- Joseph E. O'Donnell
|
|
|
|
|
Hi, thanks , I found the error and solved it.
|
|
|
|
|
Fixing that error might solve your immediate problem, but leaves your code susceptible to SQL injection attacks. Do have a look at Colin's article (link in the post above).
Regards
Senthil
_____________________________
My Blog | My Articles | WinMacro
|
|
|
|
|
Hi Senthil ,
Thanks for your reply.
I am developing C# for desktop small scale user application, so I thought, user could hack his own database, as long as it is not in a Server.
By the way, I read your reply about Background Worker. you said it is great to work asynchronusly ... But cant i work Synchronusly with Background worker ?
thanks
Emran
|
|
|
|
|
emran834 wrote: user could hack his own database, as long as it is not in a Server.
Well, I would say that regardless of how the database is being used it is good to get in to the habit of coding in the way the article describes because it is then one less thing to worry about.
Also, the database may not necessarily be running in the same user account as the application. This could lead to an elevation of privilage attack via the application's use of the database. Many databases allow some sort of access to the underlying operating system and although this can be restricted by the database administrator it often isn't, or the application logs on with all the privileges of the database administrator which mean that it is still possible to mount an elevation of privilege attack through a SQL Injection attack.
In short, it is always best to defend your systems as much as possible because neither you nor I can forsee the uses that someone will put the application. What you feel is not a security issue maybe the tinyiest little gap in security that an attacker needs to widen the hole to let them have access to more and more of the system.
ColinMackay.net
"Man who stand on hill with mouth open will wait long time for roast duck to drop in." -- Confucius
"If a man empties his purse into his head, no man can take it away from him, for an investment in knowledge pays the best interest." -- Joseph E. O'Donnell
|
|
|
|
|
emran834 wrote: By the way, I read your reply about Background Worker. you said it is great to work asynchronusly ... But cant i work Synchronusly with Background worker ?
Huh? Why would you need a component to run code synchronously?
Regards
Senthil
_____________________________
My Blog | My Articles | WinMacro
|
|
|
|
|
Hi, I think i am little bit confused with the word meaning of Synchronus and Asynchronus. To my thinking, Synchronus means At the same time the thread will be running without wiating for any other thread to complete theri task. And Asynchronus means The thread will wait for other threads to complete their task.
Am i right ?
|
|
|
|
|
Sorry. You got it backward.
Synchronous means the first one talks, and the second one waits for it's turn. Then the second one talks, and the first one waits. They are synchronized.
Asynchronous means they are not synchonized. Either side could be talking at any time.
Roy.
|
|
|
|
|
Excellent !! thats what I wanted
|
|
|
|
|
I think that You'd better use parameters.
|
|
|
|
|
Hi, Even after using parameter i could not remove the error, but I found some place of my code where i needed to use REPLACE ' but i did not. Now its ok. Thanks
|
|
|
|