|
What I came up with as a simple interim solution is this:
private sealed class MyComparer : System.Collections.Generic.IComparer<string>
{
public int
Compare
(
string Op0
,
string Op1
)
{
int result = System.StringComparer.InvariantCultureIgnoreCase.Compare ( Op0 , Op1 ) ;
if ( result == 0 )
{
result = System.StringComparer.InvariantCulture.Compare ( Op0 , Op1 ) * -1 ;
}
return ( result ) ;
}
}
|
|
|
|
|
<?xml version="1.0" encoding="utf-8"?>
<LicenceManager xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://visionontech.com/vbp/LicenceConfiguration">
<ApplicationName>ovE1c/0l6IoKP/KF6bpqv22zqoYuT3Wv</ApplicationName>
<LicenseType>7Ax330npgHE=</LicenseType>
<VersionType>bbUl/DISjDzJkqERNmGqY8eWlTKz+Er3qSWdcEGFDUdsWo9DJrviULY/entknwWw2Z67rm0RnqeB3ENiAa1blfEkGPtfeELVxVG44JG4J5w=</VersionType>
<CompanyName>KWZwGJLdl+pI240K/PURWg==</CompanyName>
<SerialNumber>7515b594-6afb-4f0f-bf4c-13351339191c</SerialNumber>
<MachineID>I50NMYu1RZix+7AuMOhIDyhyFkiepjdK1Sy93luDdi4nCxRLW+Yy259FgXAvKvX9</MachineID>
<Signature>9XvKvAXgF952yY+WLRxCn4idDul39yS1KdjpeikFyhyDIhOMuA7+xiZR1uYMN05I</Signature>
<City>Q6H8NNOnO80=</City>
<CreatedBy>TZdhgIlUIBo2BIm8yvL3ww==</CreatedBy>
<LicenseCreationDate>1xtf7PZmvZQ5e+ohObsHFHokaELQyvIq</LicenseCreationDate>
</LicenceManager>
my laptop licence is
i m using other computer d'not work plz help me brack my code
|
|
|
|
|
Hi,
I have WindowsForms application where I should execute method n-times in a second. The method should be executed inside of its own separate thread. I use thread pool for that purpose.
UI contains text box where I enter the number of times of execution and button, which I click to start processing.
I've tried to use System.Windows.Forms.Timer but it works for smaller number of executions (~ up to 100). It works means for example 50 calls can be done in 1 second. When the number of calls is growing they can't be executed in 1 second. They need more and more time.
The code looks as follows:
private int count = 0;
private int tps;
public Form1()
{
InitializeComponent();
ThreadPool.SetMaxThreads(500, 500);
}
private void button1_Click(object sender, EventArgs e)
{
listBox1.Items.Clear();
timer1.Enabled = true;
tps = Int32.Parse(textBox1.Text);
timer1.Interval = 1000 / tps;
timer1.Start();
label1.Text = "Start time: " + DateTime.Now.ToString("hh:mm:ss.fff");
label2.Text = "End time: ";
}
private void timer1_Tick(object sender, EventArgs e)
{
ThreadPool.QueueUserWorkItem(new WaitCallback(DoWork));
}
private void DoWork(object stateInfo)
{
count++;
listBox1.Items.Add(count);
if (count == tps)
{
count = 0;
timer1.Stop();
label2.Text = label2.Text + " " + DateTime.Now.ToString("hh:mm:ss.fff");
timer1.Enabled = false;
}
label3.Text = listBox1.Items.Count.ToString();
}
Do you have an idea how I can resolve this issue?
Thank you in advance.
Regards,
Goran
|
|
|
|
|
Try System.Timers.Timer[^] which is more accurate than its forms counterpart.
"Don't confuse experts with facts" - Eric_V
|
|
|
|
|
Thanks for your answer.
I've tried to use System.Timers.Timer and the results a bit better. But, there's one thing I've noticed. Sometimes, the number of items I've added to listbox is greater than number I've entered to text box. For example, when I enter 11 to text box, the number of items in list box is 12. The order is as follows: 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 1. I don't understand why 1 again?
|
|
|
|
|
The bad news is that you can't resolve this issue. If you think about it for a little bit, you'll see why. Here's a hint - you need to execute a task several number of times a second and those tasks take a finite amount of time; creating the threads (or switching to them in a threadpool) also takes a period of time - even if you are running on a multi-core machine, there are only a set number of tasks that can be spawned and run in that period of time.
By the way, you have a marshalling issue in your code (you may be suppressing it, but it still takes time). Basically, you are interacting with a UI component from a none-UI thread. WinForms is STA, so you should be marshalling the calls back to the UI thread.
|
|
|
|
|
Thanks for the answer.
Yes. I supposed this couldn't be resolved to be absolutely accurate. But what to do? I need to write the application that should load test WCF RIA service and the results should be confidential.
|
|
|
|
|
If you are load testing an application, you need to take a different approach. You should be attempting to target it from multiple machines.
|
|
|
|
|
Some comments:
1. this article may enlighten you on some timer characteristics: Timer surprises, and how to avoid them[^]
2. this one could help you in solving cross-thread problems: http://www.perceler.com/articles1.php?art=crossthreads1[^]
3. ThreadPools have their own algorithm for launching and creating threads; e.g. launching ten jobs at pretty much the same time would not necessarily cause ten threads to be used, and that is why it's method is called QueueUserWorkItem , rather than ExecuteNow . Last time I checked, the ThreadPool, when sufficient work has been queued, would launch new threads at a pace of 2 per second.
4. Load testing a component may not be handled best with equidistant requests; I would consider using a fixed number of real threads (not pooled ones), and give each the job to wait a random time, then issue a request, in a loop-forever style. That way you can simulate an average load of your choice with arbitrary phase between the requests. Furthermore I agree with Pete, when he says having more machines to realistically simulate load would be better.
|
|
|
|
|
|
Hi Everyone,
Please I need help with an online Travel Guide Project that I've been unsuccessful at. Its a .NET Project but can be coded with c# so I don't know if this Forum is the right place to post this. Please any help whatsoever would be greatly appreciated. Thanks in advance
|
|
|
|
|
If this is a homework assignment. We don't do homework for you.
If this is a work project. We don't do your work for you.
If you have tried something on your own and are stuck and in need of assistance then post what you have tried and what problem you are having.
I know the language. I've read a book. - _Madmatt
|
|
|
|
|
Go here [^]
".45 ACP - because shooting twice is just silly" - JSOP, 2010 ----- You can never have too much ammo - unless you're swimming, or on fire. - JSOP, 2010 ----- "Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass." - Dale Earnhardt, 1997
|
|
|
|
|
What kind of help do you need? If you are running into any specific issues with the code, then post only those specific questions here.
Someone may be able to help you.
Too much of heaven can bring you underground
Heaven can always turn around
Too much of heaven, our life is all hell bound
Heaven, the kill that makes no sound
|
|
|
|
|
Hi,
I'm trying do write a backup program in VB .NET. It needs to avoid backing up files that have already been backed up and so it compares the last write times of the source and backup files. If they are the same, the backup for the file is not performed.
If both the source file the backup file are on the local hard drive, the comparisons work correctly.
If both the source file the backup file are on a Network Attached Storage drive, the comparisons work correctly.
But if the source file is on the local hard drive and the backup file is on the Network Attached Storage drive, the comparison always says the they are different no matter what.
Code: (I'm using the CompareTo method.)
Dim SourceHasLaterDate As Int16 = SourceWriteTime.CompareTo(BackupWriteTime)
Is there any way I can get an accurate result for the third condition?
Thanks,
Mike
PS: I'm modifying the backup program written by Taner Riffit.
|
|
|
|
|
there are a couple of reasons why two DateTimes that should be equal actually can be different, here are the most important ones:
- some file systems only have a resolution of 2 seconds (long ago the date was stored in 16-bit, and the time in another 16-bit number (5-bit for the hour, 6-bit for the minutes, and 5 rather than 6 for the seconds).
- some file systems have a different way of dealing with daylight savings time (should the correction be applied dynamically, or should the corrected time be stored in the directory information?).
When I created my backup/synchronize utility years ago, I ended up comparing DateTimes with a tolerance: any pair of DateTime values that differed by -1, 0 or 1 hour give or take -2 to +2 seconds, I consider identical. And yes, that could lead to false identicals, but since I also compare file size and file name, chances are slim.
|
|
|
|
|
When I compensate for the differences in the storage devices by converting the last write date/time results to concatenated strings containing Year, Month, Day, Hour, and Second, the comparison works properly. With this approach I'm assuming that going to the second is accurate enough. You may want to use the same approach with yours.
Thanks for the explanation.
Here is my code:
Dim SourceWriteTime As DateTime = CDate(File.GetLastWriteTimeUtc(SourceFileName))
With SourceWriteTime
Test1 = .Year & "/" & .Month & "/" & .Day & "/" & .Hour & "/" & .Minute & "/" & .Second
End With
Dim BackupWriteTime As DateTime = CDate(File.GetLastWriteTimeUtc(BackupFileName))
With BackupWriteTime
Test2 = .Year & "/" & .Month & "/" & .Day & "/" & .Hour & "/" & .Minute & "/" & .Second
End With
Dim SourceHasLaterDate As Int16 = Test1.CompareTo(Test2)
If the SourceHasLaterDate > zero, I backup the file.
|
|
|
|
|
|
|
Thanks! I will move this post there.
|
|
|
|
|
Hiiiiiiii to all
Dear sir
any one can give link where to get about THREE TIER project in ASP.NET WEBSERVICES good tutorial and and also download small project THREE TIER programming in ASP.NET WEBSERVICES asap
rizvan sivally
|
|
|
|
|
- Don't repost your question in multiple places, found other one in ASP.NET forum[^]
sheemap wrote: Hiiiiiiii Can you please lift your cup from your keyboard, Why too much i there?
sheemap wrote: asap Don't use text like very urgent in your post. Questions in this site are answered by volunteers. Surely you can have answers so please wait for the responses.
sheemap wrote: any one can give link where to get about THREE TIER project in ASP.NET WEBSERVICES good tutorial Have you tried in web search?
sheemap wrote: also download small project THREE TIER programming in ASP.NET WEBSERVICES Read the previous point.
- For your information How to get an answer to your question[^]
thatraja
My Tip/Tricks My Dad had a Heart Attack on this day so don't...
All these are my opinions. Different people. different way of thinking. I am no one to judge others - Chandru
|
|
|
|
|
If Google is broken try bing
I know the language. I've read a book. - _Madmatt
|
|
|
|
|
Where can I find an exaustive guide or a well done tutorial, with/or commented examples about DATAREPEATER Control, distibuted together with Visual Basic Power Pack?
Thanks.
|
|
|
|
|
Have you tried Googling for "DataRepeater tutorial"?
|
|
|
|