|
Thread Rules 1. This is not a "do my homework for me" thread. If you have specific questions, ask, but don't post an assignment or homework problem and expect an exact solution. 2. No recruiting for your cockamamie projects (you won't replace facebook with 3 dudes you found on the internet and $20) 3. If you can't articulate why a language is bad, don't start slinging shit about it. Just remember that nothing is worse than making CSS IE6 compatible. 4. Use [code] tags to format code blocks. |
On October 16 2013 07:43 misirlou wrote:Show nested quote +On October 16 2013 07:08 obesechicken13 wrote: I'm doing a student project management website project for school capstone. Has anyone ever made/seen one of these for student groups before? Has anyone used one?
We're considering using Ruby because we hear it is newer and shinier than PHP or ASP.net. We know PHP and Asp.net already.
What hosts are free and available for this? I'm considering Heroku and Amazon and Sitegrounds. Siteground only has it for very expensive dedicated hosting and still seems new to providing ruby support. Heroku is free but I'm worried about speed and scalability. Amazon is cheap for development purposes but I'm worried about scalability in the future. Don't you want to use something like Redmine or gitlab? I don't like ruby but my college uses Redmine (they started using Trac on some courses this year but I think it's still new and buggy), me and some students formed a student group for extra-curricular developement so we needed a way to manage the projects and source repos on our own private server (college redmine only teachers can create projects and assign students, its easier if we could do everything we wanted), so we deployed redmine there under <host>/redmine and we modified the project creation source so it would also automatically create a bare git repo on the server under /srv/git/reponame that we can acess through https://host/git/reponame . Redmine does this natively for SVN IIRC but we wanted to use git instead.
Though not free, I use and love Digital Ocean for cheap, good virtual private servers. Amazon also has a free tier, and most of these companies will subsidize you if you e-mail them, CC'ing a teacher/professor.
|
On October 16 2013 07:43 misirlou wrote:Show nested quote +On October 16 2013 07:08 obesechicken13 wrote: I'm doing a student project management website project for school capstone. Has anyone ever made/seen one of these for student groups before? Has anyone used one?
We're considering using Ruby because we hear it is newer and shinier than PHP or ASP.net. We know PHP and Asp.net already.
What hosts are free and available for this? I'm considering Heroku and Amazon and Sitegrounds. Siteground only has it for very expensive dedicated hosting and still seems new to providing ruby support. Heroku is free but I'm worried about speed and scalability. Amazon is cheap for development purposes but I'm worried about scalability in the future. Don't you want to use something like Redmine or gitlab? I don't like ruby but my college uses Redmine (they started using Trac on some courses this year but I think it's still new and buggy), me and some students formed a student group for extra-curricular developement so we needed a way to manage the projects and source repos on our own private server (college redmine only teachers can create projects and assign students, its easier if we could do everything we wanted), so we deployed redmine there under <host>/redmine and we modified the project creation source so it would also automatically create a bare git repo on the server under /srv/git/reponame that we can acess through https://host/git/reponame . Redmine does this natively for SVN IIRC but we wanted to use git instead. I guess so. It should be similar to redmine except more tailored towards students. So it might integrate tools such as
Gradetracker http://www.gradetracker.com/ And have some advice from upper year students for courses And perhaps integration of irc chat rooms for courses
One of the self defined constraints of our project is that the software must be free to use so I think we might be able to start with redmine as a base.
|
On October 16 2013 07:58 obesechicken13 wrote:Show nested quote +On October 16 2013 07:43 misirlou wrote:On October 16 2013 07:08 obesechicken13 wrote: I'm doing a student project management website project for school capstone. Has anyone ever made/seen one of these for student groups before? Has anyone used one?
We're considering using Ruby because we hear it is newer and shinier than PHP or ASP.net. We know PHP and Asp.net already.
What hosts are free and available for this? I'm considering Heroku and Amazon and Sitegrounds. Siteground only has it for very expensive dedicated hosting and still seems new to providing ruby support. Heroku is free but I'm worried about speed and scalability. Amazon is cheap for development purposes but I'm worried about scalability in the future. Don't you want to use something like Redmine or gitlab? I don't like ruby but my college uses Redmine (they started using Trac on some courses this year but I think it's still new and buggy), me and some students formed a student group for extra-curricular developement so we needed a way to manage the projects and source repos on our own private server (college redmine only teachers can create projects and assign students, its easier if we could do everything we wanted), so we deployed redmine there under <host>/redmine and we modified the project creation source so it would also automatically create a bare git repo on the server under /srv/git/reponame that we can acess through https://host/git/reponame . Redmine does this natively for SVN IIRC but we wanted to use git instead. I guess so. It should be similar to redmine except more tailored towards students. So it might integrate tools such as Gradetracker http://www.gradetracker.com/And have some advice from upper year students for courses And perhaps integration of irc chat rooms for courses One of the self defined constraints of our project is that the software must be free to use so I think we might be able to start with redmine as a base. Hm, redmine is more Project oriented, maybe something like moodle would be more Course oriented since thats what it seems you want. If you do use the redmine, for the advice part, you can have students make a wiki page on the project, "advices for future students" where they would just talk about their experience, mistakes and achievements, if the project is public, other students can see it.
|
On October 16 2013 05:52 Manit0u wrote:Show nested quote +On October 16 2013 03:21 sob3k wrote: So now I have that cloud image moving on the screen but when it goes off of the edge of the site it extends the site and makes the scrollbar shrink etc. How do I make this not happen? I tried setting the overflow on the cloud to hidden but that was not effective. Put it in a container and give the container the max-width property?
This doesn't seem to work. I tried it on the body to no effect.
On October 16 2013 07:48 Encdalf wrote:Show nested quote +On October 16 2013 03:21 sob3k wrote: So now I have that cloud image moving on the screen but when it goes off of the edge of the site it extends the site and makes the scrollbar shrink etc. How do I make this not happen? I tried setting the overflow on the cloud to hidden but that was not effective. overflow: hidden needs to be set on the container, not the element. If your cloud image is absolute, and no div around it, you need to set it to the body
This isn't working either. It cuts of overflow when the site is rendered initially, but then as objects move over the edge later they stretch the width just like before.
|
Also, what is a method to make sure images of variable widths start completely off the screen on one side and move completely off of the screen on the other, regardless of screen size/res?
|
On October 16 2013 10:23 sob3k wrote: Also, what is a method to make sure images of variable widths start completely off the screen on one side and move completely off of the screen on the other, regardless of screen size/res?
This should fix the scroll bar problem
html { overflow:hidden; }
If you put a container around the image:
.container { width: 100%; }
Then you can do left: -50px on cloud1 to get the image -50px off the left of the page
|
On October 16 2013 13:35 Rotodyne wrote:Show nested quote +On October 16 2013 10:23 sob3k wrote: Also, what is a method to make sure images of variable widths start completely off the screen on one side and move completely off of the screen on the other, regardless of screen size/res? This should fix the scroll bar problem html { overflow:hidden; }
If you put a container around the image: .container { width: 100%; }
Then you can do left: -50px on cloud1 to get the image -50px off the left of the page
i'll try that now, but how do I make sure they go all the way off the right side?
hmm Maybe I'll try a calc(image width+100%) that sounds like it would work.
|
On October 16 2013 07:08 obesechicken13 wrote: We're considering using Ruby because we hear it is newer and shinier than PHP or ASP.net. We know PHP and Asp.net already.
Ruby on Rails is fine to use if you want to experience something new, but I wouldn't say it's "newer and shinier" than ASP.net. It IS newer of course, but if you're talking how to work with it, ASP.NET MVC is more or less the same and will probably be far more comfortable when coming from an ASP.NET background.
My personal opinion is that Ruby on Rails is more of a buzzword. There's more interesting things to try nowadays if you just want something "new and shiny", like node.js or barebones and similar javascript MVC frameworks.
|
|
|
I'm a bit short of time right now, so I can't go into much detail, but I probably will do so later today. It's really not important for my question.
What I want is some papers about how things like permutations affect minimized dfa size. Or similar things, just to have a starting point from which I can follow citations etc.
In short, shanten is a measure for the least number of draws you need to make before you can win a hand in Mahjong. I can give you a couple of links and a formal definition I once developed later. A hand consists of 13 tiles out of a total of 136 tiles (thus you can imagine how large the number of possible hands is and why the monolithic state machine is no good).
The largest dfa I have right now has something like 600,000 states and an alphabet size of 5, so a table of about 3,000,000 ints. I'm not concerned about performance or size here though, eve though a smaller size would likely reduce the number of cache misses.
I'll describe the algorithm in detail later, too. For now: I split the hand in 4 parts, apply one of 2 dfas for each part, concatenate the results (classifying dfa), and use that as the input for the last dfa which has the shanten number as the result.
I'd certainly interested in suggestions what I could use other than dfas. Maybe there is something better, I have no idea. But I realize you would need some more information before that.
This is going to be long, and there will likely still be plenty of unclear things. + Show Spoiler +In Mahjong, Riichi Mahjing to be precise, the Japanese variant, you start with a hand of 13 tiles and each turn a player draws and then discards a tile. A hand can only be won when you have 14 tiles, the last tile can either be drawn or called from an opponent's discard. You can also call a meld, a certain combination of 3 or 4 tiles, which is then immutable. A meld always is the equivalent of 3 tiles in your hand, even though some melds (kan) use up 4 tiles. You get a replacement for the extra tile. A hand can be won with the standard combination of a pair and 4 melds (both called or sitting in your hand) or with one of two special combinations (which are trivial and dealt with in a seperate way, so I ignore them here). Turns out I cant find a link in my bookmarks where shanten is explained properly. The definition "number of tiles needed to reach tenpai" is simple, where a hand is tenpai when it is just 1 draw away from having a pair and 4 melds. Here is the rather formal definition of shanten; I used a couple of natural language constructs that should be obvious. Since this is so complex I might have made a mistake here or there. It's not like this definition is really useable anyways. + Show Spoiler +colors = { 1, 2, 3 } color_number = { 1, ... , 9 } color_types = { (c, n) : c ∈ colors ∧ n ∈ color_numbers } honor_types = { 1, ... , 7 } types = color_types ∪ honor_types tiles = { (y, i) : y ∈ types ∧ i ∈ { 1, 2, 3, 4 } } pairs = { p ⊂ tiles : |p| = 2 ∧ all t ∈ p same type } koutsus = { k ⊂ tiles : |k| = 3 ∧ all t ∈ k same type } kans = { a ⊂ tiles : |a| = 4 ∧ all t ∈ a same type } shuntsus = { s ⊂ tiles : |s| = 3 ∧ all t ∈ s of color_types of same color ∧ s = { t1, t2, t3 }, t1.y.n = t2.y.n + 1 = t3.y.n + 2 } melds = koutsus ∪ kans ∪ shuntsus hands = { (d, m) : d ⊂ tiles ∧ m ⊂ melds ∧ no duplicate tiles ∧ |d| + |m| * 3 = 13 } tenpai_hands = { h ⊂ hands : exists (p, e), p ∈ pairs, e ⊂ melds ∧ |e| + |h.m| = 4 ∧ exists z ∈ (p ∪ each f ∈ e) such that h.d = (p ∪ each f ∈ e) / z } shanten: hand -> Z: shanten(h) = min |r|, ((h.d ∪ r) / u, h.m) ∈ tenpai_hands, r, u ⊂ tiles, |r| = |u|The gist of it is that I am trying to find the least number of tiles I have to replace in a hand to be one away from a pair and 4 melds, but since there are different kinds of melds (koutsu and kan have 3 or 4 tiles of the same type, shuntsu has 3 tiles of the same color in with ascending numbers n, n+1, n+2) and melds can be called, rendering them immutable, this creates a very complex recursive algorithm. Anyways, on to my actual algorithm. I group the tiles of an input hand by the three colors and a group of honors. I flip/order the tiles inside each group to abuse symmetries. Then I order these groups by their size. The smallest group can range from 0 to 3 tiles, while the largest group can range from 4 to 13 tiles. For each of the 4 sizes (smallest to largest) I have one dfa for colors and one for honors. Ordering them like that reduces the size of the result sets which is important for the second part. The base languages for step 1 have an alphabet of {0, 1, 2, 3, 4} which is the multiplicity of a tile type in the current group. Each word is made up of 7 or 9 (for honors or colors respectively) letters for the tiles in called melds, 7 or 9 letters for the closed part of the hand, and 1 letter for the number of called melds. I compact these words before putting them through the dfa by eliminating letters that can only assume a single character and reordering them in a way that probably (according to anecdotal evidence) reduces the size the of the dfa. Each of these words has a value which I call an arrangementList. An arrangement is a triplet (pair_count, meld_count, value), and there are less than 60 potential arrangements. An arrangement basically says that I could assign x pairs and y melds (of the 1 pair and 4 melds I can have total in a hand) to this color group and then it would contain value tiles that would not have to be replaced to get to tenpai. If I can reach a sum of z across the values of the arrangements of the 4 color/honor groups then I have a hand of 13 - z shanten. Sadly I don't have a complete ordering on these arrangements, only a partial ordering is possible. Because of this, the value of each word is a list of possible arrangements, and to find the final shanten of a hand, I have to iterate over all possible combinations of elements from the 4 arrangementLists and find the optimal combination. I really don't want to do that. So I encode the arrangementList as a binary word where the nth letter says whether the arrangement with the id n applies for this group. The result of the first phase of my algorithm therefore is 4 binary words representing the arrangements of the 4 groups in a hand. Each size group can only assume a subset of arrangements, which I take advantage of and again compact the binary words before concatenating them and inserting them into the last dfa (this cuts the concatenated length by over 50%). The result of this dfa is the shanten number.
|
I has but two simple C questions
one: I understand what const array does (doesnt allow you to modify values in array) but if that is the case (when using arrays as a parameter) then what situation would call for its use? The only reason I can think of on the top of my head is that you want to (if this is even viable) use the function to make a dynamic array. Personally I think I am wrong on that logic but I still can't see the reason of the point of using the const if you don't want to change the array when using it as a parameter.
two: simple program but I am running into a roadblock. No, this is not a hw assignment. Besides, I just help on the control flow. The program question is you are making a program to reserve seats on a small airplane of 10 seats. If user types 1, then that is a first class seat (seats 1-5) while 2 is economy(seats 6-10). If someone reserves a seat than it is taken and if all the seats are taken for a class then you ask whether they want an empty seat in the other class.
I don't understand how one could check if the seat is taken and how would you check if all the seats are taken to prompt the user if they want the other class. Also, how would you check if all the seats are taken. I am stuck on how to initalize the array so that I can just check if seat is taken and if it isn't go reserve it and break from there. Keep in mind we have not gone over pointers yet. An example (of just the first half of loop as the other half would be the exact same copy other than it being 2 as for the other class):
printf("type one or two: ") scanf("%d",&choice)
if(choice==1) {??? if (array[i]!=1) { printf("first class seat number: %d", array[i]) array[i]=1 } } ...
|
On October 16 2013 22:30 heroyi wrote: one: I understand what const array does (doesnt allow you to modify values in array) but if that is the case (when using arrays as a parameter) then what situation would call for its use? The only reason I can think of on the top of my head is that you want to (if this is even viable) use the function to make a dynamic array. Personally I think I am wrong on that logic but I still can't see the reason of the point of using the const if you don't want to change the array when using it as a parameter.
Say you have an array of integers you want to do some calculations on and then return a scalar value. So you make a "CalculateValue" function which takes an array. You want to make sure that the array is not changed by the function, because side effects lead to bugs which are hard to debug, so you make it const.
It's really just clarification and safety.
|
Since question 1 was already answered...
On October 16 2013 22:30 heroyi wrote: two: simple program but I am running into a roadblock. No, this is not a hw assignment. Besides, I just help on the control flow. The program question is you are making a program to reserve seats on a small airplane of 10 seats. If user types 1, then that is a first class seat (seats 1-5) while 2 is economy(seats 6-10). If someone reserves a seat than it is taken and if all the seats are taken for a class then you ask whether they want an empty seat in the other class.
I don't understand how one could check if the seat is taken and how would you check if all the seats are taken to prompt the user if they want the other class. Also, how would you check if all the seats are taken. I am stuck on how to initalize the array so that I can just check if seat is taken and if it isn't go reserve it and break from there. Keep in mind we have not gone over pointers yet. An example (of just the first half of loop as the other half would be the exact same copy other than it being 2 as for the other class):
printf("type one or two: ") scanf("%d",&choice)
if(choice==1) {??? if (array[i]!=1) { printf("first class seat number: %d", array[i]) array[i]=1 } } ...
First, initialize and array and set all elements to 0 (we'll let 0 mean free and 1 mean reserved)
for (int i = 0; i < 10; i++) { seats[i] = 0; }
Now, when someone picks first class, we need to check whether any of seats 1 through 5 (so 0 to 4 in the array as array-indices are zero-based in C) are free. If we find a free seat, we'll set it to reserved. Similarly for second class. If a class is full, we want to check the other class for free seats. Easiest is to make a function:
int firstFreeSeat(int class) { for (int i = 5 * (class - 1); i < 5 * class; i++) { if (seats[i] == 0) return i; } return -1; }
This function returns the seat-index of the first free seat in the class or -1 if nothing is free. So now we use this function:
int freeSeat = firstFreeSeat(choice);
if (freeSeat == -1) { printf("No free seats in selected class. Try other class? (1 = yes, 0 = no)"); scanf("%d", &choice2); if (choice2 != 1) return; int freeSeat2 = firstFreeSeat(3 - choice); // Turns 1 into 2 and vice versa. if (freeSeat2 == -1) { printf("No seats available! :-("); } else { seats[freeSeat2] = 1; printf("Seat reserved, but not in your favourite class!"); } } else { seats[freeSeat] = 1; printf("Seat reserved in your favourite class!"); }
|
Appreciate the answers, guys. Yea, I figured for two using functions would be a lot easier but couldn't think of them in components.
|
On October 17 2013 03:09 heroyi wrote:+ Show Spoiler +Appreciate the answers, guys. Yea, I figured for two using functions would be a lot easier but couldn't think of them in components. Just got out of a quiz in the class and a bit confused with the questioning: It pertains to arrays (again) with writing a fragment that add values in array together if we had an array a, lens represented the number of elements, and int k that was guaranteed to hold values between 0 through lens-1. So: int arraysum(int a[], size_t lens, int k) {...}
I understand how to solve it by utilizing a for loop or using recursion (again not trying to be a chump here). My problem is when trying to write the number of elements for an array why is it that you would want to use for(int i=0;K<lens-1;i++ (for loop) or (recursion method/base case) if(k==lens-1) return K I mean what if K does start at zero. Why should it be lens-1 instead of going: for(int i=0;i<lens;i++)? The reason i am somewhat baffled was because the instructor stated that in order to the recursion you would need a holder (thus the int k) but without it you could do it just by the for loop method (making lens being the size of your array). So why would I have to compensate the elements with lens-1 i.e why not 0 to lens?
An array of size N is indexed by 0 to (N-1)
i.e. an array of size 4 has the indexes 0,1,2,3
|
On October 17 2013 03:22 scudst0rm wrote:Show nested quote +On October 17 2013 03:09 heroyi wrote:+ Show Spoiler +Appreciate the answers, guys. Yea, I figured for two using functions would be a lot easier but couldn't think of them in components. Just got out of a quiz in the class and a bit confused with the questioning: It pertains to arrays (again) with writing a fragment that add values in array together if we had an array a, lens represented the number of elements, and int k that was guaranteed to hold values between 0 through lens-1. So: int arraysum(int a[], size_t lens, int k) {...}
I understand how to solve it by utilizing a for loop or using recursion (again not trying to be a chump here). My problem is when trying to write the number of elements for an array why is it that you would want to use for(int i=0;K<lens-1;i++ (for loop) or (recursion method/base case) if(k==lens-1) return K I mean what if K does start at zero. Why should it be lens-1 instead of going: for(int i=0;i<lens;i++)? The reason i am somewhat baffled was because the instructor stated that in order to the recursion you would need a holder (thus the int k) but without it you could do it just by the for loop method (making lens being the size of your array). So why would I have to compensate the elements with lens-1 i.e why not 0 to lens? An array of size N is indexed by 0 to (N-1) i.e. an array of size 4 has the indexes 0,1,2,3 A misunderstanding on my part it seems. Ty for the speedy response though
|
Hey guys, currently on Matlab and I'm trying to to write a function which returns a matrix containing all possible combinations of n different integers amongst p integers (integers from 1 to p).
Now this would be easy if I could use lists, but matlab doesn't have a built-in list structure and it's hard to preallocate with reccursive functions. Any ideas for me ?
|
On October 16 2013 22:30 heroyi wrote: I has but two simple C questions
one: I understand what const array does (doesnt allow you to modify values in array) but if that is the case (when using arrays as a parameter) then what situation would call for its use? The only reason I can think of on the top of my head is that you want to (if this is even viable) use the function to make a dynamic array. Personally I think I am wrong on that logic but I still can't see the reason of the point of using the const if you don't want to change the array when using it as a parameter.
two: simple program but I am running into a roadblock. No, this is not a hw assignment. Besides, I just help on the control flow. The program question is you are making a program to reserve seats on a small airplane of 10 seats. If user types 1, then that is a first class seat (seats 1-5) while 2 is economy(seats 6-10). If someone reserves a seat than it is taken and if all the seats are taken for a class then you ask whether they want an empty seat in the other class.
I don't understand how one could check if the seat is taken and how would you check if all the seats are taken to prompt the user if they want the other class. Also, how would you check if all the seats are taken. I am stuck on how to initalize the array so that I can just check if seat is taken and if it isn't go reserve it and break from there. Keep in mind we have not gone over pointers yet. An example (of just the first half of loop as the other half would be the exact same copy other than it being 2 as for the other class):
printf("type one or two: ") scanf("%d",&choice)
if(choice==1) {??? if (array[i]!=1) { printf("first class seat number: %d", array[i]) array[i]=1 } } ...
1/ Constants are used as data holder. There will be important data that you dont want to modify while running. For example: I want a constant array of the first 200 prime numbers. To re calculated those would be a pain in the ass so a good solution would be just store them in 1 place for future access. Another example would be to hold Initial value of programs. For example, a level(map) of a computer game is a constant. http://www.sfml-dev.org/tutorials/2.1/graphics-vertex-array.php scroll all the way down and you could see the array that representing the map right bellow.
2/ This sounds awfully like a hw assignment to me lol.... Im pretty sure most people here could just type down the solution for you within a minute but my advise is reading up and trying out examples that your instructor gave you. It will help you much better in the long run.
|
On October 16 2013 22:30 heroyi wrote: two: simple program but I am running into a roadblock. No, this is not a hw assignment. Besides, I just help on the control flow. The program question is you are making a program to reserve seats on a small airplane of 10 seats. If user types 1, then that is a first class seat (seats 1-5) while 2 is economy(seats 6-10). If someone reserves a seat than it is taken and if all the seats are taken for a class then you ask whether they want an empty seat in the other class.
I don't understand how one could check if the seat is taken and how would you check if all the seats are taken to prompt the user if they want the other class. Also, how would you check if all the seats are taken. I am stuck on how to initalize the array so that I can just check if seat is taken and if it isn't go reserve it and break from there. Keep in mind we have not gone over pointers yet. An example (of just the first half of loop as the other half would be the exact same copy other than it being 2 as for the other class):
printf("type one or two: ") scanf("%d",&choice)
if(choice==1) {??? if (array[i]!=1) { printf("first class seat number: %d", array[i]) array[i]=1 } } ...
A question here is why you're even bothering with an array. Unless you're specifically asked to use an array, or if there is a lot more expected functionality than what you're describing, then two counters with a range of 0-5 should do exactly what you need.
|
On October 17 2013 06:15 Geiko wrote:Hey guys, currently on Matlab and I'm trying to to write a function which returns a matrix containing all possible combinations of n different integers amongst p integers (integers from 1 to p). Now this would be easy if I could use lists, but matlab doesn't have a built-in list structure and it's hard to preallocate with reccursive functions. Any ideas for me ?  Matlab has arrays. Can't you concatenate with arrays?
Also matlab seems to have lists but it might be in the math toolbox. http://www.mathworks.com/help/symbolic/mupad_ref/append.html
Whoa. Deja vu
-Matlab newb
|
|
|
|
|
|