dongmi5177 2013-08-31 15:50
浏览 40

如何存储HUGE数组,用于图形[关闭]

The data, created in Javascript, with use of jQuery:

1.) Users answer multiple-choice questions, of which the time it takes to answer (tX in ms) is stored, by adding it to an array (answerTimes).

2.) Also, it is recorded whether or not the question was answered correctly (cX in binary), which is stored into an array as well (answerCorrects (I know; it's a shit name. Deal with it)).

e.g.,:

var answerTimes = [];
var answerCorrects = [];
// for every answer:
answerTimes[answerTimes.length] = tX
answerCorrects[answerCorrects.length] = cX
// which results in, e.g.:
// answerTimes = [1289, 1784, 1628, 972] and 
// answerCorrects = [0,0,0,1,1,0,1,1,0], both of variable length,
// depending on how many questions the user has answered.
// this could well be over a thousand answers!

And here's the thing:

These are multiple graphs (such as, but not limited to these 2) per chapter.
There are also multiple chapters, per subject.
There are also multiple subjects, per language.
And there are multiple languages.

e.g., a user who is learning Japanese, and is currently studying his Kanji, and is at chapter 4, wants to review his performance data, presented in the form of graphs.

The actual question:

What fashion would be best to work in, in order to store these various arrays in a MySQL database, assuming I'm using AJAX to pass these JS-values on to a PHP that does the MySQL magic?

I'm worried, because if there were to be 1 user, 3 languages, 10 subjects, 7 chapters, and 2 graphs, then there would already be an incredible number of arrays to store. However these small numbers aren't what I'm aiming for: I want as many users as the market allows me, with as many languages as there are - even ancient ones, no /joke here - and these numbers will continue to expand as time goes by. I want users to be able to learn ANY language possible, and to have as MUCH graphical information about their performance as possible to their disposal.

How the hell am I supposed to store ALL of this data in an organised way, that my script can access these arrays. I know how to work mySQL, but I've never had anything more than some strings and serialised, small arrays to store. Also; how to graph them, I know, it's just the storage part of these huge and many arrays that bothers me.

Hit me!

  • 写回答

2条回答 默认 最新

  • duanmei1536 2013-08-31 16:06
    关注

    None of what you are asking - if I am understanding the requirement - is as difficult as you are worried it will be.

    Sounds like you might have a structure like:

    Languages
    -------------
      LanguageID
      Name
    
    Subjects
    -------------
      SubjectID
      Name
    
    LanguageSubjects
    -------------
      LanguageSubjectID
      SubjectID
      LanguageID
    
    Chapters
    -------------
      ChapterID
      Name
      LanguageSubjectID
    
    Users
    -------------
      UserID
    
    GraphData
    -------------
      UserID
      ChapterID
      Scores
    
    评论

报告相同问题?

悬赏问题

  • ¥15 无线电能传输系统MATLAB仿真问题
  • ¥50 如何用脚本实现输入法的热键设置
  • ¥20 我想使用一些网络协议或者部分协议也行,主要想实现类似于traceroute的一定步长内的路由拓扑功能
  • ¥30 深度学习,前后端连接
  • ¥15 孟德尔随机化结果不一致
  • ¥15 apm2.8飞控罗盘bad health,加速度计校准失败
  • ¥15 求解O-S方程的特征值问题给出边界层布拉休斯平行流的中性曲线
  • ¥15 谁有desed数据集呀
  • ¥20 手写数字识别运行c仿真时,程序报错错误代码sim211-100
  • ¥15 关于#hadoop#的问题