|
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.
|
|
|
|
|
I've got an application. It receives some documents from server and displays them. So i have an SQLite database file with my objects and many files as attachments that are placed in some folder.
And i need to make a full-text search among this files. So i use windows search as only suitable!
as recomended in many samples i do it like this:
private void buttonSearch_Click(object sender, RoutedEventArgs e)
{
CreateSearchQuery();
UpdateLayout();
UpdateFolderProperties();
IndexContents();
try
{
using (OleDbConnection conn = new OleDbConnection(
"Provider=Search.CollatorDSO;Extended Properties='Application=Windows';"))
{
conn.Open();
OleDbCommand cmd = new OleDbCommand(SearchQuery, conn);
using (OleDbDataReader reader = cmd.ExecuteReader())
{
listView1.Items.Clear();
while (reader.Read())
{
listView1.Items.Add(reader[0]);
}
}
}
}
catch (Exception ex)
{
statusBar.Text = "Searching failed: " + ex.Message + "!";
}
}
private void CreateSearchQuery()
{
SearchQuery = @"SELECT "
+ @"System.ItemPathDisplay"
+ @" FROM SYSTEMINDEX WHERE (FREETEXT('" + txtSearch.Text + @"') OR System.ItemName LIKE '%" + txtSearch.Text + @"%') AND SCOPE = '" + txtPath.Text + @"'";
}
and so it returns me all the files it found by name or content... but i need to display pieces of content it found just like MS Explorer does for full-text search results. Any ideas?!
|
|
|
|
|
First option that comes to mind; open each file and find the first occurrence of the string you're searching. Next, copy the string (from, say, four words before the first match, up to four words after the first match)
Highlight the match itself in a different color for extra ooh's and aah's
Bastard Programmer from Hell
|
|
|
|
|
i have one template get the value from customer and display .and i have one button in grd select .in select that button and how to display the values again in template asp.net c#
|
|
|
|