I have a basic understanding of AS2 and AS3. I previously tried creating giant arrays in my file so that I could compare arrays against each other, but it would be far better to have the data tables as external files since there is so much of it. If I want to scale up my analysis, there are millions of entries in total. Ideally I can click a button and then it only loads in the part that is needed. All data is meant to be static in their files. If the data needs modifying, I'll do it manually in the text files.
The way I set up tables are vertical. EX:
Year 1:
Name: Person 1, Person 2, Person 3, Person 4
Q1: 25, 22, 21, 14
Q2: 14, 25, 19, 33
Etc.
Year 2:
Name: Person 1, Person 2, person 3, Person 4
Q1: 21, 15, 11, 6
Q2: 8, 35, 22, 9
Etc.
I have found multiple suggestions on here for parsing txt files, but I remain unclear on how to pull in a table like this and turn it into an array. In this case, Name array would be [Q1, Q2,...]. Person 1 would be [25, 14,...] Since the array is nested, it would only contain data from Year 1. If I can get the basics of this working, the rest is just converting all my tables to txt files and just grinding through.
A bit more background: I'm using Flash to help visualize data since I can draw and do color changes easily in it. There are probably better software out there. I think I'm going the right direction, but if I'm making big mistakes in my assumptions, please correct me. There's other suggestions on here for other formats and methods, in theory the data could be put directly into another flash file as an array and included when needed, that might also work. Once again, I have a smaller scale of this working with the arrays just straight in Flash, it's just going to eventually die if I try and scale up. Thanks for your time.
Related
I am trying to create my first database based application that organizes technical drawings with their revision history.
For my class 'drawing', I don't know which data type to use for the revision numbers of the drawings.
The naming convention for drawing revisions works in a way that the drawing identifier starts with 0 (first drawing) and then goes up alphanumerical A, B, C, etc.
Sometimes our customers require a numerical naming convention (in the style of 0, 1, 2, 3, etc.)
Is it practical to just declare the variable as string or is there a simpler way to organize these values while still being able to sort the drawings in the correct sequence?
The reason why I ask, is that someone once told me that if working with databases requires some more thought than a regular application.
I am trying to implement collision bounce off between two nodes. From what i learnt, collision property will be set by default and if there is any contact between two nodes, it will bounce back. I have multiple virtual 3D objects that i add into scene. There is a provision for user to move the object anywhere. For example, let us say i have two objects table and chair, if i move chair towards the table, the chair overlaps with the table. But what i need is chair should bounce back since we already have table in that position.
I have multiple objects placed liked this. And user can move any object anywhere. But no two objects should overlap with each other.
I tried setting contactbitmask and collisionbitmask but no luck(I have 6 scenefiles and i have given values from 1, 2, 4, 8, 16, 32 as category masks and 62, 61, 59, 55, 47, 31 as collision and contact masks respectively for nodes of each scenefile).
I even tried using contactTestBetween but no idea what it returns and how to find out if there is contact between two bodies using this method. I understand it returns point of contact, impulse, penetration distance etc. but with these how to find out if there is contact between 2 nodes?
got a little database design question here - I want opinions and discussion about the correct way to go about this as the actual problem is one I've hit more than once.
So I've invented a new game. In this game you can receive a penalty of either 10, 20, 30, 40, 50 penalty score. Depending on the penalty score depends how many referees need to agree. So if you get a 10 penalty score, just 1 referee 'steve' needs to agree, if 20, 2 referees 'steve' and 'alan' will agree.
How can this be arranged in a database table so I can look up which referees and how many need to agree?
A non-ideal solution :
I thought about having the headings
penScore | Ref1 | Ref2 | Ref3 | Ref4 | Ref5
10 steve
20 steve alan
30 steve alan scott
The problem with this is it leaves a lot of empty cells which is messy.
Can you come up with a better solution?
Empty cells do not take up a lot of space. It depends on which Database product you are using, but most of them have a very succinct way of expressing "nothing here". The usual way of representing "nothing here" is the SQL NULL.
The real mess begins when you start doing Boolean logic on cells that contain an SQL NULL. When you get into logical operations on NULLS, you get into SQL's three valued logic. This is really obscure stuff compared to ordinary two valued logic.
The solution you outline is not normalized. This may or may not cause problems, depending on what you are going to do with the data.
There is no one best practice. It depends on the case.
The straightforward design is:
--player PLAYER gets penalty score SCORE from referee REFEREE
Penalty(player, score, referee)
UNIQUE NOT NULL (player, score, referee)
CHECK (score in (10, 20, 30, 40, 50))
As it is really difficult to make understand the problem. I have uploaded the pic. It might help you to understand my problem. Please help me to solve it out. Thanks in advance
I cannot reconcile why you would want to have the pattern in column D. It seems to be 'look up the first position for the first two matches then progressive positions for the remainder of any matches'.
Here is the solution to your problem.
In D1, as a standard formula,
=AGGREGATE(15, 6, ROW($1:$12)/(B$1:B$12=B1), COUNTIF(B$1:B1, B1)-(COUNTIF(B$1:B1, B1)>1))
'to retrieve the values from column A as,
=INDEX(A:A AGGREGATE(15, 6, ROW($1:$12)/(B$1:B$12=B1), COUNTIF(B$1:B1, B1)-(COUNTIF(B$1:B1, B1)>1)))
However, I strongly suspect that it should be closer to this (as in G1),
=AGGREGATE(15, 6, ROW($1:$12)/(B$1:B$12=B1), COUNTIF(B$1:B1, B1)-(COUNTIF(B$1:B1, B1)>1))
'to retrieve the values from column A as,
=INDEX(A:A, AGGREGATE(15, 6, ROW($1:$12)/(B$1:B$12=B1), COUNTIF(B$1:B1, B1)-(COUNTIF(B$1:B1, B1)>1)))
Im trying to make an 2D online game (with Z positions), and currently im working with loading a map from a txt file. I have three different map files. One contains an int for each tile saying what kind of floor there is, one saying what kind of decoration there is, and one saying what might be covering the tile. The problem is that the current map (20, 20, 30) takes 200 ms to load, and I want it to be much much bigger. I have tried to find a good solution for this and have so far come up with some ideas.
Recently I'v thought about storing all tiles in separate files, one file per tile. I'm not sure if this is a good idea (it feels wrong somehow), but it would mean that I wouldn't have to store any unneccessary tiles as "-1" in a text file and I would be able to just pick the right tile from the folder easily during run time (read the file named mapXYZ). If the tile is empty I would just be able to catch the FileNotFoundException. Could anyone tell me a reason for this being a bad solution? Other solutions I'v thought about would be to split the map into smaller parts or reading the map during startup in a BackgroundWorker.
Try making a much larger map in the same format as your current one first - it may be that the 200ms is mostly just overhead of opening and initial processing of the file.
If I'm understanding your proposed solution (opening one file per X,Y or X,Y,Z coordinate of a single map), this is a bad idea for two reasons:
There will be significant overhead to opening so many files.
Catching a FileNotFoundException and eating it will be significantly slower - there is actually a lot of overhead with catching exceptions, so you shouldn't rely on them to perform application logic.
Are you loading the file from a remote server? If so, that's why it's taking so long. Instead you should embed the file into the game. I'm saying this because you probably take 2-3 bytes per tile, so the file's about 30kb and 200ms sounds like a reasonable download time for that size of file (including overhead etc, and depending on your internet connection).
Regarding how to lower the filesize - there are two easy techniques I can think of that will decrease the filesize a bit:
1) If you have mostly empty squares and only some significant ones, your map is what is often referred to as 'sparse'. When storing a sparse array of data you can use a simple compression technique (formally known as 'run-length encoding') where each time you come accross empty squares, you specify how many of them there are. So for example instead of {0,0,0,0,0,0,0,0,0,0,1,1,2,3,0,0,0,0,0,0,0,0,0,0,0,0,1} you could store {10 0's, 1, 1, 2, 3, 12 0's, 1}
2) To save space, I recommend that you store everything as binary data. The exact setup of the file mainly depends on how many possible tile types there are, but this is a better solution than storing the ascii characters corresponding to the base-10 representation of the numers, separated by delimiters.
Example Binary Format
File is organized into segments which are 3 or 4 bytes long, as explained below.
First segment indicates the version of the game for which the map was created. 3 bytes long.
Segments 2, 3, and 4 indicate the dimensions of the map (x, y, z). 3 bytes long each.
The remaining segments all indicate either a tile number and is 3 bytes long with an MSB of 0. The exception to this follows.
If one of the tile segments is an empty tile, it is 4 bytes long with an MSB of 1, and indicates the number of empty tiles including that tile that follow.
The reason I suggest the MSB flag is so that you can distinguish between segments which are for tiles, and segments which indicate the number of empty tiles which follow that segment. For those segments I increase the length to 4 bytes (you might want to make it 5) so that you can store larger numbers of empty tiles per segment.