« first day (2263 days earlier)      last day (1755 days later) » 

12:00 AM
RELOAD! There are 6248 unanswered questions (89.7276% answered)
 
1
Q: Project Euler Problem # 14 Largest Collatz Sequence written in Python

emadboctorProblem statement: The following iterative sequence is defined for the set of positive integers: n → n/2 (n is even) n → 3n + 1 (n is odd) Using the rule above and starting with 13, we generate the following sequence: 13 → 40 → 20 → 10 → 5 → 16 → 8 → 4 → 2 → 1 It can be seen that this sequenc...

 
12:46 AM
1
Q: Asynchronous Circular Buffer in C#

VisualMelonPreamble I want to be able to test methods which communicate over a simple exclusively asynchronous two-way stream-like interface which may underneath use any of a number of communication methods (e.g. sockets, named pipe. In order to test these, I need a memory-backed implementation, where I ca...

 
1:05 AM
0
Q: What is the way of splitting torch tensor by flags?

user8426627Working with PyTorch tensors, i need to do following operation: def pairs_by_flags(self, x_batch, y_batch, max_flag): #split x_batch on pairs sizes = (x_batch.size(0)//2, *x_batch.size()[1:] ) items_pos = torch.zeros((max_flag,), dtype = torch.long, device = x_batch.device) x_...

 
1:20 AM
possible answer invalidation by Steve Ngai on question by Steve Ngai: codereview.stackexchange.com/posts/224139/revisions
 
1:45 AM
0
Q: Animal Shelter Management C++

LigerI am working my way through "Cracking the Coding Interview" and I came up the question(3.6) to design a data structure to manage an Animal shelter with 2 animals, Cats, and Dogs such that when we dequeue the oldest animal should be removed first (FIFO) I implemented it as below. What all improve...

 
 
2 hours later…
3:30 AM
possible answer invalidation by 200_success on question by Sandio: codereview.stackexchange.com/posts/224183/revisions
 
4:20 AM
possible answer invalidation by Jarryd on question by Jarryd: codereview.stackexchange.com/posts/224031/revisions
 
4:36 AM
Code works, but is too slow? Give Code Review's how to ask section a read and then consider asking there. It's generally a better place for "How do I make my code work better?" type questions. — user4581301 9 secs ago
 
-2
Q: mips code in assembly

devssim trying to complete mips program code about a calculator program that can calculate integer addition / subtraction written using the MIPS assembler. im having hard times to debug this. The input is given to the array of Formula char (base address $ s0) in the form of a formula. The null cha...

 
5:05 AM
0
Q: Create Node tree from list of paths

xybrekI have this list of paths: private static final List<String> paths = Arrays.asList( "assets/css/custom.css", "assets/css/default.css", "assets/js/main.js", "assets/js/old/main-old.js", "fonts/poppins.woff", "favicon.ico", "index.html" ); ...

 
5:30 AM
possible answer invalidation by L. F. on question by Steve Ngai: codereview.stackexchange.com/posts/224139/revisions
 
 
2 hours later…
7:13 AM
@Duga Approved roll-back
Monking
@Duga Adding in more details, that's ok
 
7:25 AM
0
Q: Count character 'a' in first n characters of indefinitely repeating string s

SandioProblem statement: Lilah has a string, s, of lowercase English letters that she repeated infinitely many times. Given an integer, n, find and print the number of letter a's in the first n letters of Lilah's infinite string. For example, if the string s = 'abcac' and n = 10, the substring we con...

 
7:56 AM
It would be better to ask this question on the code review site instead. — Salah Akbari just now
 
0
Q: Calculate working hours using Python

johnashuThis is a simple boilerplate / template for a bigger program (i Hope), either linked to a DB or including a GUI frontend using PYQT or TKinter. This is just a little tool I wrote to keep track of my own hours. from datetime import datetime as dt FMT = "%H:%M" PARSE = (f"00:00", FMT) class Wor...

 
 
2 hours later…
9:44 AM
0
Q: Best project structure for styled-components that are rendered by multiple files

cbdev420Here is my situation: Filter.js Renders a bunch of Filter components Filte structure: Filter.js Parts/ PriceFilter.js CategoryFilter.js RatingFilter.js etc I'm using styled-components. Many of those Filter components are using the same styled-components to display. Like:...

 
9:56 AM
Optimization-related questions are suited for Stack Overflow, no needs to move them to Code Review. The problem, described in the question, is relatively small and focused, so I am not sure why "too broad" close reason is applied. Also, according to the answer, the problem can be solved by knowing the proper python functions, which is the very purpose of Stack Overflow. Voted for reopen. — Tsyvarev 7 secs ago
 
10:15 AM
possible answer invalidation by L. F. on question by emadboctor: codereview.stackexchange.com/posts/224132/revisions
 
10:26 AM
if it works as intended but you need a codereview, then you should rather post your question on Code Review :) — Icepickle 55 secs ago
@Icepickle thanks I did not know about Code Review I will go ahead and post it there now :) — SqueakyDeath 54 secs ago
 
11:04 AM
0
Q: A method to get a documents path

oliverbjI have a model called Document, in this I have a method that I use throughout my website to get the full path to the specific document: public function getDocument($documentName = true) { $documentName = $documentName ? $this->name : null; return storage_path('app/' . $this->getPath() ....

 
11:15 AM
@tehhowch thanks, I did a quick google search on this and it seems like a good way to go about, I reposted this question on Code Review, you are welcome to post this as an answer. — SqueakyDeath 11 secs ago
 
0
Q: Filter list items

SqueakyDeathI have a list of items i pull from SharePoint and want to filter them in my custom list view page. So my function works exactly how I want it but it seems messy and Im hoping someone could point me to or explain a better way of achieving this or an "optimized" version of what I did. im using a f...

0
Q: Trapezoidal rule for set of data

ReignHere is the question from the book of Mark Newman a) Read in the data and, using the trapezoidal rule, calculate from them the approximate distance traveled by the particle in the x direction as a function of time. See Section 2.4.3 on page 57 if you want a reminder of how to read data from a fi...

 
11:44 AM
0
Q: First Project, It is a text based fighting simulator but is a little clunky, how can i fix this?

Zack EnnenThis is my first large project, a Text based fighting simulator. It is very clunky, do you have any ideas on how to make the code better? from __future__ import print_function #Zack Ennen 1/12/19 import random import time overheadmod = 3 slashmod = 0 jabmod = 1 def load(): print("Load...

 
12:04 PM
0
Q: Python: Declaring a class within a function to encapsulate instantiation

EugeneI was wondering how acceptable or bad it is to declare a class within a function in python, that also takes care of a correct instantiation of this class. def get_access_token_provider(): class AuthTokenProvider: def __init__(self, domain, client_id, client_secret): sel...

 
1:01 PM
codereview.stackexchange.com might be the better place for this question. var something = { aa: alphabet === 'A' /*...*/ } might be a way. — str 1 min ago
 
1:21 PM
 
2:04 PM
0
Q: alternative to std::vector<std::function<...>> which uses tail recursion

TaylorAn alternative to std::vector<std::function< >> which uses tail recursion to optimize calling the functions sequentially. I'm using this on a real-time DSP thread. Because the code does single-sample processing, dispatch overhead must be minimized, since the functions (which are usually rather si...

 
2:25 PM
Greetings, Programs.
 
@Donald.McLean Greetings oh mighty MOP
 
3:10 PM
possible answer invalidation by Begueradj on question by emadboctor: codereview.stackexchange.com/posts/224132/revisions
 
@Donald.McLean Greetin's
 
3:20 PM
@Duga @Begueradj Why so sure? Do you see OP's files?
 
@Mast I just noticed another account with a username similar to that username... and did a search for the new one on the Users tab... there are 5 results that appear identical (e.g. similar name, same city for 4/5)
 
2
Q: Array of all permutations in C

smpIs this a good compromise between readability and verbosity? Are there any bugs, additional error checking, or extraneous code as well? // Generate permutations of array of n..n+x // n must have no repetitions, sorted smallest to largest // Steinhaus-Johnson-Trotter algorithm // Results are not ...

 
4:03 PM
Monking
 
@SᴀᴍOnᴇᴌᴀ Smells worthy of a mod flag. Raise one on any of their questions with links to all (or at least user ids and names) and the mods will figure out whether to do something with it or not. You could even take it to meta, but I think a mod flag is better in this case.
 
yeah sounds like a good call - will do
I know 3 are here but lurking
@Mast I guess I'd have to prove there was an issue like voting for each other and doing other sockpuppet-y things meta.stackexchange.com/a/35607/341145
 
You're asking for opinion. So isn't a good place for that because of the format, and it's therefore explicitly off-topic. See help center. It also seems like you've answered your own question in the previous one you posted, that you can just use a while loop. If you still want advise on elegance you might try Code Review. — glennsl 1 min ago
 
@Duga ooh elegance - sounds fancy!
~imagines chandeliers and wine glasses
 
4:24 PM
0
Q: pdf to text in Winpython

tguptaCould someone please point out the noob error being made in the following code to read PDF from text? [Just in case, portable WinPython needs to be used on Windoze without local admin rights.] The error message on Spyder (packaged with WinPython) is In [3]: runfile('C:/Users/User/Downloads/WP...

 
4:44 PM
0
Q: F# MailboxProcessor call procedure in time interval

Wojciech SzabowiczI have a question I am using actor to send some requests, code looks like type RequestHandler() = member this.SendRequest = MailboxProcessor.Start(fun inbox -> let rec send (messagingState : bool) = async{ let! readState = inbox.Recei...

 
5:04 PM
0
Q: Compare performance of Concurrent Dictionary with Dictionary+Locks

user781700I wanted to measure the performance of Concurrent Dictionary vs Dictionary+Locks in a multithreaded environment. So I created my own SyncDict class of type<int,int[]>. Whenever there is a key match, it adds the int[] array value to itself, it also locks the whole dictionary with ReaderWriterLockS...

 
thanks, can you also code review my answer? Seems like I have too many classes, but I wanted to inherit bootstrap property and flex container property in one, Thanks — jerrythomas 12 secs ago
 
@SᴀᴍOnᴇᴌᴀ You don't have to prove anything, but it helps to suspect something before making a fuss. Which is how I read your message.
 
5:24 PM
0
Q: Salient object detection in matlab

dtr43I am going to implement a salient object detection method based on a simple linear feedback control system (LFCS). I've come up with the following program codes but the result would not be what should be. Specifically, the output should be something like the following image: But the code produ...

0
Q: Cancelable AsyncLazy that is thread safe

rory.apI've been thinking about the AsyncLazy<T> class that Stephen Toub and Stephen Cleary present in various resources such as this. I am trying to find a way to integrate cancellation with AsyncLazy<T>. Microsoft has a version of AsyncLazy<T> in their Visual Studio 2019 SDK that offers a GetValueAs...

 
6:22 PM
A dict comprehension would also probably be faster than the for loop you're using, if only marginally: dic_test = {str(i)+"_ID":(random()*1000, random()*1000, random()*1000) for i in range(N)}. In general code looking for improvements like this might be better suited to codereview than StackOverflow — Green Cloak Guy 36 mins ago
 
0
Q: Rename and move images to a destination directory based on a text file followup

KiskaThis is my third (and hopefully final) time re-writing this program. It was recommended I use Pathlib and it simplified my code, it's easier to read and understand than the first two monstrosities. I also changed the way it functions, instead of the user providing a text file, the user creates ...

 
Yeah, I have one test suite and 4 'it' blocks. My code reviewers would complain about breaking them up! — Kevin T. 36 mins ago
 
6:41 PM
This is a code review question — Andreas 23 mins ago
 
-1
Q: How to select a text with double-click in a web page via Selenium in Python? (Not available Xpath, ID, etc.)

user3026022I have boxes like this: https://prnt.sc/ofbs2y Xpath value for the space next to the "Axles": // * [@ id = "ctl00_ContentPlaceHolder1_ABC_ctl02"] Xpath value for the space next to the "Classic": // * [@ id = "ctl00_ContentPlaceHolder1_ABC_ctl03_"] There is only one difference in the numbe...

 
7:03 PM
For a review of working code, check out our sister site Code Review. — Code-Apprentice 48 secs ago
 
0
Q: A minimalistic kind of read-copy-update class

IgnorantThis is a very simple read-copy-update (RCU)-inspired synchronization class: template<typename T> class RCU { private: std::atomic<T*> curr; std::atomic<T*> prev; std::atomic<int> readers; public: RCU() : curr (new T), prev (nullptr), readers(0) { ...

 
7:43 PM
0
Q: Batch configuration script for a new computer

ExikleI've been working on a script which configures newly imaged computers (power settings, installed apps, etc) This is what I have so far: echo off cls SET WINDOW_WIDTH=100 SET WINDOW_HEIGHT=42 mode con: cols=%WINDOW_WIDTH% lines=%WINDOW_HEIGHT% Set SOURCEPATH=\\networkpath Set JAVAPATH=%SOURCE...

 
8:00 PM
@CaptainObvious While glossing over the titles I thought I saw animalistic ... that would have been interesting
2
 
8:31 PM
apparently there don't appear to be any posts on CR including the keyword animalistic but there are three on SO
 
9:03 PM
0
Q: Does this refactor follow SOLID principles?

DelfinoI have the below method that is responsible for generating and sending a MailMessage using a SmtpClient object: public static void SendEmail( string subject, string body, bool isBodyHtml, List<string> emails, List<string> ccs = null) { if (emails == null) { ...

0
Q: Bookmarking directories

vnpWhen working on a large codebase, I often need to switch between deeply nested directories quickly. To make my life easier, I came up with a bookmarking script. #!/bin/bash bm_list() { for i in "${!BOOKMARKS[@]}"; do echo -e $i'\t'"${BOOKMARKS[$i]}" ; done } bm_go() { cd "$...

 
9:44 PM
I'm voting to close this question as off-topic because it is asking for a code review. It could probably be adjusted to be on topic for the code review stackexchange. — Quentin 45 secs ago
 
@pacmaninbw MCP
 
@Donald.McLean Sorry, please don't bring the logic prove.
 
9:59 PM
@Quenit, Given the answer provided by Brad and his hint to rephrase the question. Would you agree to rephrase the question accordingly, instead of closing it needlessly, or moving it to code review. There was some code review requested, but the core was that I need a way to reliably tell apart urls that I can do an XHR directly (absolute) and those I have to attach the baseURI to first, when the XHR is done in a different context (not form the javascript of the page). — humanityANDpeace 18 secs ago
 
10:43 PM
1
Q: A straightforward method for computing the Binomial probability mass function

comboI've been writing up code to test an alternate way of calculating the Binomial probability mass function. The Binomial random variable is the number of heads out of N coin tosses with coins that have probability p of being heads. The algorithm is pretty simple, we loop through the N coin tosses ...

 
possible answer invalidation by enharmonic on question by enharmonic: codereview.stackexchange.com/posts/224053/revisions
 
@Duga hmm - context added per request of comments... it might affect the sample query in the answer by @dfhwze ..
 
11:43 PM
0
Q: Is this a good Clojure test

Amanuel NegaIs this good a good test for a testable Clojure code? (ns github.amexboy.v2-test (:require [github.amexboy.v2 :as t]) (:use [clojure.test])) (deftest test-module-name-default (let [ repository-root "/some/path/to/git" project-root "/some/path/to/project" services...

 
@Duga wow 200_success updated dfhwze's answer to account for the OP's update
 

« first day (2263 days earlier)      last day (1755 days later) »