« first day (1539 days earlier)      last day (2772 days later) » 

00:00
RELOAD! There are 4183 unanswered questions (90.8752% answered)
00:13
0
Q: Slow execution time of search algorithm

tesseractBirdI have solved a problem of a game named 'Set'. The full problem is detailed on it's website: https://www.urionlinejudge.com.br/judge/en/problems/view/1090 However my code for the search algorithm is too slow, I'd like to achieve something around O(n). How can I make SetGameManager::CountSet() bet...

00:27
0
Q: ConcurrentHashQueue in C#

DejanThe ConcurrentHashQueue data structure is a FIFO queue that at the same time allows look-ups of items based on a key in O(1) like a dictionary. It can be used as a cache when the number of cached items is a constant and the eviction strategy is FIFO. This makes sense when the cost of computing/cr...

 
1 hour later…
01:44
0
Q: Reddit Parsing Script

User319This script is meant to do the tedious work involved in a monthly event I run on a subreddit. It does a search for all posts relevant to the event since the last posting, and creates the bulk of the next month's post. I would most like criticism at an organizational level. My functions ramble to...

02:25
0
Q: Shell script best practice and conventions

TerNoviI am asking for an experienced person to review my basic shell script. I do not write them at work, but I am a Software Developer. I am using this for my personal project that I am working on. Later, it will be integrated with Docker and a CI server maybe Jenkins/Travis CI, Who knows. I am just ...

02:58
@DanBron, i'd appreciate any thoughts on: codereview.stackexchange.com/questions/169813/…Jonah 33 secs ago
0
Q: ASCII triangle in J

JonahI've been doing code golf puzzles to improve my J. I'd appreciate any feedback on my solution to this problem. The task is take an integer and produce an ascii triangle as follows: 5 |\ | \ | \ | \ | \ ------ My solution: (#&'| \' @ (1,1,~])"0 i.) , ('-'#~>:)

 
1 hour later…
04:05
05:01
You can try it first then ask for code review at codereview.stackexchange.comdrum 9 secs ago
05:14
@RubberDuck Correct, but no leaks that I remember
06:02
1
Q: reduce memory allocation when feeding a channel

felixI recently created a small app in go that generate x random bson documents and insert them in a database (MongoDB). See this question for details. After doing some profiling, I realised that Garbage collection was taking a lot of time : for inserting 1000000 JSON documents of ~220 bytes, top10 ...

06:45
Monking
Monking.
@BeeOnRope I was unable to make the N=2 approach work. However, I have now posted the code if you want to have a go at it. — David Wohlferd just now
@PeterCordes - You said you were interested too (link]). — David Wohlferd 22 secs ago
07:03
0
Q: Trying to ease bottleneck in SSE loop

David WohlferdThis is a continuation of a discussion that was started here. While there are some interesting points there about instruction timing and latency, it is not necessary to read that Question to understand this one. What I'm looking for in a review My project is heavily bottlenecked on my (6 asm i...

Got the Announcer badge for a question I don't remember sharing. On RaspberryPi.SE, out of all sites.
Odd stuff.
; Convert to absolute value is a confusing comment because "absolute value" already has a well-defined meaning that is different from what you mean. Maybe "absolute address" would be better? (Oh wait, I'm not on Code Review!) — Cody Gray 21 secs ago
 
2 hours later…
08:49
Depends what you're doing with them! Suggest you post your code to codereview.stackexchange.com — JeffUK 55 secs ago
I'm voting to close this question as off-topic because it belongs on codereview.stackexchange.comToto 22 secs ago
09:01
0
Q: Correct implementation of the factory pattern in php

CasperHobsAll, during my vacation I am trying to learn myself the basic principles of OOP and the factory pattern in php. I read a lot of tutorials and websites (e.g. http://www.phptherightway.com) and began to write some classes. Is the underlying implementation correct? Additional information: I have s...

09:25
@RubberDuck I've used Groovy a lot, yes. Haven't run into huge leaks I think, but I think I did something for @Duga to help her memory... I will check. What classes are being created all the time? Are you sure that you are not storing any old references?
@RubberDuck If you are using GroovyShell to run Groovy scripts, you might want to try using this: docs.groovy-lang.org/latest/html/api/groovy/lang/…
-1
Q: Covert jquery code into angular js code

user143822 server.fillDashBoardData(); $('.askHelp').click(function () { $('.askHelpModal').addClass('reveal-modal'); $('.closeAskHelpModal').click(function () { $('.askHelpModal').removeClass('reveal-modal'); if ($(this).hasClass('submitBtn')) { ...

09:44
@SimonForsberg I'm using Jenkins Pipeline. I've got millions of char[], groovy ast expressions, and java.lang.Class instances that never get collected. I've been bouncing Jenkins 1/2 doz times a day.
@RubberDuck Oh, okay. Have you upgraded Jenkins to the most recent version, in case it was a bug? We're using Jenkins Pipelines at work and our Jenkins machine is somewhat stable (compared to other things around here).
If Jenkins is upgraded, then I have to ask what huge magic you are doing in the Pipeline script, if you can share that.
I'm voting to close this question as off-topic because this belogs to codereviews, not SO! — eisbehr 1 min ago
The only thing I can think is that it has something to do with us using a shared lib.
I don't think it's actually sharing it.
I think it may be parsing the shared groovy lib for each build, and creating new copies of classes that should already exist. But that's just a guess.
We're the only people at the company I know of who've created a shared lib to reuse common steps.
10:01
check out codereview.stackexchange.com Be sure to read their help center before you post anything — suraj 22 secs ago
0
Q: :root variable change change in React with input type color

Muhammed Athimannil:root CSS variable change in React with <input type="color"/> The code done with little knowledge in React therefore I am sure there must be plenty of errors. hope you can give some ideas for the best practice import React from 'react'; export class Header extends React.Component { construc...

0
Q: Fetch real-time audio input

Ashish KThe following code uses portAudio library to implement a real-time audio input through default input device. The SAMPLE format is float32 with 100 samples per frame. The code is able to provide samples accurately but there is a significant lag that can be seen. There are two questions which I w...

10:19
Monkign
Kaz
Kaz
10:32
@Vogel612 Monking
10:50
0
Q: Is my code have proper logic?

SvetaNeed help. I am trying to dynamically create triangle block and insert it right after one of already created block. Here is the code: function createArrow() { var arrowDown = { parent: document.querySelector('.landingItem'), div: document.createElement('div'), initDiv: function() { ...

11:00
@CaptainObvious Is my title have proper grammar?
I guess "fix form adding" was a proper change message for that post.
This is a very large block of code and very broad question. You should probably consider asking in codereview.stackexchange.comJames 54 secs ago
@Mast Be nice. Let's assume a language barrier.
11:18
@CaptainObvious Question overhauled, including code running snippet.
@RubberDuck I wouldn't post that as a comment on the question, don't worry.
Why I love Python: for i in re.findall("[-+]?\d+[\.]?\d*[eE]?[-+]?\d*", my_string): does exactly what you think it does. Clearest and shortest I can imagine.
@Mast Doesn't that lead to problems if re.UNICODE is set?
@Zeta Unicode leads to all kind of problems, so, probably.
Also, why [\.]? and not \.??
And isn't 10e an invalid one?
@Zeta Single character.
@Zeta Yes, but how would you work around that?
11:33
Basically add groups to make sure that if e is used at least one digit (after a +-) is there.
The [-+]?(\d+(\.\d*)?|\.\d+)([eE][-+]?\d+)? is slightly more complicated since it allows .34e-123 (missing leading digits).
@Zeta The one referenced for %e, %E, %f, %g fails for numbers like 5.7e6
Mine doesn't.
@Mast I'd recommend using raw strings, :)
@Peilonrayz Why?
@Mast Cause it's confusing whether \ is \ or \\.
So '\.' is actually '\\.'
@Mast It does? 5.7 gets captured by the first group in the first group, and e6 is also fine.
11:45
@Zeta It's a single number.
So? (And which number?)
Yours splits it.
5.7e6 is one number, your regex breaks it into 5.7 and e6.
Technically it breaks it into 5.7, .7 and e6. That's due to grouping in that example.
30.9
0.8
41.4
5.7e6
('30.9', '.9', '')
('0.8', '.8', '')
('41.4', '.4', '')
('5.7', '.7', 'e6')
You could add another group and then just use ?: (? I'm always not sure which one it is) to ignore the inner matches in the result.
11:48
First 4 are mine, last 4 are same input through yours.
So, why would I use grouping if it creates extra work?
@Mast "Mine" is just the one from the documentation, though.
@Zeta And mine shamelessly stolen from SO, so we're even on that.
@Mast Because 1e isn't valid notation, as far as I know, nor is 1+1.
True.
It's overkill for what I use, but now I'm at it anyway, I better make something that sticks so I don't have to think about it when re-using.
So, I'd have to group the current groups to fix the mess made, let's see...
Ok, I have no clue how to do that. Would ?> help here?
I'm currently investigating in another direction. You're probably just trying to get all doubles (possibly in scientific notation) from a string, right?
Are they whitespace separated?
12:01
@Zeta Yup.
@Zeta There's always at least a whitespace between them, yes.
Oh, it was ?:.
([-+]?(?:\d+(?:\.\d*)?|\.\d+)(?:[eE][-+]?\d+)?) should do the trick.
The (?: will not capture the group. So the parentheses still work, but they don't show up as another result in your match.
@Mast If you're willing to write isfloat, that could get solved with generator syntax: (float(f) for f in str.split() when isfloat(f)).
@Zeta That catches a +1 as a number, even if there is a whitespace before the +.
Try posting on codereview.stackexchange.com for improvements to working code. — jsheeran 53 secs ago
@Mast Wouldn't that be according to your spec?
@Zeta It fails in what I used earlier as well, yes, but isn't it still an invalid number?
12:06
float("+1") doesn't yell.
The + sign at the start is optional, but I think that \+\d+ can be parsed as (literal) double in most languages.
Screw that. I forgot about Haskell. Only supports - at the start.
Either way, if you don't want to support +123e+123, just get rid of the first + in the regular expression. That should work. (+1 is captured by your regex as well, so I'm wondering what you count as number).
Thanks :-)
0
Q: my MNIST model gives me accuracy under 15%. It does not work well

Heasung KimI study tensorflow and python now. I tried to change some part of MIT youtube CIFAR10 tutorial code. ( https://github.com/Hvass-Labs/TensorFlow-Tutorials ) I changed the code slightly for study but it shows me accuracy under 15% [![enter image description here][1]][1] I tried to find errors so...

@James if the code does not work (which is indicated by "error" and "problem with the code"), it's off-topic on CodeReview. — Zeta 28 secs ago
12:31
0
Q: I have "Server Error in '/' Application. Invalid postback or callback argument." and i dont know how to fix it

Von KellyI have a WebForm page which contains a User control. this user control is a grid view and has a button. when i push the button it gives me the error. how do i fix it? i have other pages exactly the same as this but they dont have errors.!?! Here is my code -> and here is my error thanks for...

0
Q: Is pass by reference or value or template function call faster?

RonnieI was asked this in an interview:- Assuming foo() does something with x, which of these is faster:- void foo(double x); void foo(const double x); void foo(const double& x); template<typename T> foo(T x); This really stumped me, and testing this is not that easy however just for anyone interes...

Voting to close this as it doesn't actually ask a question. Maybe the code could be posted on the code review site. But as it stands the only possible answer is to completely explain asymmetric cryptography (including how to spell it correctly) and transport security. — Maarten Bodewes 18 secs ago
12:48
0
Q: C++ How to test if user enter number or not?

Hà Chí Hàoi want to know how to test if user enter a number or not, i have my own solution, but i think it have better solution, here is my code : int error = 0; int i; string input; float num; cout << "Enter a number : "; cin >> input; //store what they enter as a string for(i=0; i<input.length(...

What you really want to do is go post this on Code Review where they are focused on reviewing / optimising code which is working. What will possibly help is using an Array which will get the data from the sheet and then you can process the Array and then send the data to the new sheet. — Jean-Pierre Oosthuizen 53 secs ago
This is the correct place for a code review question: codereview.stackexchange.comrubenwardy 1 min ago
Greetings, Programs.
1
Q: Nested switch that are very similar

Kaito KidI am currently doing a code review for a coworker. I have encountered something like this: switch (type) { case DatabaseType.Type1: switch (domain) { case DOMAIN_1: return DatabaseConfigType.Type1Domain1; case DOMAIN_2: ...

13:10
David Robinson on July 21, 2017

Microsoft’s earnings were released yesterday, so we thought we’d take a look at how Microsoft technologies including Azure are used in comparison to Amazon Web Services, according to Stack Overflow data.

How do the two cloud platforms compare? The Stack Overflow Trends tool shows the percentage of questions asked that have a particular tag (amazon-web-services or azure), and can give us a sense of each technology’s popularity since 2008.

It looks like they’ve both been growing consistently in their share of Stack Overflow questions. In the first few years of the site, eac …

13:21
Greetings, User.
2
Q: The help-center contains links to meta.codereview.* instead to codereview.meta.*

ZetaSee What topics can I ask about here? for example: For more information on this policy, please see this post on our Meta site. A user gets greeted with an "unsecure connection" warning, since the certificate isn't valid for meta.codereview.stackexchange.com, but for codereview.meta.stackexc...

This might be better suited for codereview.stackexchange.comChris 40 secs ago
Does this code work? Because "optimizing" is pretty broad, and not really a thing we do on Stack Overflow. As @Chris notes, this might be better off on Code Review, but be sure to read their help center. One thing they require is that you explain what your code does exactly. — Mike McCaughan 21 secs ago
Any matplotlib gurus present?
13:54
0
Q: Finding the maximum GCD of all pairs

NeyromanThe code below is for Hackerrank competition. Seems that it works correctly but performs very slowly and because of it can't pass some tests. The task is to find the maximum gcd of all possible pairs of two positive integers x ( 1 <= x <= 10^6 ) and y ( 1 <= x <= 10^6 ), where x belongs to array...

0
Q: Sum of Maximum GCD from two arrays. Incorrectly closed, due to memory error

PeilonrayzYesterday we got the question Sum of Maximum GCD from two arrays. There was some language in it that I thought was in the gray area. And so myself and the OP exchanged a comment: I have concern with two of your sentences: "it has successfully passed some of the test cases." If it doesn't pas...

0
Q: Replacing all the 'u' with specific character that is given by the user

Egek92I got this question for a Junior Software Developer interview. And came up with this solution in Java: public class Main { public static void main(String[] args) { Scanner in = new Scanner(System.in); if (!in.hasNextLine()) { System.out.println("error"); } String str =...

14:22
@Vogel612 Please explain your vote to close this:
0
Q: Replacing eval calls in JavaScript

Giulio MuscarelloI'm writing a tool that walks the AST of some JavaScript code, with the goal of hooking eval with a function (eg. _logJS). Leave aside the implementation of the AST rewriting; suppose it works perfectly. What my tool does is replace function calls like foo(bar, baz) with the following: // If `f...

0
Q: How can i simplify my router?

Arslan.HI'm developing a MVC project currently I'm stuck at the router.Thanks to Mārtiņš Tereško I have managed to get a better understanding of what needs to be done in it. The project has the following folder structure: src └── Discus ├── Core │ ├── Configuration │ ├── Database │ ...

@200_success I read the post as 'This code is intended to wrap all eval calls in a given js code, but it doesn't work for code like ...'
Accordingly it's not working as intended IMO
Also it's self-answered and references 'rubber duck debugging' in the answer
I don't see any "doesn't work for code like…" in the question. And self-answers that find bugs are allowable.
14:56
Hmm.. the foo bar and baz identifiers don't help either. Nor does the inquiry about referential transparency of the transformation.
It's too specific a question and it's quite a lot of 'suppose' in there..
Can it be done as specified in this link? Or this is just for code review? blog.devart.com/creating-tfs-custom-check-in-policy-part-1.h‌​‌​tml — Neo4j user just now
@Neo4juser That appears to be a basic tutorial on creating a check-in policy for code review. You will have to do independent research and figure out how to best implement the behavior you're interested in. — Daniel Mann 50 secs ago
Not a code translation service... Please attempt to actually translate it to Rcpp before hand. Probably better to post this on codereview.stackexchange.com — coatless 25 secs ago
@coatless Thanks. I don't need the code to be translated but point to places where I can do better. Even a pointer will do. Definitely, will post in codereview. — Mokshyam 51 secs ago
15:39
0
Q: Java Drawing House

R. HollandCan anybody tell me if there is a better way code this? As an exercise I was supposed to draw a simple house, and this is the main body of the code I have only I feel it could be way better but can't see anyway to make it so. The code works as it should, I just as I said want to make it better a...

15:52
0
Q: Comparing strings in a R vector with one another is super-slow

MokshyamI'm trying to compare every element in a vector with every other. From a dataframe of Addresses, I extract streets for a zip code. And a vector of these street strings (like "123 main avenue") is the input. streets <- c ("123 main avenue", "123 main ave", "456 paul st", "456 paul street", "1 r ...

MOnking
Also - consider posting this code block to codereview.stackexchange.com as a new question. I see some improvements that could make this code easier to maintain even though it isn't the cause of your problem. — Freiheit 47 secs ago
16:13
0
Q: Displaying MySQL data using PHP

Marty LavenderI have MySQL data that I am rendering in an HTML table using PHP. This is the full code of my table and PHP. It does output fine and looks how I would expect but I am wondering if there is a better way to write this code. Also, the 'Delete' button specifically, is there a better way to output the...

0
Q: Generate Die Rolls Using A Coin Flip

Jae BradleyProblem I've seen this basic interview question in a couple of places, but never implemented it. Create an algorithm to output a fair die roll (values between 1 and 6, inclusive), given a function that outputs the outcome of a fair coin toss (0 or 1). Approach The idea here is to use th...

16:26
0
Q: is my code following encapsulation goals and rules correctly?

AZOOZ FakiSo recently I completed the encapsulation lesson and I made a simple android app implementing encapsulation, I had difficulties understanding encapsulation. My Soldier class: public class Soldier { //Start of the class. private int solHealth; /* Soldier class constructor with t...

 
1 hour later…
17:27
0
Q: Expected Casino Profit(JAVA)

MEGHNAD SAHA .........................................................

0
Q: Trouble shooting why plots look different in python 2.7

user143854I have two codes, both that optimize coefficients x[l] of an objective function such that the function is minimized. Those coefficients are then passed into two functions (kick(x), slope(x)) and then print the values of either kick^2 and slope^2 or the average kick^2 and average slope^2 (which is...

Belongs to codereview.stackexchange.com — JFPicard 24 secs ago
@CaptainObvious OT, don't really know how to describe it
Thanks @DavidWohlferd! To be clear, over on code review you are open to bigger algorithmic changes that still get the same result (i.e., identifying likely primes), right? If you want the exact algorithm with only tweaks to the inner loop, you aren't going to get much better than Peter's answer here. Also, while you do a good job of describing various low level details, it would have been awesome to have a one or two sentence summary of the actual ProcessA algorith, e.g., "all likely primes in [start, end] are identified by ..." — BeeOnRope 48 secs ago
18:20
I need to wear one of those to work
18:34
0
Q: This decorator records the amount of time a function takes to execute and adds the elapsed time to the functions attributes

Ricky WilsonThis decorator adds the elapsed time to a functions attributes when applied. My concerns: Is the code pythonic. Could this code be useful. Should i just use the timeit module. Is the code easy to read and understand. ''' :Date: 7/21/17 :Version: 1 :Authors: - Ricky L Wilson ''' import dat...

0
Q: Retrieving values from Entity Framework DbContext to render in a ListBox

SinjaiI need to pass a ViewModel to a strongly typed View which will display a multiple-select box using HTML.ListBoxFor. My ViewModel has a List<int> for the selected values and an IEnumerable<SelectListItem> for the options. Is there a better way I could be enumerating the list of options? public M...

You're trying to solve the knapsack problem which is NP-complete. This question is too broad for stack overflow. If you ever find a working algorithm for your case, you could ask for a review on codereview.stackexchange.comEmile Bergeron 16 secs ago
18:53
0
Q: Make change for a given amount given denominations

PaparazziMake change like at a cash register Input is the denominations of the currency and the sum In test case only coins are entered Return how many of each denomination Return the fewest possible denomination count (don't return all pennies) Check for style, efficiency, correctness, and a...

@Nishtha I think your question in codereview.stackexchange.comJavia1492 7 secs ago
I'm voting to close this question as off-topic because it belongs on codereview.stackexchange.comJesper Juhl 12 secs ago
19:14
If you have working code, this may be a good fit for Code Review. — Shepmaster 14 secs ago
19:39
I'm voting to close this question as off-topic because it belongs on Code Review. — shmosel 39 secs ago
0
Q: Is it ok to ask here how code works

MontrealI have got a working piece of code without any documentation and explanation, but I don't understand how does it work. Can I ask for such questions on CW or not?

20:28
0
Q: Check whether two javascript arrays are equal, using basic library only

grayQuantI am writing a function that takes in two arrays and a test name and outputs statements (console.log) saying whether the two arrays are equal. I don't want to convert the arrays to strings or use non-core libraries to do this. I am also new to writing JS so wanted to get a code review here. Usag...

20:56
0
Q: Computing average without overflows and with half-decent precision

MorwennAt some point I needed to compute the average of a big collection of integers. I knew the size of the collection prior computation, but a naive average computation was prone to integer overflow while repeatedly adding every elements divided by the size was prone to loss of precision. To mitigate ...

possible answer invalidation by Scarabee on question by Mokshyam: codereview.stackexchange.com/posts/169853/revisions
21:10
0
Q: Scraper Class with Regex

user3568719I already posted a not (yet) complete version of this class, but that question got closed, because it contained not passing tests. Here is the full version, all 5 tests pass. Originally there was only processPlayer when I found a very rare case (see the last test Special case). The method player...

21:42
@Duga It's fine.
22:07
Monking!
Monking @Phrancis
22:34
1
Q: Text minimum in questions

ErichProblem On all Stack Exchange Sites, you can't post answers or questions that are mostly code. You always have to include some text minimum, otherwise you can't post the question. I do understand why this is very helpful on Stack Overflow, but why is there this text minimum also on Code Review?...

Questions on Stack Overflow need to contain enough information that the Q&A won't go stale as soon as the links change. Please post the actual code that you think is slow. Also, this site isn't equipped to do code reviews. You would be better off asking on Code Review. — 4castle 53 secs ago
Welcome to Stack Overflow! If this code works fine, then this question is off topic here, but may be good for our sister site Code Review. — Joe C 39 secs ago
1
Q: Select member for comparison in sort or search

Jerry CoffinThis code is predicated on the notion that when sorting (or using a sorted collection of items, such as with std::lower_bound) you're usually comparing a single field in each object being sorted/searched. So a typical sort might look something like: // Sort by age std::sort(people.begin(), peop...


« first day (1539 days earlier)      last day (2772 days later) »