|
Of course that dll's is in the same place. I copied that Dll into Debug and Release directory. That's why my Code work when I change unsafe public override string Text with unsafe public string TheText
Both can't work if the Dll is not in the right directory, right?
I'm still confused with this problem
No one can prevent me to learn something
|
|
|
|
|
What is the correct syntax to pass the value of index to the underlined code?
where in if index=2
XmlNodeList xmlNodes = xmlHelp.SelectNodes(string.Format("//Help[@name='{0}']/Item[2]", tag));
Below is my code:
protected void GetItemHelp(int index)
{
string tag = Request["ref"];
string sHelpFile = Server.MapPath("~/Help.xml");
try
{
XmlDocument xmlHelp = new XmlDocument();
xmlHelp.Load(sHelpFile);
XmlNodeList xmlNodes = xmlHelp.SelectNodes(string.Format("//Help[@name='{0}']/Item[1]", tag));
if (xmlNodes.Count > 0)
{
itemText.Text = xmlNodes[0].InnerXml;
}
else
{
itemText.Text = " [" + Server.HtmlEncode(tag) + "] Help is currently not available for this page.";
}
}
catch
{
itemText.Text = "Help is currently not available.";
throw;
}
}
|
|
|
|
|
XmlNodeList xmlNodes = xmlHelp.SelectNodes(string.Format("//Help[@name='{0}']/Item[{1}]", tag, index));
|
|
|
|
|
Hello Navaneeth
I tried doing that but it is giving me all the items in the list. It is not getting the 2nd item.
Based on the XML below, it will display Item1.
<HelpFile>
<Help name="name2">
<Item>
<p><strong>Item1</strong></p>
</Item>
<Item>
<p><strong>Item2</strong></p>
<Item>
</Help>
</HelpFile>
Because if I will simply write this, I can display Item2
xmlHelp.SelectNodes(string.Format("//Help[@name='{0}']/Item[2]
Any idea what am I missing?
|
|
|
|
|
Hello everyone,
I want to generate a list of all available machines on the LAN. Can anybody help me out that how can I do this?
Regards, Qaiser Nadeem
|
|
|
|
|
Why not searching for it? This[^] was my first hit when I searched in google.
|
|
|
|
|
Hello everyone,
I noticed in some code, in a derived class, the constructor will be written in a way like this, my question is whether it is good code to add base()? Because I think
- base() will be implicitly called for derived class constructor if we do not pass any parameters to base class;
- if we need to pass any parameters, I think we could declare in this way and pass parameter to base class in :base (parameters to base class constructor);
- so there is no need to declare in this way.
Any comments? Is my understanding correct?
DerivedClassConstructor():base()
{
}
thanks in advance,
George
|
|
|
|
|
When derived class is instantiated, base classes default constructor(parameterless one) will be called. If there is no default constructor available for base class, you should use base keyword to specify which base constructor has to be called. Not using base in this scenario will be a compile time error.
|
|
|
|
|
Hi Navaneeth,
1.
If there is a constructor is base class without any parameters, it should be the default constructor, correct?
2.
BTW: how to define a constructor to be default one if I have a couple of overloaded constructors?
regards,
George
|
|
|
|
|
George_George wrote: If there is a constructor is base class without any parameters, it should be the default constructor, correct?
Yes
George_George wrote: BTW: how to define a constructor to be default one if I have a couple of overloaded constructors?
You can't. There's no default constructor in this case, you have to call one yourself.
The parameterless constructor should still be the default one though.
regards
modified 12-Sep-18 21:01pm.
|
|
|
|
|
Thanks Greeeg,
How could I know which constructor is the default constructor?
regards,
George
|
|
|
|
|
Take a look at this link[^].
regards
modified 12-Sep-18 21:01pm.
|
|
|
|
|
So, no matter the system provided constructor or the user provided constructor, if the constructor has no parameters, it could both be called default constructor?
regards,
George
|
|
|
|
|
Yes. Why don't you write a simple app and test this yourself?
|
|
|
|
|
I would like to write a Windows service in C#, but I have a few doubts that I would like to clarify.
Given the user having Administrator rights, is there a way to prevent the user from killing the Windows service process from command-line or task manager? If such an attempt was made (killing the Windows service process), can I write a prompt dialog to have the user input some sort of password before it shuts down?
Thanks.
|
|
|
|
|
If the user has admin rights, they can modify the status of any running service.
Zerox MXI wrote: can I write a prompt dialog to have the user input some sort of password before it shuts down?
Services don't have a user interface. You'd probably have to write a system tray application that provides the interface, and the user then has to use that application to stop the service. In order to force this, you'd have to write your service so that it can only be stopped via the system tray application.
All this is totally outside the realm of "standard practice", so consider carefully before you do this.
"Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997 ----- "...the staggering layers of obscenity in your statement make it a work of art on so many levels." - Jason Jystad, 10/26/2001
|
|
|
|
|
Hi Guy's
I do not post often, google serves me well.
I cannot find the language though to search for the answer to my current dilema. Please help.
I want to ftp a file which is still being created. The file may take 10 to 15 mins to make. I would like it to arrive at it's destination as soon as it is completed.
I only work in c#. Can it be done. can ftp be throtled to stay in pace with the creation process?
thank you all in advance.
seems arrogant to assume folks will read such things. but thank you anyway.
J.
|
|
|
|
|
ltheonel wrote: I want to ftp a file which is still being created. The file may take 10 to 15 mins to make. I would like it to arrive at it's destination as soon as it is completed.
Do you want to download that file after it is created fully?
If you know the file size before, you can get the remote file's size, compare it with the expected size. If it matches, consider the file creation is complete.
Please correct me if I got your question wrong.
|
|
|
|
|
Hi, Thanks for responding.
Sorry I was a little vague.
My process at the moment is thus:
I am creating the file myself locally and when it is finished I then sent to remote
I cannont know the size of the file beforehand but I do know when I am finished creating it.
My problem is two fold:
1. How to access a file which is currently being written too. (the file I am creating)
2. How to control the speed at which I upload the file so that I can match the pace of the creation process.
|
|
|
|
|
Yes. You can do this. I have done this last early last year. I created a tiny text editor that would upload my web pages AS I WAS CREATING THEM. I acheived this by using the TextChanged Event of the TextBox control. Then I added code to the TextChanged event handler that would save the text inside TextBox control to a string. Then, I uploaded the text inside the string to my ftp sever. By doing this, everytime the TextBox control is "changed" it would save to string and upload. Save to string and upload.
So, in short:
Create TextChanged Event Handler for TextBoxControl (or whatever input control you're using)
Add the code that will save the controls text to a string
Upload string's text to server (make sure you use Append. Instead of Write.)
Hope this helps. There's alot of code involved in this (hence the reason I didn't post it here)...
jt.
p.s. let me know how it goes...
|
|
|
|
|
Thank you for your response.
I got a solution. though I am having buffer starvation issues!!
I instigate the file creation from a third party application. It takes a variable time to create the file I want to transfer via FTP.
I was chewing too big a problem, and of course once I reduced it. the solution was easy.
A lower level call to open a file as shared read on a thread I can sleep. (I have problems with this approach as my reader thinks the file writing is complested when thats not true)
but upto about 20mins I am good.
at any rate the bytes I read I feed to a queue for the FTP process and all works well till my file reader thinks the file is ended.
I will solve this shortly if you are interested, I will post the solution.
if not
Thx for your responses.
J.
|
|
|
|
|
Nice work, J. I am very interested to see how things go
j.t.
|
|
|
|
|
Cool, now that I've got the basics nailed. I'm off to work on the server core which uses remoting, so it'll be a couple of weeks no doubt
j.
- Why does everything you want to do require you to learn one more thing?!!!
|
|
|
|
|
Hello!
If I have a XML File which is at first a serialization of a class done by application A, is there a way to create in application B, which does not know how the class should look like, a class with the correct structure just by this xml file?
e.g:
Aplication a:
[Serializeable]
class A1
{
prop string s1 {get;set;}
prop int i1 {get; set;}
}
{
A1 a1 =new A1(){a1="test", i1=1};
XmlSerializer xser = new XmlSerializer(typeof(a1.GetType());
StreamWriter writer = new StreamWriter(...);
xser.Serialize(writer);
}
Now I have the xml file.
Application b:
{//MainThread
TODO: Desirialize the xml file
without knowing class A1 from application a
Or maybe this can be done by creating an xsd file first (and if so how this can be done?)?
|
|
|
|
|
ezazazel wrote: is there a way to create in application B, which does not know how the class should look like
How about both classes implement a common interface? After deserializing, you can cast that object to this interface instance.
|
|
|
|