|
Thanks, it's good to know about Stopwatch, but doesn't explain a 150% shift in performance. (If it changed from 2 to 3 milliseconds, I wouldn't bat an eye, I'd expect that with DateTime.)
This is interesting:
looped: 4294967295 in 00:00:01.0834284
System.Diagnostics.Stopwatch st = new System.Diagnostics.Stopwatch();
st.Start();
for (uint i = 0; i < x; i++) ;
st.Stop();
TimeSpan sp = new TimeSpan(st.ElapsedTicks);
Console.WriteLine("looped: {0} in {1}", x, sp);
Don't have StartNew on my 2010 express version and Start blows up with a void assignment to st.
Ran a stopwatch, got 5.93 seconds and I was slow on the trigger
DateTime tim = DateTime.Now;
System.Diagnostics.Stopwatch st = new System.Diagnostics.Stopwatch();
st.Start();
for (uint i = 0; i < x; i++) ;
st.Stop();
TimeSpan sp = new TimeSpan(DateTime.Now.Ticks - tim.Ticks);
Console.WriteLine("looped: {0} in {1}", x, sp);
sp = new TimeSpan(st.ElapsedTicks);
Console.WriteLine("looped: {0} in {1}", x, sp);
Produced:
looped: 4294967295 in 00:00:04.1742388
looped: 4294967295 in 00:00:00.8532933
So, DateTime came up with a time that theory expects for that loop and the stop watch came up with 5 times faster than theory expects and what I am seeing. Gee, which one do you think I should trust? One that is slightly faster than my physical reflexes and closely aligns with theory or one that defies theory and observed behavior?
I'm guessing the stopwatch was trying to share the same CPU that needed 100% attention on the code it was running and threw out the timer.
So, putting changes that if anything should slow down the code works 150% better today? I don't get it.
Arrrg, pull out the stopwatch code and:
looped: 4294967295 in 00:00:06.2273562
put it back in:
looped: 4294967295 in 00:00:04.1612380
looped: 4294967295 in 00:00:00.8508048
Comment out the start and stop and...
looped: 4294967295 in 00:00:04.1622381
|
|
|
|
|
Thanks for sharing your experiences. It is really nice to see how unreliable Windows is when you need a real-time experience.
|
|
|
|
|
Bernhard Hiller wrote: It is really nice to see how unreliable Windows is when you need a real-time
experience. Microsoft products are the core of this problem, but I wouldn't blame the OS, this is all CLR. It's interesting that seemingly unrelated changes cause performance to go in and out of the gutter.
What's ironic is that calling on Diagnostics should drag performance down because it's sort of like Heisenberg's principle, the act of observing can't be done without affecting what is being observed, but instead it brings performance up to where it should be by removing some change that shouldn't affect performance, yet does.
Too bad the tool is so unreliable that you can't depend on what it says. At least on my express version.
Wouldn't that be something if turning on diagnostics actually caused performance to go beyond the theoretical limit! Of course, then I would suspect it wasn't executing the loop at all.
|
|
|
|
|
|
Read Documentation???? What a novel idea
It's pretty obvious that the default thread affinity is to use the same processor the creation thread is using. Don't know how to get a list of processors or which one is being used by the main thread. DateTime seems to do very well at picking a thread that is idle to make its timing updates. So the recommended process produces wildly inaccurate results while the not recommended process seems to produce fairly accurate results. I'll stick with the not recommended process.
PS Thanks for the link to the online documentation.
|
|
|
|
|
I have a list of files that when someone launches the program it will get the "normal Files" and when someone does a Full Check, it will get the "Full Check Files".
[normalFiles]
element\userdata\systemsettings.ini
element\userdata\server\serverlist.txt
element\data\elements.data
element\data\gshop.data
element\data\gshop1.data
element\data\gshop2.data
element\elementskill.dll
element\configs.pck
element\monkeydynasty.exe
element\data\aipolicy.data
element\data\domain.data
element\data\domain1.data
element\data\domain2.data
element\data\domain3.data
element\data\domain4.data
element\data\dyn_tasks.data
element\data\dynamicobjects.data
element\data\forbidden_task.txt
element\data\hometowndata
element\data\path.data
element\data\task_npc.data
element\data\tasks.data
element\data\tasks.data1
element\data\tasks.data10
element\data\tasks.data11
element\data\tasks.data12
element\data\tasks.data13
element\data\tasks.data14
element\data\tasks.data15
element\data\tasks.data16
element\data\tasks.data17
element\data\tasks.data18
element\data\tasks.data19
element\data\tasks.data2
element\data\tasks.data20
element\data\tasks.data21
element\data\tasks.data22
element\data\tasks.data23
element\data\tasks.data24
element\data\tasks.data25
element\data\tasks.data26
element\data\tasks.data27
element\data\tasks.data28
element\data\tasks.data29
element\data\tasks.data3
element\data\tasks.data30
element\data\tasks.data31
element\data\tasks.data32
element\data\tasks.data33
element\data\tasks.data34
element\data\tasks.data35
element\data\tasks.data36
element\data\tasks.data37
element\data\tasks.data38
element\data\tasks.data39
element\data\tasks.data4
element\data\tasks.data40
element\data\tasks.data41
element\data\tasks.data42
element\data\tasks.data43
element\data\tasks.data5
element\data\tasks.data6
element\data\tasks.data7
element\data\tasks.data8
element\data\tasks.data9
element\data\title_def.lua
element\data\title_def_u.lua
element\trees.pck
element\data\vipaward.data
element\reportbugs\zreportbugs.exe
element\interfaces.pck
[/normalFiles]
[FullCheckFiles]
element\interfaces.pck
element\Localize.ini
element\arcsdk.dll
element\avcodec-52.dll
element\avformat-52.dll
element\avutil-50.dll
element\bbsfiles\error.html
element\bbsfiles\extensions\extbank\bank3.dll
element\bbsfiles\extensions\extbank\bankbox.ini
element\bbsfiles\extensions\extbank\banklist.dll
element\bbsfiles\extensions\extbank\extbank.ini
element\bbsfiles\extensions\extbank\stat.ini
element\bbsfiles\extensions\extbank\stat_bankbox.ini
element\bbsfiles\extensions\extbank\up_temp.ini
element\berkelium.dll
element\berkelium.exe
element\building.pck
element\chrome.log
element\chrome_plugins_file.xml
element\coreclientsdk.dll
element\cursors\attack.ani
element\cursors\attack.cur
element\cursors\axe.ani
element\cursors\choose.ani
element\cursors\choose1.ani
element\cursors\choose2.ani
element\cursors\dig.ani
element\cursors\drag.ani
element\cursors\drag.cur
element\cursors\drag1.ani
element\cursors\fire.ani
element\cursors\flag.cur
element\cursors\gear.ani
element\cursors\geer.ani
element\cursors\hammer.ani
element\cursors\hand.cur
element\cursors\hand1.ani
element\cursors\hand2.ani
element\cursors\harvest1.ani
element\cursors\harvest2.ani
element\cursors\hook.ani
element\cursors\key.ani
element\cursors\knife.ani
element\cursors\normal.ani
element\cursors\pest1.ani
element\cursors\pest2.ani
element\cursors\pick.ani
element\cursors\pick.cur
element\cursors\plot.ani
element\cursors\plot1.ani
element\cursors\plot2.ani
element\cursors\point.ani
element\cursors\repair.cur
element\cursors\seed.ani
element\cursors\seed1.ani
element\cursors\seed2.ani
element\cursors\split.ani
element\cursors\steal1.ani
element\cursors\steal2.ani
element\cursors\talk.cur
element\cursors\unablepoint.ani
element\cursors\water1.ani
element\cursors\water2.ani
element\cursors\weed1.ani
element\cursors\weed2.ani
element\cursors\zoomin.cur
element\cursors\zoomout.cur
element\d3dx9_24.dll
element\dbghelp.dll
element\dbserver.conf
element\facedata.pck
element\font\fzl2jw.ttf
element\font\fzl2jw.ttf1
element\font\fzlbjw.ttf
element\font\fzlbjw.ttf1
element\font\fzxh1jw.ttf
element\ftdriver.dll
element\gfx.pck
element\grasses.pck
[/FullCheckFiles]
I have tried the following expression
(?=[normalFiles])(.*?element(?:(?!\|).)*)(?![/normalFiles])
to get the file names only between [normalFiles] and [/normalFiles] But it gets the ones between <code> [FullCheckFiles] and [/FullCheckFiles] as well.
|
|
|
|
|
Why are you using this crazy format instead of using an XML file, making your RegEx a moot point??
|
|
|
|
|
|
Yeah, I just noticed he reposted.
|
|
|
|
|
I have a c# program that was written using vs 2008. On a windows xp 32 bit machine the program runs without any issues. When I try to run the program on a Win 7 64 bit machine it will not run. I am presented with an error message that says "Object reference not set to instance of object". Does anybody have an idea what I need to do to get this program running with a win 7 machine. Thanks in advance.
|
|
|
|
|
This is impossible to diagnose from our end. An object reference exception is telling you that some object has not been instantiated. Since we are unable to see your code, it's impossible to tell. What you need to do is run your app in debug on a Windows 7 machine and see what the stack trace points you to when your app breaks.
|
|
|
|
|
Thanks for answering so quick. I understand the error, but don't understand why the code runs fine, without error, on an xp machine and not on the win 7 machine. I'm just looking for something in general terms that may help me diagnose the problem.
|
|
|
|
|
It's impossible to help you without more details.
Any condition on OS version can lead you to different flow in code, and that's just a shot in the dark.
You should probably setup a debug environment to find out why this happens
|
|
|
|
|
When I see this type of error, it normally indicates that you have a piece of code that relied on an external component that is 32 bit only, on a 64 bit machine. The test for this is amazingly simple - simply run
corflags /32bBIT+ executablename The app will now be forced to run as a 32 bit app.
|
|
|
|
|
Thanks, I'll give that a try.
|
|
|
|
|
redhuskie wrote: why the code runs fine, without error, on an xp machine and not on the win 7 machine. Aside from the OS difference, are the run-time environments on the different machines the same?
/ravi
|
|
|
|
|
What setting did you use when you compiled the application ? Can you compile it with the target set as "Any CPU" ?
Project/Properties/Build Tab/PlatForm target Drop-down
“But I don't want to go among mad people,” Alice remarked.
“Oh, you can't help that,” said the Cat: “we're all mad here. I'm mad. You're mad.”
“How do you know I'm mad?” said Alice.
“You must be," said the Cat, or you wouldn't have come here.” Lewis Carroll
|
|
|
|
|
Just tell me one thing, in which mode did you compile your program?
Debug or Release mode?
Next thing is Object reference problem as others said occurs when you dont create the object of a type.
|
|
|
|
|
Hi,
How can I send variables across web pages without using session or cookies?
Thanks in advance 
|
|
|
|
|
This is strictly not a C# question, it belongs to ASP.NET forum.
Anyway, try this: Pass them as arguments in the url. E.g. http://www.mysite.com/?arg1=val1&arg2=val2&arg3=val3
Note than on most browsers, the length of the url is limited. Some browsers support only 2000 characters while other support upto 5000. Please use google to do some research.
modified 21-Jan-14 6:39am.
|
|
|
|
|
Psst! You forgot the query marker:
http://www.mysite.com/?arg1=val1&arg2=val2&arg3=val3
Without the '?' it's all a web address.
Those who fail to learn history are doomed to repeat it. --- George Santayana (December 16, 1863 – September 26, 1952)
Those who fail to clear history are doomed to explain it. --- OriginalGriff (February 24, 1959 – ∞)
|
|
|
|
|
Fixed now. Thanks for pointing out. I'm out of tea (not coffee) today. 
|
|
|
|
|
I have days like that too!
Those who fail to learn history are doomed to repeat it. --- George Santayana (December 16, 1863 – September 26, 1952)
Those who fail to clear history are doomed to explain it. --- OriginalGriff (February 24, 1959 – ∞)
|
|
|
|
|
OG, you are the man of the moment!!!!!!!
|
|
|
|
|
Rahul VB wrote:
OG, you are the man of the moment!!!!!!! He's gonna put this in his signature.
thatrajaCode converters | Education Needed
No thanks, I am all stocked up. - Luc Pattyn
When you're wrestling a gorilla, you don't stop when you're tired, you stop when the gorilla is - Henry Minute
|
|
|
|