|
Or, skip the entire SMTP method and expose a WebService to the Internet that your application calls to report it's errors. No email involved.
|
|
|
|
|
There is no easy or certain way to find such a setting. There might be a default mail program, and there might not. The default mail program might have a user account that uses smtp, and it might not. The mail program might expose the user settings, and it might not. Probably not.
I was thinking the same as Dave, when I read your question. A web service seems like a good solution.
---
single minded; short sighted; long gone;
|
|
|
|
|
Indeed that i did not think of that . A webservice is the solution. just have to check if there is a internet connection present and go with it. Can store it in a database.
Exellent tip
Thank you
Kind regards,
Marcel Vreuls
http://www.marcelvreuls.com
< >
|
|
|
|
|
Is there a way to override the F1 event on the helpProvider?
|
|
|
|
|
There are three columns in a datagrid and first column will always contains values(for ex 4 records) but the second & third column may contain only 1 value or 4 records so kindly let me know in this type of scenario how to merge the rows and display the single value in middle against the first column values.
Thanks In Advance
Thanks In Advance
|
|
|
|
|
I propose you to make a googling[^].
I Love SQL
|
|
|
|
|
Hi all,
I have a combobox initially filled with a few string. When one of them is selected, the user is given the possibility to change it using a textbox. My problem is that I don't know how to modify the nth entry of a combobox. I thought to removing and reinserting it with the new value in the same position, but the selection of an entry starts a set of operations that make this quite complex to do.
Of course, I can think to a couple ways to hack this, but none of them appear elegant nor easy to make, so I wonder if there is a easier way.
Somone has a solution?
Thank you!
|
|
|
|
|
Reference the Items property of the combobox, passing in the index of the item you want to update.
Paul
|
|
|
|
|
To alter the selected text...
myListBox.Items[myListBox.SelectedIndex ].Text = "My New Value"; To alter a specific item...
myListBox.Items[ 4 ].Text = "Item 4 Text";
"More functions should disregard input values and just return 12. It would make life easier." - comment posted on WTF
|
|
|
|
|
Hi,
I've inherited a batch of functions whose signatures differ only in the fact that one group takes a short[] as the first parameter and one takes an int[] as the first parameter. I'd like to merge the bulk of the code into one function so that changes don't have to be replicated accross versions (there already is some code difference, but no functional difference!). My two ideas were: to use a generic method, or to have one of the overloaded versions call the other version.
The problem with the first (generics) is that I only want it to be able to accept int[] or short[], not some other type, and there are some explicit assignments such as "shortArray[i] = -12345;" that the compiler doesn't appreciate when I try to make it generic.
The problem with the second, is that I cannot figure out how to convert from a short[] to an int[] without copying to another array and converting it in the loop (.CopyTo), the arrays are massive, so every time I have to copy is a performance hit (it isn't exactly performance critical at the moment, but I'd like to avoid needless operations right now to save time later during optimization).
Any suggestions?
Thanks,
Phil
|
|
|
|
|
Use a generic function and then check the Type to make sure that it is a valid type - i.e. throw an exception if it's not a short[] or int[]. Hint - use the is operator.
Deja View - the feeling that you've seen this post before.
|
|
|
|
|
Hi Pete,
I'm sure this idea would work (with a bit of effort), but I don't know if it will work for me.
Correct me if I'm wrong, but I'd still have to cast it to the appropriate type (short[] or int[]) and then carry around whichever version is the correct one along with flags signifying which to use (or copy it over to another short[] if it is an int[], which brings me to the 2nd problem presented in the original post). Adding an additional type - long, for instance, would require even more logic to be added all over the function to use the correct version. Furthermore, I'd like it to throw a compile time error and not a run-time exception.
|
|
|
|
|
All you need to do to support part of your problem is do something like:
public void Test<T>(IList<T> list)
{
if (list.Count > 0)
{
Console.WriteLine("Hello");
}
} Then, you can pass in short[] and int[] to your hearts content. It doesn't solve the constraining to short[] and int[] issues, but it does solve the other side (and you don't have to copy the arrays over).
Deja View - the feeling that you've seen this post before.
|
|
|
|
|
Hi Phil,
how about this:
- build one method DoIt() that accepts IArray as its main operand
- define an interface IArray similar to an array, supporting whatever Doit() needs
- define a class that implements IArray when given an int[]
- build a method that accepts an int[], instantiates said class and calls DoIt()
- define a class that implements IArray when given a short[]
- build a method that accepts a short[], instantiates said class and calls DoIt()
That's it, solved without generics. Would even run on 1.x
All this at the expense of a glue layer (the two classes described).
|
|
|
|
|
Yes, perfect! I only need an indexer, so the Interface would be nice and light.
Thanks again Luc!
|
|
|
|
|
Hello,
I'm developing an application for file processing. Basically I have a .txt file witch contains data from an AFM meassurement. The file itself contains the headers with information about the performed experiment and two segments built up by numbers, whitch are the actual experimental data. In order to be able to process the AFM data easier I want to divide the file in two parts, one part per header, and also remove the headers themselves.
I solved the problem by just copying the data connected to the first header in a new file and the data connected with the second header to another new file.
The problem is that the last line of each new copied file is not complete.
The last line of the original file is for example:
3.4327463E-6 1.8961255E-9 3.4336897E-6 2.8574045E-6 0.004730297 -0.020049555
The last line of my newly created file (witch is supposed to be an exact copy of the original line) is for example:
3.4327463E-6 1.89
A very large portion of the origninal information is lost.
I use an object of the StreamWriter Class to write the new file and an object of the StreamReader Class to read the original file. So I guess it's a problem with the StreamWriter.
Thank you for your help in advance.
|
|
|
|
|
Why don't you provide some meaningful code.
Hogan
|
|
|
|
|
I think you need to call the Flush() method on the StreamWriter.
"It was the day before today.... I remember it like it was yesterday."
-Moleman
|
|
|
|
|
Thank you very much. This solved the problem.
|
|
|
|
|
The problem is actually that you are closing the file before you are closing the stream. Just close the stream before the file, and the stream will be flushed automatically.
---
single minded; short sighted; long gone;
|
|
|
|
|
I agree completely on this one. Flush is irrelevant, closing things in the
logical order is what is needed.
|
|
|
|
|
Hi everyone,
So here is my concern, I really hope someone here can provide me with some much needed guidance.
Logically, I am not sure what route to take with a project I am working on. So far it is only partially built, but it contains an extensive GUI (without most of the backend still not coded) and a UDP listener that binds to a port, retrieves a byte stream and parses it into a number of variables.
The UDP stream is continuous with packets being sent at around every half second(forever). I would like to have the variables parsed from the byte stream to populate some text fields and and labels in the GUI and I am not quite sure what route to take to do this? Will I need to use multi-threading and separate the processes?
I have gotten the UDP listener to work and I could get the GUI to update the fields accordingly, but only if I stopped listening after a number of broadcasts. The GUI form wouldn't even load until the UDP listener process was finished....
realistically, the GUI would not have to update every half second. it could be every 3 or 4 packets. but in the end I would still need to save the ALL of the parsed data to an XML file or DB, so it would have to be recognized at some point(still deciding where to go with that part...). In any case I am more in need of help regarding the two processes mentioned above.
any kind of help or advice or thoughts would be greatly appreciated.
thank you in advance,
Joe
I am who I am because of who everyone around me is.
|
|
|
|
|
Hey Joe,
By strange coincidence I'm working on something similar (and indeed asked a related question earlier!).
The technique I'm looking at is the BeginRecieve method of the UdpClient class, which grabs data from the port asynchronously, enabling your application to do other things whilst this goes on. (I didn't find the MSDN example particularly straight forward to follow, but eventually got it working.)
"It was the day before today.... I remember it like it was yesterday."
-Moleman
|
|
|
|
|
thank you for the tip.
I will read into the BeginReceive method at MSDN. If you come across any links, while you are working on this that you think I may also find useful, feel free to pass them on to me.
regards,
joe
I am who I am because of who everyone around me is.
|
|
|
|
|
I'm not sure this will be any use to you, but here is a simple listening application I knocked up. When running it'll listen for TFTP requests on Port 69, and you should be able to see received data written to the console and that the console remains able to accept user input:
class Program
{
public static bool listen = true;
public static IPEndPoint endPoint;
public static UdpClient udpClient;
static void Main(string[] args)
{
Console.WriteLine("Server Running...");
endPoint = new IPEndPoint(IPAddress.Any, 69);
udpClient = new UdpClient(endPoint);
ReceiveMessages();
while (listen)
{
string str = Console.ReadLine();
if (str == "q")
{
listen = false;
}
else
{
Console.WriteLine(str);
}
}
}
public static void ReceiveCallback(IAsyncResult ar)
{
UdpClient u = (UdpClient)((UdpState)(ar.AsyncState)).udpClient;
IPEndPoint e = (IPEndPoint)((UdpState)(ar.AsyncState)).endPoint;
Byte[] receiveBytes = u.EndReceive(ar, ref e);
Console.WriteLine(Encoding.ASCII.GetString(receiveBytes) + "\r\n");
ReceiveMessages();
}
public static void ReceiveMessages()
{
UdpState state = new UdpState();
state.endPoint = endPoint;
state.udpClient = udpClient;
udpClient.BeginReceive(new AsyncCallback(ReceiveCallback), state);
}
}
class UdpState
{
public UdpClient udpClient;
public IPEndPoint endPoint;
}
Once it's running, from a command prompt enter a TFTP command like TFTP -i localhost GET test.txt and you should see it working - "q" quits.
"It was the day before today.... I remember it like it was yesterday."
-Moleman
|
|
|
|