|
Either of those should have worked. Have you verified that my_dir actually points to the directory that contains rake? Put a break point on Process p = new Process(); and see what's in my_dir.
|
|
|
|
|
replace "rake" with the full path and the full filename including its extension of that executable.
|
|
|
|
|
Hello
I filling My Datagridview with Linq Query in C#. in my program I want to filter This datagridview with Textbox. the code of Textbox changed is:
DataTable dt = new DataTable();
dt = (DataTable)(dataGridViewX4.DataSource);
dt.DefaultView.RowFilter = string.Format("T_P = '{0}'", Txt_T_P_Se.Text);
dataGridViewX4.DataSource = dt;
after Runnig program, this Error Appear:
Invalid Cast Exception Was Unhandled
Please Help me.
|
|
|
|
|
dt = (DataTable)(dataGridViewX4.DataSource);
I suspect that the DataSource of your grid is not a DataTable .
Veni, vidi, abiit domum
|
|
|
|
|
hi
thanks for your reply.
my DataSource is :
var Query=
(from p in QcGerdBaf.Taghes where p.QGI_Id_Fk == QGI_Id_Selected select new { p.T_P, p.T_Id });
dataGridViewX4.DataSource = Query.ToList();
|
|
|
|
|
That is not a DataTable .
Veni, vidi, abiit domum
|
|
|
|
|
Ok,
Please give your suggestion
|
|
|
|
|
Suggestion for what? You cannot cast a List to a DataTable ; read your .NET reference.
Veni, vidi, abiit domum
|
|
|
|
|
Is there any Way to fill Datatable with this Query?
If yes,Please Tell Codes.
|
|
|
|
|
You would have to "Select New" DataRow objects and add them to the DataTable.Rows collection.
No, I don't have an example, because I never had the need to do such a thing.
|
|
|
|
|
I wanted to see how close the performance of a loop in C# is to something written in assembly.
uint x = int.MaxValue;
DateTime st = DateTime.Now;
for (uint i = 0; i < x; i++) ;
TimeSpan sp = new TimeSpan(DateTime.Now.Ticks - st.Ticks);
Console.WriteLine("looped: {0} in {1}", x, sp);
In Debug it ran in 6+ seconds. Oh, idiot! Compile it! Ran in 2.1+ to 2.2 seconds. It's rated at 2.1 GHz so it should have finished in just under 2 seconds, so close enough to assembler speeds.
Did some more changes elsewhere in the code and used uint to define x. Wha?? Over 6 seconds, went back to int, now it is 3 seconds.
looped: 4294967295 in 00:00:06.2643583
looped: 2147483647 in 00:00:03.0888054
It's like it changed from 2 flops per loop to 3 flops. When I checked performance logs, it runs at 50% CPU on a dual core machine, so it is showing 100% of one CPU is dedicated to this loop for the 3 seconds.
Any ideas why changes in other sections of logic might affect this piece? I'm normally running 90-97% idle with occasional dips to the 80's.
Modified:
1. Subject to be more specific
2. added last line of code segment because it was missing.
modified 22-Jan-14 1:29am.
|
|
|
|
|
You cannot rely on DateTime values to time in a multi-tasking operating system. You are measuring elapsed time, which will include any switching between applications and OS overhead.
Veni, vidi, abiit domum
|
|
|
|
|
Richard MacCutchan wrote: ...DateTime values to time in a multi-tasking operating system. True, which is why I accepted slightly less than optimum theoretical performance when it ran in 2+ seconds. But this shifted to 150% slower performance.
I added a performance monitor which added a slightly higher load, but when I ran the code again, it took 50% of the CPU, which indicated one of the two CPUs had 100% dedication to this thread. To account for 150% slow-down because of load-balancing, it should have taken 33-34 percent of the load consistently over the three seconds it ran or switching between 50 and 10 %.
Instead, it is acting as if the process changed from doing 2 floating point operations per loop to 3. If it always acted the slower way, then I'd have to accept that C# puts in an unneeded additional operation I can't control into a looping process.
If I can't use elapsed time, is there any other method to capture the efficiency of the looping mechanism?
Another thing I noticed is that even though it measures 1 tick as 100 nanoseconds, measuring the time it takes shifts from 0 to 1 millisecond increments with the 10K ticks to 1 MS slightly changing. That tells me "Now" retrieves a timed update, not executing an immediate update of the time.
|
|
|
|
|
Like Richard said, DateTime is not good for this type of timing. Use System.Diagnostics.Stopwatch :
uint x = int.MaxValue;
System.Diagnostics.Stopwatch st = System.Diagnostics.Stopwatch.StartNew();
for (uint i = 0; i < x; i++) ;
st.Stop();
TimeSpan sp = TimeSpan.FromTicks(st.ElapsedTicks);
Console.WriteLine("looped: {0} in {1}", x, sp);
|
|
|
|
|
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.
|
|
|
|