Since your post is a little unclear to me, I'm just going to point out a few small things that could be improved quiet a bit.
The program logic could be separated out into different functions. This allows for easy re-usability.
You should flesh out this program with comments for clarity. There ...
I have a third party system that submits I am assuming a byte array data from OBDII port on our fleet vehicles.
I was getting values like:
AA== (bool)
AQ== (bool)
AAAaMA== (int)
AAA0IQ== (int)
Mjow (string)
UzozLTIwNA== (string)
I know what the type is for each field but the regular base64_...
Sometimes, questions with authoring comments surface, and whilst changes can greatly affect the difference in code, is an author comment really warranted in answer?
StackExchange's attribution required link on the bottom of all SE sites, lists four things required to be done when republishing co...
@QPaysTaxes Slight suggestion: When another user has already commented, with something very similar to what you want to comment, you sometimes don't need to add another comment at all.
@rolfl You might want to post a comment on that question that they should take it to meta.
@QPaysTaxes I don't think this comment is helping at all:
@Daniel The problem is that, on Code Review, hypothetical code is off-topic. Whether or not 'everything needed' is contained, there's a reason it's closed as off-topic: It's off-topic — QPaysTaxes1 min ago
> there's a reason it's closed as off-topic: It's off-topic
@GregHewgill / Danield. Respectfully, I disagree. I am happy to chat with you about it, so feel free to join a bunch of us in the 2nd monitor where this question has already been bantered around. — rolfl ♦9 secs ago
@QPaysTaxes - when I ask you to tread carefully, please respect that.
anyway, I was working on an answer to that scala question when it got closed behind me, so I couldn't answer it. (I don't really know scala, but I was taking the opportunity to learn something.) It seemed to me to be a very focused bit of code that could indeed be reviewed.
yeah, there are details like "does the order of calling someFunction and anotherFunction matter?" but I'm not sure that would necessarily be clear even if the OP had posted that snippet from "real" code.
@GregHewgill Real code leaves much less room for interpretation. Real code leaves the what very clear, it is just up to you to guess why (unless it has been explained).
chamaeleon questions change as the asker revises them, and someone puts a lot of effort in to an answer, and suddenly it is thrown out because the question asker changed a method, or assumption.
we are strict about that on Code Review, but then very relaxed on duplicates.
you can't change the code after a question is answered, but you can re-ask it with revised code.
@GregHewgill Exactly. On Code Review, answers often question design choices that has been made. If we see the real code, we might suggest an entirely different approach to the real problem.
Seems like it's a challenge for an asker to decide what is the correct balance between including too little (and being accused of posting sample code), and including too much (providing an attack surface that's too large)
I have a project I am working on, and I would like some, or all of it
reviewed, how can I ask for this review on Code Review in a way that
produces the best possible value?
This is not about a question being on-topic, or off topic. Rather, this is about making on-topic questions great qu...
A thing that commonly happens on the "How can I do this better?" questions on SO (that does not contain real code) is that people are trying to be 'clever' or funny in one way or another, by focusing too much on the example code that the OP posted, posting suggestions that would not work for the real code. We try to avoid that here.
We do have a range of "span" for questions... and recommend people post smaller sections of code for more detailed reviews, and larger swathes for big-picture reviews.
well, I'm being slightly deliberately provocative by saying "attack surface". By including a lot of code and context, the asker opens up a lot more room for "suggestions" that might be low-hanging fruit and not really what is needed.
and now I can't immediately find rolfl's answer on that topic because I closed that tab and the question in question is now gone.
I tru to recommend people put as much code in as they can expect to be reviewed in about 15 minutes.... or, alternatively, expect a review that takes 15 minutes to complete.
I have my 'pet theory' about Code Review. This is my personal theory, and it is about human psychology, so you will have to take it with some salt..... It goes like this:
You post code for review, and...
noone knows how good you are as a programmer
they do one of two things:
find the most glar...
@GregHewgill Who decides 'what is needed'? By posting more real code sure you are opening up to more answers, some might not be what you are looking for of course (suggestions to rename something from an already quite good name for example), but I believe that reviewers tend to capture 'what is needed' quite well.
Well, for example, with this question we're talking about how to write something in a functional style in Scala. Sure, the OP could have included more of the original Java code, but what benefit would that be? The OP is asking about the functional style aspects of one loop.
Perhaps the problem is that question would have been better suited on SO in the first place.
@GregHewgill It's the someFunction and anotherFunction identifiers we're primarily concerned about, and as it is a Scala question, we're more concerned with the Scala code than the original Java.
We do have an 'on-topic magic question' that asks: 'Do I want feedback about any aspects of the code?', which is often implied when posting on CR. Code without context make that hard to give... So while the question is asking about one thing, generally answers may cover more than what the question is asking about.
> Is code included directly in my question? (See Make sure you include your code in your question below.) Am I an owner or maintainer of the code? Is it actual code from a project rather than pseudo-code or example code? Do I want the code to be good code? (i.e. not code-golfing, obfuscation, or similar) To the best of my knowledge, does the code work as intended? Do I want feedback about any or all facets of the code?
Wrote a couple of blog articles about smart pointers.
Unique Pointer
Shared Pointer
Constructors for Smart Pointers
So I suppose it time to get the result reviewed.
This is not supposed to be a replacement for the standard smart pointers. It is more a simple place to start for people trying t...
@GregHewgill Good Code Review questions explain well what the code is supposed to do, when example code is posted, the code essentially does nothing. You might say that it 'loops' or that it is using recursion or whatever, but that itself is not doing anything useful. Why does it loop? What does it do in each loop? etc... those are the important questions.
@GregHewgill We do have this MSO question that we've shoved up the face in SO users been referring too when we notice bad recommendations to post on CR:
Code Review is becoming well-known on Stack Overflow.
The folks over on Code Review are happy about that.
The only problem is that there are a lot of questions redirected to CR which don't belong there.
So I want to ask that the users who direct askers to CR (or request migration of questions...
> Is code included directly in my question? (See Make sure you include your code in your question below.) Am I an owner or maintainer of the code? Is it actual code from a project rather than pseudo-code or example code? Do I want the code to be good code? (i.e. not code-golfing, obfuscation, or similar) To the best of my knowledge, does the code work as intended? Do I want feedback about any or all facets of the code?
(the last one, about feedback about all facets of the code, isn't entirely important to explicitly say in the question, but can be good to keep in mind)
'working, real code' is the parts were most questions get closed as off-topic. If you have working, real code, then it can likely become a CR question.
working = working as intended of course. Some people have a hard time grasping that.
Array of size (n-m) with numbers from 1..n with m of them missing.
Find all of the missing numbers. Array is sorted.
Example: If arr = [1,2,4,5,6,8], result should be 3 & 7.
Here is my code which I would like to get reviewed. Sorry for the quality... I'm learning.
import java.util.*;
class Fi...
I've written a toy neural network in Java. I ran it several million times with the same outputs with only the randomized weights changing from run to run. The average of all of the outputs is not 0.5, as I would have expected. The code is in this Github Repository: https://github.com/jack-t/petul...
@JohnSaunders That's a possibility but quite unlikely, since 1) the code is not touched for months, 2) the code with multi-threading doesn't use the native code 3) with plenty of code review and simplification, we don't see the threading issue in the code. — Jeffrey Zhaojust now
I am fishing for a specific reputation..... and I am really close. I am at 66651 - I would like to fish for 15 rep... that's one question upvote, and 1 answer.... and, if I may be so bold...
"Need at least two file arguments: Destination Source {Source {Source {...}}}"
I think an easier way of documenting that, at least for *nix, is:
"Need at least two file arguments: DESTINATION [SOURCE]..."
You can also turn the Paths in your main() method into a Stream too:
public class L...
Thankfully, *unlike some other SE sites* , CR and 2nd Monitor in particular has santas. Just be a good boy, (*because santa is checking*) , and maybe do a little pimping, and upvotes will be all yours :P
2
Goddamn it Markdown (Markdown pls)
Markdown in chat.se is the bane of my existance
You know what would be really cool, a heatmap/cloud on the tags page, that turns redder/larger for the more usage of a tag
Is this producer is thread safe?
Is it exception safe?
public class AsynchSimpleProducer<T> : IDisposable
{
private readonly Action<Exception> error;
private readonly BlockingCollection<T> blockingCollection = new BlockingCollection<T>(50);
public event Func<T, Task> NewItem;
p...
I found working on this jigsaw puzzle a personally rewarding experience. It really helped me appreciate what you do here.
Obviously the longer your site has been around, the more problems you find that need addressing. I'm sure you've tried cramming more unrelated close reasons into each slot, b...
Meme: 6 to 8 Weeks
Originator: Jeff Atwood
First Heard: May 13th, 2008
Cultural Height: In about 6 to 8 weeks
Definition: The time estimate given "off the top of my head" when the Stack Overflow team has only a vague idea of how long a task will take because they have little-to-no formal sche...
^^ his top SE post
mark my words: we're 6 to 8 weeks away from full-fledged graduation.
"On the other hand, codereview is still beta, and has low impact factor(~1000 on c tag) - in my opinion too low to expect answer in a lifetime" is 142 characters...
How can this code be improved?
class Fruit{
//...
}
class Apple extends Fruit { public void shape() {
System.out.println("round!");
}
//...
}
class Orange extends Fruit { public void colour() {
System.out.println("Meow!");
}
//...
}
class FruitMain {
public static void main(String[] arg...
The problem I attempted to solve is described as:
What is the largest subset of mutually non-overlapping intervals which
can be selected from I? Where I is a set of N intervals where each
interval has the same weight per item within the interval.
I claim the algorithm runs at \$O(N lg N...
hey @JeroenVannevel, i've got an idea for a roslyn-based project if you're interested: implementing the dependency graph functionality that's only available in VS Ultimate msdn.microsoft.com/en-us/library/dd409453.aspx
I have a flat data that represent the hierarchical relationship as below:
ID Name PID
0 A NULL
1 B 0
2 C 0
4 D 1
5 E 1
6 F 4
3 G 0
This table represents the 'data table', where PID indicates the parent element.
For example, in the fi...
I did some work in R and I need feedback. I repost since this section is more suited.
Generate a sample of size 1000 consisting of realizations of independent
N(4, 1) distributed random variables.
n <- 1000
x <- rnorm(n, mean = 4, sd = 1)
Write a code for a function which gives the density f...
I've node project and try to build my code better so I've created new
folder with file like following which encapsulate the read and write file .
This is working and my question is if its good practice since I need to use the call to read and write file in several place in my code.
Since Im new ...
Is this the right way to call WCF? (I am more interested in how I assign null - and handle exception etc. Parameters I have passed correctly).
// Client proxy
BasicHttpBinding binding = null;
EndpointAddress epa = null;
FreeSpaceDatabaseClient pro...
I'm working on a code where the programs allow user to prompt for a folder location and read multiple csv files.
Does anybody know how? PLEASE HELP.
Right now, I only know how to read just one file and print the output out:
import java.awt.FileDialog;
import java.awt.Frame;
import java.io.Buf...
@iluso @Duga is a bot which is searching for comments on SO which refer to code review. Often the advice to post the question here is wrong, because e.g the code is broken hence off topic.
In this way active users in chat can visit the question/comment and either upvove the comment or post a comment with the explaination that it would be off topic.
I'm designing a push notification server (for pushing notification via APNS and Google servers) and have come up with the following design for a Java based web application server. I would really like to hear anyone feedback from people who have experience with anything relating to this. This is a...
You are being watched
Code Review has an open system
A machine that spies on you on every hour of every day
I know because I built it.
I designed the machine to detect suggestions to post on Code Review but it sees everything
Horrible comments involving ordinary users
Users like yo...
Trying to solve this combinatorics problem, I wrote some functions to count the number of unordered distinct factorizations of an integer n into k distinct parts.
The following function builds up a list of unordered distinct factorizations of n with largest part at most m.
duf' :: Integer -> In...
We have main application from few separate parts - Unity and Clc.
I'm writing new tool, which will be used to manage them - deploy Unity, or run some checks and lot of other stuffs.
As there will be a lot of options - I want split them in to separate namespaces.
Here is how I realized it, but ...
I am using the following method to validate if user has given any input or left an EditText empty, I am concerned about the return statement in particular, because my IDE keeps complaining about it
Enviornment:
Android Studio 1.0
Code:
public void clientsideauth() {
if (TextUtils.is...
@Phrancis What's the logic behind calling the first song of your album 'The Final Battle'? I finally got around listening the entire album and started noticing the names.
Your code is generally clean, you have accurate comments & variable naming is mostly consistent.
$raw_bytes and $byteArray use two different types of naming. It's best if you choose one style, and stick with it.
With return ($encoded == "AQ==") and return $byteArray[0] == "00000001", you don't ...
FYI, I have been in contact by phone with a mongodb representative. She asked me to post this question in the Mongodb google group (groups.google.com/forum/#!searchin/mongodb-user/…) and an answer has been posted yesterday mentioning that : "Thanks for reporting this. I've opened a ticket in the ruby driver JIRA project if you'd like to track it: jira.mongodb.org/browse/RUBY-946 A fix is in code review and will be released with 2.0.5 soon" — Thierry46 secs ago
I tried MergeSort but it is not working correctly.Please help.Code in C++ is as follows:
#include<bits/stdc++.h>
using namespace std;
int k=0;
void Merge(int *a,int left,int mid,int right, int *temp)
{
int i,j;
i=0;j=mid+1;
while(i<=mid && j<=right){
if(a[i]<a[j]){
te...
I have exams until June 15th. I have to host a guest between June June 20-25. I leave for Argentina June 27th until August 3rd. I have exams August 20th-September 3rd. I leave for Boston September 18th-25th. I have a 3 month internship starting at the start of October.
So you can see how it will be hard squeezing stuff in there
3
But if you start the project, I'll chime in whenever possible
I was trying to solve Project Euler Problem 78: Coin Partitions.
Let p(n) represent the number of different ways in which n coins can be separated into piles. For example, five coins can be separated into piles in exactly seven different ways, so p(5)=7. Find the least value of n for which p...
how can i put style my selected value in if case, please checkk my code and let me know if any correction please..
$.ajax({
type: "GET",
url : "letsdoit",
...