|
Hi Graus,
If u don't mind. I am having another question. How can we draw a 3D surface plot in a c++ program. I am having the three (x,y,z) data generated in my program, but i don't know how to create a plot of them at runtime. I hope we have to create an activeX control to implement tht. But my program is a plain cpp program. At present i am writing all the data into a text file and opening it in an excel sheet seperately and then drawing the graph.
if we have to convert, how can we convert a plain cpp file to activeX and include tht functionality.
if u r familiar with this and r having some ideas, plz share with me...
thanks,
Suman
|
|
|
|
|
Suman Somanchi wrote:
how can we convert a plain cpp file to activeX and include tht functionality.
You want to turn your app into an ACtive X control, or you want it to consume an existing ActiveX control ? How will ActiveX plot 3D for you ? DirectX will, and the DirectX sdk has heaps of examples for you. I don't think you need direct X though, you need to do some reading on 3D math and then you can plot it yourself.
Christian
I have several lifelong friends that are New Yorkers but I have always gravitated toward the weirdo's. - Richard Stringer
|
|
|
|
|
Thanks Graus,
I will try to implement what u told and infact i am little bit aware of tht 2D to 3D geometry in my Computer Graphics course in my undergrad. For today I am stopping my programming, since I want to spend sometime on other subjects too. I will do it tommorow and let u know the improvements...
Suman
|
|
|
|
|
Hello there!
I´m having a problem here.
I have a xml file with many tags, and I only want to add information to one tag "<MediaInformation>". How can I read the file to that especific position and them add the text information "clip1.mpg".
Anyone can help me?!!
Thank you very much
|
|
|
|
|
The number of tags isn't so much an issue as the size of the file (tags names could be small, so the file could also be smaller). The easiest way is to load the document into an XmlDocument , use XPath to find the node, and add your node:
XmlDocument doc = new XmlDocument();
doc.Load("data.xml");
XmlNode node = doc.SelectSingleNode("//MediaInformation");
if (node != null)
{
XmlElement elem = doc.CreatElement("name");
elem.InnerText = "value";
node.AppendChild(elem);
} This is definitely only an example, though, since without knowing more about what you're trying to do I can make too many assumptions. If you're XML documents uses a namespace (typically a good idea if you allow for mixed schemas) then you'll need to use an XmlNamespaceManager , too. You can find more information and examples in the .NET Framework SDK.
This posting is provided "AS IS" with no warranties, and confers no rights.
Software Design Engineer
Developer Division Sustained Engineering
Microsoft
[My Articles] [My Blog]
|
|
|
|
|
First of all, I want to thank you for your help.
But the problem continues... =/
My XML struct it´s like show below...
<Mpeg7>
<MultimediaContent>
<AudioVisual>
<MediaInformation>
</MediaInformation>
</AudioVisual>
</MultimediaContent>
<Mpeg7>
And I want to add the tag "<name>clip1.mpg</name>" to the media information.
I´m trying to do this way
XmlDocument doc = new XmlDocument();
doc.Load("data.xml");
XmlNode node = doc.SelectSingleNode("//MediaInformation");
if (node != null)
{
XmlElement elem = doc.CreatElement("name");
elem.InnerText = "clip1.mpg";
node.AppendChild(elem);
}
It seams that MediaInformation don´t exist because the program never enter in the if condition.
Do you understand what is the problem?!!!
Thank you very much
|
|
|
|
|
I can't really help you much because you need to encode your XML or check "Do not treat <'s as HTML tags" when posting.
Instead of doc.SelectSingleNode , use doc.DocumentElement.SelectSingleNocde . Sorry.
If that doesn't work, it's probably because your XML document is using a default namespace in which case - like I said in my first reply - you have to use an XmlNamespaceManager and pass that along to SelectSingleNode . Default namespaces aren't supported very well, so use prefixes (prefixes don't have to match the source documents; only namespaces have to match):
XmlDocument doc = new XmlDocument();
doc.Load("data.xml");
XmlNamespaceManager nsmgr = new XmlNamespaceManager(doc.NameTable);
nsmgr.AddNamespace("def", "yourNamespace");
XmlNode = doc.SelectSingleNode("//def:MediaInformation", nsmgr);
This posting is provided "AS IS" with no warranties, and confers no rights.
Software Design Engineer
Developer Division Sustained Engineering
Microsoft
[My Articles] [My Blog]
|
|
|
|
|
but I check "Do not treat <'s as HTML tags" !!!
Can´t you see the XML code?!! =/
I think that I´m not using any namespace.
But the node gives always null...
|
|
|
|
|
hello again, I´m trying to find what is my namespace, my xml is like this...
<Mpeg7 xmlns="urn:mpeg:mpeg7:schema:2001" xmlns:xsi="http://www.w3.org.2001/XMLSchema-instance" xmlns:mpeg7="urn:mpeg:mpeg7:schema:2001">
<Description xsi:type="ContentEntityType">
<MultimediaContent xsi:type="AudioVisualType">
<AudioVisual>
<MediaInformation>
you said to use this thing
nsmgr.AddNamespace("def", "yourNamespace");
but my namespace what is?!!
thanks
|
|
|
|
|
You should really read-up on XML. All the "xmlns" attributes identify XML namespaces. Without ":something" after it (a namespace prefix), it identifies your default namespace (the namespace to use when you have no prefix). Therefore, your namespace is "urn:mpeg:mpeg7:schema:2001" and you need to modify my code like so:
nsmgr.AddNamespace("def", "urn:mpeg:mpeg7:schema:2001");
XmlNode node = doc.DocumentElement.SelectSingleNode("//def:MediaInformation");
This posting is provided "AS IS" with no warranties, and confers no rights.
Software Design Engineer
Developer Division Sustained Engineering
Microsoft
[My Articles] [My Blog]
|
|
|
|
|
|
/ means root, so unless MediaInformation is the root element, this won't work. Dropping any preceeding / means that MediaInformation must be a child of the current node. // means search under any node.
Without seeing his XML there's no way of knowing.
This posting is provided "AS IS" with no warranties, and confers no rights.
Software Design Engineer
Developer Division Sustained Engineering
Microsoft
[My Articles] [My Blog]
|
|
|
|
|
<?xml version="1.0" encoding="iso-8859-1" ?>
<Mpeg7 xmlns="urn:mpeg:mpeg7:schema:2001" xmlns:xsi="http://www.w3.org.2001/XMLSchema-instance" xmlns:mpeg7="urn:mpeg:mpeg7:schema:2001">
<Description xsi:type="ContentEntityType">
<MultimediaContent xsi:type="AudioVisualType">
<AudioVisual>
<MediaInformation>
</MediaInformation>
<TextAnnotation>
<FreeTextAnnotation>
Fim da partida Andrejs Rubins.
</FreeTextAnnotation>
</TextAnnotation>
<Semantic>
<Label>
<Name></Name>
</Label>
<SemanticBase xsi:type="EventType" id="68">
<Label>
<Name> Fim da partida </Name>
</Label>
<Relation Source="4"/>
<Relation Source="82"/>
<SemanticPlace>
<Label>
<Name> </Name>
</Label>
</SemanticPlace>
<SemanticTime>
<Label>
<Name> 90 </Name>
</Label>
</SemanticTime>
</SemanticBase>
<SemanticBase xsi:type="AgentObjectType" id="4">
<Label>
<Name> Letónia </Name>
</Label>
<Agent xsi:type="OrganizationType">
<Name>Letónia </Name>
</Agent>
</SemanticBase>
<SemanticBase xsi:type="AgentObjectType" id="82">
<Label>
<Name> Andrejs Rubins </Name>
</Label>
<Agent xsi:type="PersonType">
<Name>
<GivenName>Andrejs</GivenName>
<FamilyName>Rubins</FamilyName>
</Name>
</Agent>
</SemanticBase>
</Semantic>
</AudioVisual>
</MultimediaContent>
</Description>
</Mpeg7>
Here´s one example of my XML, I want to add information to the MediaInformation element. But I don´t know what is my namespace... =/
|
|
|
|
|
I'm trying to invoke a Web Service that has been secured with Basic authentication. (Its a Java webservice running on JBoss).
When I try to access the web service I get a HTTP 505 error implying that the HTTP Version is incorrect, but I doubt it is.
Can anyone who has accessed secure webservices have a look at the following client C# code and tell me if it looks OK. I need to establish if its my client (C#) code thats wrong, or the server (Java) code. Is this the correct way to authenticate against a web service that uses BASIC authentication?
Thanks.
proxy.AdministrationWS admin = new proxy.AdministrationWS();
NetworkCredential creds = new NetworkCredential("username", "password");
admin.PreAuthenticate=true;
admin.Credentials = creds;
try
{
String name = admin.DoStuff();
MessageBox.Show(name);
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
|
|
|
|
|
For BASIC you need to set a REALM (domain) with which to authentication. You also need to specify that BASIC authentication should be used by using the CredentialCache and assigning that to admin.Credentials :
NetworkCredential cred = new NetworkCredential(username, password, domain);
CredentialCache cache = new CredentialCache();
cache.Add(new Uri(url), "Basic", cred);
admin.Credentials = cache;
This posting is provided "AS IS" with no warranties, and confers no rights.
Software Design Engineer
Developer Division Sustained Engineering
Microsoft
[My Articles] [My Blog]
|
|
|
|
|
I just starting to work on C# last month. Just bear with me if I show my lack of experiences. I am trying to make program that populating the list in propertygrid. I found good article for me like this:http://www.codeproject.com/cs/miscctrl/customizingcollectiondata.asp#xx653437xx . But, I really have problem with standard editor. I cant rid the ... button(I think it called modal) from propertygrid. I tried to use : public override UITypeEditorEditStyle GetStyle(ITypeDescriptorContext context)
{
return UITypeEditorEditStyle.None;
}
but somehow it blocked me to show the list. For example, if I am using without codes above, then it will show whole list, but it showed the ... button(modal whatever it is) on the list that I dont want to see. If I am using with codes above, then it wont show the list at all but modal button wont appear at all. what is your suggestions about my situation?
about this articles that I linked, is there another way to make list in propertygrid instead using with CollectionBase, ICustomTypeDescriptor bec I dont like those?
My property grid should look like this:
CategoryAttribute:
+ ITEM1
+ ITEM2
+ ITEM3
+ ITEM4
+ ITEM5
Thanks in advance!!
|
|
|
|
|
Hi,
Software:
.NET 1.1 (both non-SP and SP1)
Visual Studio .NET 2003
MS SQL Server 2000 SP3
Windows XP SP 2
Hardware:
Intel Celeron 1700, Pentium 4 2.4GHz, AMD Athlon 1100
RAM 256-512 DDR
I've run into a strange problem. There is an application which allows to:
1) connect to a certain device using a modem
2) manage different aspects (mostly, working with MS SQL Server)
Serial communication is done on a separate thread, one per each connection.
The maximum number of simultaneous connections is 20.
Note: what is written below applies only when running the application not
under the debugger.
The app starts and works correctly: accepts incoming calls, performs
different scenarios, dials out when necessary. When the comms thread needs to
modify the UI, it is correctly done using Control.BeginInvoke. However,
sometimes (on different computers) the following exception is thrown:
System.OutOfMemory exception: error creating window handle --->
System.NullReferenceException: Object reference not set to an instance of
object.
at System.Windows.Forms.ThreadContext.OnThreadException
at System.Windows.Forms.Control.WndProcException
at System.Windows.Forms.ControlNativeWindow.OnThreadException
at System.Windows.Forms.NativeWindow.Callback(IntPtr, Int32, IntPtr, IntPtr)
at System.Windows.Forms.UnsafeNativeMethods.IntCreateWindowEx(int32, string,
string, int32, int32, int32, int32, int32, HandleRef, HandleRef, HandleRef,
object)
at System.Windows.Forms.UnsafeNativeMethods.CreateWindowEx(int32, string,
string, int32, int32, int32, int32, int32, HandleRef, HandleRef, HandleRef,
object)
at System.Windows.Forms.NativeWindow.CreateHandle(CreateParams)
-- End of inner exception stack trace --
at System.Windows.Forms.ThreadContext.OnThreadException
at System.Windows.Forms.Control.WndProcException
at System.Windows.Forms.ControlNativeWindow.OnThreadException
at System.Windows.Forms.SafeNativeMethods.ShowWindow(HandleRef, int32)
at System.Windows.Forms.Control.SetVisibleCore
at System.Windows.Forms.Form.SetVisibleCore
at System.Windows.Forms.Control.set_Visible
at System.Windows.Forms.Form.ShowDialog(IWin32Window owner)
at System.Windows.Forms.Form.ShowDialog
at <my form-my="" code="" to="" showdialog="">
What could be the problem?
Let me stress that this does not happen under debuggers. When debugging, the
exception is not thrown. It was noted that this happens more often when
having an active connection.
Regards,
Serge (Logic Software, Easy Projects .NET site)
|
|
|
|
|
I see from your stacktrace that you're using ShowDialog . When using modal dialogs, you need to make sure you dispose your forms or you will lose memory quickly. This isn't always a problem running under a debugger because the GC hasmore time to clean-up resources.
When displaying modal dialogs using ShowDialog , it's best to use the using block statement as below:
using (MyForm form = new MyForm())
{
form.ShowDialog();
} This compiles to something similar to this:
MyForm form = null;
try
{
form = new MyForm();
form.ShowDialog();
}
finally
{
if (form != null) ((IDisposable)form).Dispose();
} This way - even if an exception is thrown - the form's resources (i.e., the message pump on the new thread and other native resources used by the controls, since the controls merely encapsulate native Common Controls and other windows, are freed-up.
This posting is provided "AS IS" with no warranties, and confers no rights.
Software Design Engineer
Developer Division Sustained Engineering
Microsoft
[My Articles] [My Blog]
|
|
|
|
|
|
I did implement the scheme you suggested, however I'm still having the same problems. Could you suggest anything else? Should I call GC.Collect() manually? Or any other ideas?
Also, I put [STAThread] attribute as suggested to me at MSDN managed newsgroups, which also didn't help.
Regards,
Serge (Logic Software, Easy Projects .NET site)
|
|
|
|
|
I also met this problem days ago and finally found I set the value for a variable in wrong section(Notice the innerException). I set it in Form_Load(), and everything goes well when I move it to constructor. May this helps.
|
|
|
|
|
I was wondering if there is a built in function in C# that performs filling. I 'll give it the closed contour as an input and I need the filled contour as an output..Does anyone know a built in function that does that,or a ready made program that one did before that I could use. Please reply ASAP
EA
|
|
|
|
|
There are a number of articles with programming examples on this site (and others) relating to converting a bitmap to a region for irregularly shaped forms and controls. You can of course fill a region for any purpose
http://www.codeproject.com/csharp/bmprgnform.asp
Sorry I'm using FireFox, no clickety..
Gary
|
|
|
|
|
Hello!
My app open and shows HTML files.
I have a typical pdf-distiller printer driver on my system.
Is it possible to create a printfunction that print/save the shown HTML file automaticly?
- The user should only need to press the print button. I do not want the print dialog to be shown.
Any suggestions?
/sverre
|
|
|
|
|
I asked the same question a few months ago, and the answer was no
If you do find a method, please post me a reply!
Gary
|
|
|
|
|