« first day (1527 days earlier)      last day (2786 days later) » 

00:00
RELOAD! There are 4105 unanswered questions (90.9691% answered)
 
2 hours later…
02:09
0
Q: Binary search on real space

PhrogzI want to perform a binary search on a continuous unimodal function ƒ(x)=y, where x and y are real numbers. I'm not looking up values in an array, and so I don't have clean integer inputs that I'm stepping along. My original attempt at a function (written in JavaScript) has the problem that when...

I feel so out of touch everywhere. I'm barely here, and I never hear any news about what is going on with my family until its either happening or over :/
02:25
@Hosch250 #BecomingAnAdult
Ha. First time this happened was when I needed to care for my hysterical puppy when we were installing new floors.
She left her mom when she was 8 weeks, or something; just a tiny little thing. She bonded with me and had really bad separation anxiety for a long time.
That was shortly after I got my computer, so I consoled myself by learning programming.
 
1 hour later…
03:43
-1
Q: How to fix "Break outside Loop"? for Pyton

SameeraI am a beginner in Python and am trying to make a program that takes the sum of an amount of numbers a user inputs. This is what I have so far. I want to make the program repeat and have added a loop. but the comment "break outside loop" keeps coming up and interferes with it working.... How can ...

04:17
0
Q: TypeError: Can't multiply sequence by non-int of type 'float' ?? Python coding issue

SarahI am trying to make a program with a loop that shows the increase of tuition per year (5%), the only issue I am having is with the last line which shows the error: " tuition = tuition + tuition*0.05 TypeError: can't multiply sequence by non-int of type 'float'" How can I fix this? I tried puttin...

How likely is this to get me lynched?
def get_names_from_file() -> list:
    return open("names.txt", "r") \
        .read() \
        .replace("\"", "") \
        .split(",")
I find the new lines make it easier to read
return open("names.txt", "r").read().replace("\"", "").split(",")
I find this^ harder to read
0
Q: Circular dependency in utility functions

alecxeSome Background I've been developing an ESLint plugin to catch Protractor/Jasmine specific code style violations. In Protractor, there are two important notations: ElementFinder and ElementArrayFinder. ElementFinder is a special object that corresponds to a single element ...

 
1 hour later…
05:38
0
Q: Find the minimum number of operations (concat, add and subtract) for the numbers 1-9 to equal 100

SquiblebobI am beginning to learn Scala and functional programming, and I came across the puzzle defined below http://www.bbc.co.uk/programmes/articles/5wkxjTtqRvq8Cyrrjxtk7tc/puzzle-for-today This looked like a good practice and I have got a solution but just want some hints in terms of functional appro...

 
1 hour later…
06:51
0
Q: Can this code be improved from either coding standard or performance perspective?

Stack crashedGiven a non-empty array of integers, return the k most frequent elements. For example, Given [1,1,1,2,2,3] and k = 2, return [1,2]. Following is my submission to this problem on Leetcode and it is accepted. Can you please provide feedback on any issue that you see in this code? I am looking for...

0
Q: Project Euler 21 in Python 3

Baron '''Let d(n) be defined as the sum of proper divisors of n (numbers less than n which divide evenly into n). If d(a) = b and d(b) = a, where a ≠ b, then a and b are an amicable pair and each of a and b are called amicable numbers. For example, the proper divisors of 220 are 1, 2, 4, ...

 
2 hours later…
09:08
@Phrancis Lynched by who?
@SimonForsberg Well, line continuations feel odd compared to most languages, AFAIK they only apply to Python and VBA...
Guess they are a necessity for Python since whitespace actually matters
I suppose I'll just finish it and post for review though
09:29
I end up with weird looking function signatures like this one
def get_word_alpha_value ( \
    word: str, alpha_values: dict = get_alpha_values()) -> int:
    '''
    Calculates the value of each letter in the word
    and returns the sum of the letter values.
    '''
    word_value = 0
    for letter in list(word):
        word_value += alpha_values[letter]
    return word_value
09:49
-1
Q: Classes design for educational system with gamification elements

Andreas GeleverI'am working on a web-based educational testing system with some of the elements of gamification. Current implementation goes with Java (Spring IoC, SpringMVC, Hibernate, etc.) with the most of the logic running at the back-end*. Basically, users have a number of tasks in form of multiple-choice...

10:15
0
Q: An English Name Generator with React/Express/Webpack

Dream_CapHere in Korea, we give our students English names, therefore I thought it would be interesting to make an English name generator. Here is a demo Here is the index.jsx file. It holds one child component, the actual list for the names. Is this component to big? Is there something more I could ha...

11:11
0
Q: Apply the smallest possible datatype for each column in a pandas dataframe to reduce RAM use

Arjan GroenThis function is for Python Pandas users. I noticed a lot of RAM can be saved by applying smaller datatypes to columns. The function's input is a Pandas DataFrame. The function output is the compact dataframe and a list of columns that have been altered by filling out NA values with dummy values...

11:23
@Phrancis I'm not sure why you'd need a a line continuation there, if you're not working in strings Python usually figures it out without one.
12:08
1
Q: Homemade cyraz encryption algorithm

Bruno CostaThe "Cyraz" encryption algorithm was presented on SOPT community. This algorithm makes a cypher using a private key given in byte[] format with any arbitrary length. It will then "swap" bytes on the data depedending on the key value. Additionally it will append a byte to end of the cipher, that...

0
Q: Find the most popular file path in a log file

Deepak VermaI am working with udacity MAP-REDUCE for course https://classroom.udacity.com/courses/ud617 and solving 2 problem to find most popular file in a common log format file. I am getting displaytitle.php as most popular file with count while the correct answer as per the course and as per https://git...

12:21
0
Q: JavaScript: Find the number in an array which is closest to an given number

mizechIt's actually an exercise from an Assembly-course I'm doing: Find closest number. Add the following into the data section: nums dd 23h,75h,111h,0abch,443h,1000h,5h,2213h,433a34h,0deadbeafh This is an array of numbers. Write a program that receives a number x as input, and finds the dwo...

12:52
0
Q: Crawler for performing reverse search and writing results into a CSV file

SMth80I've written a script which is able to perform reverse search in the website using the Name and Lid from a predefined CSV file. However, when the search is done then it can put the results containing Address and Phone Number adjacent to those Name and Lid creating a new CSV file. It is working er...

13:31
@Incomputable No problem, feel free to bother me any time with site business.
Questions like this where you don't have a real problem are better suited on codereview.stackexchange.comcharlietfl 55 secs ago
This post would be more appropriate for codereview.stackexchange.comMichael Coker 1 min ago
0
Q: Case insensitive string to replace custom comparers

t3chb0tIn some solutions I use case-insensitive strings a lot and so far I've been always writing custom collections or using custom comparers to support them. This is usually a lot of work and a lot of testing so I thouhgt what if the string was case-insensitive instead? The implementation is really ...

@Phrancis the ` is not needed within (...)` and similar
@janos Do you mean the `\`?
yes :)
13:44
Escaping characters in markdown is hard :-)
especially if you don't notice the mistake (and why wouldn't you, yet I did...)
Wat, I just tested `\` on site and it works as expected... Nice...
different implementations of markdown are used at some places on SE
different in posts and in comments
and possibly in chat
Which just adds to the confusion, :/
0
Q: Making GET requests to a REST API using JavaScript

Steve CarrollWorking example: http://dev-site.eu.pn/crak-ajax-es6/ This code grabs data from a fake REST API website, it does so without using of libraries or templating engines and I would like to confine discussion in a similar fashion as I am interested in 'the basics'. I have a function, "processData", t...

13:48
And I always thought comments were a subset of posts, rather than different implementations...
@Peilonrayz I gave up that idea a year ago or so. Now I just re-discover the multiple shapes of the wheel every once in a while.
@Mast Good idea, it just never occurred to me
0
Q: Encoding and Decoding In Python

KCGMy script encodes text and outputs random strings. It is different each time and loads a dictionary that has been pre-set by my dictionary gen.py (included after the main script). I've started my basic Tkinter GUI and this is not the finishing GUI. The main code is as follows: # -*- coding: utf...

14:15
0
Q: Step by step wizard

InfinityStreamI'm currently working on creating a step by step wizard in Angular and twitter-bootstrap, see code below. I've actually got it to work as intended but as I'm looking to advance my skills I'd like to hear if you have any feedback on my code. That would be highly appreciated! How can I avoid usin...

15:09
0
Q: Python: a Life Counter for card games for Magic the Gathering

Marco G. de PintoBelow you can find my first Python project: a life counter that I am using together with my friends for card games (Magic the Gathering). For those who know the game, it is actually designed for 1vs1 Commander. It provides you with the possibility to take notes about life points, commander damag...

 
1 hour later…
16:22
0
Q: Nisse Server: Part 1 Helper Functions

Loki AstariGetting close to a release of generic server. So a couple of reviews will be coming this way over the next few weeks. Stating with the lowest levels and working up to the main server. Here is part 1 some (boring) utility functions that are used to build error messages. #ifndef THORSANVIL_SOCKE...

16:35
0
Q: Prime number generator in C

java-develI have to print numbers between two limits n and m, t times. I created t variable that stores a number of test cases. Outer for loop iterates for every test cases. Inner for loop prints primes from m to n. Code #include <stdio.h> #include <stdlib.h> int is_prime(int); int main(void) { ...

16:55
0
Q: Improved Atkin-Bernstein sieve for generating primes

Peter Taylor This is a class from my personal code library, and from a package which deals with integer sequences. It implements an interface package org.cheddarmonk.math.sequence; public interface IntegerSequence extends Iterable<java.math.BigInteger> { public int offset(); public int size(); ...

0
Q: Nisse Server: Part 2 Socket Layer

Loki AstariGetting close to a release of generic server. Nisse Server: Part 1 Helper Functions Here is the socket layer code. This has previously been reviewed here. But there have been some changes. Socket.h #ifndef THORSANVIL_SOCKET_SOCKET_H #define THORSANVIL_SOCKET_SOCKET_H #include <string> #include

I don't really like the idea of storing 10 iterations of a code review in history. Even for simple code reviews I'd rather just have the full change in 1 record. In our dev cycle feature branches won't generally last longer than a week, so squashing seems the way to go for me. — roim 33 secs ago
17:08
posted on July 09, 2017 by Loki Astari

Getting close to a release of generic server. Nisse Server: Part 1 Helper Functions Nisse Server: Part 2 Socket Layer Here is the stream layer code. This basically provides a std::istream and std::ostream wrapper around a DataSocket. This allowing you to use normal C++ stream operations on a socket. One notable none standard part are the two helper lambdas th

@apple.py welcome to the wonderful world of Python and welcome to StackOverflow. Trying something new and asking feedback is a great way to learn. Kudo's for that. But if you want your code reviewed, I suggest you post it at our codereview colleagues. Use this site if you have a specific error or problem, and check how and what to ask here on this site. — agtoever 15 secs ago
0
Q: Stocks application using Web Api

GiladI was given task to build a client server application, using any technology I want. The task was to build a database(doesn't have to be a real database, it can be mocked). the client side should support more than one user/ I didn't use a real database I just created some shares and created a mec...

17:24
This is in the wrong place, Code Review, Information Security or Cryptographyzaph 38 secs ago
17:38
0
Q: Simple range class

Deyan GeorgievAlthough my code doesn't support a lot of data types(only one), it's enough to see the general design, which concerns me the most. Range interface - <?php namespace Range; require_once 'vendor/autoload.php'; interface Range { function __construct(string $range); IntRange - implementati...

possible answer invalidation by globalturist on question by globalturist: codereview.stackexchange.com/posts/167176/revisions
18:00
possible answer invalidation by globalturist on question by globalturist: codereview.stackexchange.com/posts/167176/revisions
Welcome to your first question on StackOverflow. However, yhis site is not for broad optimization questions. Perhaps you should try Code Review. — Rory Daulton 12 secs ago
0
Q: Validation before sending mail in PHP

Yash KarankeIn my initial problem posted on SO, whenever anyone accessed the Mail.php on the server, it used to send an empty email to the $to. To avoid this I came up with a solution. require 'PHPMailer/PHPMailerAutoload.php'; $yourName = $_POST['yourName']; $sender = $_POST['emailID']; $subj...

possible answer invalidation by Jamal on question by kentcdodds: codereview.stackexchange.com/posts/11671/revisions
18:22
0
Q: Encryption program for loop getting stuck at 63 on decryption

FredDiggerThis encryption works fine int len = text.length(); System.out.println("encrypt before len: " + len); for (int i = 0; i < len; i++) { num += 1; int temp = 0; temp = (int)text.charAt(i); System.out.println("before: " + temp); ...

18:40
0
Q: Creating every possible combination until a code word is found

JulietI understand my main limitation is my computer's ability to compare millions of combinations but I wondered if there is any way to improve the speed at which the comparisons take place. My code is as follows: code = open("C:\\Users\\User\\Desktop\\code.txt").read() dictionary = open("C:\\Users\...

18:53
0
Q: Find integers whose sum of squared divisors is itself a square

user143008I'm trying to optimize this code (Given two integers m, n (1 <= m <= n) we want to find all integers between m and n whose sum of squared divisors is itself a square). I'm new to coding and I'm having a hard time with this concept: def list_squared(m, n): # your code import math ...

19:07
1
Q: GameObject and Component type system

Zach ToogoodI'm working on a hobby game and I want to implement a component system similar in usage to what Unity has. I was previously storing type information as a string inside Component, but that seemed like it would be very slow to constantly be doing string comparisons. I'm now storing type_info inside...

0
Q: Tuning of PI controller using Particle swarm optimization

MZF786Im trying to optimized PI parameters using PSO, codes im using are below, please help. I would like to know why im getting negative values of kp and ki, i need positive values. of 0.945-15 range. function F = tracklsq(pid) syms x; limit_1 = 0; limit_2 = 10; ...

19:46
0
Q: Encoding Message in Python using for loops, ord, chr, and modulo

David This is the code so far, I need to be able to encrypt any message using the alphabet given. How would I use the index to print the corresponding letters according the shift represented by the key? Thanks.

0
Q: Nisse Server: Part 4 Server

Loki AstariGetting close to a release of generic server. Nisse Server: Part 1 Helper Functions Nisse Server: Part 2 Socket Layer Nisse Server: Part 3 Stream Layer Here is the server. The basic usage should be very simple: NisseServer server; // declare an object. server.listenOn<TypeToHandleRequestA...

-1
Q: 2D Vector Initialization Trouble

ChillyPenguin672I am trying to create a 10x10 grid system for a battleship game. I am having trouble initializing a 10x10 grid with only one space per coordinate, instead when I try to initialize my 2D vector I am getting a 10x10 grid with 10 space characters per coordinate. A line to a Coliru Viewer of the issu...

0
Q: Nisse Server: Part 5 Handler

Loki AstariGetting close to a release of generic server. Nisse Server: Part 1 Helper Functions Nisse Server: Part 2 Socket Layer Nisse Server: Part 3 Stream Layer Nisse Server: Part 4 Server As I mentioned each connection is handled by a new handler object of specific type. These need to be derived fro...

20:04
If this code works fine, then it is off topic on Stack Overflow, but may be good for our sister site Code Review. — Joe C 41 secs ago
0
Q: Nisse Server: Part 6 SimpleProtocol

Loki AstariGetting close to a release of generic server. Nisse Server: Part 1 Helper Functions Nisse Server: Part 2 Socket Layer Nisse Server: Part 3 Stream Layer Nisse Server: Part 4 Server Nisse Server: Part 5 Handler As a demonstration protocol (also for testing). Here is a class that pulls it all toge...

20:24
Then I would say that you are doing well. Note that in my above comment I used hashes < rows + 2 instead of hashes < spaces + 2, since at this point in the posted code, spaces == rows is always true; also, loop-scoped means that in my version, spaces only exists inside the for loop where it is declared. IAC, critiquing working code and suggesting improvements is exactly what is done over at Code Review. — David Bowling 42 secs ago
You can use code review codereview.stackexchange.com to request suggestion about your code. — EsmaeelE 44 secs ago
@roim Squash merges delete important information that someone months or years down the line can use to figure out why the code was written that way. The more granular the better. If you smash it all together into 500 lines of change, it's hard to know what commit comment refers to what change. Artifacts of code review, like small fixes, can be squashed. Preserve what is useful for future devs trying to puzzle out the code. If you never use it, then it just sits there and doesn't bother anybody. But if you need it and it's not there, there's no recovering that vital information. — Schwern 43 secs ago
0
Q: Using two stacks to form a queue - solution

GrowlerI'm solving a Hackerrank practice problem of using two stacks to form a queue. The challenge is as such: In this challenge, you must first implement a queue using two stacks. Then process q queries, where each query is one of the following 3 types: 1 x: Enqueue element into the en...

20:42
0
Q: Customized class crawler to harvest names and phone numbers from a webpage

SMth80I've written some code using python to scrape names and phone numbers from a webpage which is working nice at this moment. However, The way I've written my class crawler is unconventional. As I've hardly seen any crawler which have been written the way I did here, I'm little dubious as to whether...

21:09
Better for codereview.stackexchange.com . This site is for questions with one good answer, you're asking for expert opinion on your design. — A. Jesse Jiryu Davis 28 secs ago
Anybody have reference or links to testing throughput of a web server?
You'll want to take a look at Code Review. — cᴏʟᴅsᴘᴇᴇᴅ 58 secs ago
21:42
0
Q: Use an API and return the data (as a node package)

Jake_RustonI am making a Node Package/Module that uses an API to grab Player Data. It currently looks as follows: const fetch = require('node-fetch'); const possibleModes = ['quickplay', 'competetive']; const possibleRegions = ['us', 'eu', 'kr']; module.exports = { OWoverallStats: (playerName, mode,...

21:59
0
Q: Storing user input fields in MongoDB

Even EvenI was referred here from Stackoverflow. I'm storing data in a collection for rules. These rules are user defined and can vary, and they will be used to check data from an API. I.e. a user may define that if the field spend (taken from an API) is higher than x do y (i.e. notify Slack). Each "cam...

0
Q: Run code every n invocations

ndm13I came across a situation where I needed code to run every n invocations of a method. Specifically, I was clearing out massive amounts of data and needed to hint to the VM that it should run garbage collection. My solution was a little more condensed than this, but this class offers reuseabilit...

0
Q: A pointer that stores its size at the front

ArtyerThere are two main ways to keep the size of a pointer. One as just another variable along side: size_t length = get_length(); int* stuff = (int*) malloc(length * sizeof(int)); do_stuff(stuff, length); Another is a struct: typedef struct ptr_with_length { void* ptr; size_t length; } ...

22:12
0
Q: Python: Writing to a TXT File at a Specific Column

RoboJacob5000Is there a way to begin writing to a file at a specific column on the line that the file pointer is currently on without having to use padding? For example, I'm trying to write some pool tournament data to a text file and I want to be able to write dicts containing the players name and place in t...

22:30
0
Q: Template to determine most frequent entries within a collection

EdwardThe problem Given an arbitrary collection of objects of some kind, count and report the top k most frequent, together with the associated count. For example, if the input array is {'a', b', 'a', 'c', 'b', 'b'} and for k = 2, the template would return { {b, 3}, {'a', 2} }. The idea for the temp...

22:48
@CaptainObvious No code / potentially code not written yet
23:18
0
Q: Rxjs, retryWhen event hasn't happened

CedI've this piece of code that does a request to the server and prints back the response to the console. Before sending the request it's checking if gate is ready. When gate is ready it performs the request and the response is printed to the console. Now I find the code really complicated and I ha...

so, a very important question.
if I have a multi-part program that I want reviewed, but it's in way too many parts or too many lines of code to just add to a question, what should I do?
@CaptainObvious @ThomasWard Multiple questions would be fine I think, Loki done that today
@Peilonrayz Might be hard since they're all related to everything. And we'd be looking at >= 20 separate questions. This thing's too many pieces >.>
@ThomasWard Maybe as an iterative review, with the main bit first?
IDK, 20 questions over like 40+ days wouldn't be too bad IMO
mmm, probably.
23:41
monking

« first day (1527 days earlier)      last day (2786 days later) »