Page 1 of 2 12 LastLast
Results 1 to 10 of 11

Thread: VB Programming Question

  1. #1
    Senior Member
    Join Date
    Oct 2001
    Posts
    175

    VB Programming Question

    Hello All,

    I am currently writing a little program in VB that should be relatively easy, but unfortunetly I have encountered a problem...Let me explain!

    Last night after posting my thread "Firewall Log Humor" I decided that I wanted to write a program that would take the Zone Alarm Alert Log and parse the data and display it as a neatly formatted HTML document... simple task right?

    Well here how I have arranged the order of operations of the programs

    [ 1) Program Start]
    [ 2) Input: Location of the Firewall Log]
    [ 3) Open Firewall Log]
    [ 4) Start of a Do-While not EOF loop]
    [ 5) Read A Line]
    [ 6) Parse the line using "Split()" and the comma as my deliminator]
    [ 7) Load the parsed string into an Array]
    [ 8) Print the contents of the array into a HTML template I created]
    [ 9) End the Loop]
    [ 10) Close the open Log File]
    [ 11) Launch the default browser with the formatted HTML log]
    [ 12) End Program]

    Ok...Rough Overview

    Now the code runs perfectly with small ZA logs, but when I attempt to open large files (> 100k) the program will stop responding. I was curious if anyone has any ideas to get past this 100k barrier!

    Any help is appreciated!
    Simon Templer

    \"Your work is to discover your world and then with all your heart give yourself to it. \"
    -The Buddha

  2. #2
    Old-Fogey:Addicts founder Terr's Avatar
    Join Date
    Aug 2001
    Location
    Seattle, WA
    Posts
    2,007
    This happens only when you try to open them, right? This is with the Open statment? Have you tried opening it in a different mode? What mode are you opening it in anyway? MS VB Books Online doesn't say much... Here's what It says, just BTW:


    Enables input/output (I/O) to a file.
    Syntax
    Open pathname For mode [Access access] [lock] As [#]filenumber [Len=reclength]

    The Open statement syntax has these parts:
    Part Description

    pathname Required. String expression that specifies a file name¾may include directory or folder, and drive.

    mode Required. Keyword specifying the file mode: Append, Binary, Input, Output, or Random. If unspecified, the file is opened for Random access.

    access Optional. Keyword specifying the operations permitted on the open file: Read, Write, or Read Write.

    lock Optional. Keyword specifying the operations permitted on the open file by other processes: Shared, Lock Read, Lock Write, and Lock Read Write.

    filenumber Required. A valid file number in the range 1 to 511, inclusive. Use the FreeFile function to obtain the next available file number.

    reclength Optional. Number less than or equal to 32,767 (bytes). For files opened for random access, this value is the record length. For sequential files, this value is the number of characters buffered.

    Remarks
    You must open a file before any I/O operation can be performed on it. Open allocates a buffer for I/O to the file and determines the mode of access to use with the buffer.
    If the file specified by pathname doesn't exist, it is created when a file is opened for Append, Binary, Output, or Random modes.
    If the file is already opened by another process and the specified type of access is not allowed, the Open operation fails and an error occurs.
    The Len clause is ignored if mode is Binary.
    Important In Binary, Input, and Random modes, you can open a file using a different file number without first closing the file. In Append and Output modes, you must close a file before opening it with a different file number.
    [HvC]Terr: L33T Technical Proficiency

  3. #3
    Senior Member
    Join Date
    Oct 2001
    Posts
    175
    I'm opening the file as input...the problem is not when I open the file... it's when it starts the Do..While Loop ...

    I'm pretty sure that the large amount of information in the text file is what is causing the program to lock up...

    I did some more testing and it happens with text files > 50k

    I was aware of most of the info you posted, the "reclenght" was new to me... I thank you for the info though
    Simon Templer

    \"Your work is to discover your world and then with all your heart give yourself to it. \"
    -The Buddha

  4. #4
    Old-Fogey:Addicts founder Terr's Avatar
    Join Date
    Aug 2001
    Location
    Seattle, WA
    Posts
    2,007
    How about adding a small textbox object to the interface, and as the loop goes, update it every few loops with the index value, so that you can see if it is simply taking forever to loop, or if it actually ran into something weirder...
    [HvC]Terr: L33T Technical Proficiency

  5. #5
    Senior Member
    Join Date
    Oct 2001
    Posts
    175

    Figured it out

    Your idea was very good...but I finally figured out what the problem was:

    I forgot to use "Line Input" instead of "Input" ! *Smack*

    If your looking at this and saying "Whats the difference?" I'll explain...

    Using a simple "Input #filenum, variable" will return a string containing the characters until a carriage return or certain types of deliminators (such as comma)

    Using "Line Input #filenum, variable" will return the entire line including those deliminators.

    Hehe...Stupid mistake.... Everything Works Fine Now

    Thanks Terr for the info posted, and Thanks for your Help

    PS. I'll be posting my source when I finish for anyone who wants it
    Simon Templer

    \"Your work is to discover your world and then with all your heart give yourself to it. \"
    -The Buddha

  6. #6
    Senior Member
    Join Date
    Sep 2001
    Posts
    800

    VB question

    This might sound like a dumb question but where can I find files for VB programming? I know the basic VB commands but I want to get into programming a little deeper.
    [gloworange]\"A hacker is someone who has a passion for technology, someone who is possessed by a desire to figure out how things work.\" [/gloworange]

  7. #7
    Senior Member
    Join Date
    Oct 2001
    Posts
    175
    Well... You can check out my site, I have some links to VB related sites here is my site's URL:

    www.geocities.com/pharmicomlabs

    Your question was not dumb! How else are you supposed to learn if you don't ask

    I will be posting more VB links in the days to come... and hopefully in the future I can write some tutorials!

    Check out those links on my site, and if those don't suit your needs let me know, and I will give you some more (I have a ton of links)

    But remember, no online site is as good as a book.

    Hope this helps you out!!
    Simon Templer

    \"Your work is to discover your world and then with all your heart give yourself to it. \"
    -The Buddha

  8. #8
    Senior Member
    Join Date
    Aug 2001
    Posts
    170

    Arrow

    no online site is as good as a book
    I have to disagree with you there. At least for me personally, I can learn much faster going through online tutorials than going through a book (especially programming languages). First off, you can almost always find a tutorial on any facet of a programming language online, so it is rarely a question of the Internet lacking the information. Secondly, once you get used to having the tutorial text on one half of your screen as you code on the other, it is hard to go back to looking up and down from the screen to the book all the time. Also, the savings are another plus for those who don't have the cash (like me). I know I probably would have had to have purchased close to $700 worth of books if the tutorials weren't online. (not to say I don't have some books)

    In the end, though, do whatever fits you.

    Simon - nice web site by the way
    \"If you torture the data enough, it will confess.\" --Ronald Coase

  9. #9
    Senior Member
    Join Date
    Oct 2001
    Posts
    175
    Thanks for the Positive note on my site!

    I agree with you that online tutorials are cheaper and easier to read than books, but what I was trying to say was that online tutorials are "usually" not as definitive as books. Books usually contain alot more information than online tutorials (in my experience). And it has been my experience that some online tutorials leave out alot of good relevant information that books don't.

    I'm not knocking online tutorials...I have learned almost everything I know from them...(mainly because I don't have the money for book) But books (in my opinion) are better for referencing .
    Simon Templer

    \"Your work is to discover your world and then with all your heart give yourself to it. \"
    -The Buddha

  10. #10
    Senior Member
    Join Date
    Sep 2001
    Posts
    800
    Thanks for the help i appreciate it greatly. By the way your site is great too.
    [gloworange]\"A hacker is someone who has a passion for technology, someone who is possessed by a desire to figure out how things work.\" [/gloworange]

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •