|
That would also be a clue that what you think is a " is not a ", find out what it is.
modified on Friday, August 15, 2008 9:52 AM
|
|
|
|
|
I found very little about RKLib.Export when searching for it. Does it export to CSV?
In that case, escaping quotation marks with a backslash will not help you at all.
A value in CSV that contains commas (or whatever separator is used), line breaks or quotation marks should be enclosed with quotation marks, and quotation marks are escaped by putting double quotation marks in the value.
If the library doesn't handle escaping at all, you can do something like this:
if (value.indexOfAny(new char[]{ ',', ';', '"', '\x0d', '\x0a'}) != -1) {
value = "\"" + value.Replace("\"", "\"\"") + "\"";
}
Despite everything, the person most likely to be fooling you next is yourself.
|
|
|
|
|
|
Hello everyone,
Two basic questions about BeginInvoke in asynchronous model. More specifically I am asking from this URL,
http://msdn.microsoft.com/en-us/library/bb559033.aspx
1.
I am wondering whether there is any benefit to pass an object by reference to BeginInvoke? Since in EndInvoke, the results will be retrieved. So, pass by value is fine? Any benefits to pass by reference in BeginInvoke?
2.
Any needs to pass asyncState parameter? I think we can define enough values in the 1st input parameter to BeginInvoke and then asyncState parameter will become useless?
thanks in advance,
George
|
|
|
|
|
George_George wrote: I am wondering whether there is any benefit to pass an object by reference to BeginInvoke? Since in EndInvoke, the results will be retrieved. So, pass by value is fine? Any benefits to pass by reference in BeginInvoke?
which object are you talking about ? The question doesn't make any sense at all.
George_George wrote: Any needs to pass asyncState parameter? I think we can define enough values in the 1st input parameter to BeginInvoke and then asyncState parameter will become useless?
assyncState will be assigned to IAsyncResult 's AsyncState[^] property. So it is not useless.
|
|
|
|
|
Thanks N a v a n e e t h,
N a v a n e e t h wrote: which object are you talking about ? The question doesn't make any sense at all.
My question is more about asynchronous method call in Web Services scenario. For example,
http://www.codeproject.com/KB/cpp/async_xmlws.aspx[^]
In the beginXXX method, like BeginPrime, there are 3 parameters,
int num, System.AsyncCallback callback, object asyncState
My question is, I think the 3rd parameter is useless, since we can change the 1st parameter to some type which wraps both the 1st and 2nd parameter.
Any comments?
regards,
George
|
|
|
|
|
George_George wrote: My question is, I think the 3rd parameter is useless, since we can change the 1st parameter to some type which wraps both the 1st and 2nd parameter.
That's your case. They have made it generic to support everyones needs. The parameters are clear. asyncState can contain any user state, callBack will be the delegate which calls back. So it's the pattern. BTW, what is the issue you are facing ? Your question looks odd.
|
|
|
|
|
Thanks N a v a n e e t h!
My question is, I think using asyncState to transfer variable is useless as I can see from the sample, because we can wrap the asyncState into the 1st parameter of BeginInvoke method.
In another way to express, my question is in what situations does the 3rd parameter of BeginInvoke method have special function -- which we can not wrap it into the 1st parameter?
(my English is not good, please feel free to let me know if you have any questions about my description.)
regards,
George
|
|
|
|
|
George_George wrote: I think using asyncState to transfer variable is useless as I can see from the sample, because we can wrap the asyncState into the 1st parameter of BeginInvoke method.
Yeah, you can do that. C# is a flexible language. There are many ways to achieve result. If you felt that is the good design, go with that and pass null to asyncState.
George_George wrote: my question is in what situations does the 3rd parameter of BeginInvoke method have special function
When you won't be able to wrap the user state in the first parameter as you said.
|
|
|
|
|
Thanks N a v a n e e t h,
1.
There is a further question, suppose we pass a reference variable a to BeginInvoke method, then I think in the real actual asynchronous execution, the content of real object instance (which the variable is binded to) modified, correct?
2.
If it is yes to (1), then I think even before EndInvoke, in theory we can access the modified/updated content of the object instance by the reference variable, correct?
regards,
George
|
|
|
|
|
I think YES. Have you tried it ?
|
|
|
|
|
Hi N a v a n e e t h,
I asked two questions, you mean yes to both?
regards,
George
|
|
|
|
|
I am not sure as I haven't tried what you are asking. That's why I ended with a single YES. Better option is to try yourself.
|
|
|
|
|
Thanks N a v a n e e t h,
These days I am thinking and experimenting with a prototype. I want to use BeginRead and EndRead to prove what we discussed here,
http://www.codeproject.com/script/Forums/View.aspx?fid=1649&msg=2689514[^]
But find it is hard to retrieve in the middle of an asynchronous I/O reading. Do you have any ideas how to prototype and prove our two points discussed before?
regards,
George
|
|
|
|
|
Hi All,
are there any ways that i can generate these pieces of code by CodeDom:
public object GetAccessGetPatientCount(string firstName, string lastName)
{
using (PatientTableAdapter ta = new PatientTableAdapter())
{
// this is what i wanted, whihc has parameters
return ta.GetAccessGetPatientCount(firstName, lastName);
}
}
i am only able to generate these pieces of code:
public object GetAccessGetPatientCount(string firstName, string lastName)
{
using (PatientTableAdapter ta = new PatientTableAdapter())
{
// but i am only able to get the codes like this, which does not have parameters
return ta.GetAccessGetPatientCount;
}
}
by these c# codes:
webMethodDeclaration.Statements.Add(new CodeSnippetExpression("return ta." + methodInfo.Name));
Many thanks in advance.
Andie Du
|
|
|
|
|
AndieDu wrote: are there any ways that i can generate these pieces of code by CodeDom:
Yes, now what is the problem?
|
|
|
|
|
sorry mate, i didnt get what do you mean. My probleme has just been listed on my post. thanks a lot anyway
|
|
|
|
|
Hi there,
Am working on a Window project, i have created a User control using Infragistics Controls. i want to clear the value in the user control when i click on the "Clear" button. any advice hope to get reply soon
Regards
ybasha
|
|
|
|
|
Surely the control has a text or other property you can clear ? If their controls suck so bad that this simple operation is not clear, I suggest asking them, or on their support forums.
Christian Graus
No longer a Microsoft MVP, but still happy to answer your questions.
|
|
|
|
|
I created an application that converts an image to icon.. Most of my source codes are research from google.. The conversion was successful but unsatisfying results. Why? because the icon result has bad pixels and its like the color of the icon is the icon they used during windows version 3.1.. I've tried most of the source codes I have found anndd yep, all of them produced the same result. Do you have any work around on how to create a high quality version of the icon? I was wondering how GIMP does it cause GIMP has this save as ICO and the result is like the mini version of the image with complete colors.
|
|
|
|
|
Can you provide the code and even a link to examples if possible? Do you have full rights to the image? (I've seen people download images and try to convert them and they get all fudged up.)
Blog link to be reinstated at a later date.
|
|
|
|
|
I've studied most of the code and so far I think this is the main code that really converts an image source to an icon file. I removed other processes like getting the right proportion of the image during conversion.
private System.Drawing.Icon ImageToIcon(System.Drawing.Image image)
{
return System.Drawing.Icon.FromHandle(((Bitmap)image).Get Hicon());
}
And after the method has returned the icon, All I have to do now is to stream it to the computer storage device.
|
|
|
|
|
Icon.FromHandle may change the palette on you. It probably also does a quick and dirty resize. Try making a new icon sized Bitmap, getting its Graphics and then drawing your image to it using DrawImageScaled(?) with all the high quality options turned on. See what that looks like, and then see what it looks like in an icon.
|
|
|
|
|
I did. I get the image using Bitmap.. from that bitmap I made use of graphics to draw it in memory with the specific sizes.. then from the drawn icon that is from the memory I streamed it and save it to the hard disk device. Result? the same.
|
|
|
|
|
Hrmmm, make sure you set all the quality options on the Graphics object (look at interpolation) to their highest settings. Also try writing out the image to disk as a bitmap before you try to turn it into an item. You need to test if its the resize thats stuffing it up, or the icon conversion.
It might just be the case that the best the framework can do is a bicubic interpolation, and the GIMP does some extra magic for low resolutions.
|
|
|
|