This is a multiplayer bowling simulator in Ruby. It allows for variable skill levels, and produces weighted random results for each roll based on those skill settings. The methods are grouped in four sections:
game mechanics
scoring calculations
stats calculators (because I got curious about w...
Well, I am actually a bit skeptical and think it could be done better. I don't like the bottom-up approach (i.e. each element checks for the parenst right), instead I would prefer the parent to propagate the rights down to each element.
I'm trying to push out a questionnaire at work with several questions on. Users can reply with radio buttons ranging from yes, some, maybe and no. This questionnaire is contained in the sheet called Manager.
If they select yes or no I would like to copy the question to a seperate sheet in a tabl...
@dirkk the truth is that it's easier to comment on trivial things and/or stuff that is applicable to most languages, and most answers will naturally do that first - since nobody seems to really know angularjs you're unlikely to get an answer on what you want
you could look at the few angularjs questions we have and see if you have better insights than what has already been posted.
@Vogel612 well, turns out all our top-to-bottom approaches didn't work ;) However, I think it should be practically possible, to "dribble down" the value.
@QuentinPradet Yeah, thats my impression as well. There are hundredths of tutorials about Angular out there, but not many go beyond the basic directive, isolated scope stuff. Also, it seems to me that the "proper way to do it" changes in AngularJS about once a week...
@Vogel612 Could you elaborate, I am not quite sure how and where you want to parse the DOM. However, we would like to stay as much as possible in the AngularJS logic, so to do it the angular way (whatever this is supposed to mean...)
@Vogel612 sure, but just because it is possible doesn't mean it should be done... I also could write my server logic in assembler, but I am not going to do that either.
@Vogel612 yes, thats what we did. The problem is with passing values in Angular between directives, because they are completely shared if no isolated scope is used (which is a problem if the rights are modified for siblings) or they use isolated scopes, i.e. they are not shared at all by default and need explicit passing, which didn't fit with our "default-by-inheritance" model
@QuentinPradet naaah, angular is not really my main focus. If you would have XML-related questions using functional programing (XQuery/XPath) I would get active, but this seems to be missing somehow...
I have homework, in which I get number of cases and then four numbers.. Each number tells how many rows there are in each column
For example:
2 2 3 3
_ _
_ _ _ _
_ _ _ _
Produces this result. Where ever there are lines that can be joined in one, i have to do this, and write out minimun n...
I could guess a lot of things.... if you want, we can file a bug .... but I decided ther was no real need.... you can ping the guy, but noone will answer.
@RubberDuck - isn't there a thing about disabling updates on the sheet when it is being modified, and then renabling them afterwards... it makes a huge performance difference.
When doing a CR, it's important to be able to quickly find methods/classes/whatever in the source. Currently, it's just terrible as you get a couple of small scrolling views and the search takes way more time than anything else.
That's specific to CR, as other sites rarely need that much code. T...
Is http://codereview.stackexchange.com/questions/64490/conditional-statements-with-doctor-and-patient-information a duplicate of http://codereview.stackexchange.com/questions/64350/displaying-information-about-people-from-a-json-file ?
and following.. basically there's two quite extremely similar questions asked by new users with generic names..
@JaDogg Because I wanted to see what kind of pattern it used internally, I haven't embedded your code but it does seem to do what I want, but I do not see why my code does not do the same (it's almost the same, but I do not use a DateTimeFormatterBuilder)
@JaDogg You've got my upvote and accept there... Though I'm stubborn and still want to get my own way working! It's really quite similar tow hat youa re doing but a bit more generalized
I'm trying to fully grasp JavaScript inheritance and encapsulation. Take the following example (here is a fiddle):
myPage = {
someObj: function() {
var x = 0;
//PRIVATE: increment by 10
var inc10 = function() {
x = x+10;
};
//PUBL...
Just beginning to get the idea of Queue and threading.
Would welcome input on this exercise script:
from threading import Thread as T
from Queue import Queue as Q
from random import randint as R
import time
'''
Silly script exploring simple use of threadding.Thread and Queue.Queue
'''
q = Q()...
This is indeed about code review, if you cared to read correctly. I asked if my architectural approach is correct and if there are alternatives. — robinmitra6 hours ago
I wrote a class which can time and compare functions.
I already posted it here once before, and got great suggestions from @rolfl, which I have added to my code.
my original question can be found here (example usages can be found there as well)
the formating class I use can be found here
As...
So, I have to make a code that calculates the last digit of a^b. Here, a can have upto 1000 digits whereas b can be from 0 to 915*10^15. Now, what I did was, I calculated the last digit of a and raised that single digit number to the power b and that number's last digit will be the answer. Here i...
Not sure why there are 4 close requests for broken code - perhaps one of the mods can weigh in here. I feel that while this is not a perfect reproduction of the Google homepage, the OP has submitted code that represents their attempt at building the reproduction. As such, in light of the fact that the OP is learning how to build websites, the OP may not be creating things the right way - this does not however constitute broken code, just bad code (which is why we do Code Reviews, no?) — jsanc6231 hour ago
I was wondering how I could refactor this duplicate code. The only difference
in the methods are a = goToTheStoreForFood(); and a = iLoveToEat();
private CoolObject getSomeFood() {
CoolObject a = null
try {
int i = 0;
a = goToTheStoreForFood();
(a.status == 0) {
...
I used the odata4j library to access a .Net WCF Data Service but it is abandoned and has critical errors.
Someone has forked the project and fixed those errors, but the source code cannot be compiled, it misses a lot of other projects (I guess).
Can you tell me how can it be compiled? What does ...
I am working on the lossy 16 bit representation for 32 bit integers that catches all 32 bit range with precision depending on absolute value.
My idea is to store integer lv = sign(x)*ilog2(x) in first bite, and a tail that approximates the error x - 2^ilog2(x) in order to do that I divide possib...
I wrote this code to parse dates from the output of the OCR, which means that the obtained date can be literally anything, so I put some restrictions in place:
Date is the the format of: field1?field2?field3, where the fields are either day, month or year and any delimiter can be used to split ...
I wrote this code to parse dates from the output of the OCR, which means that the obtained date can be literally anything, so I put some restrictions in place:
Date is the the format of: field1?field2?field3, where the fields are either day, month or year and any delimiter can be used to split ...
This is a simple word count program I wrote to play around and get familiar with using std::map. Is there anything I can improve upon?
I didn't use CTRL+Z to stop the program because that suspends the process on Linux.
#include <iostream>
#include <iomanip>
#include <string>
#include <map>
#in...
Wrong answer
$$ everything^0 = 1 => 0^0 = 1$$
if ( e == 0 && b == 0 )
cout<<"0"<<"\n";
Solution
Last digit relay only on last digit and you can not look at digits than goes before last one. As your power is up to \$10^{18}\$ you have to use modular binary power function.
Here ...
I am trying to define some interfaces to implement some web service integration middleware.
The SOA pattern that fits this system is probably the Multi-Channel Endpoint http://soapatterns.org/design_patterns/multi_channel_endpoint
I expect a lot of mapping of data formats happening in this integ...
I'm working with python 2.7.5 and I'm trying to make it match the Pep8 coding style. I have a few one line for loops but the issue is that they are each above 80 characters in length. Is it bad practice for me to make them multiple lines for the sake of Pep8?
So should something like this:
pat...
Take the following code...
window.thisPage = {
MyObject: function() {
//private var
var x = 1;
//private method
var inc = function() {
x = x+1;
};
//public method
this.output = function() {
return x;
};...
I'm building a multi-screen ajax form in an ASP.NET MVC solution. The first screen displays some user details. If the user clicks 'edit', they are taken to the next screen where they can edit the fields. The call to retrieve the user info is quite slow so I don't want to repeat it for every aj...
(sudden disappointment that this PC probably won't allow JDK)
Is there a tag on Meta representing discussions about the "colors" site design? Since CR is going through graduation, perhaps it would be useful to have one, if it doesn't already exist... ? That would perhaps make the designers' life easier if all ideas are gathered under one tag?
@Jamal oh, noice :P The Headsplitter is a good looking hat. I've mostly been focusing on creating my "Strangie Engie". Strange RR, PDA, wrangler, pistol, etc. What is your main?
Wrong answer
$$ everything^0 = 1 => 0^0 = 1$$
if ( e == 0 && b == 0 )
cout<<"0"<<"\n";
Solution
Last digit relay only on last digit and you can not look at digits than goes before last one. As your power is up to \$10^{18}\$ you have to use modular binary power function.
Here ...
I want a whole city to be on drugs secretly, so they don´t know they are drugged by their government.
The city is about 2 billion people and roughly structured like a Makropole from the Warhammer 40k universe. This means:
Many levels
4 classes (Lower, higher, worker, and government class)
L...
Alright. Create a responsive website that uses Sass or Less in combination with Grunt, 2 vanilla JS modules and test it with Grunt (minify, concat) and Bower. So much fun.
Your last code block had not indented properly, ran into that bug last night. If you make a code block right after a list in your post, you have to put a HTML comment <!-- --> in between or it borks the indentation.
@Jamal Snoipah is my least played class, aside from Hooovy. Most of the time I play in between classes on a laptop with the trackpad so my aim is terrible. Mini-sentries are my best friend.
I have a file HintBox.js containing a JS prototype of the same name which requires our internal JS library (call it $lib) in order to work. One way to solve this problem would be to remember to make sure that the lib.js file is included every time in the PHP, but this is easy to mess up, especial...
I've run across a strange issue when testing some method of mine and I seem to have been able to obtain a concrete example of my issue.
I am using the ja_JP_JP_#u-ca-japanese locale not able to parse a date using it's own date pattern defined by the locale.
I am wondering whether I am doing som...
I want a whole city to be on drugs secretly, so they don´t know they are drugged by their government.
The city is about 2 billion people and roughly structured like a Makropole from the Warhammer 40k universe. This means:
Many levels
4 classes (Lower, higher, worker, and government class)
L...
DatabaseLogMessageFormatter
I didn't change the ILogMessageFormatter interface, but the
DatabaseLogMessageFormatter implementation ignores the parameters and
uses the FormatMessage method to supply the DatabaseLogger with the
SQL command string:
Okay wow. I don't think that ignoring p...
http://pastebin.com/Y8K3Lcn1
On a larger program I have had memory jumping from plus minus 4mbs. Not a lot, but questionable. This is a short version, memory jumps slightly, .1mb. (By that I mean it starts 1mb, then 1.1mb back to 1 etc...)
I'm wondering if there is a mistake, is that normal? O...
> PHP is a hose, you usually plug one end into a car exhaust, and the other you stick in through a window and then you sit in the car and turn the engine on.
I have the follow script to change my data within Mongo DB:
db.TRACKING_DATA.find( { 'eventdata' : { $type : 2 } } ).forEach(
function (x) { x.eventdata = JSON.parse(x.eventdata);
db.TRACKING_DATA.save(x);});
db.TRACKING_DATA.find().forEach(
function(doc) {
var QueryDate = doc.eve...
I had a thought that potentially could speed up the design of the official Code Review site design. I think if we made a tag specifically for that, like say official-colors, and used it for any question related to that, it would show the SE site designers that we have put some thought into it, an...
I had a thought that potentially could speed up the design of the official Code Review site design. I think if we made a tag specifically for that, like say official-colors, and used it for any question related to that, it would show the SE site designers that we have put some thought into it, an...
They /ðeɪ/ is the third-person plural personal pronoun (subjective case) in Modern English.
== Usage ==
The "singular" they is the use of this pronoun as a gender-neutral singular rather than as a plural pronoun. The correctness of this usage is disputed. The Oxford Dictionaries have an article on the usage, saying that it dates back to the 16th century.
The singular pronoun they is even found in formal or official texts. For example, a 2008 amendment to the Canadian Criminal Code contains the following text:
if a peace officer has reasonable grounds to believe that, because of their physical...
French is worse: if you don't know the gender, or worse, if you have a group with varied genders, it defaults to masculine. Even if you have 999 women and 1 man, the group is masculine.
> German has four third-person nominative singular pronouns: er (grammatically male), sie (grammatically female), es (grammatically neuter) and man (impersonal). Man is frequently used in general statements such as Man darf hier nicht parken (One cannot park here).
Use preprocessed values.
function processData(input) {
var parse_fun = function (s) {
return parseInt(s, 10);
},
heights = function() {
var result = [1]
for (var i = 1; i <= 60; i++) {
if (i & 1) {
result...
But I know that if I changed "teh" to "the" to correct a definite error, but nothing else, such a minor change, that Jamal would be getting on to me for editing extraordinarily minute changes.
The policy here (and throughout SE) has been not to edit for extraordinarily minor fixes.
And I'm not sure I particularly care what the community thinks of me anyway since no one votes for my answers anyway.
The community would have to be actively downvoting my posts for it to care any less about me... so I'm not too concerned about the community's opinion of me.
I think you're doing a mighty fine job and you often have brought up genuine concerns about site policy.
It may be more of a matter of exposure, since the languages you review seem to be less common than say, C# or Java or Python. I think the community considers you the de-facto expert in Obj-C and related things. But these don't get exposed in chat as much unless you are here...
I'm using the following code to initialise 8 I/O-ports (i.e. GPIO pins on a Raspberry Pi). That's 4 x 2 pins, each duo controls a switch, A to D, and each duo consists of a pin for On and a pin for Off.
def init_switches():
switch = {
'A': dict(On = 22, Off = 12),
'B': dict(...
How is it that I answer basically every Objective-C/Swift/iOS question, and the minutely few questions in these 3 tags that I don't answer are the ones that absolutely explode (relative to the others in these tags) in terms of upvotes?