|
If it is a tool which takes a command line, executes and closes, then for each 'command' you should start a new process, with the command line you want to send, and capture the output. You can do that with Process.Start (set the ProcessStartInfo up to redirect the console streams). The fact it's on Unix shouldn't matter as long as Mono supports that part of the framework, and I'd be astonished if it doesn't.
|
|
|
|
|
|
I'm not sure, I will have to see if that is possible.
It is a Unix/Solaris SAN server connected to a fiber card of the windows server.
|
|
|
|
|
Hi,
I have a string with the format yyyymmdd.
I'm trying to convert it to date time by DateTime.Parse(myString),
but i'm getting an error.
How can i convert it?
|
|
|
|
|
DateTime.ParseExact("20011215", "yyyyMMdd"); //note the capital M's
|
|
|
|
|
Ennis Ray Lynch, Jr. wrote: DateTime.ParseExact("20011215", "yyyyMMdd"); //note the capital M's
What about the IFormatProvider at the constructor?
There is no constructor at the ParseExact that takes 2 parameters
modified on Wednesday, June 15, 2011 3:37 PM
|
|
|
|
|
DateTime d = DateTime.ParseExact("20011215", "yyyyMMdd", System.Globalization.CultureInfo.InvariantCulture);
|
|
|
|
|
10x
|
|
|
|
|
In addition to the other answers, there is also Convert.ToDateTime(something)
Always nice to know different methods of doing something.
|
|
|
|
|
That would not help in this case.
|
|
|
|
|
Probably not, but I don't know all the possible Culture formats available. There might be one out there who decided to use sensible dates.
|
|
|
|
|
1. What is the error it gives you
2. Use the TryParseExact function.
3. Read up on MSDN for the format string options[^]
Hope this helps.
V.
|
|
|
|
|
I have Invoice entity wich I change and then add InvoiceRows and then I want to cancel the whole operation.
What is the easiest way of doing this?
I can use Context.refresh() to get a fresh copy of my Entity but is this really the way to do it?
//h
|
|
|
|
|
I would use Context.Refresh(RefreshMode.StoreWins, obj) as my "Plan B".
My "Plan A" would be keeping changes outside of Context until they are ready to be committed, and then apply and commit them in an atomic operation. This requires more work as you need to track the state of newly added entities, but I think it is worth it, because the approach is cleaner overall.
|
|
|
|
|
Transaction. I've not worked with them with Entity Framework myself, but that seems like what you want.
|
|
|
|
|
Hi experts,
there is a PropertyGrid in my application. It shows properties of an object. Some of these properties can hold values that are illegal to business logic. Those values show a warning symbol by using a custom TypeEditor. Mentioned properties are marked by an attribute.
Some of the properties are even linked. Business logic decides whether or not a combination of linked properties is illegal.
To this point all is fine.
Now the PropertyGrid has to show properties of multiple objects and the warning symbols don't work any longer.
This method should tell whether a property can, depending on its value, warn by setting the symbol
public override bool GetPaintValueSupported(System.ComponentModel.ITypeDescriptorContext context)
{
if (
context.PropertyDescriptor.PropertyType.IsEnum
&& Enum.IsDefined(context.PropertyDescriptor.PropertyType, "Invalid")
)
return(true);
foreach(Attribute attribute in context.PropertyDescriptor.Attributes)
if(attribute is WarnableAttribute)
return(true);
return (false);
}
The marked line fails for multiple objects.context.PropertyDescriptor is a PropertyGridInternal.MergePropertyDescriptor , which is not accessible due to access levels.
How could I test for an icon to be painted?
Edit: It's working now thanks to ITypeDescriptorContext containing an object called instance , which is an Array when selecting multiple objects.
Knowing that, it's possible to check for attributes with some reflection.
Ciao,
luker
modified on Friday, June 17, 2011 3:19 AM
|
|
|
|
|
Environment – VS2010, Window 7;iis7.0
We have created a Web service (EDI_Translate) and we are consuming this webservice in C# console application. This console application calls the web service in a loop continuously in different thread. The web server handles the request sequentially (like first in first out) but we want web server to handle the request parallely to boost the performance. What should be done in webservice code or web server in order to handle the request paralley by webservice code .
Ramesh Kumar Singh
Software Engineer
Ness Technologies
India
|
|
|
|
|
Without knowing anything at all about what the webservice actually does or how it does it how do you expect anyone to accurately answer this?
I know the language. I've read a book. - _Madmatt
|
|
|
|
|
Calling the service in a loop sounds pretty serial to me. I suspect that the client is making requests in that form, and the server is not serialising them. Web services are (I think) intrinsically parallel. Try starting two clients and see if they interleave.
|
|
|
|
|
Hello everyone this is my first post so be gentle.
I've implemented a solution to download file,
the problem is that specific pdf files can't be downloaded with lots of bytes per package therefore I want to decrease the number of packages but in order to reduce the waiting time until download completion I want to download the file in sections which means to download parts of the file simultaneously when I implemented it I got an exception "Stream does'nt support multiple IO accesses" probably I'm doing something wrong can someone tell me what should I correct or how should I do it?
for (int i = 0; i < numberOfParts; i++)
{
httpRequest.AddRange("splittedDownload",Convert.ToInt32(i * size / 5),Convert.ToInt32((i+1) * size / 5-1));
httpResponse = (HttpWebResponse)httpRequest.GetResponse();
streams.Add(new MyStream(httpResponse.GetResponseStream(),i+1));
IAsyncResult result = streams[i].Input.BeginRead(buffer, 0, paketSize, AsyncDownload, streams[i]);
}
Thanks.
|
|
|
|
|
You can't read a network stream with random access because the data you are trying to access doesn't exist yet. I don't think HTTP supports downloading files in sections, but I'm not sure about that – it supports starting a download from a particular point (that's how browsers can resume a download so you might be able to fire multiple requests for parts of a file.
Chances are though that the waiting time is to do with your connection speed and not this.
|
|
|
|
|
Thank you for the reply,
I've used AddRange in order to start downloading from specific place I think this is the method in order to do it please correct me if I'm wrong but the first request goes well but when I tried to start the second Async operation I get the exception.
I checked the pdf issue and I can see that I can download rar files in packets of 1024 bytes (I didn't check it with bigger packets) but pdf files are recieved corrupted if I download more than 2 bytes every time so it effects the download speed (the same file with 1024 bytes is downloaded in 26 seconds now with 2 bytes it grows to 37 seconds and this is small file,about 2.5 MB) so I think this is the right solution, can you please tell me what is may be wrong in my code in my last correspondence?
Thank you very much.
|
|
|
|
|
The number of bytes you read at a time should not affect the output. You are doing something wrong in your reading code if that is the case (perhaps writing the buffer size, not the actual number of bytes read, at each step). It should be something like
byte[] buf = new byte[buf_size];
int read;
while(0 < read = stream.Read(buf, buf_size)){
outStream.Write(buf, 0, read);
}
A common mistake is to write buf_size bytes to the output, not read bytes.
2.5MB in 26 seconds is roughly 800kbps, that is quite plausible for a transfer from the public internet.
|
|
|
|
|
Thanks, that was the problem
now I can download the 2.5MB file in about 13 seconds
anyway I would like to know what I did wrong with the download in parts (just to learn for the next time) but its not that urgent anymore.
Thank you very much
|
|
|
|
|
Hello Everybody,
I am drawing text, rectangle and Line. In which have i am tring to zoom Text but i m confused how to zoom text as per as zoom level.
Eg : Rectangle r = new Rectangle (x,y,width * zoomlevel,height * zoomlevel);
How to Zoom Text for ZoomLevel.
Thanks
If you can think then I Can.
|
|
|
|