Sign in to follow this  
Followers 0
eEniquEe

Random Problems Extraction

3 posts in this topic

Hi,

I'm having a little bit troubles with my current project. Basically, it's a Mathematics Problem Generator. I have, like 1000 problems. Each problem can be stored in a text file, with less than 500 bytes long.

The problem is that, I haven't found a way, to store those problems efficiently. What I mean is that it should take as little disc space as possible, and the reading speed should be acceptable, and when loading the problem, it shouldn't take much RAM.

I'm thinking about storing each problem in each separated file naming from Problem 1.txt to Problem 1000.txt.

But since each problem is less than 500 bytes. And any file which is less than 4kB, when stored in my computer, will take up to 4kB disc space. So even a 500 bytes file will takes up 4kB space on the disc. That's 8 times bigger than the actual size. So, I'm also thinking about grouping 8 problems into 1 single file. But when generating the problem, the program will have to read the whole file (this is RAM con-summing), and take one arbitrary problem from that set of 8 problem (reading speed).

I hope I'm being clear enough.

I wonder if there's some way that is more efficient than storing each problem in a single file like that? Can someone please give me a push?

Thanks everyone very much,

And have a good day, :)

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

INI file, XML file, SQLite database file, etc., etc.

Lots of options for more efficient storage.

:)

Edited by PsaltyDS

Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law

Share this post


Link to post
Share on other sites

Why worry about disk space?

1000 x 4KB equals to about 4 megabytes. No big deal on todays computers.

When space is an issue (USB device, transferring over slow connection ...) put everything into a single ZIP-file and unzip it on the target device.


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2017-04-18 - Version 1.4.8.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2017-02-27 - Version 1.3.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0