You, mainly:
chose non-optimal algorithm do to the task at hand,
used non-standards-conformant functions/declarations (getch, #define for constants),
didn't use indentation,
used an unusual naming scheme for variables,
used an initializer for an array that should be used for 1-D arrays only (si...
^ Much improved. If it wasn't a good answer before, I think it is now.
For your argc <- return $ length args , the reason the compiler is telling you to use the return is because in do notation, monadic binding lines must be the form:
binding <- value wrapped in whatever monad you're using
So length args just returns an Int, but Haskell wants an IO Int. By doing ...
@ChrisW lol - I skimmed through, upvoted, and then noticed it was the heated discussion from earlier; retracted the upvote, started reading more thoroughly, found nothing blatantly wrong [that I could see with my C non-knowledge], came back here, saw your comment about it being much improved, and put the upvote back in!
Go with #3, "Create a nice mock for mockOperationQueue." The only reason you're having to do that stubbing is that OCMock creates "strict" mocks by default. Strict mocks used to be the standard, but mock object frameworks have evolved. The problem with strict mocking is that they make tests more ...
I would format it like this:
(ns phrase
(:require [clojure.string :as s]))
(defn word-array [phrase]
(s/split (s/lower-case phrase) #"\W+"))
(defn word-count [phrase]
(frequencies (word-array phrase)))
Notice that I included the require statement as part of the ns definition.
Whether...
I'm still playing with how I want to build the parameter. However, in the end I still want to pass it to the prepare statement the same. Note: $this->dbh is defined in the __construct()
function getTable_Where($table){
/*
* Usage:
* $table - assoc. array containing all values.
...
The 10K tools are pretty cool... You get a birds-eye view of activity on the site, a "dashboard" view of what's happening. Some of the individual tools haven't scaled particularly well with Stack Overflow's growth, but the concept behind them is still sound: we trust you to enough to be a bee wat...
> Task accumulates 6 RecommendDelete + Delete reviews. Outcome: mark flags "helpful". If the post scores > 0 then raise DisputedLowQuality mod flag, else just delete post (current behavior).
@ChrisW Apple's recent security bug was caused by a malformed if statement and a missing brace. That's my new go to "aha! it does really happen in the real world!" example.
Hrmm... this guy isn't really helping his case. Every comment, he's simultaneously assuring me that his code is working and he wants it reviewed AND that his code has flaws that need fixing...
Last days, I experimented some time with spriteKit and (amongst other things) tried to solve the problem to "throw" a sprite by touching it and dragging.
I have tackled the major hurdles, and the code is working fine, but there consist some little problems I cannot explain to myself. Additional...
The only "flaws" an on-topic CR question should have would be things that an end-user likely doesn't even notice. PERHAPS an end-user may notice an on-topic performance question regarding speed or memory.
The other "flaws" on-topic CR questions might have will be things that make future maintenance more difficult, readability, etc.
A day doesn't pass on the SO Java tag without each of the following three questions: 1. .equals() vs == string comparison 2. Null Pointer Exception, without a stack trace. 3. Index Out Of Bounds Exception, without a stack trace.
One thing that ticks me off quite a bit: questions as titles that lack a question mark. Someday I'm gonna go off the edge and end up downvoting each one until they're fixed.
Was sent here to get some of code reviewed. Having difficulties with the problem. Wanted to know if I was going in the right direction. Here is the problem:
Create a Java GUI program which has one button, one text box and one textfield. When a user click on the button, the system should pop u...
I wish there were higher standards back then, but I understand that the site was just starting out. What's important is that we're maintaining quality for new questions.
so in java we create abstraction by generating classes(which has property & operations on those property) and in python we show abstraction by creating functions?
Im a beginner in JNI and Java. I have a JNI program which reads data from C++ files into Java. The C++ files belong to the Open Trace Format(OTF). The current JNI interface works fine, when I try to read in data from C++ into Java. But it becomes very slow when I try to read in data from large fi...
@200_success in java we use class name which abstracts its internal complexity and in python we use name which binds to value or computational process(function)
@nhgrif - your statement is partly true - *it's basically impossible to analyze code written in a language you don't understand* The true part is that you have to be able to read the code.... The false part is that once yuou can read the code, the logic constructs in pretty much all languages are comparable to things you know anyway. The fuzziness comes down to how deeply you need to analyze things.
@200_success i mean, when is say 'from operator import mul' john said that name mul is assigned to a computational process(which is a mul function which takes 2 args and return a value) so name mul is abstraction for that computation, so am saying this is functional paradigm
@Sham True, mul is a function, and functions are first-class in Python, which helps you do some functional programming. However, there are limitations to how far you can take functional programming, for reasons given in the link.
When are objects or something else said to be "first class" in a given programming language, and why? In what do they differ from languages where they are not?
EDIT. When one says "everything is an object" (like in Python), does he indeed mean that "everything is first-class"?
Background
We've had a user who asked many questions, mainly follow-up questions, some of which lacked sufficient detail and a review request. Due to some issues stemming from issues of the user and the community regarding how these questions should be asked, the user eventually had their accou...
@Jamal Why is retention of unanswered questions from deleted users a question in the first place? What's the default Stack Exchange behaviour? (I assume it keeps them around.)
@200_success In the case of on-topic questions, they could still be answered as the solutions are supposed to benefit everyone. But we're a bit different in that questions are localized to the OP and hardly anyone else.
@JamesKhoury The question, once asked, should stand on its own. If clarifications are needed but cannot be provided, then it becomes "unclear what you're asking."
I am trying to learn C++ by myself. I looked up a sample question after going through some text. Though I would like someone to review my code. I'm basically asking you to break it to show some flaws or some thing I missed. As a beginner I tried exhaustively to improve it and now hit a wall to ...
I am a beginner and I have made Colorful Lights using check-boxes in HTML. I'm pretty sure it will look horrible to any developer out there, but hey, that's why I've posted it.
I'd like a general review of this. I'm especially concerned about the quality and enhancements of this form.
<html>
<...
@Jamal I see now. I agree with Jerry Coffin that posts should be judged on their own merit. Deleting questions based on who asked them is equivalent to ad hominem reasoning, which is generally bad, but once in a while it serves as a useful filter.
The problem is not that the questions originate from a user who has since been deleted. It's that they're low quality.
Quick question for anyone in here: what are your thoughts on a 'canonical' C++ question (or every language ideally -- C++ is just what I'm familiar with)? I've been thinking about it for a while, and I think there could be a great value in a community wiki question/answer pair where a relatively beginner snippet of C++ is posted with intentional missteps/bad practices, and then the answer(s) goes into extreme detail on issues and why those issues are a thing.
I hate it in a way because it means that a lot of questions would become redundant in the form of "Go look at this question," but at the same time, it gets old seeing the same "don't use namespace std", "use the c<blah> headers instead of .h," "declare one variable per line," blah blah blah that is in almost every C++ question.
Would people be willing to help with that, and does it seem like a good idea?
I've been meaning to post on meta about it for ages, but I've never gotten around to it.
I don't see how it would make "questions become redundant". People (new users) would still post questions which contain C++ problems, and those questions would still be on-topic, and pointing out those problems in answers would still be on topic.
@200_success I notice that about two of the open ones don't have a review request. This seemed to be problematic with this user, even after others have offered advice.
@ChrisW true. I guess a general application of something doesn't really make redundant specific manifestations. It would be nice to be able to point to a central, long, thorough description of problems though. Could save a lot of explaining the same thing over and over again. Spotting the issues would still be necessary though.
I would volunteer to scan them all, and do a preliminary assessment. I can vote to close the ones I think are off topic, and then let the review queue either agree, or disagree.
@ChrisW Are in favor or against an example question? I'm not sure if you're arguing that it would be pointless or that while it would serve as a good reference, it would not detract from anything like I fear?
@Corbin: I do see where you're going with this, but I feel that it makes for less of a specific review (not quite sure how to word that). And, like 200 said, it'd be quite a long list. Perhaps in these situations, we could strive to explain each of these points mentioned (and I am getting tired of talking about using).
I wouldn't mind applying a filter. Pseudocode: DELETE FROM Posts WHERE PostTypeId=1 WHERE Score <= 0 HAVING SUM(AnswerScores <= 0) AND OwnerDisplayName='user34330';
I have created the private chat system. I want to reload the div so that it can have the effect of instant messaging.I am very new to php. I know that I can use ajax to do this and I try but it does not work.A lot of error!I cannot do it.
Here is the php file of the display messagees page:(
<html>
I have created the private chat system. I want to reload the div so that it can have the effect of instant messaging.I am very new to php. I know that I can use ajax to do this and I try but it does not work.A lot of error!I cannot do it.
Here is the php file of the display messagees page:(
<html>
Looking for general feedback on this package.
This question is a follow up this post: Utility package comparable to underscores.js
I changed my naming conventions and remvoed some excess methods. I added in better comments.
This simple isType functions I keep for use in callbacks. That is th...
I don't want any feedback on the regexes as I know what needs to be updated here. Also, don't need any feedback on naming conventions.
I'm looking for feedback on the structure and correctness of the class.
/**************************************************************************************...
I had previously asked this question on SO. The answer pointed me towards using the task parallel library for multiple parallel downloads. I'm not actually utilizing this exact code, but it got me to rethink my design.
The one open issue that wasn't really addressed (and I didn't ask it), canc...
Things you could improve:
Bugs
Your initial printing of the input command line arguments looks buggy.
cout<<argv[1]<<endl;
cout<<argv[2]<<endl;
cout<<argv[2]<<endl;
It looks like you meant to print argv[3] here, but accidentally put a 2.
Syntax/Styling
Please don't use using namespace...
#define macros are more common in C than in C++, and you should instead use constants:
const int LOWER_LIMIT = 23.3;
const int UPPER_LIMIT = 256.3;
main() is doing too much. Ideally, you should have it handle input/output and function calls. For everything else, put them into separate functi...
Short Version
I believe it would be valuable to create a 'canonical' question/answer of sorts for each language, and I am hoping to get others' thoughts on this.
These questions and answers would serve as a central explanation of certain common issues. All answers would still be expected to be ...
I am trying to learn C++ by myself. I looked up a sample question after going through some text. Though I would like someone to review my code. I'm basically asking you to break it to show some flaws or some thing I missed. As a beginner I tried exhaustively to improve it and now hit a wall to ...
I would actually like to see you do this code, you sound like a pro :) also i would have a great example to start with for learning c++. I am a newbie so i would like to know how would i parse the negetive numbers/arguments ? You have a great approach to the problem , i thing you will be able to generate the most robust and complete code :P Do you accept the challenge? :P :) — Dexobox5 mins ago
@200_success is the only one that sounded like a pro among us all :P
Short Version
I believe it would be valuable to create a 'canonical' question/answer of sorts for each language, and I am hoping to get others' thoughts on this.
These questions and answers would serve as a central explanation of certain common issues. All answers would still be expected to be ...
I am doing refactoring for node js + express application.
For client images I am doing this kind of link, I am doing it in 10+ places. How can I make it kind of global,
var urlPath = req.protocol + "://" + req.get('host') + '/api/users/';
The problem is that is uses req object, which is acc...
I am doing refactoring for node js + express application.
For client images I am doing this kind of link, I am doing it in 10+ places. How can I make it kind of global,
var urlPath = req.protocol + "://" + req.get('host') + '/api/users/';
The problem is that is uses req object, which is acc...
This question has been covered very thoroughly, but I have a bit more to add.
Use spacing consistently. Sometimes you do if(x>y) sometimes you do if(x > y) and sometimes you do if (x >y). Pick one (that's not if(x >y) and stick with it. Personally, I prefer if (x > y) as the spacing makes the ...
Wow, there was a lot wrong with that question. Originally only had one or two items. Just edited in about a half dozen more. I feel sorry for that poor OP. His code just got jumped all over by about 5 people x.x
It's easy to do than criticize. Here's my attempt to implement a Celsius-to-Fahrenheit conversion table in C++.
#include <cstdlib>
#include <cstring>
#include <iomanip>
#include <iostream>
#define DEGREE_SIGN "\u00B0"
class Fahrenheit;
class Celsius {
public:
explicit Celsius(double c)...