|
JTmetoo wrote: has not left any means of contacting them
Ummm, no. There is a forum for the article, which you have posted to. Whether the author responds is another matter.
Failure is not an option; it's the default selection.
|
|
|
|
|
|
how can we use #pragma omp directive in c# vs 2010??
|
|
|
|
|
|
its taking more execution time than sequential code.. any sol??
|
|
|
|
|
That is not possible; #pragma is a compiler directive and has nothing to do with execution speed.
Unrequited desire is character building. OriginalGriff
I'm sitting here giving you a standing ovation - Len Goodman
|
|
|
|
|
but i want to reduce the execution time of a loop by making it parllel...
for(int i=0;i<100;i++)
{
Console.WriteLine(i);
}
thatwhy i used pragma directive..
# prgma omp parllel
for(int i=0;i<100;i++)
{
Console.WriteLine(i);
}
but its increse the time instead of reducing..
any sol for this??
|
|
|
|
|
This has nothing to do with your original question, and I have already answered with a suggestion here[^].
KUNWAR999 wrote: # prgma omp parllel
What is this supposed to mean?
Unrequited desire is character building. OriginalGriff
I'm sitting here giving you a standing ovation - Len Goodman
|
|
|
|
|
Here[^] you go. Warning: it is a different world altogether.
|
|
|
|
|
Yes, I did discover that in the C++ compiler. My question was to get OP to explain what he/she thought it was, in terms of C#.
Unrequited desire is character building. OriginalGriff
I'm sitting here giving you a standing ovation - Len Goodman
|
|
|
|
|
A few points. That pragma is for C/C++. If you want to have the sequence in order, you shouldn't try to turn it parallel as there is no guarantee of order of execution in parallel processing. If this isn't an issue, why not use the Task Parallel Library.
|
|
|
|
|
You can't, so there is no answer to "how". The standard C# compiler does not support OpenMP.
|
|
|
|
|
i am using Pcap.net to send packets using send buffer with Wireshark file (pcap extension) and i want to do some packet manipulation e.g change the packet IP, but after send the packet again the packet looks corrupt with checksum bad and malformed TCP
using (PacketSendBuffer sendBuffer = new PacketSendBuffer((uint)capLength))
{
int numPackets = 0;
Packet packet;
while (inputCommunicator.ReceivePacket(out packet) == PacketCommunicatorReceiveResult.Ok)
{
IpV4Layer ipLayer = (IpV4Layer)packet.Ethernet.IpV4.ExtractLayer();
EthernetLayer ethernet = (EthernetLayer)packet.Ethernet.ExtractLayer();
var payload = packet.Ethernet.Payload.ExtractLayer();
IpV4Address newIpv4 = new IpV4Address("17.18.19.20");
ipLayer.Destination = newIpv4;
Packet newPacket = PacketBuilder.Build(DateTime.Now, ethernet, ipLayer, payload);
sendBuffer.Enqueue(newPacket);
++numPackets;
}
outputCommunicator.Transmit(sendBuffer, isSync);
}
|
|
|
|
|
And your question is?
The difficult we do right away...
...the impossible takes slightly longer.
|
|
|
|
|
i have try something that i think is correct but in the line sendBuffer.Enqueue(newPacket) error received: Failed enqueueing to SendQueue
using (PacketSendBuffer sendBuffer = new PacketSendBuffer((uint)capLength))
{
int numPackets = 0;
Packet packet;
while (inputCommunicator.ReceivePacket(out packet) == PacketCommunicatorReceiveResult.Ok)
{
IpV4Layer ipLayer = (IpV4Layer)packet.Ethernet.IpV4.ExtractLayer();
ipLayer.Destination = new IpV4Address("11.12.13.14");
EthernetLayer ethernet = (EthernetLayer)packet.Ethernet.ExtractLayer();
PayloadLayer payload = (PayloadLayer)packet.Ethernet.Payload.ExtractLayer();
Packet newPacket = PacketBuilder.Build(DateTime.Now, ethernet, ipLayer, ipLayer, payload);
sendBuffer.Enqueue(newPacket);
++numPackets;
}
outputCommunicator.Transmit(sendBuffer, isSync);
}
|
|
|
|
|
Have you tried the PCap site? Don't they have a support forum?
The difficult we do right away...
...the impossible takes slightly longer.
|
|
|
|
|
yes they have but the forum not so effective (lack of users)
|
|
|
|
|
i have a float type of variable i.e float t1=200.36 and t2=300.62. now i want to roundoff these two variables to their nearest degit.
I want to show the information like this:
t1=200.36 roundoff=-0.36 total=200
t2=300.62 roundoff=+0.38 total=301
|
|
|
|
|
Look here:
Floor[^]
Ceiling[^]
Round[^]
Then you can take the difference of the original with the rounded value.
Hope this helps.
V.
|
|
|
|
|
See this code to get the idea:
double t1 = 200.36;
double t2 = 300.62;
int t11 = (int)Math.Round(t1, 0);
int t21 = (int)Math.Round(t2, 0);
MessageBox.Show("t1=" + t1.ToString() + " roundoff=" + (t11 - t1).ToString("0.00") + " total=" + Math.Round(t1, 0).ToString());
MessageBox.Show("t2=" + t2.ToString() + " roundoff=" + (t21 - t2).ToString("0.00") + " total=" + Math.Round(t2, 0).ToString());
|
|
|
|
|
I want to add the following
What is required when the number is half i.e. 200.5. Whether 200 or 201?
By default Math.Round follows
MidpointRounding.ToEven enumeration value.
double number = 200.5;
Console.WriteLine (Math.Round(number,0));
Console.WriteLine (Math.Round(number,0, MidpointRounding.AwayFromZero));
double number2 = 201.5;
Console.WriteLine (Math.Round(number2,0));
Console.WriteLine (Math.Round(number2,0, MidpointRounding.AwayFromZero));
So, if the next higher number is required always, when the value is half way, then
MidpointRounding.AwayFromZero is to be used.
modified 30-Mar-12 10:15am.
|
|
|
|
|
Try this code.. :
double g = [any no];//should be of double
double L = Math.Floor(g);
if (g-L<0.5)
{
k = (int)(L);
}
else
{
k = (int)(L + 1);
}
now k have ur nearest integer..
|
|
|
|
|
Hi All,
I am building a windows tool for which I require a text area control where i can format the text such as color, size etc. but the formatted text should be readable as HTML in the codebehind.
Is there any such tool?
Jack Sparrow
--------------------------------------
Defeat is not the worst of failures. Not to have tried is the true failure.
|
|
|
|
|
Ramkithepower wrote: Is there any such tool?
There should be some HTML-editor controls here on CodeProject
Bastard Programmer from Hell
|
|
|
|
|
I have a control DateTimeInput, when I run up, then assign the current date by default, but when his days in DateTimeInput clrear then how do you know to enter the date again? I checked the way DateTimeInput.Text == "" or DateTimeInput.Value.ToString () == "" but it does not understand. Thanks to all who know you helped with.
|
|
|
|