« first day (2482 days earlier)      last day (1520 days later) » 

12:00 AM
RELOAD! There are 6378 unanswered questions (90.1378% answered)
 
12:23 AM
0
Q: Palindrome checker program

TlomolokoI've been studying Java for some days and I'm just now starting to make some simple programs, I'd like to know if there's any 'noob' mistakes or habits that I could avoid. In other words: how could my code be more streamlined to Java? My code: import java.util.Scanner; public class Main { ...

 
12:43 AM
0
Q: Brute force sum numbers of an array in python

JFBid like to know how to code in python something that sums all the possible combinations of numbers inside an array, for example with an input like this arr = [1,2,3] and get an output like this 1= 1 1+2 =3 1+3 =4 1+2+3 =6 2=2 2+1=3 2+3=5 2+3+1=6 and so on, showing all possible combinations

1
Q: Haskell creating a greedy zip function

Node.JSI am trying to implement a greedy zip method in Haskell where it does not drop the elements, instead, it will use some default value. I appreciate any feedback to make it more compact. zip' [-1] [] r = r zip' [] [-1] r = r zip' [] b r = zip' [-1] b r zip' a [] r = zip' a [-1] r zip' a b r =...

 
1:22 AM
I'm voting to close this question as off-topic because it belongs on codereview.stackexchange.comR. Richards 7 secs ago
 
 
1 hour later…
2:45 AM
0
Q: Page Coming Soon Subscribe for Notifications

Ryan StoneI've just downloaded a script from PhpJabbers, which Uses Php & Javascript to Display a Page coming soon animated countdown. PhpJabbers - countdown Script: Coming-soon.html <!DOCTYPE html> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-type" content...

 
3:06 AM
0
Q: find the longest sequence of consecutive numbers in decreasing order

Gunjan PaulI have a list [5,2,7,4,3,2,0,8, 9,100,99,98,97,93,92] i need out [100,99,98,97] but i am getting 4, 3, 2, 100, 99, 98, 97, 93, 92 `arr=[5,2,7,4,3,2,0,8, 9,100,99,98,97,93,92] z=[] l=[] for i in range(len(arr)-1): if(arr[i]==arr[i+1]+1): if(arr[i] not in z): ...

 
3:23 AM
I'm voting to close this question as off-topic because this belongs on the Code Review site. — tadman 17 secs ago
 
4:09 AM
0
Q: Event handler for SFML

CortexBelow is code for handling events in SFML. It works by reading a text file containing a sequence of functions to be called when a given event is detected: EventManager.hpp #pragma once #include <SFML/Window.hpp> #include <SFML/Graphics.hpp> #include <vector> #include <unordered_map> #include <...

 
4:49 AM
0
Q: Execution time of data import from google sheets to a MySQL table

user25407I have one large google sheet import that I am working on by breaking it down into smaller chunks for easier processing and this used to work fine until recently when the number of records grew significantly throwing off my script. The sheet has some 40 odd columns and each batch I execute is lim...

0
Q: Leetcode: Subtree of Another Tree

user_185051My solution to the Leetcode's Subtree of Another Tree passes all the test cases, but the code feels and looks ugly. Would appreciate an advice on how to improve it. The problem: Given two non-empty binary trees s and t, check whether tree t has exactly the same structure and node values with...

 
5:09 AM
0
Q: Would this be a safe way of creating unique IDs?

Aliosh rIs the code below safe to create unique ids for objects? I will create new yoga classes and need to have a unique id for each class. I made this small piece of code to generate the id numbers. Regarding specifically the uniqueIdCreatorHandler method, would this solution incur in bad performance...

 
5:35 AM
You'll find an answer here: codereview.stackexchange.com/a/109478. Convert your numbers to strings, and use "." to split those strings. — Gerardo Furtado 24 secs ago
 
6:10 AM
0
Q: C# Random Password Generation

Chris P. BaconSo I have a method that, after validation, generates a random password based on the length and characters provided. The UI uses check boxes to select using between lowercase and/or uppercase letters, numbers and special characters to populate the characters parameter. as well as the length of the...

 
6:51 AM
0
Q: How to export data from mongodb to a pdf file using python?

user218747My code exports data from Mongodb collection to a csv file and now I'm trying to convert this csv file to a normal text/pdf file. Instead I'd like to know if there is a way to export data to pdf file directly from mongodb? >>mongoexport --host localhost --db dbname --collection >>name >>--type...

0
Q: HTTP download function in Rust (async/await)

A TWhy am I fighting the compiler? - Wrote this, which works, but I feel like I'm breaking every rule in the book: #[macro_use] extern crate lazy_static; use std::ffi::OsString; use std::path::PathBuf; use std::str::FromStr; use actix_rt; use actix_web::client::Client; use async_std::fs::File; u...

 
Monking
 
7:31 AM
0
Q: Synchronize list of trees with DB using DRF serializer

Davit TovmasyanGiven the models below: class Structure(Model): ... class StructureComponent(Model): ... structure = ForeignKey(Structure) parent_component = ForeignKey('self', null=True, ...) Developer should synchronize with the database a list of trees: The sample of request data: { ...

0
Q: Symfony rest endpoint for get a number products of one user

jikaillI want to improve quality of this symfony rest endpoint (solid principle, Kiss, best practice...) Can you review my code please? Symfony controllController function that return json list of product /** * @Route("/api/products/my_list/{number}", methods={"GET"}) * @param Security $security * ...

 
 
1 hour later…
8:32 AM
0
Q: Javascript bill calculator - need help to refactor code

AjamesI'm trying to learn Javascript and I've set up a bill calculator. Most of the lines in the code are to deal with rounding. It has four main components: Allows you to enter the bill amount and tip percentage calculates the total bill divided by the number of guests Calculates the total tip Split...

 
8:52 AM
0
Q: Plotting the integer values in text format in matplotlib piechart

P HI have done a clustering algorithm and represented the results in a pie chart as shown below. fig, ax = plt.subplots(figsize=(20, 10), subplot_kw=dict(aspect="equal")) contents = [] for k,v in clusters.items(): indi= str(len(clusters[k])) + " users " + "Cluster_"+ str(k) contents.ap...

0
Q: Asynchronous TCP network server with a packet system

Ash KetchumSo I'm writing a game emulator and would like some advice after finishing the networking. It is designed to accept multiple connections, and process packets from all of them. Here is how each individual packet is structured: [lengthOfString:short][stringEncodedInUtf8:Byte[]] Okay, let's get d...

 
9:05 AM
possible answer invalidation by Toby Speight on question by wispymisty: codereview.stackexchange.com/posts/205436/revisions
 
9:17 AM
Sorry all, moved it to Code Review stackoverflow.com/questions/60290546/…Ajames 18 secs ago
 
9:32 AM
0
Q: PHP & mySQL - Display a message using a function

Cullen CarstensI have been working with a PHP / mySQL script It's an OPEN file sharing website. Users register and get a default account status of 0 in mySQL indicating BASIC USER. In the Admin Panel of the script I can see all user and uploads etc. Next to any users name on the list, there are 3 icon to cha...

 
9:53 AM
0
Q: Asynchronous TCP network server with a packet system

SamSo I'm writing a game emulator and would like some advice after finishing the networking. It is designed to accept multiple connections, and process messages from all of them. Here is just a brief introduction to the packets and how they are structured. [lengthOfString:short][stringEncodedInUtf8...

 
10:13 AM
0
Q: Octet Stream to PDF Azure Python

IrtzaSuhailI'm trying to upload a PDF to an Azure blob store, and then download and read it. The upload works fine, and when I open it in the Azure Storage Explorer, the file opens fine. However, when I try to download it, I get an Octet stream and I cant figure out how to convert it back into a PDF. Im doi...

0
Q: Handling dirty input (developing a cleansing software)

AliFor a simple algorithmic java project, I have to handle/cleanse many issues in the input data. From a software engineering perspective, I want to use a proper approach for handling each of these issues. Instead of throwing exceptions for handling and catching them elsewhere (which is not recomme...

0
Q: Function to convert little endian bytes into big endian

Vishal SharmaI'm working on a little endian machine and in my program I need to convert 2,3,4,5 or 8 bytes into network order before transmitting them over the network. I've written the following function which basically just reverses the bytes. I just wanted to make sure if it's logic is correct. void conv...

 
0
Q: Clarifying Code Review Scope

MukyuuI just checked the How to Ask, What types of questions should I avoid asking? and What topics can I ask about here?, but I'm confused about the working code part. Quoting from What topics can I ask about here?: If you have a working piece of code from your project and are looking for open-...

 
If you just want to know if this is the recommended way, then please use Code ReviewZlytherin 16 secs ago
 
11:02 AM
Also if your code is working (no errors no issues) and you are just looking for someone to review it, that is off-topic here and should be posted at codereview.stackexchange.comPᴇʜ 1 min ago
 
11:14 AM
0
Q: WPF: An implementation of INotifyDataErrorInfo

Kostas K.Below is an abstract base class which derives from the ObservableObject of the MvvmLight, implementing the INotifyDataErrorInfo interface. The view binds directly to the model (exposed via the ViewModel), to avoid duplication of properties. A couple of notes: a) I chose the HashSet<string>> t...

 
 
1 hour later…
12:14 PM
0
Q: ANDROID - Receive and manage markers in Google Maps

Dani NuñezRecently, I've received negative feedback of interview's test. They say that they need somebody with higher technical level, the quality of the task was not good enough. I upload it here, to request your knowledge and teach me how to improve it to improve my development skills around Google Maps...

 
 
2 hours later…
2:36 PM
0
Q: Design pattern for logger implementation in salesforce apex?

Noor A ShuvoI have two classes ExceptionLog and DebugLog public class ExceptionLog { public static String StackTrace {get; set;} public static String ClassName {get; set;} public static String MethodName {get; set;} public static String LogType {get;set;} public static Exception ex {get;...

0
Q: Get specific lines from a huge text file

AlexanderI had a 50 Gb text file (ca. 45 mln lines) and needed to extract about 1500 lines from it. I knew their indices, that is, line numbers. Those 1500 lines were spread across the whole file up to the very end. To accomplish this, I wrote a simple Perl script. It worked and was quite fast: it finishe...

0
Q: Speeding up string splitting in Rcpp/Cpp

sahwahnI'm looking to speed up an Rcpp function I have written. The function takes in a string called vcfield, which takes the format od x:y:z. This string has 3 fields if you separate it by the :. It takes an int DSfield which tells us the index (0 based) field from vcfield which is the dosage. Dosag...

 
3:11 PM
If this code is working then it should be posted on Code ReviewZack E 13 secs ago
Sorry - it's not working as intended, but I'll post it on Code Review if necessary. — jotten7137 36 secs ago
 
3:54 PM
posted on February 19, 2020 by CommitStrip

 
News:
7
Q: The company’s commitment to rebuilding the relationship with you, our community

Teresa DietrichMy name is Teresa Dietrich. About a month ago, I joined Stack Overflow as Head of Product and Community. During my years as an engineer and technology leader I saw the impact this community and site has on people across the world and I am very excited to be here. While I have personally gotten a ...

 
Erin Martin on February 19, 2020
We’re two weeks into collection of data for our 2020 Developer Survey. If you haven’t yet taken the survey, be sure to do so before it closes on February 25th. Read on for background on this year’s survey, what we hope to achieve this year, and how you can help. Primarily, you can take the…
 
4:36 PM
I think this question is in the wrong overflow. It would be better suited for codereview.stackexchange.comDaniel 56 secs ago
 
Monking
 
Monking
 
@Mast OK, Dumpster fire fire fighter.
 
4:57 PM
@Mast Sounds hopeful (without reading all yet), where's the catch?
 
5:57 PM
I'm voting to close this question as off-topic because questions asking for refactoring advice with working code belong on codereview.stackexchange.comTaplar 49 secs ago
 
6:20 PM
1
Q: Swapping Nibbles

BradI have small (<250 bytes) chunk of binary data, where I know that almost always, the first nibble is going to be zero 0. For example, in hex: 01 02 03 04 0A 0B 0C 0D I want to do some simple compression on this data. What I've decided to do is run length encoding, but I first need to get the...

 
@skiwi probably the catch is that nothing publicly visible properly happened yet
 
6:42 PM
-1
Q: Asathryne - A Python RPG

AppleThis is a project I started a while ago, and still going. It is a text-based RPG written in Python. There are two files: asathryne.py (the main file) and stuff.py (a file with some functions for programs that I make; the game imports a couple of functions from it.) Thanks for looking over it! as...

 
6:57 PM
@Vogel612 Yea, this is more of a notification of "give us another week".
We'll see.
We can probably give them that.
 
7:43 PM
1
Q: Cleaning up code from part 2 of blackjack game

Aaron PlylerI posted the first part of this game earlier, and now I finished the second part. From the first part we just had to have a random value to get the cards, and the bet always stayed at $25. For the second part the user could choose their bet, enter 0 to quit the game completely, and just hit enter...

0
Q: C++ matrix calculator

chrysaetos99I wrote a program that is able to perform calculations with matrices: main.cpp (Just for test purposes) #include <iostream> #include <vector> #include "matrix.hpp" int main() { std::cout << "Width (matrix 1):\n"; int width = getDimension(); std::cout << "Height (matrix 1):\n"; ...

-1
Q: Scheduling Locks in Python

DittiI want to schedule a script such that next instance of script will not run if previous instance is still running. Currently I am using file based lock as below. What is the correct pythonic way to achive the same ? import os import sys import time # Next Instance will check for lock and exit i...

 
7:54 PM
There is source code HERE (for Windows applications only) that creates an API for sending a cmd and reading stdout into a dynamically sizing buffer. I have tested it up to 2GBytes when reading a recursive directory call to Windows. — ryyker 15 secs ago
 
@Vogel612 He's really hung up on McKinsey, isn't he?
 
yea, the thread is a bit slow to start, but once you got over the McKinsey thing it gets better
 
@CaptainObvious That's off-topic for so many reasons I'm not sure what to comment.
 
8:11 PM
hmm .. pseudocode would be one, but I would be willing to let it slide, actually
 
# Do Stuff
while empty:
    time.sleep(5)
    keep_filling()
Yea, you don't want a review on that.
Anyway, left a comment.
It probably warrants closure for failing the most important question on CR: do I actually want my code reviewed?
 
I assume that OP is not aware that the lock is working-directory aware
 
Assuming the script is always running from the same place, directory-awareness is not a major problem here.
 
but it's what makes the mutex so clearly broken
the fact that it's not actually a mutex
 
Whether the mutex is broken is not relevant if the question itself is broken, right?
It's broken for both being hypothetical (explicitly off-topic) and not being a request for review (proven by the hypothetical code actually).
 
8:17 PM
hmm ... honestly it could be edited into something remotely reviewable
 
Closing a question does give it a lot of time for getting fixed, so, that's not mutually exclusive.
lol
 
because we wouldn't require including the full code if instead of the #Do Stuff part there was a cleanup_script.run(args)
 
Oh look, bonus comment.
Comments are free today too.
 
0
Q: Search engine that looks through files

K00lmanFor my programming class, at the start of the semester before we learned about object oriented coding, I was supposed to make a small program that searches through a bunch of files, being graded on useability. from os import walk from time import time SEPARATORS = (" ", "-", "_", ":", "|", "~")...

 
8:36 PM
 
-1
Q: Spring boot application web service

kodingreviewIt's a web application. It should provide a service for entering data. Data is then evaluated and uses itself another service. It was part of an interview process where I was given that task to solve. The feedback was that it was not sufficient and I got rejected. But I don't know what exactly t...

 
This is the kind of code that if it came my way for a code review I'd reject. Don't use attr when data is factually and programmatically more correct. — Trasiva 33 secs ago
 
9:00 PM
Also agree that it is opinion-based. I also wanted to point out that the framing of the question and the comments above seem to suggest that the only purpose of code review is error-checking. Architectural and standards consistency are also benefits of the code review as is sharing knowledge of how certain features are built. No unit tests or code analysis is going to say "remember in sprint planning we agreed that approach X gives us better flexibility later than approach Y?" — Daniel 1 min ago
 
-1
Q: Batch normalization code optimization?

shreyas kamathI am trying to implement Deep Quaternion Networks. I was able to implement the batch normalization technique. But it requires a lot of GPU memory. Is there any way I can optimize the code provided below? class MyQuaternionBatchNorm2d(torch.nn.Module): def __init__(self, num_features, eps=1e...

 
9:14 PM
One more VTC, Authorship.
Garbage, no code posted. Just requirements.
 
-3
Q: Java Questions Practice

patch Write a program to continuously asks the user an exam score given as integer percentages in the range 0 to 100. If a value not in the range is input except for -1, print out an error and prompt the user to try again. Calculate the average of all valid grades input along with the total number of ...

 
Oh look, there it is.
 
9:43 PM
Might be more suited for the CodeReview SEthat other guy 46 secs ago
If you go the Code Review route, please take a good look at this FAQ first. — Mast 8 secs ago
 
10:00 PM
Thanks I will try posting in CodeReview, I am still new to this website. — Nenad Mitkovic 14 secs ago
 
10:25 PM
0
Q: std::string::operator+() vs std::string::operator+=() vs std::string::append()

AdrianI'm doing some code review and I saw something like the following: std::ifstream dataFile(filename); if (dataFile.is_open()) { std::deque<std::string> lines; std::string line, line_batch; while (std::getline(dataFile, line)) { if (!line.empty()) lines.push_bac...

 
@R.Richards While this may be on-topic on CR in the future, please don't use the existence of the Code Review site as a reason to close a question. Evaluate the request and use a reason like Needs more focus, primarily opinion-based, etc. Then you can mention to the OP that it can be posted on Code Review if it is on-topic. Please see the section What you should not do in this answer to A guide to Code Review for Stack Overflow usersSᴀᴍ Onᴇᴌᴀ 54 secs ago
 
 
1 hour later…
11:46 PM
0
Q: Deleting three consecutive numbers in an array

Nenad MitkovicI am a beginner in the programming, started about 2 months with Java, changing careers from law. I have recently applied for an internship but was denied because i failed to do the pre-interview test right. One of the task was to keep deleting 3 consecutive same integers from the array until th...

 

« first day (2482 days earlier)      last day (1520 days later) »