|
I am trying to write a program to select a feature using mouse click on a map control of DotSpatial framework. But I am stuck.
Please Help..
Thanks.
|
|
|
|
|
I am pretty sure that DotSpatial has a forum. I guess that's a great place to find an expert in it.
|
|
|
|
|
I recently wrote some code to clean up user input by turning all multiple-space spaces into single-space spaces.
I tried several different approaches to optimize performance, and, interestingly enough, the stringbuilder is performing better than I remember from past versions. I can't seem to do better than the following no matter how hard I try to optimize.
private StringBuilder builder = new StringBuilder();
public string RemoveExtraSpaces(string inputString)
{
builder.Clear();
int length = inputString.Length;
if (length > 0)
{
builder.Append(inputString[0]);
for (int loop1 = 1; loop1 < length; loop1++)
if (inputString[loop1 - 1] != ' ' || inputString[loop1] != ' ')
builder.Append(inputString[loop1]);
}
return builder.ToString();
}
Even for very short strings, this solution performs better than other solutions.
Edit: Also, for clarification, the RemoveExtraSpaces method is called many times in a row on a bunch of strings for performance testing.
|
|
|
|
|
The Clear() is a new method for StringBuilder in VS2010. But by observing its IL code we can see it just set this.Length = 0. So we can see that the inner algorithm somewhat not change a lot. StringBuilder is a efficient class, not only in VS 2010, I think it's the class itself rather than the IDE version that makes your solution better.
Dynamsoft
|
|
|
|
|
so_soul wrote: The Clear() is a new method for StringBuilder in VS2010
The method is new in .NET Framework 4.0, not Visual Studio 2010. Visual Studio can make use of multiple frameworks and is independent of them.
Failure is not an option; it's the default selection.
|
|
|
|
|
Curious. What else have you tried?
* String.Replace?
* RegEx.Replace?
* StringBuilder.Replace?
* Using an array of characters?
Perhaps this will give me a research topic for the day, being slow here.
|
|
|
|
|
I tried several variants of using the string concatenation += operator, stringbuilder, and arrays of characters. I expected an array of character approach to be best, but every approach I tried was slightly outperformed by the stringbuilder-based method I posted.
I didn't bother using RegEx, as I expected its overhead costs to eliminate itself here, but I could be wrong.
|
|
|
|
|
I just want to know there whether are any new files in the FTP site, and if a new file be uploaded/Deleted in the FTP site, then I will download/delete this file to local system. Could someone give me some suggestions?
|
|
|
|
|
It depends on whether or not you have control of the FTP site as well. If you do, have a process monitor that directory at that end, and maintain a hash of all the files in the FTP directory/subdirectories. Keep a hash of the files at your end, and when you connect to the FTP site, retrieve the remote hash. Compare it to yours - if it's changed, you've got changes to download.
|
|
|
|
|
Hi! I develop in Visual Studio and I need to build a SIP webphone. I searched and found a SIP softphone solution with a free sample program on the net: www.voip-sip-sdk.com/p_83-silverlight-sip-softphone-javascript-voip.html (I added this site for showing you the example program I found on the net.) Is it possible to build a Silverlight SIP softphone in both Visual Studio 2008 and 2010 ? Thank you for your answer.
|
|
|
|
|
In the .NET Framework, what exception would you expect Image.FromFile to throw if the image is invalid? Something like an "InvalidImageFormatException" or similar?
Nope. It throws an OutOfMemoryException. MSDN says:
OutOfMemoryException
The file does not have a valid image format.
-or-
GDI+ does not support the pixel format of the file.
Really? I doubt the system is actually running out of memory as it returns quickly.
|
|
|
|
|
It does what the documentation says it does. That is positive in general, and it sounds a bit weird in this case.
Anyhow, it is a lot better than getting a "General error occurred in GDI+" which can mean almost anything.
|
|
|
|
|
You are probably trying to read an image that is not valid.
If you notice, there is no such exception like "Invalid Image" listed out.
OutOfMemoryException
The file does not have a valid image format.
-or-
GDI+ does not support the pixel format of the file.
FileNotFoundException
The specified file does not exist.
ArgumentException
filename is a Uri.
|
|
|
|
|
Yeah, I'm validating that an uploaded image is actually a valid image. I was just ranting about the framework using an OutOfMemoryException to signal an exception that doesn't relate to memory at all
|
|
|
|
|
Daniel Lo Nigro wrote: I was just ranting about the framework using an OutOfMemoryException to
signal an exception that doesn't relate to memory at all
Not necessarily true. It could be a bug in GDI+ that recursively tries to load the bad image and results in a real Out of Memory situation.
|
|
|
|
|
How to convert string english to marathi
|
|
|
|
|
Not sure what you mean by that question.
If you want to allow your UI to be displayed in multiple languages, you need to implement your application using Localization features and capabilities. .NET - Localization using Resource file[^] will help you understand how you need to implement localization using resources.
If you want to build your own language translator that converts English to Marathi, you will need to implement a parser that, at the simplest, reads a word and translates it into the Marathi equivalent.
|
|
|
|
|
Hi,I need to see if a webpage displayed via the vb browser contains certain words .I've tried parasing through the html but that contains too much junk html and css tags which caused problems.That was done by using property webBrowser.document.Body.InnerText.contains . Are any way to search through the actual text via the program like the control-f function on common webbrowser ?
Thanks in advance
|
|
|
|
|
We can sign asseblies with a strong name or key. Sometimes I need reuse the assembly on a different device so I need to sign it again with a different key. How do we do it? Can I unsign it first with the previous key and sign it with the new key? Thanks!
Best,
Jun
|
|
|
|
|
Signing is a one-way operation. Once done, it cannot be unsigned.
|
|
|
|
|
Thanks Dave. So if I signed my assembly with key A and want to resign it with key B, does it work at all?
Best,
Jun
|
|
|
|
|
If it your assembly then you can just rebuild it or start with the unsigned version (the one that you used A to sign in the first place.)
|
|
|
|
|
Jun Du wrote: Sometimes I need reuse the assembly on a different device so I need to sign it again with a different key. How do we do it?
- Build your solution
- Zip the entire solution (source-code folder, containing the bins)
- Burn the zip on a CD, take a black marker and write the productname, the version and the date on it
- Make a copy of the assembly for customer A
- Sign the assembly for customer A
- Make a copy of the same unsigned assemblies and sign the copy for customer B.
- Enjoy a coffee and a smoke.
- Bastard Programmer from Hell
|
|
|
|
|
Hi,
I have a WCF(TCP/WAS) service communicating with a winform application.
I have tried to get the following performance counters from this service :
ServiceModelService 4.0.0.0
ServiceModelOperation 4.0.0.0
ServiceModelEndPoint 4.0.0.0
I do hoverver never get any values on these counters.
This solution : TestProject shows how my solution is setup but this test project do work with performance counters. The question is what would make the performance counters to not record any values?
I have invested alot of hours to locate diffrences in this testproject and the real one but havent found anything yet?
|
|
|
|
|
As a guess - performance counters require an 'install' step that involves (I believe) adding some specific values to the registry (or something similar) which allows windows to know about the values being collected.
|
|
|
|