|
You should be mindful of the service registration type. If you use a singleton - depending how the remoting object is hosted, yours calls may be synchronous while web service methods are not. This will result in synchronous-like method calls to your web service. The lifetime of the remoting object is also a factor. Basically, there's a lot of factors that go into this. If you're not familiar with .NET Remoting, I suggestion a couple of books. I just posted these earlier today, so I'll just refer you to that post[^].
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
Hi,
I have a combobox and now i want that you can see the first item when it's filled. Now it's empty and you can type in the combobox.
Thx!
|
|
|
|
|
You should change the DropDownStyle property to ComboBoxStyle.DropDownList . The default is DropDown and allows you type, where DropDownList doesn't. If you want the user to be able to type in new items, then you should set the SelectedIndex to 0.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
Hello,
I have a xml-file where some words are in uppercase. Is it possible to edit the entire file. So everything in the file is in lowercase?
thx in advance
|
|
|
|
|
Read the entire file into a String, just like any text file, then call the .ToLower method on the String, then write the new file out to a DIFFERENT file. Write it out a different file just to make sure nothing went wrong and you still have the original file to work from.
RageInTheMachine9532
|
|
|
|
|
While the two previous answers tell you how, I want to stress the "why and why not". If the XML elements and attributes are supposed to be a certain case, you should leave them. XML elements and attributes are case-sensitive. Changing them would cause any processors specific to that schema (like an XSLT or DOM parser) to fail (at least, identifying it as the appropriate doc type).
If this is a file you have created, then you must make sure that any processing is changed to use the lower-case elements and attributes.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
hi
why output of this code isn't Transparent.
Bitmap b = new Bitmap(100,20);<br />
Graphics g = Graphics.FromImage(b);<br />
g.Clear(Color.Transparent);<br />
g.DrawString("Test",new Font("Tahoma",8),new SolidBrush(Color.Green),0,0);<br />
b.Save("test.gif",System.Drawing.Imaging.ImageFormat.Gif);<br />
Close();<br />
thanks.
|
|
|
|
|
A GIF is an index image, so there is no transparent color. There is, however, a color that is masked so that the GIF appears transparent. See the Bitmap.MakeTransparent method. You provide it a color and that image is saved with that color's index marked as the transparent color so it appears transparent when displayed.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
Hi i am trying to get the value of an attribute displayed, but i can't seem to find the best way to get to it. If the element contains no attributes it returns -1?
XmlDocument document = new XmlDocument();<br />
document.Load("..\\..\\commands.xml");<br />
<br />
XmlNodeReader reader = new XmlNodeReader(document);<br />
<br />
this.Show();<br />
<br />
while (reader.Read())<br />
{<br />
switch (reader.NodeType)<br />
{<br />
case XmlNodeType.Element:<br />
int attributes = reader.AttributeCount;<br />
cmdOutput.Text += "<" + reader.Name + reader.GetAttribute(attributes) + ">";<br />
break;<br />
case XmlNodeType.Text:<br />
cmdOutput.Text += "\t" + reader.Value + "\r\n";<br />
break;<br />
case XmlNodeType.EndElement:<br />
cmdOutput.Text += "</" + reader.Name + ">\r\n";<br />
break;<br />
}<br />
}
|
|
|
|
|
Why not just have a case for the XmlNodeType.Attribute ? Your switch cases will be called appropriately so even if you were to just write-out the attribute, it will happen in between XmlNodeType.Element and XmlNodeType.Text or XmlNodeType.EndElement , if there are any attributes. What you have anyway will not work anyway. AttributeCount - 1 would be the index of the last attribute. Remember that indexes in the .NET FCL are 0-based.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
Hello,
Is there a way to sort an xml with xslt faster? Right now a file with 15 records takes about 9 seconds. A file with 60 records takes about 15 seconds. I probably won't have more then 60 records but a file with 1000 records takes about 2 minutes. 15 seconds is still a little to long i think, is it possible to make it faster?
Thx in advance
|
|
|
|
|
How is the sorting being done? Through code you wrote or through an for-each order-by?
RageInTheMachine9532
|
|
|
|
|
Hi,
i did it like this:
private void SortXml(string sortOrder, string sortString)
{
xml.Load(filePath);
string pad = "//session[@name='" + cboSessions.SelectedItem.ToString() + "']";
XmlNodeList selectedNode = xml.SelectNodes(pad);
string box = selectedNode.Item(0).OuterXml;
xml.LoadXml(box);
XmlTextWriter xmltw = new XmlTextWriter(hulpfilePath,new UTF8Encoding(false));
xml.WriteTo(xmltw);
xmltw.Close();
string xsl = "<xsl:stylesheet version=\"1.0\" xmlns:xsl=\"http://www.w3.org/1999/XSL/Transform\">"
+ "<xsl:template match=\"@*|node()\">"
+ "<xsl:copy>"
+ " <xsl:apply-templates select=\"@*|node()\">"
+ "<xsl:sort data-type=\"number\"" + " select=\""+ sortString +"\"" + " order=\"" + sortOrder + "\"" + "/>"
+ "</xsl:apply-templates>"
+ "</xsl:copy>"
+ "</xsl:template>"
+ "</xsl:stylesheet>";
XslTransform xslt = new XslTransform();
StringReader rdr = new StringReader(xsl);
xslt.Load(new XPathDocument(rdr), null,null);
xslt.Transform(hulpfilePath,hulpfilePath,null);
ds.Clear();
ds.ReadXml(hulpfilePath);
File.Delete(hulpfilePath);
}
|
|
|
|
|
Since your having an XSL stylesheet do the sorting for you, there isn't really a way to get a significant speed increase. The only thing I can think of trying is loading the XML document and writing the sort yourself, shuffling around nodes using you own sort algorithm. But I don't know if your going to get the kind of performance your looking for. You could only try it and see.
I haven't had the cause to sort an XML file myself. I usually just get the data I need and have the visual control sort it as needed.
RageInTheMachine9532
"...a pungent, gastly, stinky piece of cheese!" -- The Roaming Nome
|
|
|
|
|
i did it like appelz did it
thx for the help
|
|
|
|
|
Hello,
I want to open a file for my program. I'm doing it with the openfiledialog but my file can also be on a server. How can i get that file then? Is it possible?
thx in advance
|
|
|
|
|
OpenFileDialog Op=new OpenFileDialog();
Op.ShowDialog();
System.Diagnostics.Process.Start(Op.FileName.ToString());
Sreejith S S Nair
|
|
|
|
|
It depends on how you can access that server. If you access the file through a UNC, the OpenFileDialog can do that and most classes in the .NET FCL can use UNC paths. If it's an HTTP path, the OpenFileDialog can reference the file if you have the HTTP server in your Network Locations "directory", but most classes that deal with files won't be able to access it. You'd have to use a WebClient or something to download it first.
One agnostics way would be to use a WebRequest to request the file using the file path. If it's a local or UNC file path, a FileWebRequest is returned. If it's an HTTP URL, an HttpWebRequest is returned.
Really, though - you don't need to care. WebRequest.GetResponse returns a WebResponse which you can use to "download" (copy to local) the file and then you can work on it however you want. The WebRequest /WebResponse classes are pluggable protocols, and you can find out more information about them in the .NET Framework SDK under the System.Net namespace.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
|
Hi,
I have a dll. I want to know the functions inside the dll. I don't have documentation about it. I there any way to know that.
Karteek
|
|
|
|
|
If it is an unmanaged DLL, I don't think there is anyway to find out. If it is managed, you can always decompile it - using, for example, the .net reflector[^]
|
|
|
|
|
You could use the Depends tool that comes with Visual Studio 6 to get the function names (possibly!), but not the parameters that those functions use. On top of that, without the documentation, there is no way your going to know what those functions are used for and how to properly use them.
RageInTheMachine9532
|
|
|
|
|
Hi!
I would like to show a progess-window while a hardware-reading process blocks the running threat.
I tried to intercommunicate with
ProcessStartInfo startInfo =
new processStartInfo("Animation.exe");
startInfo.FileName=@"c:\animation.exe";
startInfo.UseShellExecute=false;
startInfo.RedirectStandardInput=true;
Process Anima=Process.Start(startInfo);
...
Anima.StandardInput.WriteLine("1");
But how can I read the Standard Input in a WinForm?
Or am I on a bad track?
Thanks
Ariadne
|
|
|
|
|
First you have to redirect the StandardOutput:
startInfo.RedirectStandardOutput=true;
Then you can read the output stream just like any test file stream, for example:
String outText = Anima.StandardOuput.ReadToEnd();
RageInTheMachine9532
|
|
|
|
|
Dave thank you,
but that is not my question.
My Question: How do I write in Animation.exe (WinForms-App) to the standard output-stream?
|
|
|
|