|
This is surely a better solution than mine!
|
|
|
|
|
Then vote it a good answer.
.45 ACP - because shooting twice is just silly ----- "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 ----- "The staggering layers of obscenity in your statement make it a work of art on so many levels." - J. Jystad, 2001
|
|
|
|
|
Wait, re-reading carefully the documentation it seems that it is only for XNA and XBox360. I tried a small test program and the Thread.SetProcessorAffinity does not exist in the standard 3.5 .NET framework. Am I missing something obvious?
|
|
|
|
|
You're right, and I changed my answer.
.45 ACP - because shooting twice is just silly ----- "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 ----- "The staggering layers of obscenity in your statement make it a work of art on so many levels." - J. Jystad, 2001
|
|
|
|
|
Sounds more logical too; imagine all applications dividing their affinity over two cores. You'd freak out if your computer has four cores, as two would be consistently ignored
The CPU-affinity can be set by the end-user over the task-manager, if there's a need to do so.
I are Troll
|
|
|
|
|
C# seems not to support the feature you are requiring, you should use some Interop to do it.
This snippet should do the work (I found it here[^], I didn't tested it.
class Program
{
[DllImport("kernel32")]
static extern int GetCurrentThreadId();
static void Main()
{
Thread t = new Thread(
new ThreadStart(DoWork));
t.Start();
t.Join();
}
static void DoWork()
{
foreach(ProcessThread pt in Process.GetCurrentProcess().Threads)
{
int utid = GetCurrentThreadId();
if (utid == pt.Id)
{
pt.ProcessorAffinity = (IntPtr)(1);
Console.WriteLine("Set");
}
}
}
} But why do you want to change the thread affinity? The scheduler should automatically take advantage of both CPU cores.
|
|
|
|
|
Hi,
don't worry about which processor executes which thread; setting processor affinities isn't necessary at all. If you let everything run without "helping" it, Windows will assign threads to processors dynamically (which means a thread once blocked for some reason might continue on another processor), with some retention as to preserve cache efficiency. It is only in very special cases that you could improve on the automatic assignment.
|
|
|
|
|
Hi All, I am trying to do some query in my sqlite database. I wanted to get average of some number, but could not do it.
if you please can, write a sql statement that get average of some number.
"SELECT AVE(w)FROM x WHERE y = z ";
It should return the ave of all w.
thanks in advance
|
|
|
|
|
This belongs to the "General Database" forum, this is the C# forum.
I suggest you post there and delete this post.
CCC solved so far: 2 (including a Hard One!)
37!?!! - Randall, Clerks
|
|
|
|
|
jashimu wrote:
"SELECT AVE(w)FROM x WHERE y = z ";
This transact sql statement will be
"SELECT AVG(w)FROM x WHERE y = z ";
Thanks
Md. Marufuzzaman
Don't forget to click [Vote] / [Good Answer] on the post(s) that helped you.
I will not say I have failed 1000 times; I will say that I have discovered 1000 ways that can cause failure – Thomas Edison.
|
|
|
|
|
How do i change the title of the webpartzone.
It is keeping the ID of the webpartzone as the name
|
|
|
|
|
Ok. Good question, or, what the hell is a webpartzone?
|
|
|
|
|
use webpart in ASP.NET to drag and drop controls.
Webpartzones are the zones in which webparts are created.
My question how do you change the webpart zone name or even
remove the title of the webpart zone
|
|
|
|
|
Ah, so it's an asp.net question. Good, ask in the ASP.NET forum, you will get a (better) answer there.
|
|
|
|
|
|
Wow, this message is deleted, and I can still vote for it...harsh.
In Christ,
Aaron Laws
http://ProCure.com
|
|
|
|
|
I read it, and voted one also. The jist was "please give me an idea for a degree dissertation".
CCC solved so far: 2 (including a Hard One!)
37!?!! - Randall, Clerks
|
|
|
|
|
Ahh. It's still a bit harsh that it's still voteable.
What is a CCC? You have caught my attention with your signature, and I would like to solve them (even the Hard Ones).
In Christ,
Aaron Laws
http://ProCure.com
|
|
|
|
|
CCC= Cryptic Crossword Clue. Dalek Dave sets one in the lounge everyday (about 9am UK time) and we have two hours to solve them. He sets an extra hard one on Thursdays.
CCC solved so far: 2 (including a Hard One!)
37!?!! - Randall, Clerks
|
|
|
|
|
how can i convert double to binary?
i have tried tostring("X") for Hex
is there a way to use this method for binary?
|
|
|
|
|
double d = 1.2;
int i = (int)d;
|
|
|
|
|
use:
int i = 12345;
string s = Convert.ToString(i, 2); The second parameter is the base: MSDN[^]
All those who believe in psycho kinesis, raise my hand.
|
|
|
|
|
thanks
|
|
|
|
|
Change your userID.
.45 ACP - because shooting twice is just silly ----- "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 ----- "The staggering layers of obscenity in your statement make it a work of art on so many levels." - J. Jystad, 2001
|
|
|
|
|
what do you main by "Change your userID. "?
|
|
|
|