|
Just start your program from a command prompt (cmd.exe), and add " > somfile.txt" after the program name, and the output of the program is sent to the file.
This is built into the command shell, and you can for example send a directory listing to a file:
dir c:\users\nesfrank\documents > myfiles.txt
Despite everything, the person most likely to be fooling you next is yourself.
|
|
|
|
|
There is NO code to be written. Your app (let's call it Foo.exe) has several Console.WriteLine() statements which write to the console, and you want them to be written to a file (let's call it AppLog.txt).
Right now, this is how you would invoke your app:
C:\>Foo.exe Simply change that to
C:\>Foo.exe > AppLog.txt If you want the app to append to the file rather than overwrite, use
C:\>Foo.exe >> AppLog.txt Obviously, you will have to use the correct path, etc.
Cheers,
Vıkram.
"You idiot British surprise me that your generators which grew up after Mid 50s had no brain at all." - Adnan Siddiqi.
|
|
|
|
|
Additionally to what the others already said, there's also a slightly more advanced, yet more flexible solution:
log4net[^]
It has some nice features:
- you can specify where the log messages should go (like to the console, to a file, via mail and much more)
- you can add a custom format to your log messages (like a timestamp)
- you can specify the type of the log message, like Info, Warning, Error, Debug and much more
regards
modified 12-Sep-18 21:01pm.
|
|
|
|
|
Hi
if no element return from this i need "loct" to be null
int? loct = (from s in sdc.Locations
where s.Name == listViewEx4.Items[i].SubItems[7].Text
select s.Location_ID).SingleOrDefault();
First() return error message Sequence contains no elements
SingleOrDefault() return 0
i need null from this sequence
how can i do
modified on Wednesday, November 12, 2008 10:46 AM
|
|
|
|
|
mutafa81 wrote: how can i do
no, try to compile this:
int n = null;
Now, read the compiler error message and think about your question. Good luck.
led mike
|
|
|
|
|
but the OP was using int? rather than int
|
|
|
|
|
J4amieC wrote: but the OP was using int?
ooops
led mike
|
|
|
|
|
Im guessing your field "Location_ID" is an int rather than an int?, in which case the default is 0 which can be assigned to the int?
you could try this:
int temp = (from s in sdc.Locations
where s.Name == listViewEx4.Items[i].SubItems[7].Text
select s.Location_ID).SingleOrDefault();
int? loct = (temp == 0) ? null : temp;
|
|
|
|
|
Thank you will try
J4amieC wrote: Im guessing your field "Location_ID" is an int rather than an int?, in which case the default is 0 which can be assigned to the int?
you could try this:
int temp = (from s in sdc.Locationswhere s.Name == listViewEx4.Items[i].SubItems[7].Textselect s.Location_ID).SingleOrDefault();int? loct = (temp == 0) ? null : temp;
|
|
|
|
|
I need to compile .net project in mono.
but I am getting errors while compiling it. Can anybody help me to do it?
as i do
mcs Program.cs Form1.cs Form1.Designer.cs AssemblyInfo.cs -r:System.Windows.Forms.dll -r:System.Drawing.dll -r:System.Data.dll
it gives me error, my program is not getting compiled, so please help me.
|
|
|
|
|
What error does it give you? You need to be more clear.
|
|
|
|
|
And the error would be ....... ????
Keep in mind that Mono is NOT a 100% direct replacement for .NET Framework code. So, System.Windows.Forms will not work on Linux, since it, surprise, is NOT WINDOWS.
|
|
|
|
|
This is the part where we try to become mind readers. It's a zen thing.
"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
|
|
|
|
|
John Simmons / outlaw programmer wrote: This is the part where we try to become mind readers. It's a zen thing.
-_- mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm Nope, not getting anything from him. I wonder why??
|
|
|
|
|
Hi guys,
I need to leave space or newline between radio button which is dynamically created but i cant do this any suggestions for ths prob.....
0-->radiobtn
0 1 0 2 0 3
I need like this,
0 1
0 2
0 3
modified on Wednesday, November 12, 2008 9:22 AM
|
|
|
|
|
Depends on your environment.
If you're in ASP.NET, just include a <br>, <p>, etc. or perhaps use a table to build up the radio buttons.
If you're in WinForms, use a TableLayoutPanel (if .NET 2.0+) or docking perhaps.
You've got many options really in either environment. Think about how you would do it statically and then build code to replicate that on the fly.
|
|
|
|
|
Set the position(X,Y) of the radio buttons on your form. Perhaps increment the Y value by 10 for each radio button created but leave the X value the same.
|
|
|
|
|
Hi All,
I have an application that builds a specialised database of certain file types. The app scans a machine and stores its information in a SqlCe database.
I also want to enable the application to detect any changes and update the database accordingly.
This is where my query lies. So far my thoughts on enabling this involve some form of hashing. So for each directory that the application adds files from it will also make a hash value from that directories filenames by concatenating all the file names and getting, for instance, an MD5 hash from that string. Then it stores that hash value against its directory in a table in the DB.
This table could then be used to drive a syncronisation process by recreating new hash values for each directory entry in the table and comparing it to the stored hash value. If they match no work is required, if not the directory and the DB need syncronising.
One other question would be what field setup in the DB would be recommended for storing these hash values?
Does this concept overall make sense?
|
|
|
|
|
Jammer wrote: Does this concept overall make sense?
Pretty much, although bear in mind, that if you only hash the filenames, you won't detect any difference if the file contents change. Is this ok for what you are trying to achieve?
If you need to monitor for contents changes too you will need to hash the whole file. Obviously, bear in mind that hashing every file and directory on a system is likely to take quite a long time.
Perhaps take a look at the
FileSystemWatcher[^] class. It allows you to be notified when changes are made to the file system. You could use this, but obviously your program would have to be running all the time to respond to the events.
Simon
|
|
|
|
|
Hi Simon,
Thanks for this.
It would be impossible for my app to monitor the contents of files as well. I'm dealing with 100,000 file data sets and this would really be overkill. Just knowing that a directory has changed is good enough at the moment.
Thanks again!
|
|
|
|
|
Jammer me old mucker. What you want to look at is the Microsoft Sync[^] Framework. Download it here[^].
|
|
|
|
|
Sh*t the bed!! Looky!!! THANK YOU!
|
|
|
|
|
Who's your daddy. Hoo yah.
|
|
|
|
|
HAHA!
|
|
|
|
|
I have two very simple report in my winform project.
Development machine is windows vista home premium, vs 2005 sp1 and crystal report sp1 for vs 2005.
I read the printer name from a config file and use that printer name in code
crReportDocument.PrintOptions.PrinterName = PaletteLabelPrinter;
PaletteLabelPrinter is a string holding the printer name from config file.
When I deploy my app to server 2003 R2, I simple have an error for report printing if I have a different printer name at the server than at my development machine.
Crash happening right at the line
crReportDocument.PrintOptions.PrinterName = PaletteLabelPrinter;
Error is as follows
Error in File C:\DOCUME~1\alc.......... The request could not be submitted for background processing
Besides, even though I installed the crystal report sp1, vs2005 just stop running when I select from
menu
Crystal Report -> Design -> Printer Setup, do something change and press OK then VS2005 simple
stop working.
Please help
Thanks to everybody
Muharrem
|
|
|
|