|
I was wondering how to find the source code line / filename (__LINE__/__FILE__ equivalent) when using the Compact Framework, since the System.Diagnostics.StackTrace class is not supported? Goal is to support logging of location of errors in release as well as debug. Has anyone found a technique using Trace, perhaps?
|
|
|
|
|
|
I see the .NET Framework have GraphicsPath class to do this but in .NET Compact Framework don't have it. How can i hit the lines? Thanks
Nothing
-- modified at 20:07 Thursday 2nd February, 2006
|
|
|
|
|
hello, this is my first 2 weeks in programming language, iam taking visual C++ and Visual C# and i need a help in C#
if i have a company and inside it i have 3 departments, each department has a symbol, like : A-Adminstration.etc..
i wanna define a char variable like this :
char depar = ( and here i wanna write that 'A' means Adminstrations and 'I' means Information), so when the user enters a symbol, appeares the full name of the department.
so how can i define in ?
-- modified at 11:06 Wednesday 1st February, 2006
|
|
|
|
|
http://www.parashift.com/c++-faq-lite/how-to-post.html#faq-5.2
|
|
|
|
|
First, make an enumeration as follows:
enum Positions
{
Administration = 0;
Management = 1;
Junior = 2;
}
You can then use this to store the current value ie
Positions myPositions = Positions.Administration;
when the function is called you want to check the input (A, M, or J) and then statically handle it, so
if (a) myPositions = Positions.Adminstration
etc
Hope this helps
James
|
|
|
|
|
thanx james, i learned how to do it using switch structure.
|
|
|
|
|
Write a simple FTP (File Transfer Protocol) server and client using the TCP socket libraries on
Unix. This simple FTP application only implements the command “GET” to retrieve a file and
the command “LIST” to request a list of all the files the server offers. The example client and
server codes studied in class show how to use command line parameters and the use of the
socket libraries for a simple stateful server that returns a message to the client that tells the
number of times it has been accessed. The specifications for your client and server are as
follows:
===========================================
Client specification:
Your client should accept as parameters from the command line the name of the host on which
the server runs and the corresponding port number. Both arguments are optional. If no host
name is specified, the client uses "localhost"; if no protocol port is specified, the client uses a
default one given by PROTOPORT.
The client should do the following:
· Prompt the user to enter one of the following two commands:
o GET filename to retrieve the given file
o LIST to get a list of all files the server offers
· Connect to the server and request service by sending the user’s request.
· The client should then simply display the information sent back by the server on the screen.
· The requested file should be written into a file of the same name. If the file already exists, prompt the user to enter a new name.
· Close connection with server when done.
-----------------------------------------------------------------------------------
Server specification:
The server takes a single commandline argument that specifies the port number the server is
using, i.e. server 5555 . If no protocol port is specified, the client uses a default one given by
PROTOPORT. Have the server export a set of files from the computer on which it runs (i.e.
make them availabla for download). The server should:
· Read the request message from the client.
· Process the request (either GET or LIST):
o If the request is GET filename, then retrieve the file and send it to the
client.
o If the request is LIST, then get the list of all files available for download.
· On errors, send an error message back to the client such as:
o Not a command or command not implemented
o File does not exist
o Incorrect command format
Satyaranjan Sahu
|
|
|
|
|
And your question is?
Tom Wright
tawright915@yahoo.com
|
|
|
|
|
the codes are not compiling properly.
If u agree i ll send the codes,ve a look in to it.
http://www.netbook.cs.purdue.edu/code/code30_1.htm (for client code)
-- modified at 11:18 Wednesday 1st February, 2006
|
|
|
|
|
http://www.parashift.com/c++-faq-lite/how-to-post.html#faq-5.2
|
|
|
|
|
|
|
I don't understand the problem. You have to build a control. You put in a numUpDown and a label for the number if you don't want to have a textbox. Then catch the KeyEvents. If a number is typed change the value. You might have to catch the Events from the Form and then change your controlvalue.
Or did I missunderstood your question?
Greetings,
Ingo
|
|
|
|
|
Hello,
I have a method that executes the given SqlCommand and returns the command result as a DataSet, while the method works under heavy load SQL Server (2000 Enterprise SP3) memory usage goes through the roof.
After some investigation I found that connections were being left active in the database. "Proof" of this was found after running a load test, a few minutes after the test completes (and while there is not activity on the SQL server) SQL Profiler shows various "Audit Logout" entries
EventClass : Audit Logout
TextData :
ApplicationName : LoadTestRun1
NTUserName : NETWORK SERVICE
LoginName : sa
CPU : 0
Reads : 10
Writes : 0
Duration : 459920
ClientProcessID : 0
Spid : 2969
StartTime : 2006-02-01 15:16:12.987
After hunting around various sites and tutorials this is the SqlCommand execution method:
public static DataSet ExecuteSqlCommand(SqlCommand command, string dataSetName)
{
if (command == null)
{
throw new ArgumentNullException("command");
}
if (dataSetName == null)
{
throw new ArgumentNullException("dataSetName");
}
DataSet returnDataSet = new DataSet();
returnDataSet.DataSetName = dataSetName;
returnDataSet.Locale = CultureInfo.InvariantCulture;
try
{
SqlDataAdapter sda = new SqlDataAdapter(command);
sda.Fill(returnDataSet);
sda.Dispose();
sda = null;
return returnDataSet;
}
catch
{
throw;
}
finally
{
if (command.Connection.State != ConnectionState.Closed)
{
command.Connection.Close();
}
command.Connection.Dispose();
command.Connection = null;
command.Dispose();
command = null;
}
}
Can anybody tell me if there is anything obviously wrong with my implementation or if there is something else I should check for.
|
|
|
|
|
//Perhaps this might work. Although I saw nothin in your post that would leave
//an open connection Remember the connection pool will remain for reuse but
// that's a good thing
try
{
SqlDataAdapter sda = new SqlDataAdapter(command);
command.Connection.Open;
sda.Fill(returnDataSet);
command.Connection.Dispose();
command.Dispose();
sda.Dispose();
return returnDataSet;
}
catch
{
throw;
}
finally
{
}
"People who never make mistakes, never do anything."
My Blog
|
|
|
|
|
It is generally good practice to put anything that is being disposed in the finally block so that it is still run if an exception is thrown.
ColinMackay.net
"Man who stand on hill with mouth open will wait long time for roast duck to drop in." -- Confucius
"If a man empties his purse into his head, no man can take it away from him, for an investment in knowledge pays the best interest." -- Joseph E. O'Donnell
|
|
|
|
|
yes you are correct ... silly me.
"People who never make mistakes, never do anything."
My Blog
|
|
|
|
|
I'm trying to string several arrays together. Here is my code.
<br />
public void OnCreateMessage(string TermID, string AddressLine, string MessageText)<br />
{<br />
private byte[] HeaderBegin = new byte[]{0xFF, 0x00, 0xAA, 0x55, 0x00, 0x1E, 0x48, 0x02, 0x00, 0x01, <br />
0x4C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, <br />
0x08, 0xD2, 0x00, 0x00, 0x00, 0x00};<br />
private byte[] HeaderEnd = new byte[]{0x55, 0xAA, 0x00, 0xFF};<br />
<br />
Encoding enc = Encoding.ASCII;<br />
uint nTermID = (uint)Encoding.ASCII.GetByteCount(TermID);<br />
uint nAddressLine = (uint)Encoding.ASCII.GetByteCount(AddressLine);<br />
uint nMessageText = (uint)Encoding.ASCII.GetByteCount(MessageText);<br />
string sMyMsg = TermID+ASCII.CR+ASCII.LF+AddressLine+ASCII.CR+ASCII.LF+MessageText;<br />
byte[] myBytes = enc.GetBytes(sMyMsg);<br />
byte[] MyMsg = new byte[30+nTermID+nAddressLine+nMessageText+4];<br />
<br />
MyMsg = HeaderBegin;<br />
myBytes.CopyTo(MyMsg, 26);<br />
HeaderEnd.CopyTo(MyMsg, MyMsg.Length);<br />
However when I step thru my code there is nothing in the MyMsg. Am I doing something wrong?
Thanks for any suggestions.
Tom Wright
tawright915@yahoo.com
|
|
|
|
|
RTFM
The second parameter of the CopyTo method is the destination position, not the length.
---
b { font-weight: normal; }
|
|
|
|
|
ah..okay...That's what I'm doing,
first I move in headerbegins. 26 bytes in length.
then I move in myBytes which is a byte array of ASCII text, into MyMsg at postion 26.
Then I copy in HeaderEnd into MyMsg at the current length of MyMsg.
Is this wrong?
Thanks
Tom Wright
tawright915@yahoo.com
|
|
|
|
|
Tom Wright wrote: Then I copy in HeaderEnd into MyMsg at the current length of MyMsg.
I think that's the problem. You are trying to copy elements starting from one past the last element in the array. MyMsg.Length doesn't represent the actual number of elements in that array, it's always fixed and is equal to the array size.
Regards
Senthil
_____________________________
My Blog | My Articles | WinMacro
|
|
|
|
|
Yeah I see that..... I changed my code to this...
<br />
byte[] MyMsg = new byte[HeaderBegin.Length+myBytes.Length+HeaderEnd.Length];<br />
<br />
HeaderBegin.CopyTo(MyMsg, 0);<br />
myBytes.CopyTo(MyMsg, 26);<br />
HeaderEnd.CopyTo(MyMsg, MyMsg.Length+2);<br />
and I get an error saying that I do not have enough elements in my array. So how do I size my byte array to handle all of the different arrays that I need to copy into it?
Will bytesread give me a value that will resize my array correctly?
Thanks
Tom Wright
tawright915@yahoo.com
|
|
|
|
|
Hi all,
a simple question.
i need to invoke a gui from a program. i can simply do
Application.Run(myForm);
the gui is started but the problem is how do i come to the next line of the code?
regards,
rnv
|
|
|
|
|
Are you tring to load a form from your main app? To do this you do something like.
NewForm newform = new NewForm();
newform.ShowDialog();
Once it it shows the form then in NewForm dialog in LoadForm you can have it start the next line of code you want.
Tom Wright
tawright915@yahoo.com
|
|
|
|