|
Hello all,
I was not sure if I should throw this into C# or Asp.net forum, please move if you feel appropriate.
Situation:
Programming an ASP website that will allow scheduling and connecting to a remote Cisco router to help students learn to configure Cisco routers during their Cisco classes. If you did not know, Vista no longer has Hyperterminal as XP did, and Hyperterminal is no longer free. Aside from the fact that there are some open source/free TCP/IP clients out there, the need arises to make it as simple for the student as possible.
My solution was/is to provide the solution via a webpage.
Problem:
I am quite new to ASP in general, though not C#. I wrote my own "Telnet" client that connects to the router and so far as I can tell works quite well. I am now trying to translate this Winforms application over to a ASP page that can be deployed onto the schools' server.
I used a TCPClient and Stream in the Winforms application to work out the telnet client part. In trying to translate this over to an ASP page, I am unclear exactly where I need to put the connection info (ie Page_Load). I need to keep the connection open to the router at all times. Currently in my Page_Load, I establish the connection and stream, however stream.DataAvailable does not seem to work (I was using it in a loop to get the greeting and passphrase prompt). However, if I just read the stream, in a combination of 2 separate Do..While loops, I get the initial greeting/passphrase prompt.
Aside from that issue, the stream is disconnected after the initial Page_Load. I need to be able to keep the connection alive for the duration that the user is logged into/viewing the webpage, and also process (via a textbox entry line on the same webpage) any commands sent by the person connected.
Can anyone provide some suggestions on how to accomplish this? Is anyone available via some form of Instant Messenger that can maybe help me out (I would not normally ask this, but, I do not know any other programmers in my area)?
Any help would be appreciated!
Thanks!
|
|
|
|
|
I know it doesn't really answer your question, but Vista does actually include a TelNet client. If you go into 'Programs and Features', then 'Turn Windows features on or off' and TelNet client is visible about six entries from the bottom (this is on Vista Home Premium). You can then run it from the Command Prompt as 'telnet', with 'telnet /?' explaining the command line arguments.
Modified: Corrected spellings.
|
|
|
|
|
Yes, true, telnet is available in that way. I did know about that, but thanks for the reply. Trying to tie together the two OS's though is really the issue. I guess I may be over complicating it a bit, we could just supply two different instruction sets. I figured the easy solution was a web page that does not depend upon the OS, if you get my drift. You are correct in that respect though.
|
|
|
|
|
Passing a SQL 2005 varBinary object (a Word document) to an instance of Word.Application --> Word.Document. This site has given me great guidance thusfar but I can't seem to make that connection with that SQL return (reader) of a word document and assigning it to a Word.Document object. I am working in C#, but a VB example is okay.
Kindly advise,
Dunloe
|
|
|
|
|
I'm not sure if this is what you're after but if you have stored the whole Word document in a varbinary field, save the contents to a file with doc extension. After that open it simply by executing the file in a shell (with Process.Start method) or use Word interop if you want to add it to an existing document.
Hope this helps,
Mika
The need to optimize rises from a bad design.
My articles[ ^]
|
|
|
|
|
Mika,
I am sorry, I wasted your time. I have resolved my issue.
Thanks,
dunloe
|
|
|
|
|
No problem at all. You don't have to be sorry if your problem got solved.
If you feel afterwards that your post or my reply was somehow 'bad' or that something should have been figured out earlier, it's only part of the learning process and it goes both ways.
Mika
The need to optimize rises from a bad design.
My articles[ ^]
|
|
|
|
|
I am an existentialist that happens to be a programmer. There is no right or wrong. In our realm just syntax, and the sharing of that syntax.
All the best,
dunloe
|
|
|
|
|
hi...i wrote this code to read the input of textbox, and i wanna to classify each input to compute the given expression i want to store each operand in an index of arrayList ... as example:
suppose the input is : 22+99*7
then when i display the contents of the arrayKist results should be :
22
+
99
*
this is my Code please i realyy need help i stuck here:
private void equal_Click(object sender, EventArgs e)
{
ArrayList equation = new ArrayList();
string input = textInput.Text;
char[] Buffer = input.ToCharArray();
string tempString="";
try
{
FileStream historyFile = new FileStream("History.txt", FileMode.Append, FileAccess.Write);
StreamWriter sw = new StreamWriter(historyFile);
DateTime log = new DateTime();
sw.WriteLine(input + ": @ time " + log.TimeOfDay + "@ date " + log.Date);
sw.Close();
historyFile.Close();
}
catch( FileNotFoundException l)
{
MessageBox.Show("Logs File Not Found !!","Error Message");
FileStream exeptionFile = new FileStream("Errors.txt", FileMode.Append, FileAccess.Write);
StreamWriter sw = new StreamWriter(exeptionFile);
sw.WriteLine(l.ToString ());
sw.Close();
exeptionFile.Close();
}
for (int i = 0; i < Buffer.Length; i++)
{
if (char.IsDigit(Buffer[i]))
{
tempString += Buffer[i];
for (int j = i + 1; j < Buffer.Length; j++)
{
if(char.IsDigit (Buffer[j]))
tempString += Buffer[j];
}
}
else if (char.IsLetter (Buffer[i]))
{
tempString += Buffer[i];
for (int j = i + 1; j < Buffer.Length; j++)
{
if (char.IsLetter(Buffer[j]))
tempString += Buffer[j];
}
}
else if (char.IsSymbol (Buffer[i]))
{
tempString += Buffer[i];
for (int j = i + 1; j < Buffer.Length; j++)
{
if (char.IsSymbol(Buffer[j]))
tempString += Buffer[j];
}
}
equation.Add(tempString);
}
for (int t=0; t<equation.Count ;t++)
MessageBox.Show(equation[t].ToString());
}
while(1)
System.out.println("I love Palestine ");
|
|
|
|
|
You didn't quite indicate your exact problem.
However, perhaps you could use String.Split (for known operators) to find each operand and then test that operand is valid for example using Decimal.TryParse .
Hope this helps,
Mika
The need to optimize rises from a bad design.
My articles[ ^]
|
|
|
|
|
thanks mika...
my exact problem is that i cant get the operands exactly as extra operands are stored such the instead of storin just the 22 it stores also 2 and insted of 222 it stores two other operands 22 and 2 ... have i explained well??!!
there isnt just one operand to split around its all operands(mathmatical operations)...
what do think now?
thnx in advance..
while(1)
System.out.println("I love Palestine ");
|
|
|
|
|
I can usually reduce posted code quite a bit, but this time it really got a lot smaller.
string[] equation = Regex.Split(textInput.Text, "([+-*/])");
Despite everything, the person most likely to be fooling you next is yourself.
|
|
|
|
|
ok gofa...thanks
but it gives compiler error on the word: Regex
Error 1 The name 'Regex' does not exist in the current context
while(1)
System.out.println("I love Palestine ");
|
|
|
|
|
Add a using System.Text.RegularExpressions; to the code, or specify the full namespace of the class as System.Text.RegularExpressions.Regex .
Despite everything, the person most likely to be fooling you next is yourself.
|
|
|
|
|
You can split all at once since the parameter for Split is an array. For example:
string [] split = words.Split(new Char [] {'+', '-', '*', '/'});
or you can use Regex as Guffa suggested.
However I thought that you don't want split with all operations at once since then you may have a problem in knowing what were the original operations.
The need to optimize rises from a bad design.
My articles[ ^]
|
|
|
|
|
hi...thanks alot
but i really have problem in determining what the operation order was
also..i tried the codeline you wrote but it gives a compiler erorr on the words:
Error 1 The name 'words' does not exist in the current context
i appraciate your help
while(1)
System.out.println("I love Palestine ");
|
|
|
|
|
For the compiler error: the words was only a variable name. In your case use the variable where you have the original string you want to split.
And then the logic (since this seems to be a homework assignment I won't go to full blown solution). One (brute force) way to handle this could be:
- create a class that holds information about the input string, number and operation (three separate properties)
- create a generic list for this type where you will store individual 'elements'
- break the operations one by one into parts and add them to the list to the place where you parsed them.
Something like following (let's say the class name is Operation:
First you have only one Operation instance in the list, which has three properties
1: text: 22+35-76+28*5, number: empty, operation: empty
if you split the text using plus, you could then have three instances on the list
1: text: empty, number: 22 operation: +
2: text: 35-76, number: empty, operation: +
3: text: 28*5, number: empty, operation: empty
then if you split using minus you could have four instances (note the order)
1: text: empty, number: 22 operation: +
2: text: empty, number: 35, operation: -
3: text: empty, number: 76, operation: +
4: text: 28*5, number: empty, operation: empty
and so on.
This won't entirely solve the issue you have, but perhaps gets you forward.
The need to optimize rises from a bad design.
My articles[ ^]
|
|
|
|
|
I have the following case statement where I am looking for a enter key being pushed to be in the suffix. I need this to be a enter but I can not seem to figure out how to add the char(13) as I can not make it into a string and fit into the const setting. Can someone help me with this?
<code>
string keyAscii = e.KeyChar.ToString();
const string Prefix = "|~";
const string Sufix = "";
switch(keyAscii)
{
case Prefix:
break;
case Sufix:
break;
default:
break;
}
</code>
|
|
|
|
|
|
|
Hi
i want to insert datatable object to database, i know which can do this by SqlDataAdapter.Update() or TableAdapter.Update() methods, but my question is that is this work correctly for enterprise systems ?
have it high performance ?
what's best approach for this aim ?
(beacuse currently, i am develping a large application (enterprise system) for at least 800 concurrent users).
any idea would be appreciated
thanks
|
|
|
|
|
It sounds like you are using the MS data wizard objects. You should build a data access layer (DAL) and use dataset.fill, datareader and datatable. You should also be doing the CRUD via stored procedures.
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
Hi All,
In both my last job and my current job we have had applications that sit on (very) busy PC's which typically run anywhere between 10-20 spreadsheets in Excel, several internet explorers, market data systems etc. In both cases our C# application always runs out of handles and stops working (throws exceptions etc) with problems in the call to CreateHandle. Clearly whats happening is we are hitting the internal win32 handle limits. I know of a registry entry that I can change that will increase the limit but this at best still only stalls the problem - not fixes it. Others among you must have seen this problem so what did you do about it?
Cheers,
E.
|
|
|
|
|
I had many applications which works on busy systems and working without any issues. Looks like you have some design issues. Hard to help without getting more information on what you are trying to do.
|
|
|
|
|
Hello community,
I'm writing a programm which shell set other windows to the foreground. So I would like to know how I can check which process a window has, that I select via a mouse click. Is this possible with a API function?
Best regards
MyPiano
|
|
|
|