Click here to Skip to main content
15,904,346 members
Home / Discussions / C#
   

C#

 
AnswerRe: Abstracts: can I do better than this? Pin
Eddy Vluggen30-Dec-09 6:56
professionalEddy Vluggen30-Dec-09 6:56 
AnswerRe: Abstracts: can I do better than this? [modified] Pin
PIEBALDconsult30-Dec-09 7:20
mvePIEBALDconsult30-Dec-09 7:20 
GeneralRe: Abstracts: can I do better than this? Pin
MollyTheCoder30-Dec-09 7:43
MollyTheCoder30-Dec-09 7:43 
GeneralRe: Abstracts: can I do better than this? Pin
PIEBALDconsult30-Dec-09 7:52
mvePIEBALDconsult30-Dec-09 7:52 
GeneralRe: Abstracts: can I do better than this? Pin
MollyTheCoder30-Dec-09 7:58
MollyTheCoder30-Dec-09 7:58 
GeneralRe: Abstracts: can I do better than this? Pin
pbalaga30-Dec-09 8:12
pbalaga30-Dec-09 8:12 
GeneralRe: Abstracts: can I do better than this? [modified] Pin
ProtoBytes30-Dec-09 8:35
ProtoBytes30-Dec-09 8:35 
GeneralRe: Abstracts: can I do better than this? Pin
MollyTheCoder30-Dec-09 8:36
MollyTheCoder30-Dec-09 8:36 
GeneralRe: Abstracts: can I do better than this? Pin
PIEBALDconsult5-Apr-10 15:33
mvePIEBALDconsult5-Apr-10 15:33 
GeneralRe: Abstracts: can I do better than this? Pin
MollyTheCoder5-Apr-10 17:00
MollyTheCoder5-Apr-10 17:00 
GeneralRe: Abstracts: can I do better than this? Pin
PIEBALDconsult5-Apr-10 17:39
mvePIEBALDconsult5-Apr-10 17:39 
AnswerRe: Abstracts: can I do better than this? Pin
petercrab30-Dec-09 17:00
petercrab30-Dec-09 17:00 
QuestionHow to use in c# SqlHierarchyId.GetDescendant(null,null)? [modified] Pin
dimitarmarinov30-Dec-09 2:21
dimitarmarinov30-Dec-09 2:21 
QuestionInvoke a function every time that a function is been added to my event Pin
bonzaiholding30-Dec-09 1:17
bonzaiholding30-Dec-09 1:17 
AnswerRe: Invoke a function every time that a function is been added to my event Pin
OriginalGriff30-Dec-09 2:01
mveOriginalGriff30-Dec-09 2:01 
AnswerRe: Invoke a function every time that a function is been added to my event Pin
petercrab30-Dec-09 16:56
petercrab30-Dec-09 16:56 
QuestionThreads, speed up calculations Pin
Renven30-Dec-09 1:01
Renven30-Dec-09 1:01 
AnswerRe: Threads, speed up calculations Pin
Rob Philpott30-Dec-09 1:17
Rob Philpott30-Dec-09 1:17 
GeneralRe: Threads, speed up calculations Pin
Renven30-Dec-09 1:31
Renven30-Dec-09 1:31 
AnswerRe: Threads, speed up calculations Pin
Luc Pattyn30-Dec-09 2:01
sitebuilderLuc Pattyn30-Dec-09 2:01 
AnswerCODE Pin
Renven30-Dec-09 2:22
Renven30-Dec-09 2:22 
(how code looks after trying with 7 threads (because captured image is divided in 7 rows)) I have to warn you CODE is not optimized. as example I show you only 2 thread methods: ThreadOneP and ThreadTwoP


public int TransferToMatrixThread()
{
temptest = 0;
CabX = CabX - 18;
CabY = CabY + 53;
CabXX = CabX - 484; //POSSITION
CabYY = CabY + 20;
for (int i = 0; i < 11; i++) //FILLS MATRIX WITH 0
{
for (int j = 0; j < 11; j++)
{
transfered[i, j] = 0;
}
}
ThreadStart ts = new ThreadStart(ThreadOneP);
ThreadStart ts2 = new ThreadStart(ThreadTwoP);
ThreadStart ts3 = new ThreadStart(ThreadThreeP);
ThreadStart ts4 = new ThreadStart(ThreadFourP);
ThreadStart ts5 = new ThreadStart(ThreadFiveP);
ThreadStart ts6 = new ThreadStart(ThreadSixP);
ThreadStart ts7 = new ThreadStart(ThreadSevenP);
Thread thread1 = new Thread(ts);
Thread thread2 = new Thread(ts2);
Thread thread3 = new Thread(ts3);
Thread thread4 = new Thread(ts4);
Thread thread5 = new Thread(ts5);
Thread thread6 = new Thread(ts6);
Thread thread7 = new Thread(ts7);
DateTime startTime = DateTime.Now; //TIME
thread1.Start();
thread2.Start();
thread3.Start();
thread4.Start();
thread5.Start();
thread6.Start();
thread7.Start();

thread1.Join();
thread2.Join();
thread3.Join();
thread4.Join();
thread5.Join();
thread6.Join();
thread7.Join();

DateTime stopTime = DateTime.Now;
TimeSpan duration = stopTime - startTime;
listBox1.Items.Add("7 THREAD = " + duration);

TransfX = currX + CabXX + 9; // norima nustatyti i pav viduri todel pridedamos konstantos
TransfY = currY + CabYY + 11; // norima nustatyti i pav viduri todel pridedamos konstantos
return temptest;
}
public void ThreadOneP()
{
int o = CabYY;
int zy = 8;
int zx = 2;
for (int ok = CabXX; ok < CabXX + 490; ok = ok + 72)
{
var color22 = RGBreturnLVL(ok, o, 30, 30, bmpScreenshot51);
if (maze[0, 1] < color22.R && color22.R < maze[0, 2] && maze[0, 3] < color22.G && color22.G < maze[0, 4] && maze[0, 5] < color22.B && color22.B < maze[0, 6])
{ transfered[zy, zx] = maze[0, 0]; }
else if (maze[3, 1] < color22.R && color22.R < maze[3, 2] && maze[3, 3] < color22.G && color22.G < maze[3, 4] && maze[3, 5] < color22.B && color22.B < maze[3, 6])
{ transfered[zy, zx] = maze[3, 0]; }
else { transfered[zy, zx] = 0; temptest++; }
zx++;
}
}
public void ThreadTwoP()
{
int o = CabYY - 72;
int zy = 7;
int zx = 2;
for (int ok = CabXX; ok < CabXX + 490; ok = ok + 72)
{
var color22 = RGBreturnLVL(ok, o, 30, 30, bmpScreenshot61);
if (maze[0, 1] < color22.R && color22.R < maze[0, 2] && maze[0, 3] < color22.G && color22.G < maze[0, 4] && maze[0, 5] < color22.B && color22.B < maze[0, 6])
{ transfered[zy, zx] = maze[0, 0]; }
else if (maze[3, 1] < color22.R && color22.R < maze[3, 2] && maze[3, 3] < color22.G && color22.G < maze[3, 4] && maze[3, 5] < color22.B && color22.B < maze[3, 6])
{ transfered[zy, zx] = maze[3, 0]; }
else { transfered[zy, zx] = 0; temptest++; }
zx++;
}
}


waiting your response
GeneralRe: CODE Pin
Luc Pattyn30-Dec-09 3:00
sitebuilderLuc Pattyn30-Dec-09 3:00 
GeneralRe: CODE Pin
Renven30-Dec-09 3:27
Renven30-Dec-09 3:27 
GeneralRe: CODE Pin
Renven30-Dec-09 3:44
Renven30-Dec-09 3:44 
GeneralRe: CODE Pin
Luc Pattyn30-Dec-09 3:49
sitebuilderLuc Pattyn30-Dec-09 3:49 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.