Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
S

stephan_007

@stephan_007
About
Posts
87
Topics
44
Shares
0
Groups
0
Followers
0
Following
0

Posts

Recent Best Controversial

  • Log4net: one loggfile a day
    S stephan_007

    Hy everyone! I do need your help. I would like to create a logfile for my application one a day (eg. Logfile_20090210.log for today, Logfile_20090211.log for tomorrow etc.). the log4net config file looks like this

    <configuration>
    <configSections>
    <section name="log4net" type="log4net.Config.Log4NetConfigurationSectionHandler, log4net" />
    </configSections>
    <log4net>
    <appender name="RollingLogFileAppender" type="log4net.Appender.RollingFileAppender">
    <param name="File" value="C:\\PrintService.log" />
    <param name="AppendToFile" value="true" />
    <param name="rollingStyle" value="Date" />
    <param name="datePattern" value="yyyyMMdd" />
    <layout type="log4net.Layout.PatternLayout">
    <!-- <param name="Header" value="[Header]\r\n" />
    <param name="Footer" value="[Footer]\r\n" /> -->
    <param name="ConversionPattern" value="%d [%t] %-5p %c %m%n" />
    </layout>
    </appender>
    <root>
    <!-- <level value="INFO" /> -->
    <appender-ref ref="RollingLogFileAppender" />
    </root>
    </log4net>
    </configuration>

    I do have two problems: there is no logfile with the config above. when I change this to "yyyyMMdd-HHmm" for datePattern, then it works, but I do not want the time to be part of the logfilename. the second problem is the logfile is named PrintServce.log20090210-1346 for example. So my question: What does the config have to look like to get PrintServer_20090210.log for example? I found pages with configs similar like mine ("yyyyMMdd" for datePattern). But none worked! Thanks for any help! Stephan.

    C# help question tutorial workspace

  • thread abort exception when service ends to where it has been invoked from
    S stephan_007

    nope, i am not aborting any thread. i forgot to add an important info: sharepoint is located on two servers, meaning there is a loadbalancing installed using two servers. could it be, the task is switched to the other server when returning? meaning when starting the printing from server A to sharepoint it looks like as if the server is very busy and when returning it is switched to server B, but there is not thread active so it thinks it is aborted? that's an idea which I had when talking to some other guys.

    C# help database algorithms performance tutorial

  • thread abort exception when service ends to where it has been invoked from
    S stephan_007

    hy everyone! we do have a problem: we coded a webpart which allows searching and printing of document in a document store. you search for files, you are able to display them and you are able to print them. therefor we wrote a printservice, which fetches the file from the store and sends them to the spooler and printer respectively. that works fine. afterwords we update the database to set some fields, indicating the file was already printed. when using a little amount of files it works file, but the bigger the collection of file is, the more problems appear. meaning, when selecting around 100 files with around 1 MB each, a thread abort exception is thrown. if there are just 40 files, no exception is thrown. and to complicate the situation: if you repeat printing the same files lets say for 10 times, it works in lets say 7 tries and fails in 3 tries. sometimes it even works in all tries or it fails more often. its like guessing numbers in a lottery. but it does not throw the thrad abort exception during printing, it throws the exception when returning to the code of the webpart where the printing was invoked at. meaning we wrote a printbuttonclick event-function which invokes the printservice with the file ids, and some other properties. and when returning the exception is thrown. we tried to change the timeout of the printservice indefinite (-1), we also tried to change the code to get as much performance as possible, we also did a lot of garbage collection etc. but we can't get rid of this exception. we also have already been googling for this incident, but nothing really solved our problem. we were just able to send more files until it is likely to be thrown. printing around 100 files could take up to 1-2 minutes, so i guess maybe this could take to long and the thread times out when returning. does anyone have an idea of 1) where to start to get an idea how to get rid of this error (maybe a page of hints we haven't already been to etc.) 2) how to get rid of this exception. maybe one of you has already encountered anything similar. thanks for any hints and ideas. if you do need some further infos for understanding or to get an idea of how to solve it, just feel free to ask. thanks! stephan.

    C# help database algorithms performance tutorial

  • page won't fit in A4 (itextsharp dll used)
    S stephan_007

    Hy everyone! I used the itextsharp dll http://itextsharp.sourceforge.net/examples/Chap0607.cs ccomponent to add images to a pdf document. In default it uses the squar format for the page. I didn't change this, but no matter which size i choose the pic to be or which parameter I try to use to set the location where the pic is located at, there is a white strip on top of the page. is there a chance to use 100% of the page? my code is

    Document document = new Document(PageSize.A4.Rotate());
    try
    {
    PdfWriter.GetInstance(document, new FileStream(outputPath, FileMode.Create));
    document.Open();
    for (int i = 0; i < list.Count; i++)
    {
    iTextSharp.text.Image img = iTextSharp.text.Image.GetInstance(list[i]);
    // Querformat
    if (img.Width >= img.Height)
    {
    img.Alignment = iTextSharp.text.Image.MIDDLE_ALIGN;
    //img.Alignment = iTextSharp.text.Image.ALIGN_TOP;
    img.RotationDegrees = 0f;
    }
    // Hochformat
    else
    {
    img.Alignment = iTextSharp.text.Image.MIDDLE_ALIGN;
    //img.Alignment = iTextSharp.text.Image.ALIGN_TOP;
    img.RotationDegrees = 270;
    }
    //img.ScaleToFit(624.5f, 462);
    //img.ScaleToFit(687, 508);
    //img.ScaleToFit(720, 534);
    img.ScaleToFit(855, 550);
    document.Add(img);
    //Add a new Page for net next image
    document.NewPage();
    }
    // document.Close();
    }
    catch (System.Exception EX)
    {
    logger.Error(EX.ToString());
    }
    finally
    {
    document.Close();
    }

    is there a chance to fit the pic into the page to use the whole size, so to get rid of the white strip on top (compareable to the orange bar on top to the rest of this page here)? thanks! stephan.

    C# csharp json help question

  • problems with process.start methode
    S stephan_007

    it's just a typo. should have been adobe instead of acrobat :( sorry. if there are typos in the dirinfo then please ignore them. it's not the reason, because i copied the directory info from the file explorer to visual studio, so this info is correct. i guess when typing it here i mixed it up. so the correct path should be System.Diagnostics.Process.Start("\"C:\\Program Files\\Adobe\\Reader 8.0\\Reader\\AcroRd32.exe\"", "\"C:\\sourcedir\\somefile.pdf\"");

    C# help question

  • problems with process.start methode
    S stephan_007

    nope, it's just a typo in here!

    C# help question

  • problems with process.start methode
    S stephan_007

    yeap, this is a typo, sorry. the correct path is C:\\Program Files\\Acrobate\\Reader 8.0\\AcroRd32.exe in every example.

    C# help question

  • problems with process.start methode
    S stephan_007

    is there a difference in mering it to one string or to seperate it with a comma?? and is there a chance to get it start with the parameters and the printer this way?

    C# help question

  • problems with process.start methode
    S stephan_007

    hy everyone! i do have some problems with the process.start() methode. i want to start the following command via the process.start()

    "C:\Program Files\Acrobate\Reader 8.0\Reader\AcroRd32.exe" /h /t "C:\sourcedir\somefile.pdf" "printer001"

    (sure it's not the correct syntax here, but it's readable this way) when i try to start this code in command line then it works fine, but when i add it to the process.start() methode, it either does nothing or it throws an exception "there is/are invalid path/s" I added full access to the sourcedir, so access problems shouldn't be the reason. when i just try to start acrobate as parameter (so e.g.

    System.Diagnostics.Process.Start("\"C:\\Program Files\\Acrobate\\Reader 8.0\\AcroRd32.exe\"");

    , it works and it start acrobate as a process. when i just add the file including the dirinfo e.g.

    System.Diagnostics.Process.Start("\"C:\\sourcedir\\somefile.pdf\"");

    , it accepts it as well. but it does not work using the whole string above. i also tried to use the startinfo object with all it's parameters, but it didn't work neither. does anyone of you have an idea? I don't think it's a problem because of access rules, because why would the acrobate start if there were some?? :sigh: thanks! stephan.

    C# help question

  • looking for good ideas
    S stephan_007

    hy everyone! i am looking for good ideas. what i want to do is to realize a file/directorywatcher, which handles xml files and when it is done it places a "finished" file into this directory to indicate the file was handled. example: i do have 5 directories (a, b, c, d and e) which contain different xml files. only one in each folder. when my program has handled a file in one folder, it places a "finished" file in there. sounds easy :) well my problem is, i found out if it takes to long to handle a file and the other proggy (which creates the xml files) finds a "finished" file, then it starts to consume these files and folders. this means when one "finished" file is found then it deletes all folders one by one. and if my program isn't quick enough, files are lost. that's why i tried to figure out a different solution to this problem. i have to add the "finished" files to the directories after having handled tue last xml file, which was found. well therefore i have to remember the directories, i parsed before. i thought about using a string similar to csv e.g. "dir1;dir2;...", split it afterwards and add the file. or to create an array adding one element after each other. but both solutions could become very timeconsuming. the bigger the string will get, the longer it will take to rewrite it (no idea if there is a function like stringbuilder in c#). and rewriting an array to add an element isn't nice neither. does anyone of you have a good idea how to handle it? i also thought about creating a temp "finished" file and rename it afterwards, but i will have to remeber the directories as well to do so. so to summarize the situation is like this: 1) read xml files from different directories and handle them (one by one - read one dir, handle xml file, next dir etc.) 2) when all xml files are handled which where found in the directories, then write a "finished" file in each directory to indicate the operation was finished 3) start at 1) again whit the next files it's allowed to have dirA finished dirB finished .... dirZ finished but it's not allowed to have dirA finished dirB finished ..... dirX file.xml dirZ file.xml my old solutions was quite easy: reading the file and write a "finished" file to this directory, then continue with the next one etc. with this solution no storage of directories was needed, but this didn't work properly enough :^) thanks for any good ideas! stephan.

    Visual Basic tutorial csharp data-structures xml help

  • invalid path using process.start method
    S stephan_007

    when i set the process to start acrobate then it does, but it does not send the file to printer, as it is intended to. is there a way to debug this (meaning the process) to see, why no file is received by the printer queue?

    C# help question

  • invalid path using process.start method
    S stephan_007

    strange, the error is gone now, but this process should start the printing on the specified printer, but the program finishes with returncode ok but the file never reaches the printer. does this mean the processcall here doesn't throw any exception anymore but it doesn't really do what it should have done? does anyone of you have an idea? Stephan.

    C# help question

  • invalid path using process.start method
    S stephan_007

    i already did this, and it works. but it does not work the way i programmed it. i will try to start just adobe and proceed step by step, maybe I will stumble into this error.

    C# help question

  • invalid path using process.start method
    S stephan_007

    ....
    if (string.IsNullOrEmpty(AcrobatReaderPath))
    {
    //AcrobatReaderPath = @"C:\Program Files\Adobe\Acrobat 7.0\Reader\AcroRd32.exe";
    AcrobatReaderPath = @"C:\Programme\Adobe\Reader 8.0\Reader\AcroRd32.exe";
    //AcrobatReaderPath = @"C:\Program Files\Adobe\Reader 8.0\Reader\AcroRd32.exe";
    }
    logger.Info("AcrobatReaderPath = " + AcrobatReaderPath);
    System.Diagnostics.ProcessStartInfo startInfo = new ProcessStartInfo();
    logger.Info("1");
    startInfo.Arguments = "/h /t \"" + pdfFileName + "\" \"" + printerName + "\"";
    logger.Info("2");
    startInfo.FileName = AcrobatReaderPath;
    logger.Info("3");
    startInfo.UseShellExecute = true;
    logger.Info("4");
    startInfo.CreateNoWindow = true;
    logger.Info("5");
    startInfo.RedirectStandardOutput = false; // was true
    logger.Info("6");
    startInfo.UseShellExecute = false;
    logger.Info("7");
    System.Diagnostics.Process process = Process.Start(startInfo);
    logger.Info("8");
    ....

    I checked the acrobat path, it is correct. I checked the pdfFileName path, it is correct. I also checked the printername and this is correct as well. But when starting the process it throws the error message. What the code does: it prints a pdf file (located on harddisk) using the specified printer. As I said in my first posting, I tried it on different systems, there are some it works fine (no error message) but there are some which cause this message. And I have no clue why. the logging works well, so this should not be the problem! Stephan.

    C# help question

  • invalid path using process.start method
    S stephan_007

    hi everyone! i do have a problem, which occours on some machines but not on every machine: when using the process.start method, it throws the exception the path is invalid.

    System.Diagnostics.Process process = Process.Start(startInfo);

    the startinfo is

    System.Diagnostics.ProcessStartInfo startInfo = new ProcessStartInfo();

    then I add Arguments (startInfo.Arguments), a FileName (startInfo.Filename), set the UseShellExecute to true (startInfo.UseShellExecute = true) ,set the CreateNoWindow to true (startInfo.CreateNoWindow) to hide the window, then set the RedirectStandardOutput to false during one try and to true in another try (startInfo.RedirectStandardOutput = false or true) and then I reset the UseShellExecute to false (startInfo.UseShellExecute = false). Finally I invoke the methode but it throws the exception described above. Does anyone of you have an idea? i checked all the paths and they are correct (meaning those I used during assigning the parameters). thanks. Stephan.

    C# help question

  • directory watching
    S stephan_007

    so this means, when a file enters the directory, then the trigger is started. if file a_file and b_file enter at (almost) the same time, is a_file handled first or the one which is first in? to guarantee the correct handling of the files i have to take care, a_file is there before b_file etc. is this correct? because changing contence before creating a file won't work :) or updating data which is not there because the last command should have put the data in there ;) thanks for your info. stephan.

    C# csharp xml question

  • directory watching
    S stephan_007

    Hy everyone! I know there is a c# operation, to watch a directory for changes, meaning to realize, when files are copied into it to handle them etc. this could be done by filesystemwatcher (FileSystemWatcher watcher = new FileSystemWatcher(); ) but in which order are the files which are found in this directory handled? in alphabetical order or just picking one? so lets say i copy three files to this directory b_file, a_file and c_file in which order are these files handled? and lets say there is already a d_file in it when i start the service watching, which files comes first? because i want to realize a tool which takes the files describing what to do (in xml). so the correct order is important. therefore i have to know the files are handled in the correct order. let's say a_file creates a file, b_file changes the contence and c_file copies it to it's destination. so the "commandfiles" have to be handled in correct order. that's why this info is so important for me. thanks for any hint. stephan.

    C# csharp xml question

  • can't attach to process when debugging (error code 0x8013134b)
    S stephan_007

    hy everyone! i do have problems debugging my webservice. it compiles propperly but when i choose "debug > start new instance" in the solution explorer then i get the message "Auto-attach to process '[2704] aspnet_wp.exe' on machine 'devVS2003' failed. Error code 0x8013134b". When I manually attach the process to aspnet_wp.exe and start it in debug mode (common language runtime checked) i get a dialog "unable to attach to the process" but no message why. does anyone of you have an idea how to solve this? when i googled for it i just found similar postings but no solution to these problems which could help me. thanks for any advice. stephan.

    Visual Basic help asp-net debugging tutorial question

  • strange behaviour of console application
    S stephan_007

    hy everyone! i do have a strange problem maybe someone of you knows a solution to this or a good way to find out: i do have a console application (parser) which reads from file, splits the input if necessary and writes the data to outputfiles. the number of outputfiles depends on the input type, meaning if the file is split into parts then there are as many outputfiles as there are parts. the program searches a directory using a search pattern, then splits the file if necessary and performes the parsing and inserts data which match the tokens in the output template and renames the final file from tmp to the final extension. sounds easy. on my system it works well (Vista, Visual Studio 2005). But when I execute the program on a Win2003 Server it looks like some parts of the code are left behind. e.g. i do have two files, the first one is split into two parts, but i do only get one output file. a second file which is parsed afterwards (the instance is still running because i first read all filenames which match the pattern) and is not split returns the one outputfile. so somewhere the second outputfile of the first inputfile is lost, the program doesn't crash it doesn't write a failure into log (because i write a log entry when starting, when finishing and when an exception occures). the start logentry is in the logfile, but no failure nore the finish entry. but both files are moved to the success folder and not to the error folder, so it looks like it was parsed correctly. but after the move statement in the code the logmessage is insert into the logfile. so the code has to be used because the one file is there as well. so to me it looks like as if the parser just sends some input to nirvana and not to the output or "ignores" parts of the code. and the strange thing is, when i run the program on my vista machine, everything is ok. well, the main problem in my case is, i can't install Visual Studio on the server because it is not mine, it's a client's machine i programmed the parser with. so my first idea would be to insert logfile entries when entering one of my functions and one when leaving to see, when the operation suddenly stopps. did anyone of you encounter similar problems during coding console applications in circumstances like me? or does anyone of you have a hint on which could be the reason to help me solve this strange behaviour more quickly? thanks for any advice and hints, because i nevery had behaviours like this before. all my programs i coded bevour could be used no mat

    C# help regex csharp visual-studio sysadmin

  • how to merge single bitmaps to a multipage tiff
    S stephan_007

    hy everyone! i need your help because i am stuck. i do have bitmaps which are each stored in a byte[]. i want to merge them to a single multipage tiff. does anyone of you have a solution how to do this? (maybe a link to a project where this was done) thanks. stephan.

    C# help tutorial question
  • Login

  • Don't have an account? Register

  • Login or register to search.
  • First post
    Last post
0
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups