Remove 1st & 2nd lines in 1st file, and 1st line in 2nd file. I want the headers to be the first line after the script runs!

I have two files that look like this (Notepad++):
In the first file, which has a date as a name and always ends in 'COV', I want to remove the 1st & 2nd lines.  All lines end in LF (LineFeed).  In the 2nd file, which has a date as a name and always ends in 'RSK', I want to remove the 1st line. 
Basically I want only the headers.  I'm working with the code below.  I've tried several different iterations of
reader.ReadLine().Skip(1);
reader.ReadLine().Skip(2);
reader.ReadLine().Skip(3);
It never really gives me what I want, so I can't tell what's going on here.  I guess I'm missing something simple, but I don't know what.  Any ideas, anyone?
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;
using System.Diagnostics;
namespace ConsoleApplication1
class Program
static void Main(string[] args)
string sourceDirectory = @"C:\Users\rshuell\Desktop\Downloads\Files";
try
var txtFiles = Directory.EnumerateFiles(sourceDirectory);
foreach (string currentFile in txtFiles)
if (currentFile.Contains("COV"))
var items1 = new LinkedList<string>();
using (var reader = new StreamReader(currentFile))
reader.ReadLine().Skip(2); // skip 2lines
string line;
while ((line = reader.ReadLine()) != null)
items1.AddLast(line.Replace("\"", ""));
File.WriteAllLines(currentFile, items1);
else
var items2 = new LinkedList<string>();
using (var reader = new StreamReader(currentFile))
reader.ReadLine().Skip(1); // skip one line
string line;
while ((line = reader.ReadLine()) != null)
items2.AddLast(line.Replace("\"", ""));
File.WriteAllLines(currentFile, items2);
catch (Exception ex)
Knowledge is the only thing that I can give you, and still retain, and we are both better off for it.

Call the ReadLine() twice if you want to skip the first two lines. Each call results in a single line being read:
static void Main(string[] args)
string sourceDirectory = @"C:\Users\rshuell\Desktop\Downloads\Files";
try
var txtFiles = Directory.EnumerateFiles(sourceDirectory);
foreach (string currentFile in txtFiles)
if (currentFile.Contains("COV"))
var items1 = new LinkedList<string>();
using (var reader = new StreamReader(currentFile))
reader.ReadLine(); //read line 1
reader.ReadLine(); //read line 2
string line;
while ((line = reader.ReadLine()) != null)
items1.AddLast(line.Replace("\"", ""));
File.WriteAllLines(currentFile, items1);
else
var items2 = new LinkedList<string>();
using (var reader = new StreamReader(currentFile))
reader.ReadLine(); // skip one line
string line;
while ((line = reader.ReadLine()) != null)
items2.AddLast(line.Replace("\"", ""));
File.WriteAllLines(currentFile, items2);
catch (Exception ex)
Calling the Skip method on the already read string returned by the ReadLine() method won't help you at all here. By the time you call the Skip method the line has already been read from the file. You must call the ReadLine() method for a new line being read.
Hope that helps.
Please remember to close your threads by marking helpful posts as answer and please start a new thread if you have a new question.

Similar Messages

  • Remove / unload external swf file(s) from the main flash file and load a new swf file and garbage collection from memory.

    I can't seem to remove / unload the external swf files e.g when the carousel.swf (portfolio) is displayed and I press the about button the about content is overlapping the carousel (portfolio) . How can I remove / unload an external swf file from the main flash file and load a new swf file, while at the same time removing garbage collection from memory?
    This is the error message(s) I am receiving: "TypeError: Error #2007: Parameter child must be non-null.
    at flash.display::DisplayObjectContainer/removeChild()
    at index_fla::MainTimeline/Down3()"
    import nl.demonsters.debugger.MonsterDebugger;
    var d:MonsterDebugger=new MonsterDebugger(this);
    stage.scaleMode=StageScaleMode.NO_SCALE;
    stage.align=StageAlign.TOP_LEFT;
    stage.addEventListener(Event.RESIZE, resizeHandler);
    // loader is the loader for portfolio page swf
    var loader:Loader;
    var loader2:Loader;
    var loader3:Loader;
    var loader1:Loader;
    //  resize content
    function resizeHandler(event:Event):void {
        // resizes portfolio page to center
    loader.x = (stage.stageWidth - loader.width) * .5;
    loader.y = (stage.stageHeight - loader.height) * .5;
    // resizes about page to center
    loader3.x = (stage.stageWidth - 482) * .5 - 260;
    loader3.y = (stage.stageHeight - 492) * .5 - 140;
    /*loader2.x = (stage.stageWidth - 658.65) * .5;
    loader2.y = (stage.stageHeight - 551.45) * .5;*/
    addEventListener(Event.ENTER_FRAME, onEnterFrame,false, 0, true);
    function onEnterFrame(ev:Event):void {
    var requesterb:URLRequest=new URLRequest("carouselLoader.swf");
    loader = null;
    loader = new Loader();
    loader.name ="carousel1"
    //adds gallery.swf to stage at begining of movie
    loader.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR, ioError);
    function ioError(event:IOErrorEvent):void {
    trace(event);
    try {
    loader.load(requesterb);
    } catch (error:SecurityError) {
    trace(error);
    addChild(loader);
    loader.x = (stage.stageWidth - 739) * .5;
    loader.y = (stage.stageHeight - 500) * .5;
    // stop gallery.swf from duplication over and over again on enter frame
    removeEventListener(Event.ENTER_FRAME, onEnterFrame);
    //PORTFOLIO BUTTON
    //adds eventlistner so that gallery.swf can be loaded
    MovieClip(root).nav.portfolio.addEventListener(MouseEvent.MOUSE_DOWN, Down, false, 0, true);
    function Down(event:MouseEvent):void {
    // re adds listener for contact.swf and about.swf
    MovieClip(root).nav.info.addEventListener(MouseEvent.MOUSE_DOWN, Down1, false, 0, true);
    MovieClip(root).nav.about.addEventListener(MouseEvent.MOUSE_DOWN, Down3, false, 0, true);
    //unloads gallery.swf from enter frame if users presses portfolio button in nav
    var requester:URLRequest=new URLRequest("carouselLoader.swf");
        loader = null;
    loader = new Loader();
    loader.name ="carousel"
    loader.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR, ioError);
    function ioError(event:IOErrorEvent):void {
    trace(event);
    try {
    loader.load(requester);
    } catch (error:SecurityError) {
    trace(error);
    addChild(loader);
    loader.x = (stage.stageWidth - 739) * .5;
    loader.y = (stage.stageHeight - 500) * .5;
    removeChild( getChildByName("about") );
    removeChild( getChildByName("carousel1") );
    // remove eventlistner and prevents duplication of gallery.swf
    MovieClip(root).nav.portfolio.removeEventListener(MouseEvent.MOUSE_DOWN, Down);
    //INFORMATION BUTTON
    //adds eventlistner so that info.swf can be loaded
    MovieClip(root).nav.info.addEventListener(MouseEvent.MOUSE_DOWN, Down1, false, 0, true);
    function Down1(event:MouseEvent):void {
    //this re-adds the EventListener for portfolio so that end user can view again if they wish.
    MovieClip(root).nav.portfolio.addEventListener(MouseEvent.MOUSE_DOWN, Down, false, 0, true);
    MovieClip(root).nav.about.addEventListener(MouseEvent.MOUSE_DOWN, Down3, false, 0, true);
    var requester:URLRequest=new URLRequest("contactLoader.swf");
    loader2 = null;
    loader2 = new Loader();
    loader2.name ="contact"
    loader2.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR, ioError);
    function ioError(event:IOErrorEvent):void {
    trace(event);
    try {
    loader2.load(requester);
    } catch (error:SecurityError) {
    trace(error);
    addChild(loader2);
    loader2.x = (stage.stageWidth - 658.65) * .5;
    loader2.y = (stage.stageHeight - 551.45) * .5;
    // remove eventlistner and prevents duplication of info.swf
    MovieClip(root).nav.info.removeEventListener(MouseEvent.MOUSE_DOWN, Down1);
    //ABOUT BUTTON
    //adds eventlistner so that info.swf can be loaded
    MovieClip(root).nav.about.addEventListener(MouseEvent.MOUSE_DOWN, Down3, false, 0, true);
    function Down3(event:MouseEvent):void {
    //this re-adds the EventListener for portfolio so that end user can view again if they wish.
    MovieClip(root).nav.portfolio.addEventListener(MouseEvent.MOUSE_DOWN, Down, false, 0, true);
    MovieClip(root).nav.info.addEventListener(MouseEvent.MOUSE_DOWN, Down1, false, 0, true);
    var requester:URLRequest=new URLRequest("aboutLoader.swf");
    loader3 = null;
    loader3 = new Loader();
    loader3.name ="about"
    loader3.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR, ioError);
    function ioError(event:IOErrorEvent):void {
    trace(event);
    try {
    loader3.load(requester);
    } catch (error:SecurityError) {
    trace(error);
    addChild(loader3);
    loader3.x = (stage.stageWidth - 482) * .5 - 260;
    loader3.y = (stage.stageHeight - 492) * .5 - 140;
    removeChild( getChildByName("carousel") );
    removeChild( getChildByName("carousel1") );
    // remove eventlistner and prevents duplication of info.swf
    MovieClip(root).nav.about.removeEventListener(MouseEvent.MOUSE_DOWN, Down3);
    stop();

    Andrei1,
    Thank you for the helpful advice. I made the changes as you suggested but I am receiving a #1009 error message even though my site is working the way I wan it to work. I would still like to fix the errors so that my site runs and error free. This is the error I am receiving:
    "TypeError: Error #1009: Cannot access a property or method of a null object reference."
    I'm sure this is not the best method to unload loaders and I am guessing this is why I am receiving the following error message.
         loader.unload();
         loader2.unload();
         loader3.unload();
    I also tried creating a function to unload the loader but received the same error message and my portfolio swf was not showing at all.
         function killLoad():void{
         try { loader.close(); loader2.close; loader3.close;} catch (e:*) {}
         loader.unload(); loader2.unload(); loader3.unload();
    I have a question regarding suggestion you made to set Mouse Event to "null". What does this do setting the MouseEvent do exactly?  Also, since I've set the MouseEvent to null do I also have to set the loader to null? e.g.
    ---- Here is my updated code ----
    // variable for external loaders
    var loader:Loader;
    var loader1:Loader;
    var loader2:Loader;
    var loader3:Loader;
    // makes borders resize with browser size
    function resizeHandler(event:Event):void {
    // resizes portfolio page to center
         loader.x = (stage.stageWidth - loader.width) * .5;
         loader.y = (stage.stageHeight - loader.height) * .5;
    // resizes about page to center
         loader3.x = (stage.stageWidth - 482) * .5 - 260;
         loader3.y = (stage.stageHeight - 492) * .5 - 140;
    //adds gallery.swf to stage at begining of moviie
         Down();
    //PORTFOLIO BUTTON
    //adds eventlistner so that gallery.swf can be loaded
         MovieClip(root).nav.portfolio.addEventListener(MouseEvent.MOUSE_DOWN, Down, false, 0, true);
    function Down(event:MouseEvent = null):void {
    // re adds listener for contact.swf and about.swf
         MovieClip(root).nav.info.addEventListener(MouseEvent.MOUSE_DOWN, Down1, false, 0, true);
         MovieClip(root).nav.about.addEventListener(MouseEvent.MOUSE_DOWN, Down3, false, 0, true);
    //unloads gallery.swf from enter frame if users presses portfolio button in nav
         var requester:URLRequest=new URLRequest("carouselLoader.swf");
         loader = new Loader();
         loader.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR, ioError);
         function ioError(event:IOErrorEvent):void {
         trace(event);
         try {
         loader.load(requester);
         } catch (error:SecurityError) {
         trace(error);
         this.addChild(loader);
         loader.x = (stage.stageWidth - 739) * .5;
         loader.y = (stage.stageHeight - 500) * .5;
    // sure this is not the best way to do this - but it is unload external swfs
         loader.unload();
         loader2.unload();
         loader3.unload();
    // remove eventlistner and prevents duplication of gallery.swf
         MovieClip(root).nav.portfolio.removeEventListener(MouseEvent.MOUSE_DOWN, Down);
    //INFORMATION BUTTON
         //adds eventlistner so that info.swf can be loaded
         MovieClip(root).nav.info.addEventListener(MouseEvent.MOUSE_DOWN, Down1, false, 0, true);
         function Down1(event:MouseEvent = null):void {
         //this re-adds the EventListener for portfolio so that end user can view again if they wish.
         MovieClip(root).nav.portfolio.addEventListener(MouseEvent.MOUSE_DOWN, Down, false, 0, true);
         MovieClip(root).nav.about.addEventListener(MouseEvent.MOUSE_DOWN, Down3, false, 0, true);
         var requester:URLRequest=new URLRequest("contactLoader.swf");
         loader2 = null;
         loader2 = new Loader();
         loader2.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR, ioError);    
         function ioError(event:IOErrorEvent):void {
         trace(event);
         try {
         loader2.load(requester);
    }      catch (error:SecurityError) {
         trace(error);
         addChild(loader2);
         loader2.x = (stage.stageWidth - 658.65) * .5;
         loader2.y = (stage.stageHeight - 551.45) * .5;
    loader.unload();
    loader2.unload();
    loader3.unload();
         // remove eventlistner and prevents duplication of info.swf
         MovieClip(root).nav.info.removeEventListener(MouseEvent.MOUSE_DOWN, Down1);
    //ABOUT BUTTON
         //adds eventlistner so that info.swf can be loaded
         MovieClip(root).nav.about.addEventListener(MouseEvent.MOUSE_DOWN, Down3, false, 0, true);
         function Down3(event:MouseEvent = null):void {
         //this re-adds the EventListener for portfolio so that end user can view again if they wish.
         MovieClip(root).nav.portfolio.addEventListener(MouseEvent.MOUSE_DOWN, Down, false, 0, true);
         MovieClip(root).nav.info.addEventListener(MouseEvent.MOUSE_DOWN, Down1, false, 0, true);
         var requester:URLRequest=new URLRequest("aboutLoader.swf");
         loader3 = null;
         loader3 = new Loader();
         loader3.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR, ioError);
         function ioError(event:IOErrorEvent):void {
         trace(event);
         try {
         loader3.load(requester);
    }      catch (error:SecurityError) {
         trace(error);
         addChild(loader3);
         loader3.x = (stage.stageWidth - 482) * .5 - 260;
         loader3.y = (stage.stageHeight - 492) * .5 - 140;
         loader.unload();
         loader2.unload();
         loader3.unload();
         // remove eventlistner and prevents duplication of info.swf
         MovieClip(root).nav.about.removeEventListener(MouseEvent.MOUSE_DOWN, Down3);
         stop();

  • I used "my documents" for the profile folder, I removed the profile and firefox asked if i want to remove its file, and it took ALL my file except a few, all my photographs etc, are these now unrecoverable? as they are not in the recycle bin

    I used "my documents" for the profile folder, I removed the profile and firefox asked if i want to remove its file, and it took ALL my file except a few, all my photographs etc, are these now unrecoverable? as they are not in the recycle bin
    disaster, thanks firefox 1 year of photos lost

    Thanks for the obvious question. I mean it. The very same thought came to me this morning and, sure enough, I had booted into another drive--my old one that, of course, had the old desktop, etc.
    It didn't dawn on me that this was the case since I hadn't set it as a boot drive but I guess in the course of all the restarts I did, it got switched.
    I'm back to normal again.

  • Problem in reading no. of files and writing into a single file

    Hi,
    Iam with Problem in reading no. of files and writing into a single file....
    Iam reading no. of files stored in local directory.......
    Iam able to read and print the data in files successfully....but while writing..only first file is being written...and the next files are not written in my output file...
    plz tell me my mistake....I hope Iam doing some mistake while writing into file...PLz help.....
    Basically my code structure is like this....
    import java.io.*;
    import java.util.regex.*;
    import java.util.*;
    import java.text.*;
    import org.apache.poi.poifs.filesystem.POIFSFileSystem;
    import org.apache.poi.hssf.usermodel.HSSFWorkbook;
    import org.apache.poi.hssf.usermodel.HSSFSheet;
    import org.apache.poi.hssf.usermodel.HSSFRow;
    import org.apache.poi.hssf.usermodel.HSSFCell;
    class Writing {
    public static void main(String args[]) throws Exception {
              FileOutputStream fileOut = new FileOutputStream("ServerResult.xls"); //my output file
              int counter = 1;
              File dir = new File("C:/Perform/ServerLogs");
              String[] children = dir.list();
              if( children == null)
                   System.out.println("The Directory mentioned does not exist");
              else {
                   for (int fileNo = 0; fileNo < children.length; fileNo++ ) {        //Files iteration starts
                        String filename = children[fileNo];
              File logFile = new File(filename);
    FileReader logFileReader = new FileReader(logFile);
    BufferedReader logReader = new BufferedReader(logFileReader);
    StringBuffer sBuf = new StringBuffer(5000);
              HSSFWorkbook wb = new HSSFWorkbook();          
              HSSFSheet sheet = wb.createSheet();
              HSSFRow rowTitle;
              HSSFRow rowReq;
              HSSFRow rowRes;
    String aLine = null;
    boolean skip = false;
    boolean readed = false;
    boolean initReq = false;
              boolean flag = false;
    long requestTime = 0;
    long responseTime = 0;
    long recdTime = 0;
    long sentTime = 0;
              long hasTime = 0;
              long presentTime = 0;
              int hasCalls = 0;
    Pattern startMessage = Pattern.compile("^<MESSAGE.*ID=\".*_"+args[0]+"\".*", Pattern.DOTALL);
    Pattern requestMessage = Pattern.compile("^<MESSAGE.*TS=\"(.*)\" CATEGORY=\"RequestMsg.\".*ID=\".*_"+args[0]+"\".*<ActName>(.*)</ActName>.*", Pattern.DOTALL);
    Pattern requestMessage1 = Pattern.compile("^<MESSAGE.*TS=\"(.*)\" CATEGORY=\"RequestMsg.\".*ID=\".*_"+args[0]+"\".*<Svc id=\"(.*)\">.*", Pattern.DOTALL);
    Pattern responseMessage = Pattern.compile("^<MESSAGE.*TS=\"(.*)\" CATEGORY=\"ResponseMsg\".*ID=\".*_"+args[0]+"\".*", Pattern.DOTALL);
    Pattern initMessage = Pattern.compile("^<MESSAGE.*TS=\"(.*)\" CATEGORY=\"HostConnInit\".*ID=\".*_"+args[0]+"\".*", Pattern.DOTALL);
    Pattern initResMessage = Pattern.compile("^<MESSAGE.*TS=\"(.*)\" CATEGORY=\"ResponseMsg\".*ID=\"null\".*", Pattern.DOTALL);
    Pattern initResIDMessage = Pattern.compile("^<MESSAGE.*TS=\"(.*)\" CATEGORY=\"ResponseMsg\".*ID=\"null\".*<IATA>"+args[0]+"</IATA>.*", Pattern.DOTALL);
              Pattern sentMessage = Pattern.compile("^<MESSAGE.*TS=\"(.*)\" CATEGORY=\"DCMsgSentInfo\".*ID=\".*_"+args[0]+"\".*", Pattern.DOTALL);
              Pattern rcvdMessage = Pattern.compile("^<MESSAGE.*TS=\"(.*)\" CATEGORY=\"DCMsgRcvdInfo\".*ID=\".*_"+args[0]+"\".*", Pattern.DOTALL);
    SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS");
    DecimalFormat dcf = new DecimalFormat("########.##");
    String actName = "";
              if (fileNo ==0)
              rowTitle = sheet.createRow((short)0);
              rowTitle.createCell((short)0).setCellType(HSSFCell.CELL_TYPE_STRING);
              rowTitle.createCell((short)0).setCellValue("Req/Res");
              rowTitle.createCell((short)1).setCellType(HSSFCell.CELL_TYPE_STRING);
              rowTitle.createCell((short)1).setCellValue("Action");
              rowTitle.createCell((short)2).setCellType(HSSFCell.CELL_TYPE_STRING);
              rowTitle.createCell((short)2).setCellValue("Server Time(in ms)");
              rowTitle.createCell((short)3).setCellType(HSSFCell.CELL_TYPE_STRING);
              rowTitle.createCell((short)3).setCellValue("Request Vs Response Time in Server(in ms)");
              rowTitle.createCell((short)4).setCellType(HSSFCell.CELL_TYPE_STRING);
              rowTitle.createCell((short)4).setCellValue("Time Taken By HAS/HOST(in ms)");
              rowTitle.createCell((short)5).setCellType(HSSFCell.CELL_TYPE_STRING);
              rowTitle.createCell((short)5).setCellValue("No. of HAS calls");
              rowTitle.createCell((short)6).setCellType(HSSFCell.CELL_TYPE_STRING);
              rowTitle.createCell((short)6).setCellValue("Data Size");
              //wb.write(fileOut);
    while((aLine=logReader.readLine()) != null) {
    if(aLine.startsWith("<MESSAGE TYPE=\"EVENT\"")) {
    Matcher m = startMessage.matcher(aLine);
    if(m.find()) {
    sBuf.setLength(0);
    sBuf.append(aLine);
    skip = false;
    initReq = false;
    m = initMessage.matcher(aLine);
    if(m.find()) {
    initReq = true;
    } else {
    if(initReq) {
    m = initResMessage.matcher(aLine);
    if(m.find()) {
    sBuf.setLength(0);
    sBuf.append(aLine);
    skip = false;
    } else if(aLine.startsWith("</MESSAGE>")) {
    if(!skip) {
    sBuf.append(aLine);
    readed = true;
    } else if(!skip){
    sBuf.append(aLine);
    if(!skip && readed) {
    String tempStr = sBuf.toString();
    if(tempStr.length() > 0) {
    boolean reqMatched = false;
    Matcher m = null;
    if(initReq) {
    m = initMessage.matcher(tempStr);
    actName = "Intialization";
    } else {
    m = requestMessage.matcher(tempStr);
    String time = "";
    if(m.find()) {
    reqMatched = true;
    for (int i=1; i<=m.groupCount(); i++) {
    String groupStr = m.group(i);
    if(i == 1) {
    time = groupStr;
    } else if(i == 2) {
    actName = groupStr;
    } else if(!initReq){
    m = requestMessage1.matcher(tempStr);
    if(m.find()) {
    reqMatched = true;
    for (int i=1; i<=m.groupCount(); i++) {
    String groupStr = m.group(i);
    if(i == 1) {
    time = groupStr;
    } else if(i == 2) {
    actName = groupStr;
    if(time.length() > 0 ) {
    try{
    requestTime = sdf.parse(time).getTime();
    }catch(Exception ex){}
    System.out.println("Request,"+actName+","+time+",,,,"+dcf.format(((double)time.length()/1024.0))+"K");
                                  //bw.write("Request,"+actName+","+time+",,,,"+dcf.format(((double)time.length()/1024.0))+"K");
                                  String reqDataSize = dcf.format(((double)time.length()/1024.0))+"K" ;
                                  rowReq = sheet.createRow((short)counter);
                                       rowReq.createCell((short)0).setCellType(HSSFCell.CELL_TYPE_STRING);
                                       rowReq.createCell((short)0).setCellValue("Request");
                                       rowReq.createCell((short)1).setCellType(HSSFCell.CELL_TYPE_STRING);
                                       rowReq.createCell((short)1).setCellValue(actName);
                                       rowReq.createCell((short)2).setCellType(HSSFCell.CELL_TYPE_STRING);
                                       rowReq.createCell((short)2).setCellValue(time);
                                       rowReq.createCell((short)3).setCellType(HSSFCell.CELL_TYPE_STRING);
                                       rowReq.createCell((short)3).setCellValue("");
                                       rowReq.createCell((short)4).setCellType(HSSFCell.CELL_TYPE_STRING);
                                       rowReq.createCell((short)4).setCellValue("");
                                       rowReq.createCell((short)5).setCellType(HSSFCell.CELL_TYPE_STRING);
                                       rowReq.createCell((short)5).setCellValue("");
                                       rowReq.createCell((short)6).setCellType(HSSFCell.CELL_TYPE_STRING);
                                       rowReq.createCell((short)6).setCellValue(reqDataSize);
                                       counter = counter +1;
                                       System.out.println("counter is "+counter);
                             Matcher l = sentMessage.matcher(tempStr);
                             Matcher k = rcvdMessage.matcher(tempStr);
                   if(l.find()) {
                                            for (int i=1; i<=l.groupCount(); i++) {
         String groupStr2 = l.group(i);
    try{
    sentTime = sdf.parse(groupStr2).getTime();
    }catch(Exception ex){}
                        if(k.find())
                                                 for(int j=1;j<=k.groupCount(); j++) {
                                                 String groupStr1 = k.group(j);
                                                 try{
    recdTime = sdf.parse(groupStr1).getTime();
    }catch(Exception ex){}
                                                 presentTime = (recdTime - sentTime);
                                                 hasTime = hasTime + presentTime;
                                                 hasCalls = hasCalls +1;
    if(!reqMatched) {
    if(initReq) {
    m=initResIDMessage.matcher(tempStr);
    } else {
    m=responseMessage.matcher(tempStr);
    if(m.find()) {
    for (int i=1; i<=m.groupCount(); i++) {
    String groupStr = m.group(i);
    try{
    responseTime = sdf.parse(groupStr).getTime();
    }catch(Exception ex){}
                                                 String resDataSize = dcf.format(((double)tempStr.length()/1024.0))+"K" ;
                                                 rowRes = sheet.createRow((short)(counter));
                                                 rowRes.createCell((short)0).setCellType(HSSFCell.CELL_TYPE_STRING);
                                                 rowRes.createCell((short)0).setCellValue("Response");
                                                 rowRes.createCell((short)1).setCellType(HSSFCell.CELL_TYPE_STRING);
                                                 rowRes.createCell((short)1).setCellValue(actName);
                                                 rowRes.createCell((short)2).setCellType(HSSFCell.CELL_TYPE_STRING);
                                                 rowRes.createCell((short)2).setCellValue(groupStr);
                                                 rowRes.createCell((short)3).setCellType(HSSFCell.CELL_TYPE_NUMERIC);
                                                 rowRes.createCell((short)3).setCellValue((responseTime - requestTime));
                                                 rowRes.createCell((short)4).setCellType(HSSFCell.CELL_TYPE_NUMERIC);
                                                 rowRes.createCell((short)4).setCellValue(hasTime);
                                                 rowRes.createCell((short)5).setCellType(HSSFCell.CELL_TYPE_NUMERIC);
                                                 rowRes.createCell((short)5).setCellValue(hasCalls);
                                                 rowRes.createCell((short)6).setCellType(HSSFCell.CELL_TYPE_STRING);
                                                 rowRes.createCell((short)6).setCellValue(resDataSize);
                                                 hasTime = 0;
                                                 hasCalls = 0;
                                                 counter = counter + 1 ;
    sBuf.setLength(0);
    readed = false;
              wb.write(fileOut);
              } // End of for (int fileNo = 0; fileNo < children.length; fileNo++ )
    }     //End of else
              fileOut.close();
    } //End of public static void main
    } // End of Class

    First of all, use [code]-tags to make your code readable, please.
    I didn't do a complete inspection of your code (because it's too much and unreadable as it is) and I don't know POI, but creating a new HSSFWorkbook for each input file sounds fishy to me ... try re-using the workbook and just creating a new sheet in each iteration.

  • Can not open JPEG files and can not create JPEG files from other software

    Can not open JPEG files and can not create JPEG files from other software (For example from Solidworks).
    When I try to right click on a JPEG, a notice window appears written: "Windows Explorer has stopped working - Windows is
    checking for a solution to the problem" and then the notice box disapears, the desktop appears and I can continue working.
    From the other side - If I try to save as JPEG a screen of Solidworks (like a view of a part) the Solidworks falls but the JPEG
    is created (I can see its name in the directory I created it).
    I can open the JPEGS with the Paint software if I want but not with the Windows Photo Viewer.
    I have the feeling that the Windows Photo Viewer disapeared from my computer - just a feeling.
    I will appreciate your assistance.
    Avi T. 2014

    Hi,
    Did Windows Photo Viewer option appear when you right click the JPEG file and select open with?
    I would like suggest you use Clean Boot to troubleshoot if there is third-party software conflict:
    How to perform a clean boot in Windows
    http://support.microsoft.com/kb/929135
    Karen Hu
    TechNet Community Support

  • When I open a PDF file and I try to Save As to my shared drive I can't select it from the dropdown

    When I open a PDF file and I try to Save As to my shared drive I can’t select it from the dropdown menu. (See screenshot).
    When I select on the left side “Computer”, then my shared drive is available. (See screenshot).

    Hi staceye,
    Where are you creating the PDF file, and what is the error that you're receiving? Is it a file that is saved in your Acrobat.com online account?
    Best,
    Sara

  • Which Version of Adobe do I need to be able to "extract" a page from a existing  file and save/download to another file?

    Which Version of Adobe do I need to be able to "extract" a page from a existing  file and save/download to another file?

    Acrobat Pro or Standard.

  • When I update itunes it deletes the library file, and when I restore that file from the previous libraries or my backup, itunes will run but tell me "the iTunes library file cannot be saved. A folder was specified instead of a file" How do I fix this?

    When I update itunes it deletes the library file, and when I restore that file from the previous libraries or my backup, itunes will run but tell me "the iTunes library file cannot be saved. A folder was specified instead of a file" How do I fix this?

    Hi there Br0x,
    You may want to try rebuilding the iTunes library as an initial troubleshooting step. Take a look at the article below for more information.
    iTunes: How to re-create your iTunes library and playlists
    http://support.apple.com/kb/ht1451
    -Griff W.

  • Took backup of data files and controlfile but not archive file db is 11g xe

    took backup of data files and controlfile but not redo file db is 11g xe r2..was trying complete shut backup,..missed redo..
    anyway to restore the db back..
    I had failed to backup redo log file..
    db was shut...properly
    any info highly appreciated.
    cheers
    Edited by: zycoz100 on Feb 27, 2013 4:42 AM

    A controlfile create is a fairly trivial task, for either a cold backup or hot backup scenario. Well, its an easy task after you've done the process a few times.
    If you have a healthy oracle instance running any place else, preferably at 11gR2, or even a 10g instance can work as an example, get a system connection and do an `alter database backup controlfile to trace;` and the instance will create a new trace file with all SQL commands needed to rebuild the controlfile in the instance trace directory.
    Have a look at the trace file, a `show parameter diag` reveals the diagnostic_dest parameter, look for the "trace" directory under that folder, for the latest *trc file. In 10g its `show parameter dump` and the trace file goes straight to the user_dump_dest directory, no digging required.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

  • In the past when I have imported my dslr video/audio files and then my zoom audio files Final Cut Pro has organized them in pairs in my library. For some reason my video/audio and my audio are being organized seperately. How do I fix this? Thanks!

    In the past when I have imported my dslr video/audio files and then my zoom audio files Final Cut Pro has organized them in pairs in my library. For some reason my video/audio and my audio are being organized seperately. How do I fix this? Thanks!

    Thank you Russ! Seems as though the timestamp on my audio files was completely incorrect so it placed the files far away from the corresponding video. I've modified the timestamp information and this has helped. The hour/minute information is incorrect but at least now I'm in the ballpark. Thank you!

  • Can anyone help me write a code about coping data from many files and paste them to one file !?

    Hello ! 
    As I said in title , I have alot files (e.g. 60 files) and I want to write a code to copy 5 columns (for examples) of special sheet of files and paste them in one file respectively. For perceive it I explained it more below .
    Suppose one of my files is simplified as this : http://s000.tinyupload.com/?file_id=00699705919876414523
    The name of  this file is 2006Oct and assume my excel files are like "2006Oct, 2006Nov,2006Dec,2007Jan ... 2010Dec". At first I should go to "my files" sheet of 2006Oct file and copy columns " A,B,C,D,E,F " that has "PerturbationNumber=1"
    respectively and then paste these to a file that is output file and repeat this process for the other files ( 2006Nov and etc ) and paste data in output file sequentially. 
    I appreciate and look foreward for any help in this issue.
    Majid

    Try code below
    Sub CombineBooks()
    Dim wb As Workbook
    Dim sourceSht As Worksheet
    Dim destSht As Worksheet
    Set destSht = ThisWorkbook.Sheets(1)
    destSht.Cells.Clear
    FolderName = "C:\temp\test\"
    file = Dir(FolderName & "*.xlsx")
    firstSht = True
    Do While file <> ""
    Set wb = Workbooks.Open(Filename:=FolderName & file, ReadOnly:=True)
    Set sourceSht = wb.Sheets(1)
    With sourceSht
    sourceLastRow = .Range("A" & Rows.Count).End(xlUp).Row
    If .Cells.AutoFilter Then
    .Cells.AutoFilter 'turn off autofilter
    End If
    .Cells.AutoFilter Field:=6, Criteria1:="1"
    If firstSht = True Then
    Set copyRange = .Range("A1", .Range("E" & sourceLastRow)).SpecialCells(xlCellTypeVisible)
    destSht.Range("F1") = "FileName"
    firstSht = False
    destNewRow = 1
    Else
    Set copyRange = .Range("A2", .Range("E" & sourceLastRow)).SpecialCells(xlCellTypeVisible)
    destNewRow = destSht.Range("A" & Rows.Count).End(xlUp).Row + 1
    End If
    copyRange.Copy Destination:=destSht.Range("A" & destNewRow)
    LastRow = destSht.Range("A" & Rows.Count).End(xlUp).Row
    If destNewRow = 1 Then
    destSht.Range("F2:F" & LastRow) = file
    Else
    destSht.Range("F" & destNewRow & ":F" & LastRow) = file
    End If
    End With
    wb.Close savechanges:=False
    file = Dir()
    Loop
    End Sub
    jdweng

  • Dear Apple Support,  Good day to you. This is to report the problem i encountered when i updated my Ipad mini to the new IOS 8.1..  After the update my Ipad restart and after that it appears a picture that need to connect to itunes and need  to resto

    Dear Apple Support,
    Good day to you.
    This is to report the problem i encountered when i updated my Ipad mini to the new IOS 8.1..
    After the update my Ipad restart and after that it appears a picture that need to connect to itunes and need  to restore. So i connect it to itunes and wait to restore my ipad mini because it is not opening.
    After restoring it my ipad is now opening and it is like new that i need to set up again.
    I set up again until i reach the apple id and password.
    I put my below apple ID and password to unlock my ipad but it didn't work. The message i receive is "the apple ID cannot be used to unlock this Ipad.
    What will I do? Please help.
    Thank you
    Sent from my iPhone
    Begin forwarded message:
    From: Apple <[email protected]***>
    Date: October 9, 2013 at 11:53:53 PM GMT+4
    To: ****
    Subject: Your Apple ID was used to sign in to iCloud and iMessage on an iPad mini 
    Dear Leslie J.,
    Your Apple ID was used to sign in to iCloud and iMessage on an iPad mini named “Leslie Joye's iPad”.
    If you have not recently set up an iPad with your Apple ID, then you should change your Apple ID password. Learn more.
    Apple Support
    <Email Edited By Host>

    1. It is never a good idea to include personal info like your email address or Apple ID in a post on an open forum.
    2. The email you received DOES NOT say your Apple ID cannot be used to unlock this iPad. The email informs you that your Apple ID was used to unlock an iPad. Fortunately the iPad is yours. The message confirms that. If your Apple ID was used to unlock an iPad that was not yours your would then know to change your password. Since the iPad is yours you do not need to change your password.
    Is your iPad working?

  • My iPod touch 5th Gen iOS 8.1 won't turn on, charge and CONNECT TO iTUNES. Maybe this is because of the new release ios 8.1 where after the update it went recovery mode then i didn't restore, i set up a new ipod. What's wrong? Is ths bcoz of ios 8.1?

    My iPod touch 5th Gen iOS 8.1 won't turn on, charge and CONNECT TO iTUNES.
    Maybe this is because of the new release ios 8.1 where after the update it went
    recovery mode then i didn't restore, i set up a new ipod.
    What's wrong? Is ths bcoz of ios 8.1?

    How do you do that
    lllaass wrote:
    Try:                                               
    - iOS: Not responding or does not turn on          
    - Also try DFU mode after try recovery mode
    How to put iPod touch / iPhone into DFU mode « Karthik's scribblings
    - If not successful and you can't fully turn the iOS device fully off, let the battery fully drain. After charging for an least an hour try the above again.
    - Try another cable              
    - Try on another computer                                                       
    - If still not successful that usually indicates a hardware problem and an appointment at the Genius Bar of an Apple store is in order.
      Apple Retail Store - Genius Bar                              

  • I bought a used PowerMacPC G5. I can burn and read DVDs, but I can't read or burn CDs. The CDs are not even recognized. After the drive searches for a while, the CD is ejected without any error messages. The CDs work okay on my iMac.

    I bought a used PowerMacPC G5. I can burn and read DVDs, but I can't read or burn CDs. The CDs are not even recognized. After the drive searches for a while, the CD is ejected without any error messages. The CDs work okay on my iMac.
    I am running Mac OSX 10.4.11. According to the System profiler the CD/DVD drive is a "PioneerDVD-RWDVR-112D." When I compare the information under this heading, the only unusual difference from my iMac is that the G5 reads "Burn Support: Yes (Unsupported)." My iMac reads "Burn Support: Yes (Apple Shipping Drive)."
    Under the System Preferences the options are set to "Ask what to do" when a blank CD or DVD is inserted. Music CD set to open iTunes, Picture CD set to open iPhoto, Video DVD set to open DVD player.
    Do you have any suggestions?
    Thanks, Jack

    Hi Jack, great help so far!
    Internal...
    http://eshop.macsales.com/static_pages/Framework.cfm?page=superdrive/sdl_powerma c_g5.html
    External be sure it's Firewire & not Bus powered...
    http://eshop.macsales.com/shop/firewire/optical-drives/

  • Hi, I just updated my mac from version10.6 to 10.9.3 os mavericks. i went to open iPhoto and it says "Your photo library will not be readable by previous versions of iPhoto after the upgrade." does this mean I have lost all photos i had in there?

    Hi, I just updated my mac from version10.6 to 10.9.3 os mavericks. i went to open iPhoto and it says "Your photo library will not be readable by previous versions of iPhoto after the upgrade." does this mean I have lost all photos i had in there? It does not give me a choice, it just says quit or upgrade? p.s. i didn't realise ther was  a way to back up my computer beforehand, which i am guessing this is time machine?

    1. No, you haven't.
    2. Back up the iPhoto library(this can be done through Time Machine or by dragging it to a drive, partition, or disk image formatted as Mac OS Extended) and then click Upgrade.
    3. Aside from Time Machine and drag-copying items from your home folder, programs such as the Disk Utility, Carbon Copy Cloner, and SuperDuper can make backups.
    (108026)

  • I have a problem in iPhone . When you receive a contact and press the key at the top to cancel the contact screen stopped working .ataml times after the last restart device

    I have a problem in iPhone . When you receive a contact and press the key at the top to cancel the contact screen stopped working .ataml times after the last restart device

    Since restarting did not help, reset your iPhone, see: Turn your iOS device off and on (restart) and reset  http://support.apple.com/kb/ht1430
    If that still does not solve it, check, if the contact you are trying to add is problematic. Try to save a different contact. Does that work?
    If not, reinstall the Contacts app. This is only possible by restoring your iPhone, unfortunately.
    See: Use iTunes to restore your iOS device to factory settings  http://support.apple.com/kb/HT1414

Maybe you are looking for

  • T-code extended name

    If I need to see the purpose of the T-code (like MD04 - stock requirement list) how do I get this field? From which table can I see this data? Pls advise.

  • Problem with Windows 8.1 and iTunes

    Hi Apple Support I use windows 8.1. on my laptop and I have a problem with iTunes after the latest version. When I connect my iPhone, iTunes doesn´t work ( I cannot see my iPhone on iTunes) and when I connect my iPod nano the latest version, it is wr

  • Configuration of scot in ecc6.0

    Hi all, i have configured out going mails in sap with scot....but i am able send the mails...its throwing an error that "Cannot process message, no route from BS5VIJAY to [email protected]" Thanks vijay

  • Wrong value getting updated into konv table.

    Hi, i have created 1 sales order through VA01 transaction. when i checked this sales order value into VA02 It shows 14,700, but when i check into KONV table this value shows 147.00 . please suggest a solution . thanks Abhay

  • How to uninstall iOS 6

    How to uninstall ios6 and go back to 5 or 4 ?