« first day (2849 days earlier)      last day (1160 days later) » 

1:59 AM
For such feedback a more appropriate site is Code Review. — kaylum 45 secs ago
 
2:22 AM
0
Q: Exercise 2-3. Write an alternate version of squeeze(s1, s2) which deletes each character in s1 which matches any character in the string s2. K&R

JrChavezI've been trying to create an alternate function 'squeeze(s1, s2)' and well, I have taken my time to do it, but I'm actually I'm not 100% sure If the solution I have done is correct. Although I test it, and everything it works fine and gives me the result I expect. But sometimes I start to wonder...

 
 
1 hour later…
3:32 AM
If you have working code that you want peer reviewed for improvements, you should ask on Code Review instead. It was created specifically for that purpose. — Ken White 17 secs ago
 
4:24 AM
This question is better suited for codereview.stackexchange.comdrum 18 secs ago
 
1
Q: duplicate element removal

WounderI have tried to remove the duplicate elements from the array using c language, here I am using 3 for loops to remove the duplicate elements. How can this optimize the code? Are there any other simple methods to remove the duplicate elements? #include <stdio.h> #define MAX_SIZE 100 // Maximum siz...

 
4:50 AM
It would be better to ask this question at Code Review. — Andrew Naguib 5 secs ago
 
5:09 AM
The answer here: Find a bitmap within another bitmap is a good start. Note that it requires that the smaller image is actually a section of the source image, not similar, since that method doesn't apply any threshold to the comparison. For example, the Images you have posted here have a slightly different color, so it won't find a match. If you crop a piece of the larger Image and save it as PNG, it will. You could convert the Images to black & white or grayscale to increase the chance of a match. — Jimi just now
 
5:45 AM
0
Q: Hangman Game from OCW MIT 6.0001 Pset No. 2

yfrI just completed Pset 2 about the Hangman game that was issued from OCW MIT. The Pset has no available solution so that any comment regarding code writing best practices would be greatly appreciated (especially about defining functions and linking them to each other). The full lines of code and a...

 
 
2 hours later…
7:51 AM
0
Q: How can I refactoring this nested try-with-resources?

Abindu DharHere's the code I am trying to refactor. The same Http client is being used in each nested try with resource. I don't understand the rationale behind nesting client.execute() calls. The code tries to Post data to an endpoint if resource is missing and retries to Post to a backup endpoint if earli...

 
 
2 hours later…
9:58 AM
0
Q: Binary-Decimal-Hexadecimal converter

Axel BozicI'm a fairly new programmer and have been learning c++ for about 8 months now. I've written a program that can take either binary, hexadecimal, and decimal inputs and convert them to the other two values. For example, if the user inputs a binary value, then the program will output both decimal an...

 
10:48 AM
0
Q: Next different permutation in C

RainningTWThis is a program which you can get the next "different", i.e. elements in A[] can be identical, permutation at each call. I've written a C++ program for the same purpose in 2018, but I found it unreadable, readability = NULL, so here is a new one. Any critical comment and answer will be welcomed...

 
The C version, de-generalized int version: codereview.stackexchange.com/q/256255/126584Rainning 37 secs ago
 
11:40 AM
This question seems better suited for Code ReviewNick Parsons 49 secs ago
 
12:02 PM
If the code works and you just want someone to review it, it fits better over at Core Review. — Magnus Eriksson 39 secs ago
 
12:37 PM
@SᴀᴍOnᴇᴌᴀ The code in this question is not broken, it is a performance issue.
 
@pacmaninbw Was the vote cast before the edit from 15h ago perhaps?
Rev1 was a bit iffy.
Current version looks fine.
Not great, but good enough.
 
14 hours ago.
@Mast True
 
1:21 PM
0
Q: Fast hamming distance function in Julia that returns a distance matrix

giacI would like to use Julia to compute the hamming distance on a very large dataset. I need to get back a distance matrix between rows in order to run further analysis on this matrix. For my purposes, it is useful that the data are stored in a DataFrame type. using DataFrames The data looks someth...

0
Q: Best data Structure for storing a phone keypad format

Mandy8055I am new to java collections and learning them right now. I was trying to code the phone keypad characters with its numbers. The first idea which came to my mind is using a HashMap. After trying various options I came up with the below Code. I want to know if the data structure and methodology wh...

 
Is Duga running right now? I expect to see a message that I may have invalidated an answer (I didn't).
 
@pacmaninbw Which edit?
Duga was still running 2h ago, so, probably.
 
@pacmaninbw If you're referring to the edit on this question, there are no codeblock changes in the edit.
Duga only triggers on codeblock changes.
Not on every edit.
 
1:36 PM
You know I don't change code blocks.
 
So Duga won't mention them.
 
Great!
 
1:50 PM
@pacmaninbw in the original revision the expected output was different than the output the code would have generated. The OP of the answer has left a comment that pointed that out- if that hadn’t been made then I might not have voted to close. I have retracted my vote
 
OK.
 
"$filec | Set-Content $file a little bit dumby, cuz I need to replace only one line" - no, this is in fact the right way to go about it - the underlying file system does not know what a "line" is, the file is just one long string of bits on disk. If you want a code review, feel free to post on codereview.stackexchange.comMathias R. Jessen 1 min ago
 
2:12 PM
0
Q: N-Queens Puzzle in AEC

FlatAssemblerThis is my solution to the N-Queens Puzzle. Here is the AEC code (compiled to WebAssembly): /* * My solution to the n-queens puzzle, one of the classical problems of the * structural programming. It asks in how many ways you can arrange n chess * queens on an n-times-n chessboard without break...

 
2:33 PM
@pacmaninbw As a side note (@Mast) addressed the problem. Sometimes @Duga doesn't report AI, for example no AI by Toby just me?
 
3:28 PM
0
Q: loop inside loop over one array

callbackI have the following code: const arr = Array.from({length: 5}, (_, i) => i + 1); const finalArray = []; for (let i = 0; i < arr.length; i++) { for (let j = 0; j < arr.length; j++) { finalArray.push(arr[i] + '-' + arr[j]) } } console.log(finalArray); Which creates an array ...

0
Q: All core MediaWiki upgrade script (round 2)

timesharerThe following script upgrades an existing, all core (no add ons) MediaWiki install. I run it with set -x for debugging (I avoid set -euo because I often run this script line by line and/or block by block and in case of typos or problems this terminates the session, which I don't want to happen). ...

 
3:53 PM
I think this question would be better suited for the Cryptography or Code Review Stack Exchange. — dan1st 37 secs ago
 
4:19 PM
0
Q: Sort an array of integers with a hashset

Kudos BI was trying to make a sorting algorithm for an array of integers. Here's are the steps/theory: It turns an array into a HashSet, iterates over every integer value from the minimum value in the array to the maximum. It carries an array that starts with 1 element, the minimum. While iterating to h...

 
MOnking
 
5:01 PM
This may get more attention on Code Review. But check for relevant tags and requirements (full running code etc). I usually don't recommend CR, but you seem to have used the speedups most recommended on SO, such as numba. So it may come down to coding details and organization, the kind of thing that CR answers seem to focus on. — hpaulj 33 secs ago
 
0
Q: More efficient solution for this recurrence relation?

Justindef T(n): if n <= 0: return 1 else: return T(n-1) + (n-1) * T(n-2) print T(2) I want to print out a list of numbers generated using the recurrence relation above. Is there any way to make this more efficient?

 
 
1 hour later…
6:24 PM
Stack Overflow asks that questions be about a specific, narrow problem. There's a separate Stack Exchange site, Code Review, for general-improvement requests. (That said, this isn't complying with their rules either right now; be sure to read the Code Review Help Center in full before reposting). — Charles Duffy 7 secs ago
Please go through the intro tour, the help center and how to ask a good question to see how this site works and to help you improve your current and future questions, which can help you get better answers. Your post is far too broad, without supporting data. You have to ask a specific question about your implementation; this is Stack Overflow, not Code Review. — Prune 12 secs ago
@CharlesDuffy I understand, do I have to delete my post before posting it to code review? num % 10 was the first thing that came to my mind, but I didn't know how to use it probably — Ilkin 26 secs ago
 
6:48 PM
@Mast can you check if I'm off-base here:
@Justin There is a difference between "how can I make my code more efficient" and "how can I do this in Python". Code Review is about the former question where you are asking the latter. — Peilonrayz 1 hour ago
 
0
Q: Web Scraping data from website using Selenium in python

Mr.A IApplicationDetail.txt: URL: https://www.abc.com applicationNo : 123456 Application Class: from dataclasses import dataclass @dataclass class Application(object): """ Binding Json Data to this Class """ Status: str ApplicationType: str StatusDate: str Location: str LocationD...

 
7:07 PM
@Peilonrayz Smells like a feature request.
'My code does it using X but I want to use Y instead'.
 
Ah, good we're in agreement. Thank you
 
IMO asking for shorter code is a developer smell, something worse than a code smell.
If you want effectiveness, try different things and use a profiler.
Where I'm using effectiveness <=> performance
Anyway, there's a second answer now that is probably more in line with what they want. But it couldn't have been written without you writing yours first, so in effect it was still useful to OP.
 
@Mast Speaking from personal experience; I agree. Back when I liked "short = good" it was more "unintelligible on liners = not good"
 
It's something that can only be cured with experience.
 
Yeah, darn experience
@Mast Welp it's probably going to go hot now. I'll be surprised if someone doesn't post an answer with the iterative approach to simple recursive problems
 
7:21 PM
@Peilonrayz Wouldn't the score prevent going hot?
 
I don't have the rater that Sᴀᴍ likes, but IIRC the penalty to 2 downvotes is outweighed by like 0.1 of an upvote
I'm not sure if there's a question must have a positive score thing tho
 
7:42 PM
0
Q: Reacting to updateChildren from firebase realtime

binyyI have uploaded data with updateChildren() as follows: public void update(List<Player> playerList) { Map<String, Object> map = new HashMap<>(); for (Player player : playerList) { map.put("players/"+player.getKey() + "/entity", player.getEntity()); } mR...

 
@Mast Ah I found the user script. The post is at 15%, and the lowest HNQ is at 10%.
And there's no negative score bar
 
8:33 PM
-1
Q: Checking duplicate file version and keeping the latest file with specified pattern only in Python

Aleem AbdulI have too many pdf files in the folder. I want to remove the old version file automatically by Python only. The file name is like this: 20022021_cap_mp_19_1_col_r1.pdf 20022021_cap_mp_19_1_col_r2.pdf 20022021_cap_mp_18_1_col_r1.pdf 20022021_cap_mp_20_1_col_r2.pdf 20022021_cap_mp_20_2_col_r1.pdf ...

0
Q: Calculating pi with Monte Carlo using OpenMP

emrepunI'm a C noob and I'm learning about concurrency using C. I came across an exercise in a book asking me to find the approximate value of Pi using the Monte Carlo technique with OpenMP. I came up with the following: #include <stdio.h> #include <stdlib.h> #include <pthread.h> #include <math.h> #incl...

 
9:13 PM
Don't know Code Review before, will do it next time. — Neville Zong 19 secs ago
 
That looks like clickbait, but trust me, they should teach that video before teaching anything else at CS courses.
I have to remind myself every so often when I've discarded most of the information.
Because I'm too stupid to follow advice I know to be good.
 
0
Q: function parameters for a matrix data structure

userx1234I've noticed for some functions that take a matrix as a parameter could be rewritten for a vector.(A vector is a double*, and so is our matrix). typedef struct { size_t rows; size_t cols; double* m; }MATRIX; int matrix_abs(MATRIX* const A); int matrix_negate(MATRIX* const A); int mat...

 
9:47 PM
@CaptainObvious I think this is too hypothetical.
 
0
Q: how to add functions to menu my code makes a pizza menu in the terminal

user238008hello I am creating a python menu it is about a pizza menu and I need help I do not know how to add some functions such as getting discounts in my code and postcode and address of a customer and phone number and email can you please help me her is the code that i have started with def mainMenu():...

 
@CaptainObvious The user is asking us to write the code for them.
 
10:04 PM
@Mast Someone should really present it better though. The content is good, but the presentation could've been neater.
 
0
Q: How to keep track of original property of object in C#?

Mj _So iam trying to make a Dhond't Polling system . This explains what i am trying to make : https://www.bbc.co.uk/news/uk-politics-27187434 (pretty quick read) However I cant find a way in c# to be able to keep track of the original object property value while also being able to change the value af...

 
 
1 hour later…
11:35 PM
@Mast Sorry just had a 2 hours where nothing went right. I'll watch it now that's over with. I'm sure you know when step 1 find software, step 2 download software and step 3 use software, doesn't work at all and you spend 2 hours downloading programs, resetting accounts, fixing bugs and the pièce de résistance is finding you already had the software installed... 🤦‍
 
11:56 PM
0
Q: Optimizing a diagonal matrix-vector multiplication (?diamv) kernel

user169291For an (completely optional) assignment for an introductory course to programming with C++, I am trying to implement a diagonal matrix-vector multiplication (?diamv) kernel, i.e. mathematically $$\mathbf{y} \leftarrow \alpha\mathbf{y} + \beta \mathbf{M}\mathbf{x}$$ for a diagonally clustered matr...

 
RELOAD! There are 7325 unanswered questions (89.6244% answered)
 

« first day (2849 days earlier)      last day (1160 days later) »