The problem was pretty straightforward and used two simple algorithms from our examples; the one for computing the sum, and the one for counting matches. The array for the problem wasn't provided, but you can easily write a method around it without actually having it, since she gave us the name a...
I have some code which works fine. First, it checks that dates format are valid and then, checks that first date is lower than second date. I had to use free input text and custom validator because multiple date formats are supported such as quarter number (2014 Q1) etc.
But I find my code too l...
Currently I have 5 sorted arrays and they all are size of 3. And I am trying to search for single element in each of the 5 arrays (or its predecessor, if it doesn't exist).
Obviously, I can binary search each array individually, which will result in O(k log n) where k is number of sorted arrays....
@Vogel612 sorry to be a party-pooper, but editing OP's code (Question) is a no-no on CR - things like indentation and code formatting can be part of a review, so we systematically reject these edit suggestions.
@Vogel612 you are right, without an actual "real" implementation we are designing an application not reviewing an implementation... although it is a hard distinction to draw...
You're making more work for yourself than necessary.
Check this out:
var fs = require('fs');
var nodefn = require("when/node/function");
var get_some_data = function(filename) {
return nodefn.call(fs.readFile, filename);
};
var parse_some_data = function(filename, throwError) {
return ge...
Am I using a feature of Java 8 or misusing it?
Refer the code and explanation below to know as to why it was chosen to be like this.
public interface Drawable {
public void compileProgram();
public Program getProgram();
default public boolean isTessellated() {
return fals...
well it's kind of awkward, I thought the question was best fit for SO, but maybe it's meant for CR, but it has so many points on SO again and activity that it should better stay there
Nice answer! This would be the kind of answers we give on Code Review, feel free to join us if you enjoyed writing this answer :) — retailcoder6 secs ago
@Vogel612 - how do I say this and get it to sound right.... CodeReview is a place people sometimes bring their crap code to, that they know is crap, and that they are already embarrassed about.... Looking for ways to say: hey, this is code, I am not proud of it, but I am not sure how to make it better. (not all questions are like this, but some are)
and, in this case, I think the comment is 'fine'...
but the idea is to help, not pass judgement
For some people, coming to CR is like going to AA .... X: Hi My name is X, I have crap code. All: Hey X, yes, your code is crap X: Well, duh, that's why I am here.
Does having 10,000+ inactive & long-gone "avid" users (150-200) from the Dark Ages of CR (haven't counted them, really - just assuming) mean we have to compensate with 10,000+ brand new fresh active avid users to make up? How much is the Dark Ages (2011-2012, early 2013) affecting [non-]graduation? We've addressed the unanswered zombies, but we really have no way of addressing zombified users... Yeah, a quick look says we have 30K+ users, but... what's the picture like if we factor out zombie users that hasn't visited in, say, a year's time? — Mat's Mug8 secs ago
@MatsMug We check absentee values on all levels across a number of reputation levels. Though you don't have remotely to deal with 10,000 zombies. In terms of avid users, you have 2337 in the bracket from 150 and higher rep. Of them, only 1001 have been seen in the past month, with 98 of those being in the 1k+ bracket. That's basically 10% for the month. If we look at users who visited some time in the past 6 months, it's more like 7% (115 1k+ users out of 1685 qualifying users). — Grace Note2 mins ago
@MatsMug We check absentee values on all levels across a number of reputation levels. Though you don't have remotely to deal with 10,000 zombies. In terms of avid users, you have 2337 in the bracket from 150 and higher rep. Of them, only 1001 have been seen in the past month, with 98 of those being in the 1k+ bracket. That's basically 10% for the month. If we look at users who visited some time in the past 6 months, it's more like 7% (115 1k+ users out of 1685 qualifying users). We aren't going to hold super-long-gone users against the site's potential. — Grace Note7 mins ago
I am learning Java algorithm now. I have a question about the different implementation of insertion sort. The first one is the one I implemented exatly as the algorithm book and the second one I made a small change. Is it OK to change the implementation as in the second one? If not, what differen...
As an out-of-interest discussion about avid users, and avid user retentions... I modified 200_success's avid-user query to exclude users who are dormant. Consider this result:
Avid Users of all time
Reputation Threshold # Users % of Avid Users Cumulative % of Avid Users
--------------------...
The only ripples you've caused so far are creating smiles.
14
I dropped by because I figured that people have been poking me a lot so I figure it may be easier in some cases for direct responses here than making this gigantic comment chain.
@konijn We only save one draft on the main and one draft on the meta per user.
As an out-of-interest discussion about avid users, and avid user retentions... I modified 200_success's avid-user query to exclude users who are dormant. Consider this result:
Avid Users of all time
Reputation Threshold # Users % of Avid Users Cumulative % of Avid Users
--------------------...
If you adjust the query to account for activity in the past 4 months (since the review), then compare us against something like : CodeReview: http://data.stackexchange.com/codereview/query/171444/distribution-of-avid-users-by-reputation-tier?SeenInMonths=4 WorkPlace: http://data.stackexchange.com/workplace/query/171444/distribution-of-avid-users-by-reputation-tier?SeenInMonths=4 AskUbuntu: http://data.stackexchange.com/askubuntu/query/171444/distribution-of-avid-users-by-reputation-tier?SeenInMonths=4
"Do note, however, that you'll also take a blow to the number of direct editors. That's probably more valuable." - We'd still have @Jamal, wouldn't we? I don't see how the number of direct editors could change then.
@SimonAndréForsberg I was merely meaning that there's a lot affected by rep changes, and I felt that I wouldn't really be concerned about the number of people closing as much as the number of people being able to edit. It's not to say that the change is going to be what stops anything, but considering there already is voiced concern about the rep level changes, it looks like a point of concern.
@Mat'sMug Well, we want people in the 500-1000 range as well, so to speak.
@GraceNote I totally understand, I was just using the @Jamal = Editor meme :) (sometimes, he does feel like our only one. We need more editors overall. I'm also a bit bad in editing posts sometimes)
Some "memes"...
A few expressions have come up recently, thought I'd share them here (feel free to add, this is CW!)
Running out of ammo: when you have exhausted all 40 votes for the day.
Head shot: when you're out of ammo and post a target in chat, and then someone puts in a vote for you.
Wak...
@GraceNote: On another note: do you all perform any kind of pro-tem review, private or public? As I may be in this position for a while, I'd still like to make sure I'm still in check (such as monitoring my moderation action log). I haven't received any serious complaints yet (obviously I'll still make some mistakes here and there), so I suppose not much will need to be said. This also has to do with what I believe Tim has told you regarding the site's collective diamond moderation.
I am working through Kernighan and Ritchie to brush up on my C skills, so I thought I would invite critiques of my code.
Here is my htoi:
int htoi(char *str, unsigned long long *result)
{
int c;
int i;
int msnibble;
int digits;
const int nibbles[] = {'\x0','\x1','\x2','\x3',...
@Vogel612 - you keen on the German site.... : Here's my favourite SEDE Queries: German: http://data.stackexchange.com/german/query/161411/site-activity-and-votegraph#graph CodeReview: http://data.stackexchange.com/codereview/query/161411/site-activity-and-votegraph#graph
@GraceNote so updating on beta-progress 100 days after the review wasn't premature or otherwise uncalled for? Last thing I want is for us to... look like a bunch of kids waiting for prom night ;)
@Marc-Andre shit happens. You have a grace period to re-edit the same suggested edit (unless that has changed recently)
@Mat'sMug Everyone was real proud to see this. I think that you guys made a summary-and-analysis-and-what-to-do-moving-forward thread like that is a good sign of how much you guys are dedicated to making this work.
@GraceNote Dedicated is a good word. The only reason I'm here today is because I've visit this room once and they gave me the motivation to (re)start contributing here ! And I must say I'm glad I did!
When I look back at November, and remember that @Jamal had like 1.2K rep, @Malachi & I had just above 500, and I look at where we are today, I can't help but think the whole site is on the same trend.
I have been working on a project and I'm actually refactoring some code. I have encountered myself with lots of foreach and if statements, which could be easily replace with LINQ.
But I have this code snippet, that I wonder how I could make it more functional style.
foreach (var notification in...
@Jamal - can you look in to the precognitive answer questions: [Precognitive Answers](http://data.stackexchange.com/codereview/query/171088/precognitive-answers) (This came up when I was looking in to AskUbuntu, and they have [seriously precognitive answers](http://data.stackexchange.com/askubuntu/query/171088/precognitive-answers) )
What causes answers to arrive up to 13 hours before the question was asked? It appears to be something funky with migration or merging.
LINQ isn't a silver bullet. It stands for Language-INtegrated-Query, which allows querying objects.
Querying objects isn't something that's supposed to have side-effects. However this is precisely what you loop's body is doing.
Therefore, refactoring it to use LINQ, if at all possible, would ma...
I was thinking about posting an answer to the Java Direction enum question which I planned on answering (as I was the one who suggested him to post that one in the first place...), but well... I might do it tomorrow instead. I do have some more things to add, besides what the monkey brought up.
@skiwi I recommended to a friend that he try an antenna and digital tuner to get 'free' HD-TV. I do this myself, nice setup. He spent a week on it trying to get it to work... finally I get a phone call: All he could get was low-quality signal 480i, until he found the network cable was flakey.... he was ready to ship the system back to source when he tried it 'one-last-time' and it was glorious HD on a different cable.
As request of Simon's comment:
Direction.java
package net.woopa.dungeon.datatypes;
import java.util.Random;
public enum Direction {
NORTH, EAST, SOUTH, WEST;
private static Random rnd = new Random();
static public Direction randomDirection() {
return Direction.values()[rn...
@SimonAndréForsberg - you did see his comment, right?
I like the efficiency of this class and the fact it doesn't require me to change any of the other code in the project. I did however add public Vector2D getFront(Vector2D vec) { return new Vector2D(this.forwards_x(vec.getX()), this.forwards_y(vec.getY()));}... as I liked 200_success's naming convention, the simplicity and it didn't have any noticable drop in performance. — Sam Martin9 hours ago
Here is the code for the CString class that I created.
public class CString {
public String reverse(String s) {
char[] array = new char[s.length()];
array = s.toCharArray();
for(int i=0; i<array.length/2; i++) {
char tmp = array[i];
array[i] =...
I have k sorted arrays, each of size n. Currently I have hard coded 5 sorted arrays each of size 3 but in general that is configurable.
I would like to search for single element in each of the k arrays (or its predecessor, if it doesn't exist).
Obviously I can binary search each array individu...
Here is a SQLite Helper Class I created. Any input appreciated, including security and simplification.
using System;
using System.Collections;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Data.SQLite;
using System.Linq;
using System.Text;
using ...
@GraceNote thanks for showing up on CR today, we really appreciate your feedback - you're more than welcome here anytime you like (that does include out-of-office time as applicable - you're addicted to SE as well aren't you? ;)
I'm having trouble with the calcDistance methods. The instructions say to create:
A method distance that returns the distance from this point (0, 0) to another point of the MyPoint type.
A method distance that returns the distance from this point to another point with specified x and y coordinate...
I'm attempting to serialize the state of a program I'm developing, but I'm getting the following error when I attempt to Deserialize the resulting file:
System.ArgumentException
Message=Empty path name is not legal.
Source=mscorlib
StackTrace:
at System.IO.FileStream.Init(String path...
In this assignment, I'm supposed to split a string using strtok. (The assignment consists of the comment and the function definition; I fill in the function body.)
It works as far as I've tested. But it seems a little ugly to me. Perhaps it's my Java background, but somehow this just doesn't fee...