|
sarabjs wrote:
Single Processor, Single Thread!
I think in that case threading would be contraproductive...
Sorry but I think I have no further suggestions for improving the performance
|
|
|
|
|
Nein problemo!
You've done great.. Thanks for the help...
Sarab.
|
|
|
|
|
|
No he doesn't. He can't.
Why?
Lets assume you have something like this:
for (int i = 0; i < myArray.Length; i++)
{
}
How can the compiler know what is done within the loop. The loop could probably change the array:
for (int i = 0; i < myArray.Length; i++)
{
myArray = new int[myArray.Length + 10];
}
If the JIT had replaced the condition in the loop with a constant value than the program would not behave correct anymore. This simple example could probably be resolved, but there are more complex examples a compiler can never resolve... so it doesn't even try
I've measured this already as well in debug as in release mode and it can have a real impact on your performance (about 50% if you e.g. just sum up the values of an array).
|
|
|
|
|
|
Hmmm... I've tested some constellations.
As far at it goes to GetLength Im totally right. Caching the length makes it by far faster.
For the normal Length property its a bit more complicated. Brad is true if the arrays is declared locally. If its a field member the cached version will still be a bit faster (about 15%).
Seems to be hard to give some general hints on thic topic. Its mostly like Brad stated:
"The lesson here is more along the lines of measure, measure, measure when you are doing perf work"
|
|
|
|
|
Robert Rohde wrote:
Seems to be hard to give some general hints on thic topic. Its mostly like Brad stated:
"The lesson here is more along the lines of measure, measure, measure when you are doing perf work"
I agree.
David
Never forget: "Stay kul and happy" (I.A.)
David's thoughts / dnhsoftware.org / MyHTMLTidy
|
|
|
|
|
I guess...
Though as far as my requirements are concerned, I don't need to use getLength etc. since the dimensions of the pixel matrix I'm using remain the same throughout.
|
|
|
|
|
I am at the moment building a client/server application using .NET. This is a Win Forms based app and for the communication I thought I would use sockets. But someone just mentioned "why dont you use remoting?". I dont know how skilled this person is and how much experience he has with remoting and/or sockets so I cant really know based on what he made that comment.
The application is nothing out of the ordinary really. The server has a database and the client interacts with the server and inserts, updates, deletes and requests data to/from the server. All clients and the server are all on a local network.
What I really need to know is, how do I know when I have an application that is a good candidate to use remoting for its network communication?
|
|
|
|
|
My take on this :-
Use remoting if client and server are guaranteed to be .NET
If a non-.NET client needs to connect to the server, use sockets
Nish
|
|
|
|
|
I want to distribute an application to people who may or may not have the .NET Framework installed. Currently, I have created a project that includes the application and the .NET Framework. The .NET framework is installed if it is currently not installed. However this leads to a large distribution file (I would like to email my application). As the .NET Framework is only needed to be installed once, any subsequent release containing the .NET Framework would be a waste.
I would prefer to determine if the .NET Framework is installed. If not I would display a popup to tell the user to download the framework from the Microsoft website.
Does anyone know how I could do this?
Thanks
Liam
|
|
|
|
|
You could examine the registry :-
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Internet Settings\5.0\User Agent\Post Platform
|
|
|
|
|
What I am struggling with is how I get code to execute to determine if the .NET Framework exists.
The code that I write will need the .NET Framework to run.
|
|
|
|
|
|
|
LiamD wrote:
Does anyone know how I could do this?
Either in C++, or via your MSI generator.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
Do you have a link describing how to doing this? I would have thought it a fairly common thing to do.
Thanks,
Liam
|
|
|
|
|
Which one ? Doing it in an MSI is in the help of whatever installer you use, and the C++ code just checks the registry key - here's some code:
bool CRDCInstallerDlg::NeedsDotNet()
{
HKEY key;
bool bRunInstall = true;
ERRORMESSAGE("Checking for .NET", 1);
if (ERROR_SUCCESS == ::RegOpenKeyEx(HKEY_LOCAL_MACHINE, "SOFTWARE\\Microsoft\\.NETFramework\\policy\\v1.1", 0, KEY_READ, &key))
{
ERRORMESSAGE("Found registry key", 2);
// Grossly simplified this test because Matt was reporting this was returning true when it should return false.
bRunInstall = false;
BYTE val[10];
DWORD len = 10;
if (ERROR_SUCCESS == ::RegQueryValueEx(key, "4322", NULL, NULL, &val[0], &len))
{
ERRORMESSAGE("Found item 4322", 2);
// Yuck, yuck, yuck. I get an array of bytes out of the registry, but I need a char array for strcmp.
char * pVal = (char*)&val[0];
if (0 == ::strcmp(pVal, "3706-4322"))
{
ERRORMESSAGE("Value is correct", 2);
}
}
::RegCloseKey(key);
}
return bRunInstall;
}
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
You should use Bootstrapper:
http://msdn.microsoft.com/vstudio/downloads/tools/bootstrapper/
|
|
|
|
|
Hi,
I have created a DLL component in Vb.net, i want no other project/person use my component, how to stop outside access .
Advance Thanks
aB
|
|
|
|
|
Baste wrote:
I have created a DLL component in Vb.net, i want no other project/person use my component, how to stop outside access .
You could use an obfuscator on the assembly to prevent people disassembling the IL.
And you could also have an Auth(string passwd) method which has to be called first before any of the other exposed interfaces work properly.
|
|
|
|
|
String 1 is the regex parsing string. String 2 is the string I am trying to parse. Note that String 2 is a continuous line and therefore it is matching almost everything in (?<report_desc>.+) part of the parser.
Anyone know how I can get around this?
String 1:
StatusArray\[\d+\] = "(?<status>.)";JodIdArray\[\d+\] = "(?<job_id>\d+)";FormatTypeArray\[\d+\] = "(?<format_type>\d+)";FileNameArray\[\d+\] = "(?<filename>\w*)";FileExtArray\[\d+\] = "(?<file_extension>\w{3})";ReqNameArray\[\d+\] = trimAll\(\"(?<report_desc>.+)"\);ApplId\[\d+\] = "(?<app_id>\d+)";ExeId\[\d+\] = "(?<exe_id>\d+)";Qid\[\d+\] = "(?<query_id>\w+)";DivId\[\d+\] = "(?<div_id>\d+)";CountryId\[\d+\] = "(?<country_id>..)"
String 2:
StatusArray[0] = "E";JodIdArray[0] = "98155582";FormatTypeArray[0] = "1";FileNameArray[0] = "_98155582_";FileExtArray[0] = "zip";ReqNameArray[0] = trimAll(" WF Product Characteristics- Comp Stores ");ApplId[0] = "300";ExeId[0] = "264";Qid[0] = "Q680";DivId[0] = "1";CountryId[0] = "US";StatusArray[1] = "N";JodIdArray[1] = "98110301";FormatTypeArray[1] = "1";FileNameArray[1] = "_98110301_";FileExtArray[1] = "xls";ReqNameArray[1] = trimAll(" Trash supply metrics - total stores D14 ");ApplId[1] = "300";ExeId[1] = "263";Qid[1] = "Q10001";DivId[1] = "1";CountryId[1] = "US";StatusArray[2] = "N";JodIdArray[2] = "98110298";FormatTypeArray[2] = "4";FileNameArray[2] = "_98110298_";FileExtArray[2] = "zip";ReqNameArray[2] = trimAll(" IT - US - WM - POS Sales - ItemWeekStoreType - Dept 93-99 - LY ");ApplId[2] = "300";ExeId[2] = "264";Qid[2] = "Q680";DivId[2] = "1";CountryId[2] = "US";StatusArray[3] = "N";JodIdArray[3] = "98110290";FormatTypeArray[3] = "4";FileNameArray[3] = "_98110290_";FileExtArray[3] = "zip";ReqNameArray[3] = trimAll(" IT - US - WM - POS Sales - ItemWeekStoreType - Dept 93-99 - TY ");ApplId[3] = "300";ExeId[3] = "264";Qid[3] = "Q680";DivId[3] = "1";CountryId[3] = "US";StatusArray[4] = "E";JodIdArray[4] = "98110213";FormatTypeArray[4] = "4";FileNameArray[4] = "_98110213_";FileExtArray[4] = "zip";ReqNameArray[4] = trimAll(" IT - US - Sales - Velocity by ItemStoreWeek - TY ");ApplId[4] = "300";ExeId[4] = "264";Qid[4] = "Q680";DivId[4] = "1";CountryId[4] = "US";StatusArray[5] = "E";JodIdArray[5] = "98110212";FormatTypeArray[5] = "4";FileNameArray[5] = "_98110212_";FileExtArray[5] = "zip";ReqNameArray[5] = trimAll(" IT - US - Sales - Velocity by ItemWeek ");ApplId[5] = "300";ExeId[5] = "264";Qid[5] = "Q680";DivId[5] = "1";CountryId[5] = "US";StatusArray[6] = "N";JodIdArray[6] = "98076304";FormatTypeArray[6] = "4";FileNameArray[6] = "_98076304_";FileExtArray[6] = "zip";ReqNameArray[6] = trimAll(" BR - Instocks ");ApplId[6] = "300";ExeId[6] = "313";Qid[6] = "Q10401";DivId[6] = "1";CountryId[6] = "BR";StatusArray[7] = "N";JodIdArray[7] = "98042022";FormatTypeArray[7] = "4";FileNameArray[7] = "_98042022_";FileExtArray[7] = "zip";ReqNameArray[7] = trimAll(" EDM_EVERYDAY_Daily_WM_POS_DOWNLOAD ");ApplId[7] = "300";ExeId[7] = "264";Qid[7] = "Q680";DivId[7] = "1";CountryId[7] = "US";StatusArray[8] = "N";JodIdArray[8] = "98042017";FormatTypeArray[8] = "4";FileNameArray[8] = "_98042017_";FileExtArray[8] = "zip";ReqNameArray[8] = trimAll(" EDM_FRI_Daily_WM_POS_DOWNLOAD ");ApplId[8] = "300";ExeId[8] = "264";Qid[8] = "Q680";DivId[8] = "1";CountryId[8] = "US";
|
|
|
|
|
Randy Walker wrote:
Anyone know how I can get around this?
Looks like your fields are ; delimited, search for anything bar ;, instead of using .*.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
This is driving me crazy ...
Why does the following code :
UdpClient uc = new UdpClient ();
try
{
uc.JoinMulticastGroup (IPAddress.Parse ("239.255.255.250"));
}
catch (Exception e)
{
Console.WriteLine (e.ToString ());
}
creates the following exception :
System.Net.Sockets.SocketException: An invalid argument was supplied
at System.Net.Sockets.Socket.setMulticastOption(SocketOptionName optionName, MulticastOption MR)
at System.Net.Sockets.Socket.SetSocketOption(SocketOptionLevel optionLevel, SocketOptionName optionName, Object optionValue)
at System.Net.Sockets.UdpClient.JoinMulticastGroup(IPAddress multicastAddr)
If I go and create a UDP socket and try to set the multicast option I get the same exception. I'm puzzled.
Sylvain
|
|
|
|
|
The socket hasn't been created. For multicast to work practically, you need to specify a port - you can't just use a dynamic port. Specify the port number in the UdpClient constructor, and it should work.
Stability. What an interesting concept. -- Chris Maunder
|
|
|
|