Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8385565
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T17:42:10+00:00 2026-06-09T17:42:10+00:00

Help me brainstorm how I would solve this problem. I have a file of

  • 0

Help me brainstorm how I would solve this problem.

I have a file of dates with corresponding data, the format looks like this:

Date,data,data,data,data,data
Date,data,data,data,data,data

It’s a plain csv file, only commas being used.

I need to be able to select a beginning date. And then get the data for the next 20 days beginning with the date selected.

Date format:
2007.05.21 (y,m,d)

So I think it would be best to search for the date. Either loading the entire file first into memory or read line by line. The file is only 1 megabyte, however I might want to do this with a 100 megabyte file as well. Is that still little?

Also I will want to do this very many times. I think I may want to keep the file in memory for the entire run of the program. So I can repeatedly access it.

After finding the date. I need to be able to get column 2 day 1, column 4 day 4. Ect. However there is always the same amount of columns for each day. So I guess if this is loaded into some kind of array I can always know in what array number the next and next day starts.

Any help would be greatly appreciated. Also any code examples provided would really help. This is not a homework problem or anything like that and I’m really new to programming.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-09T17:42:11+00:00Added an answer on June 9, 2026 at 5:42 pm

    You can user csv library to parse your file like this line by line

    require 'csv'
    date_to_search = Date(2009, 10, 10)
    CSV.read('yourfilename.txt', :col_sep => ',') do |row|
      # row will be an array of strings which you can parse
      cur_date = Date.parse(row[0])
      if cur_date == date_to_search
        # you are set to read next 19 lines
        # you can keep a counter and increment it after parsing each line (row here)
      end
      # compare and check if you need this line (and next 19)
      # other calculations
    end
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Help me, please, solve one problem. I have project, which uses Nhibernate and Fluent
Help guys, i've just seen this example in the web. i would like to
Help please on how to extract data like 15,Teaching Periods 1 and 2.,Max 150.
Help for this specific server side php code I don't have any knowledge of
help me please with regular expression in ruby. I have a text like 1.
I have a little DB challenge for you. Hopefully you can help. The Problem:
Help me please. I have problem with encoding response string after GET request: var
Help! I have a clickonce app built and published using .Net 2.0. This app
I would love to brainstorm with you guys on how to program this game
Help, I'm deperate..i can't continue my app because of this: I have setup one

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.