« first day (1661 days earlier)      last day (2364 days later) » 

12:00 AM
RELOAD! There are 4690 unanswered questions (90.4254% answered)
 
12:44 AM
Components are classes. Most times classes are created not because they are reused but because they make sense. Otherwise you end up with a big pile of code that is hard to test and maintain. This is the concept that is common to OOP in general. You're the only one who can decide if a pile is big enough. If you're not sure, consider asking at codereview.stackexchange.comestus 54 secs ago
 
@SimonForsberg And.... right back at you! Now to do some digging of my own.
My first post here?
Nov 21 '13 at 1:25, by rolfl
I can start ammo-unloading in the #java .... (just joining the fray)
 
 
1 hour later…
1:51 AM
0
Q: Grep kata in Elixir

user1837378I've written a simple grep program as my first foray into Elixir. Could you please suggest some ways in which the code could make better use of the language? defmodule Exgrep do def exgrep(path \\ ".", substring) do case File.ls(path) do {:ok, ls} -> Enum.map(ls, fn new_path ->

 
 
1 hour later…
2:51 AM
0
Q: Can be done with less code? Java

mcGuffinThese is about to show the results of a runners competition. It shows us the runners number, the sex ( 1 = man, 0 = woman ), age and time. After showing the results of theses runners, it shows the winner of each sex. package *; public class ArraysSix { public static void main(String[] args) ...

0
Q: Fast implementation to check if elements of a list are identical

LoganSuppose we've got a list, any arbitrary nested list. I'd like to check if the (int) elements in the list are identical. Examples: # elements are identical, as it's all 1s board = [[1],[1,1],[1,1,1]] #True board = [[1,1],[1,1],[[1,1,1]]] #True # elements are not identical board = [1,2,3] #Fa...

 
3:05 AM
0
Q: Writing better switch like statement in python?

SamI am trying to write a program where if I call get_bin_pos(19.4) ==> output as 20 get_bin_pos(13.4) ==> output as 20 get_bin_pos(31.4) ==> output as 40 I wrote something like below, it looks bad, any suggestion in optimizing it ? Switch statement for this would be more readable, but we don't...

 
3:17 AM
You might want to ask at the Code Review site instead. codereview.stackexchange.com. This question might be closed for being too broad because it's really 'what do you think? how can it be improved?'. If your question could be answered by an entire book, or has many valid answers (but no way to determine which - if any - are correct), then it is probably too broad for the SO format — Josh 17 secs ago
 
3:44 AM
I'm voting to close this question as off-topic because it is better suited to Code Review. — ekhumoro 10 secs ago
 
4:21 AM
@SimonForsberg, it reminds of some C++ features that I never found a use for in 2 years. I believe the github organization has a use, may be we just didn't stumble upon it yet
 
5:04 AM
0
Q: Python: Find duplicated in a list of tuples

jihn04You are given information about users of your website. The information includes username, a phone number and/or an email. Write a program that takes in a list of tuples where each tuple represents information for a particular user and returns a list of lists where each sublist contains the indice...

 
Avoid asking multiple questions in one. The item list is too broad to elicit a precise answer. You may want to ask on codereview.stackexchange.com for opinions for improvement. — yacc just now
 
0
Q: Multithreaded Excel + VBScript Timer: Snake Game Demo

Thomas InzinaMultithreaded Excel + VBScript Timer Download Multithreaded Excel VBScript Timer - Snake Game.xlsm After reviewing these post: Snake in Excel in… VBA? and Drawing a snake using arrow keys in Excel using VBA, I decided to work on creating a VBA Timer. The typical Timers patterns used in the VB...

 
5:36 AM
Monking
 
This might be better on Code Review, but a couple of quick tips would be to pre-compute sin and cos(theta), and to loop with vector<int>::const_iterator. I also can't tell what algorithm you are using, but a library like OpenCV or Eigen might implement them more efficiently. If you're on Intel architecture, try turning on SSE support. — Ken Y-N 55 secs ago
 
6:10 AM
possible answer invalidation by Daniel Lyons on question by Daniel Lyons: codereview.stackexchange.com/posts/180633/revisions
 
6:23 AM
0
Q: Lucky Purchase problem solution

VishwaProblem Sharon wants to buy a laptop for programming. She plans on buying a laptop whose price is made of digits 4 and 7 only. The number of 4s and 7s in the price should be equal. You are given laptop brand names and their prices. Find and print the name of the laptop brand that satisfies the a...

0
Q: Count Projects in a Scratch Studio

Challenger5I recently wrote a small Python 3 script to count the number of projects in a Scratch studio: import re, functools import requests PARSE_RE = re.compile(r"""^ (?: http:// | https:// | // )? # optional header scratch\.mit\.edu/studios...

 
6:37 AM
0
Q: Robotic automation process

Neeraj NaugaiProgram to select browser from existing browsers and then open gmail login page ask for credentials and then compose mail and send then validate the sender in sent item, record this whole activity so that this will happen automatically from 2nd time in python 3.6. Please help me in this code.

 
7:27 AM
I believe this question rather belongs on CodeReview. Nevertheless, what you could do is create a function that adds an element to the list if a condition is true, which you could declare like ConditionalListAdd(bool condition, string value). Also note that you can omit the == true from the if statements, as there is no point in comparing a boolean to a boolean. — Ian H. 38 secs ago
 
8:01 AM
0
Q: Whats the best way to cache information (json) hourly?

JoshHi I want to pull information from a JSON API but I would like to cache/store this information until at least an hour has passed whereby the api will be called again and refreshed. My problem comes when I would like to store the datetime from the method was called last. How do I instantiate my da...

1
Q: Validating Yes/No answers in C++

VlastimilI intend to accept all of the following answers: y Y yes YES Yes plus mixtures, such as yeS, yES, which I didn't intend to accept but it's a consequence of my code the same applies to No and its variants #include <iostream> // std::cout, std::cin #include <string> // std::string #...

 
8:28 AM
This might be more suitable for codereviewJonathan Brooks 35 secs ago
 
Monking
 
8:55 AM
@Incomputable that's what we've been saying for the past four years.... :)
 
9:46 AM
0
Q: Find the maximum possible summation of differences of consecutive elements

Manya Array A contains the elements, A1,A2...AN. And array B contains the elements, B1,B2...BN. There is a relationship between Ai and Bi, for 1 = i = N, i.e., any element Ai lies between 1 and Bi. Let the cost S of an array A be defined as: You have to print the largest possible value o...

 
10:02 AM
0
Q: Python generate combinations of sub lists

Van PeerI'm generating a combination of sub lists without using itertools. Here's what I've come up with: input = [[1, 2], [2, 3], [4, 3]] output = [[1, 2, 2, 3], [1, 2, 4, 3], [2, 3, 4, 3]] def getList(): a = [[1, 2], [2, 3], [4, 3]] return(a) c=[] # output list l = l...

0
Q: how to optimze this program in golang way and perform testing on this?

Manjeet ThakurHey I am working on golang and try to understand to write best code not translation from another language. So i have written this Program just for learning package main import "fmt" func arrayExm(array []int, limit int) []int { var res []int length := len(array) for i:=0; i < li...

 
10:16 AM
0
Q: JSON structure for optimal search performance

dorkI had an exam the other day which had this question: Assume that you have a library that have multiple sections and in each section you have multiple books and will have multiple tags. Each book will have one author and each tag will contain a string key and a string label. Each author ...

0
Q: Do not use return at the end of the main in C++

trafalgarLawwWhy should not I use the return statement at the end of the main in C++. I got an answer over here and it recommends not to use the return, I just would like the topic to be more elaborated.

0
Q: Python - Is that #async function documentation correct?

BaksI would like to document the function, so it's clearly visible what should i pass and what i will receive. Is that a correct approach? import aiohttp import asyncio import async_timeout from typing import Type async def fetch( session: Type[aiohttp.ClientSession], url: Type(str) ) -> ...

 
10:34 AM
Code review isn't really suitable for Stack Overflow. Maybe you want to check out our sister site Code Review but familiarize yourself with their guidelines before posting anything. Also, you will want to fix obvious errors reported by a tool like shellcheck.net before asking for human review. But even with those things fixed, this is pretty horrible, I'm afraid. /-: — tripleee 1 min ago
 
10:45 AM
possible answer invalidation by hamza keurti on question by hamza keurti: codereview.stackexchange.com/posts/180568/revisions
 
10:57 AM
@CaptainObvious That's not how Code Review works.
 
just opening tabs makes my laptop spin it's fans as if it were bruteforcing a sudoku...
Monking btw
 
Monking
 
11:43 AM
1
Q: XML-SQLITE optimization

NicoleI have a script and I need to optimize it to reduce the execution time of this, currently, 6000 lines takes 1 minute and 38 seconds, I would like to reduce the time to take much less and I do not know how to optimize it anymore, I paste the script: #! /bin/bash function charge_files () { datab...

 
wow ... two votes left.
 
12:05 PM
@Vogel612 Any tabs or specific sites? Background crypto-mining from a browser is apparently a thing nowadays.
 
only catching up on questions
and only when they're loading....
spins down pretty quickly again
 
Ah
@CaptainObvious 2 more VTC.
 
I should eat breakfast ...
 
@Vogel612 It's probably lunch by now.
 
a matter of definition..
 
@CaptainObvious Personal preference, should be a comment on the answer.
@Duga That title.
 
@Mast On the exit 0 issue StackOverflow rather than software engineering stackoverflow.com/questions/8867871/…
 
@ekhumoro Thanks for your suggestion. But, I'll just leave my question in Stack Overflow because my original code has a problem/bug that needed to be fixed to get it working. From my understanding, Code Review is for working code that needs to be optimized. Thanks. — jihn04 7 secs ago
 
12:44 PM
0
Q: Sorting struct in C done right?

SamuelWhat do you think of my code ? I implemented this in C using qsort, but I'm not sure about the reliability and correctness. And can I make it faster? I call this piece of code a lot. #include <stdio.h> #include <stdlib.h> #include <time.h> #define DIM 1 #define POWDIM 4 typedef unsigned long k...

0
Q: Python - Knight's tour recursive function

LoganI realize that there're many implementations of Knight's tour problem suggested across webs, without jumping to those suggested solutions (most in Java, I'm not proficient in Java), I managed to implement one myself using Python. It works and returns some results. For example: board = Board(4,4...

 
suggest you maybe call out the particular issues you are aware of.. otherwise this feels like you're just asking for code review in which case codereview.stackexchange.com is a better home.. — TygerKrash 1 min ago
 
@CaptainObvious @Captain obvious, user is asking what part of his code does.
 
0
Q: Cycling through sibling elements on button click and assigning a class to the “active” element

MarkI am attempting to do something that seems pretty simple, but I'm not sure if it as performant as it could be. I'm looking to cycle through a set of elements and toggle a class to only show a single item at a time, looping back to the first item at the end. $(document).ready(() => { const togg...

 
1:13 PM
@pacmaninbw Meh, SO tends to have bad advice mixed right through the good advice, so I tend not to link towards it unless I know a specific question.
 
1:45 PM
0
Q: Thread Pool in C++

FrancescoI know thread pools have been reviewed dozens of time and there is plenty of libraries around that implements them, but for fun and for the sake of learning more about multi threading and C++ I wanted to create my own thread pool. Functionality-wise it is currently doing what I expect it to do an...

0
Q: Check if variable has one of the given values

GabrielI need to check if a given variable is either "get" or "post". If it's neither then I should throw an error. My preference is for: if (!['get', 'post'].includes(x)) { throw new Error('OhGodWhy') } A team mate of mine prefers this one: if (x !== 'get' && x !== 'post') { throw new Error('O...

 
I think this question should belong to code review. — xRed 58 secs ago
 
2:29 PM
I would have done the same thing as you did. Maybe codereview is a better place to ask this kind of question? — YSC just now
 
2:50 PM
0
Q: Reverse bytes in C++

trafalgarLawwLet me start with the code: #include <iostream> unsigned reverse0(unsigned); union FourBytes { unsigned value; unsigned b1 : 8; unsigned b2 : 8; unsigned b3 : 8; unsigned b4 : 8; }; unsigned reverse1(unsigned); int main(void) { std::cout << reverse0(2) << std::endl...

0
Q: Is there a convention for a getter of a weak_ptr?

JawapI'm trying to figure out how to implement accessors for smart pointers in C++. I've used smart pointers in other languages before, but in C++ the implementation is much more verbose. When implementing a getter for a weak_ptr, should I just return the weak_ptr or a shared_ptr instead? One might a...

 
 
1 hour later…
3:58 PM
0
Q: Program that finds the cosine of a given angle

Sushrut ThakurThe below given program is of cosine value. Since I am fairly new to the C++ language, I didn't refer the advanced programs for this and tried to build it based on it's expansion. NOTE : I should mention that I use Turbo C3 compiler for all my coding so the code may look different This code sh...

 
4:12 PM
0
Q: Prevent duplicate code when an animation is possible

J. DoeI have a function in which I perform for example frame changes. Sometimes it needs to be visible to the user (animated == true), but sometimes not. Now I need to write two times the same code (do()). Is there any way I can write do() one time and execute the UIView.animate function if animated ==...

 
Greetings, Programs.
 
4:38 PM
@rolfl Ah, nostalgia.
@Donald.McLean Greetings.
 
Greetings @Donald.McLean @SimonForsberg
 
0
Q: Creating Guests for Dinners RoR

Mickey TorresI'm fairly new and I'm making a rails app that allows users to create dinners and allow a number of guests that can join. Other users can click a button in the dinners#show to join that dinner as a guest. Here's my approach for this: #guest.rb belongs_to :user belongs_to :dinner #dinn...

 
5:00 PM
0
Q: Is this a sensible way to nest for loops and break conditions when trying to deal with a process that may need to restart after failing?

Noctis SkytowerWhile writing some code for a battleship-like game, one of the methods written for the Board class was place_boats. Since the algorithm for placement was meant to be random and could potentially fail, the code was designed to fail on multiple levels and gracefully restart its processing up to a c...

 
5:13 PM
I'm voting to close this question as off-topic because it belongs on codereview.stackexchange.com — kdopen 31 secs ago
 
2
Q: A programs that accepts numbers and computes their sum, and displays smallest and largest number

Muhammad KamalI am self learning programming by reading Programming, Principles, and Practises by Bjarne Stroustrup. I have solved a drill. Please review my code and give suggestions. Drill Write a program that: Accepts numbers with units m, cm, ft, and in and rejects other units. Keeps a record of all the...

0
Q: Effecient EF query with count subquery (avoiding multiple subquery calls)

ZoinkyI have a table called alerts and is related to a table called coin (coin can have many alerts) I would like to return a list of alerts but also return a subquery count of how many alerts that coin has Here is my query, I would love some feedback on how it can be improved. context.Alerts ...

 
5:46 PM
This smells like homework. Either way... code optimization belongs here: codereview.stackexchange.comTehTris 56 secs ago
 
5:57 PM
0
Q: Optimization of python code

KaushikI have written python code below which is working fine but it's taking time to download file. Anybody could help me to optimise the below code and make it more efficient and faster. import urllib.request import shutil path1="path" path2="path" path3="zpath" path4="path" path5="path" path6=...

 
Welcome to Stack Overflow! I'm voting to close this question as off-topic because it is much too broad for Stack Overflow, which deals with more focused coding problems. For advice on improving working code, consider Code Review instead - but do read A guide to Code Review for Stack Overflow users first, as some things are done differently over there!. — Toby Speight 10 secs ago
 
6:25 PM
posted on November 20, 2017 by CommitStrip

 
0
Q: KDF computation using CMAC with AES (as PRF) using Bouncy Castle C# library

RaghuUsing bouncy castle .net implementation (version: 1.8.1.0), I am trying to create an encryption key from a known master key using a key derivation function. The NIST Publication 800-108 contains recommendation for key derivation using pseudorandom functions (PRF). This document has several KDF mo...

 
6:40 PM
0
Q: Securing access to PHP services from Javascript Ajax calls

Theo d'OrI am creating a generic PHP handler, or "dispatcher", for Ajax calls made from Javascript running on the page served by PHP. The handler will take posted data and, depending on a value, decide how to route the call further. WordPress is being used, but my question is not specific to WordPress (if...

 
6:52 PM
For code review, consider the Code Review StackExchange site. — tyteen4a03 18 secs ago
 
0
Q: How can this powershell script be better?

Tar HeelI have put together a script that will serve as a tool for a Power User so that they can make changes to two distribution groups in our organization that are used for "on call" purposes. It works as intended, but after looking it over I cannot help but think that there must be some ways for it a...

 
What version of python and pandas are you using? The code in your update suggests you are using a different version than what @Abdou is using, which is why you may not be able to appreciate his comment answer... If you are able to answer your question then please post it as an answer to your question and accept it. Your request for improvement suggestions will probably be more successful in codereview.stackexchange.com — Projski 43 secs ago
 
7:27 PM
if this is working code SE code review might be a better place for this type of question — depperm just now
I'm voting to close this question as off-topic because it belongs on codereview.stackexchange.com — Patrick Haugh 58 secs ago
you are trying to read in a while loop but second line in your while loop you are calling dr.Close() try using the debugger and also start code reviewing your own code.. I would also recommend separating the Selects and Updates into there own smaller methods to make your code more readable.. it's kind of messy and read up on SQL Injection as well — MethodMan 39 secs ago
 
0
Q: Create Lists for Drop-Down Menus in Different Sheet

KimI'm currently working with a workbook utilized at my work that has the following code. It currently takes about 10 seconds to complete, and needs to be executed several times throughout utilizing the workbook. Is there any way to speed up this process? Right now, the user specifies enters the ...

0
Q: JavaScript OOP practice - Soccer Field Map Creator

Lou BagelI am fairly new to OOP and am working on a little website project to practice. I wanted to post after getting the initial setup done in case I am making any major errors or not following best practices. Feedback Requested Looking for feedback mostly on the OOP aspect. Since I am new I don't ha...

0
Q: Simple WinForms using MVP and ICommand patterns

SulphyI'm learning about the MVP and ICommand design patterns as I'd like to use them in my own projects. I've cobbled this very simple WinForm application together to hopefully demonstrate that I'm using the patterns in the right way. I was wondering if someone who is more familiar with both pattern...

 
7:59 PM
Still doesn't address my previous concern: What is the issue/problem with it? Doesn't it work? Do you have (validated by benchmarks) concerns its slow? If it's a pure "code review"/aesthetic question, then it's off-topic on Stack Overflow. Please have a look at What topics can I ask about here?. For code reviews you should close the question here and create it at Code Review which is a StackExchange page specifically for reviewing code — Tseng 33 secs ago
 
8:10 PM
-1
Q: File upload with PHP

user153892I'm developing code to upload files in the server. But its not working as I want: 1 - If the user didnt choose any file then it should skip the file validation (as there is no file) 2 - If there is at least one file, then it should validate all $_FILES occurences then move to a folder. The H...

0
Q: Designing a chess application using object oriented principles

DporthRight now, the purpose of this java program is to correctly move chess pieces with a driver class. ChessBoard.java import java.util.ArrayList; public class ChessBoard implements ChessBoardInterface { protected Square[][] board; protected ArrayList<Piece> whitePieces; protected Arr...

0
Q: Extending Exception: avoiding code duplication

BelleI'm implementing a REST API in PHP 7.1. It throws Exceptions to print non-200 responses. I would chain extend Exception, but unfortunately that doesn't seem to work. I've thought of two ways to implement this, but both have their issues. Which of these ways is the better way to do it? I'm not fon...

 
8:24 PM
-1
Q: How do i make my code more better?

Abhinav RajI got a python project which says that i have to Write a program that takes one or more filenames as arguments and prints all the lines which are longer than 40 characters. I want to do make following changes in my code: I want my code to take multiple filenames at the sametime. I want my code ...

 
If you have a working code then please consider Code Review SE instead. It is unclear what the question is. — Ron 37 secs ago
 
8:53 PM
0
Q: Polymorphic comments: can't pass type and id (NoMethodError for nil:NilClass)

EvantoI'm trying to create polymorphic comments for Question and Answer, but commentable_type and commentable_id never get passed when I hit the "create" button on the "create comment" form. I can successfully create a new comment through the rails console, but not through the form (currently I'm testi...

 
9:14 PM
I'm voting to close this question as off-topic because review of functional code is off-topic for Stack Overflow. Your question may be on-topic for Code Review. Be sure to read their on-topic page prior to posting your question there to be sure it's on-topic in it's current state. — Makyen 19 secs ago
I'm voting to close this question as off-topic because should be under CodeReviewMethodMan 12 secs ago
 
-1
Q: How do I reset a picture's coordinates when it gets to a certain location

NinjaNube008I'm trying to make a picture's location reset when it gets to a certain location and I thought that the if(x == 557 && y == 533){ x = 300; y = 300; }; },1000); statement would reset the x and y coordinates but I was wrong... var canvas = document.querySelector("#myCanvas"); var conte...

 
9:53 PM
1
Q: Reading a yes/no answer from std::cin

Roland IlligBased on this question, I wrote my own implementation of the yesno function I suggested. The function reads an answer until it is either "y" or "yes" or "n" or "no" (case-insensitive). #include <algorithm> #include <cctype> #include <cstdlib> #include <iostream> #include <string> bool yesno(con...

0
Q: NBCJ Passwordchecker

F.Marcanoimport sys,math,re def check_password_length(password): length = str(len(password)) global password_length_good if len (password) < 8: print("Password should be at least 8 characters long") print("Password is only" ,length, " character(s) long") password_length_good = False; else: ...

0
Q: How can I refactor this, for dynamic dbset usage, instead of named type during the c# coding?

Visky MátéI am writing an importer service, I have different sources and at the end I would like to push them into database tables. For different db tables, I am using different dbset in the context, I also do aware for which db what is the primary key (it could be different, because other naming conversa...

 
10:30 PM
If null was a billion dollar mistake, JS is surely a trillion dollar mistake, and rapidly climbing.
 
10:45 PM
possible answer invalidation by Sam Onela on question by kr099: codereview.stackexchange.com/posts/139947/revisions
 
11:00 PM
0
Q: can you help me testing a twitter clone in nodejs?

MizRaeLI have written a small Twitter clone using NodeJs, MongoDB and RabbitMQ, you can find it here: https://barfer.azurewebsites.net I started this project because I wanted to get a better understanding of both NodeJs and Rabbit. I'm still learning so if anyone has any comment, suggestion, advice, it...

 
11:46 PM
0
Q: printing javascript equations via html

Blue34CEHere's a (probably) simple question for you all, I need some simple equations generated via javascript to display on my website, but I am unable to do so. Following online tutorials, I have: <h2>The += Operator</h2> <p id="demo"></p> <script> var w = 5; var x = 5; var y = 5; var z = 5; w += 5; x...

 

« first day (1661 days earlier)      last day (2364 days later) »