It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.
Closed 10 years ago.
For a school project, we have to develop a theatre booking system, with a graphical representation of the theatre, which is labelled in a really annoying way. Our tutor said we should represent the theatre with a 2-d array of labels, but referencing each label to change the colour is tricky, say if the user booked seat 10,10 then that wouldn't be 10,10 in the array.
Does anyone know of any good methods of solving this? Because I am stumped.
Here is a link to the seating plan: http://i.stack.imgur.com/U14ut.png
I would suggest that you use an array of labels for each row. For example for row A create labels named lblRowA with indexes 1 to 14 and repeat for the other rows (having an array for each row). That should make it easy to map requests onto real world seating.
In addition to the 2-D array of labels, you can use two 2-D arrays of the same size, one for the row letter and one for number of each seat represented by the array of labels.
For example, for labels(4, 7) the seat number might be seatNumbers(4,7) and the row letter might be rowLetters(4,7).
If you know how (or can figure it out), you use one 2D array of a class or structure where each member contains the two values, and possibly reservation information, etc. In that case, you could address the seat information with something like seats(4,7).rowLetter, seats(4,7).seatNumber, and seats(4,7).reserved. You could also have a reference to the seat labels in the seats class.
Related
It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.
Closed 9 years ago.
Need help - How to create partition in SQL server which will held 2011, 2012, 2013 data in separate file groups.
I'm struggling to understand between RANGE RIGHT or RANGE LEFT....
Please specify version of you sql server, and read this: http://msdn.microsoft.com/en-us/library/ms187802.aspx
As for RANGE LEFT/RIGHT difference and decision to choose one for datetime column (I'm assuming datetime, but what exactly is the type in your case?), the command would look like this for int type:
CREATE PARTITION FUNCTION OrderDateRangePFN(int)
AS
RANGE [LEFT | RIGHT] FOR VALUES (100,200,300)
When you use RANGE LEFT, the first partition will contain values <=100. With RANGE RIGHT it'll be <100, and that's the difference really (please note that also NULLs will be handled differently).
In your example, if you wish to create partition function on datetime column, with RANGE LEFT your boundary values would have to be specified like this:
('20111231 23:59:59.997','20121231 23:59:59.997','20131231 23:59:59.997')
With RANGE RIGHT it'll be more elegant and plain:
('20111231','20121231','20131231')
It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.
Closed 9 years ago.
The real scenario is a bit complicated so, i will explain in a simple way.
I have a table with 10 columns as below
ID Year1 Year2 Year3 Year4 Year5
--------------------------------------------
1 x1 x1+ x1+ x1+
Year1 Year1+ Year1+ and so on
Year2 Year2+
Year3
x1 is a scalar value
Year1 - previous cell's value for the 'same row'
In such a case, how do i write insert statement in sql server.
I cannot use Insert into tableName values (1, x1, ???.....
I get stuck from the third row onwards. Any help would be help ful. Thank you.
Another option i found was to first insert, and then sequencially update for each cell's value. This method uses too many lines of code and I fear it could lead to overhead
I can think of two possible solutions here.
If you use T-SQL then use variables for columns and update these values as you described before triggering an Insert.
If you use some kind of middle-ware programming language like Java, update the column values before inserting.
It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.
Closed 10 years ago.
I 've been set the following problem and don't have a clue how to start any help would be much appreciated.
In 2-D, read in the initial positions, velocities and masses of two bodies (suns, stars etc) . You will need to define suitable units for these. Then using the gravitational equation, calculate the force on each body from the other, and use Newton’s 3rd law to calculate the acceleration of that body. Generate a file with the positions of both bodies at each timestep for a long time period. Use this file to plot the paths of the two bodies.
Store the initial position, velocity and masses.
Calculate the magnitude and direction of the gravitational force.
Knowing the force, you can calculate the acceleration of each body.
Knowing the acceleration you can calculate the new velocity.
Knowing the velocity you can calculate the new position.
Using suitably small time steps you can get a reasonably good approximation to continuous motion.
It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.
Closed 11 years ago.
We want to implement Public Transport Guide for Android.
Inputs will be beginning and destination point. Outputs will be the directives that
tell how can be gone to the destination with using buses, subways,... e.c
This is not easy for big cities and we must have a well-designed database for quick answer. Tranport algorithm must give optimum lines to the passanger.
I wanna see your precious ideas for database and algorithm design.
Thank you very much for answers.
Most likely you will need a graph there to calculate shortest path.
Your graph will be G=(V,E) such that V = {all possible stations} and E = {(u,v) | there is a transport connecting station u to station v}.
If your graph cannot fit into memory [which is probably the case for a big city], you might want to make a function successors(u) = { v | (u,v) in E } which will allow you to calculate the graph on the fly.
In this older question there is some discussion how to efficiently find a path between two vertices in a dynamic environment similar to the one you are describing.
It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.
Closed 11 years ago.
This may seem quiete easy to everyone else but I am struggling to comprehend it.
I have to add up the numbers held in the middle 20 indexes of an array 0-99
but I cant work out from what index to what index I should add.
Is it from 40-60? or is that 22 values?
if you are having trouble counting things in lists of consecutive integers that are not starting at one then just imagine subtract the lowest index from all of them and then add 1. Then you will have a lsit of consecutive integers starting from 1 so whatever the top index is will be the count of the thing.
So in the case of 40-60 you can subtract 40 from everything and add one to see that these indexes map to the numbers 1 to 21.
To get your correct answer a simple extension of this can be used. 0-99 is 100 values (just add one to all of them to see this). That means you need to skip 40 values and then take the next 20.
So to work out the ones you skip you want to start at 0 and then take 40 items. You can easily see that after adding one to the list you want your top index to be 40 (so your indexes map to 1-40) which means the actual indexes are 0-39. So 40 then starts your list and in a similar way you can say that if 40 is your first index (40-39=1) then your last index will be 59 (since 59-39 = 20).
Thus the answer is that you are lookign at indexes 40-59.
I hope this not only helps you get the answer here but helps you work out how to do it on your own.
index 40 - index 59 is your middle-range ;)