« first day (2452 days earlier)      last day (76 days later) » 

12:00 AM
RELOAD! There are 6368 unanswered questions (90.0739% answered)
 
0
Q: converting bits binary to bcd

momonosukeI wrote a code that requests user input and then converts binary to bcd then back to binary using bitwise operations. While I think my code is good I want to know if there is a better way to write the code. Is there also a way to keep the code mostly the same but getting rid of the arrays for pri...

 
12:26 AM
1
Q: Function to get the ratio of the number of positive, negative, and null values inside an array in relation to its length

A L V A R OI wrote a function that checks what's the ratio of the number of positive, negative and null values inside an array in relation to its length. The code I wrote is the following: function plusMinus(arr) { /**first I declare 3 variables to store the positive, negative and null elements inside...

 
 
2 hours later…
2:39 AM
This might make a good post for codereview when you get it working — Kerndog73 53 secs ago
 
3:11 AM
Also, this is probably better on codereview.stackexchange.com — Mateen Ulhaq 30 secs ago
 
 
2 hours later…
5:03 AM
Monking
 
5:33 AM
0
Q: Stock merchant from hackerrank - idiomatic typescript?

rofrolI just started learning typescript, and I don't know if this is good style: import * as fs from 'fs'; process.stdin.resume(); process.stdin.setEncoding('utf-8'); let inputStringTemp = ''; let inputString: string[] = []; let currentLine = 0; process.stdin.on('data', inputStdin => { inputSt...

 
5:53 AM
1
Q: Get 3 counts from a table

AllenBooTungI am trying to get 3 results. All, chk='Y', chk='N' What can I do to improve this code? $Val = explode(",", urldecode($_POST['Val'])); $addSQL = ''; if (!empty($Val[2])) { // parrent.guid $addSQL.= " and up_cls='".mysqliChkData($Val[2])."'"; } $getSQL = "Select guid From table Where ...

 
6:40 AM
Monking
 
So I have a somewhat delicate question. On another forum, someone made reference to some people from CodeReview thinking of trying something new due to the train wreck referenced in the starred links on the right. I was wondering where I might find out more about this effort? If there's somewhere else I should ask this question, please let me know.
 
@user1118321 I'm not sure if any of us are involved, but there are a couple of 'alternatives to SE' slowly growing. I think codidact is the one with the most traction at the moment, but they're far from ready. Although Writing.SE has a clone running on an old version of that, I think.
Which can be found here.
But at the moment there is no Code Review version of that, if that's your question.
But perhaps the people on that forum are up-to-date than I am.
 
 
1 hour later…
8:26 AM
This is rather a question for Code Review: codereview.stackexchange.comStultuske 18 secs ago
 
9:16 AM
0
Q: Contour from triangulation in Python

Noam NavehI have a set of 2d vertices (x,y) and a set of triangles referring to the vertices' index (p1,p2,p3). The vertices represent a closed polygon shape, however those are not in order. When 'merging' all the triangles together, we get a the area of the desired polygon (from which we can conclude th...

 
ok - this question has now been asked here: codereview.stackexchange.com/questions/235877/…Noam Naveh 38 secs ago
 
9:36 AM
0
Q: Takes a string array and searches for two words that are anagrams of each other

Ben ParrLooking for some advice on weather or not this can be improved in terms of efficiency and speed, it would need to work on large data sets. public class Anagrams { public static boolean isAnagram(String str1, String str2) { String s1 = str1.replaceAll("\\s", ""); String s2 = str2...

 
10:16 AM
Hi and welcome to SO. This type of question would be better suited for codereview.stackexchange.com. — Jacques Gaudin just now
 
10:31 AM
Monking
 
This belongs to CodeReview SE. — Marco Bonelli 51 secs ago
If your code is working and you want feedback on it then Code Review would be a more appropriate site for this question. — kaylum 49 secs ago
I'm voting to close this question as off-topic because it's a code review question. — Marco Bonelli 46 secs ago
 
10:57 AM
0
Q: Random walk for 500x500 is not efficient enough

Caleb jonesFor a 500x500 matrix with 50k iterations, it would easily take one full day to compute. How to reduce the computation time drastically? Logically program is correct. I tried profiling, it didn't tell me a whole lot. The while loop is causing the issue? Any suggestions to improve the efficiency ...

 
I think you’re probably looking for codereview.stackexchange.com. Stack Overflow is for specific programming questions; not, “How can I improve this code?”-type questions. — Martin Bean 16 secs ago
 
11:30 AM
@Mast First I've heard of this. Only seen a couple faces there as well. But since it's taken so long to start doing something I stopped following - maybe things have changed...
 
I love the smell of Brainfuck in the morning
0
A: Optimized FizzBuzz in brainfuck

Simon ForsbergTape setup Esolang constants are compact, but not efficient. You are using an esolang constant to get the number 61, but what you actually want is a series of numbers: 0 5 66 117 122 105 70 3 0 100. In this case Esolang constants doesn't really help. Instead, it helps to look at the series of nu...

 
11:59 AM
@Peilonrayz If they ever get things done I'll take it into consideration, but for now it's not an alternative and it's not within my expertise to help them in their current stage.
Wouldn't be surprised if the whole thing went up in smoke within the year, or that it's still not close to finished by that time.
Just give me some time and I promise to review this! — Simon Forsberg Feb 1 '18 at 17:11
Some time, for some values of some.
 
@Mast Nothing to see there!
 
@Mast Yeah, I can see that happening. Just seems like all the cons of a Q&A with none of the benefits of lots of people being developers.
 
@Mast Your opinion about codereview.stackexchange.com/q/163334/31562 might give you a bounty. And a checkmark.
 
12:43 PM
@SimonForsberg Last time I was trying to see if I could even do a Fibonacci in BF is 4,5 years ago, around this time.
 
@Mast Sadly there are not many BF enthusiasts around. Also, you don't have to make it to review it :)
 
@SimonForsberg True. For now I'd say you massively overcomplicated it, but turning that into an answer is a bit tricky.
I may give it a shot later, but I don't have high hopes for it.
 
@Mast Overcomplicated how?
 
Jake Goulding on January 20, 2020

Rust has been Stack Overflow’s most loved language for four years in a row, indicating that many of those who have had the opportunity to use Rust have fallen in love with it. However, the roughly 97% of survey respondents who haven’t used Rust may wonder, “What’s the deal with Rust?”

The short answer is that Rust solves pain points present in many other languages, providing a solid step forward with a limited number of downsides.

I’ll show a sample of what Rust offers to users of other programming languages and what the current ecosystem looks like. It’s not all roses in Rust-land, so I talk about the downsides, too.  …

 
@SimonForsberg Well, a fibonacci is pasically putting the 1st character on 0th place, the 2nd on 1st and put the sum of the new 0th and 1st on 2nd. Keep a counter somewhere and that's it.
So a bit of set-up, the above in a loop, and done.
As far as I understand your code, it does a heck of a lot more than that.
 
12:52 PM
@Mast My code is also capable of handling bigger numbers than 255.
Even though the Brainfuck cells only go to 255.
But basically, I do that exact same thing - but at a digit level and not for the whole number at once.
 
go to start
while (has more digits) {
3   b = a
5   a = c
8   c = a plus b
   if c exceeds 10 during addition then activate next digit and increase it by 1
}
That probably makes sense to you, but I'd expect the following:
go to start
while (has more digits) {
   a = b
   b = c
   c = a plus b
   if c exceeds 10 during addition then activate next digit and increase it by 1
}
Not sure what those 3, 5 and 8 are, pointers to the location of b, a and c?
 
1:36 PM
@SimonForsberg Must be lonesome at the top of your field.
 
@Mast It's just example numbers to remember what number is the old, current and next.
@Mast That code has just different orders of a b and c, otherwise it is the same.
 
1:53 PM
@SimonForsberg Is it also the same operation wise? I'd suspect mine is cheaper.
 
@Mast How would yours be cheaper? You just assign a = b and b = c instead of b = a and a = c. It's still just two assignments.
 
@SimonForsberg I'd think since a and b are next to each other, so are b and c, it would be cheaper in moves of the pointer.
a and c are not next to each other.
But I haven't drawn it out on paper, so I'm not sure.
 
Okay, I see what you mean. You're basically suggesting that I switch positions of A and B. Then I would need to do that at all places. It might be an improvement, I'm not sure.
 
@Feeds I love how the blog has become even more of a waste of space. 🤣🤣
 
@SimonForsberg A very minor one, but yes.
If I have time I'll try both versions and see what happens, but probably not.
I'd have to get the environment all suited up again and all.
 
2:08 PM
@Mast Yeah, Brainfuck coding can be a mess... any little minor thing you do wrong and the whole thing blows up and you have no clue why
A little while ago I started considering if maybe I should migrate Brainduck to Kotlin and use Vue.js for frontend instead.
 
2:20 PM
@SimonForsberg Oh, don't worry, I can make a mess with any language.
6
 
That's the spirit!
 
2:34 PM
Currently trying to automatically update thousands of PDFs at once if they're older than X from a German website in 3 languages without API, buffered over a local folder to minimize impact on the network.
Shouldn't be too hard, yet...
Poor standardization is killing me.
All portable of-course, to work around system limitations that should've been fixed 2 weeks ago.
 
2:48 PM
headers is unused here, as far as I can see. It is defined and not sent in the POST call. You can send both: requests.post('<address>', headers=headers, data=xml) I checked this was true. I didn't get an error when not including it, but I think I'm seeing faster results with it... anyway, if just defining it and not passing it does something magical in Python that I don't know about that wouldn't surprise me. This answer did help me get further. There's my code review :) — Neil Guy Lindberg 55 secs ago
 
3:05 PM
Do you have an issue with your code? If it is just to get an opinion / suggestions for improvement, then this is probably better suited on codereview SE? — Fildor 30 secs ago
 
@Mast The code has never been completed, I knew what the the includes were. It the OPs place to make sure the code works.
1
Q: Dutch National flag solution in C++

Rahul Wadhwanithis week I learned about QuickSort and used the technique to solve the Dutch National Flag problem. I would appreciate it if someone would review my code and give feedback. The Dutch national flag problem is a computer science programming problem proposed by Edsger Dijkstra. The flag of the ...

 
If it is working (as expected), then you should consider posting to codereview. On SO this will probably be considered as "opinionated" and therefore off-topic. — Fildor 39 secs ago
This question is more suitable for codereview.stackexchange.com. You could also check out the networkx docs for this algorithm hereCDJB just now
 
@pacmaninbw Absolutely, but the example runs on my PC. So what's wrong with it?
 
3:46 PM
Put all of those parameters into a single entity (struct). Then that will have the constructor taking only one parameter, not 20 or 30. Call the struct SMSInformation or something like that. Also, the code would fail many code reviews, and even have automatic code "inspectors" give a red flag, due to the number of parameters. To be honest, it is not worth to keep the code in that state. — PaulMcKenzie 21 secs ago
 
The OP never put the includes in.
OK, I'll remove my comment, retract my VTC and vote up the answer.
 
@Mast My god, now the "missing imports that anyone that's done a beginner course of the language would know" close votes are going to broken rather than context for some reason. Strange.
 
4:35 PM
possible answer invalidation by Graipher on question by skualos: codereview.stackexchange.com/posts/234365/revisions
 
4:48 PM
@Mast Thanks for the info. I had seen codidact but someone claimed there was something else code review-related, so thought I'd ask. But perhaps it's not taken off or they were misremembering. Oh well.
 
Possibly better suited to codereview.stackexchange.com since presumably this is already working. — user2478398 17 secs ago
 
Monking
 
If you have working code and are looking for advice on improvements, Code Review is a better site. — Barmar 24 secs ago
possible answer invalidation by here4learn on question by here4learn: codereview.stackexchange.com/posts/235826/revisions
 
5:26 PM
@Duga yes indeed, rolled back. Look out for more potential edits there... as it was a quite minor one, but still a big invalidation.
 
5:48 PM
@Mast I think we can all make a mess with any language. :)
 
6:40 PM
possible answer invalidation by greybeard on question by Caleb jones: codereview.stackexchange.com/posts/235883/revisions
I'm voting to close this question as off-topic because this question belongs to codereview.stackexchange.com — KamilCuk 1 min ago
If you have working code that you'd like reviewed, please take it to codereview.stackexchange.com after reading their posting guidelines to ensure it's a good fit for them. — miken32 39 secs ago
 
 
2 hours later…
8:35 PM
This may be a better question for codereview.stackexchange.comr.ook 25 secs ago
 
-2
Q: Question whether working solution is bad practise

BirdieI want to ask a conceptual question whether some code piece that works perfectly fine is considered an example of bad practice or misuse of some design pattern / library that is available. I was considering asking the question on Code Review, but I do not know if it allows for conceptual discussi...

 
9:10 PM
I guess all my Code Review answers are not helpful. I wander why I have so much rep then... Something's not really adding up for me. — Peilonrayz 14 mins ago
Couldn't have said it better myself, @Peilonrayz ^^
Ask the question, add a comment here with a link to it and ping me. If it is not a good fit for Code Review, then Peilonrayz and I can assist you and explain how to improve it. — Simon Forsberg 9 secs ago
 
 
2 hours later…
10:53 PM
0
Q: GTK+ CMake setup

ShadowDragonI'm mainly working with Java and Gradle, but for my current project I have to use C++ with CMake and thus I would like to have some feedback on my current folder structure and project setup. root_project |─── .gitignore |─── CMakeLists.txt |─── build |─── src | | |─── [...].hpp...

0
Q: Unit testing an unspecific order of method calls

JoggeI cannot figure out how I am supposed to unit test the implementation of GetFilteredEntites(IEnumerable<MyEntity> myEntities). public class MyEntity { public int Rank { get; set; } public int Points { get; set; } } public interface IMyMethodClass { ICollection<MyEntity> RemoveBadRan...

0
Q: Maximum sum of hourglass in an array

Rahul WadhwaniI am solving some questions on Hackerrank for practice purposes. I solved this morning called Maximum sum of hourglass in an array. Given an array: 1 1 1 0 0 0 0 1 0 0 0 0 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 the hourglass sum is 7 and we need to find the maximum sum of all hourgla...

3
Q: Speeding up Dijkstra's algorithm

AlexeyI have Dijkstra's algorithm: # ========================================================================== # We will create a dictionary to represent the graph # ============================================================================= graph = { 'a' : {'b':3,'c':4, 'd':7}, 'b' : {'c':...

2
Q: Java Single LinkedList

PierreI am a CS student and I was wondering is this code looks clean. I tested it and it passed every tested but I think the delete(Node node) is a bit long, I did not find a way to reduce it Node class public class Node { private int data; private Node next; Node(int data){ ...

0
Q: Maximal Bipartite Matching

Jedi_Maseter_SamI have been working on creating a code solution for the Hungarian Algorithm, and from the testing, the slowest and buggiest part has been the bipartite matching. The most recent rendition is based on this GeeksforGeeks article, but, I removed the recursion since that was a stack-overflow waiting...

0
Q: Java - How can I optimize my "Edit Distance" algorithm/code?

SchytheronI have a piece of code that calculates the edit distance between words and works, but it's apparently not fast enough. Code: ClosestWords.java: import java.util.LinkedList; import java.util.List; public class ClosestWords { LinkedList<String> closestWords = null; int closestDistance = -1...

-1
Q: Is there a better way to manage these non-daemon worker thread?

NovaWe have a Java application that's continuously running. Nothing much goes on in the main method except initializing a few background threads through a helper class. The background threads process socket events as they occur. Apart from the time the socket events are being processed, app remains i...

-2
Q: Left rotate array in php

Sachitha HirushanI want to left rotate an array like this , a = [1,2,3,4,5]; after left rotate a = [2,3,4,5,1]; after another left rotate a = [3,4,5,1,2] a = [1,2,3,4,5]; //after left rotation leftRotate(a); a = [2,3,4,5,1]; Are there any methods instead of for loops?

1
Q: C program that dynamically allocates and fills 2 matrices, verifies if the smaller one is a subset of the other, and checks a condition

Samuele B.Yesterday, I asked this question because I was asked to implement a software that used variably sized matrices with C89's limitation, so I had to practise dynamic pointer-to-pointer allocation. After the useful answers I got, I started working on a solution to a problem that I was assigned as an ...

3
Q: Automatic picture selector

TlomolokoI'm working on a project for digital marketing, I want to automate the upload of pictures. The program itself isn't done but here I came up with a way to keep track of which and when pictures have been posted. from os import listdir, rename from random import choice from _datetime import datetim...

-1
Q: Make a Map<?,?> containing configurations based on file system principles

BirdieI am working on a Java project that currently depends on 500+ configuration files in the form of XML, XSLT and YML files. The vast majority (~400) are XSLT files, and the purpose of the application is to transform a variety of XML structures using XSLT, and currently the files are deployed as par...

0
Q: Reactive Extensions wrapper around Confluent.Kafka for .NET

Sereja BogolubovJust an Rx wrapper around Kafka to represent topic consumption as IObservable<T>: using System; using System.Collections.Generic; using System.Threading.Tasks; using Confluent.Kafka; using PM.TT.Live.Kafka.Rx.ConfluentKafka; using Reactive = System.Reactive; namespace PM.TT.Live.Kafka.Rx { ...

1
Q: Basic Subnet Mask Calculator + A Little Extra

CarcigenicateFor my Networking class, we learned about subnetting and subnet masks. I decided to write a little "calculator" (a generous term) that when given n-many network bits, generates a 32-bit subnet mask, then displays it as octets, and as binary with the leading 0s removed. Example main: int main() ...

0
Q: Searching within a data model using an array matching multiple terms

ChrisI have a standard tableview app that displays information from a data model array that uses a custom class. There is a UISearchController to filter the data. A simplified version of the custom class is shown. I use a computed property for a string that is checked when searching the data. class ...

-1
Q: python3:Find the maximum value of | Ai - Aj | + | i - j |:

Madhuraank BClick here https://www.hackerearth.com/practice/data-structures/arrays/1-d/practice-problems/algorithm/can-you-solve-it/ to view the source of the problem Given an array 'A' consisting of 'n' integers, It is required to find the maximum value of the following expression: |Ai - Aj| + |i ...

0
Q: SQL to Excel then to CSV file for Data Upload

Zack EBefore we get started I need to let you know a critical piece of information: Due to permissions within an offsite database I am NOT allowed to create tables even temporary ones within the database that I am getting the data from. With that being said: All of the code below works as expected, ...

 
11:13 PM
0
Q: Vectorization, 7-bit encoding

JoniI was curious how vectorization works and how to write suck code. To start simple I choose 7-bit encoding as my test suspect. I'm not expecting improved throughput in any way. My implementation works just fine, until we go over 2^31 due to compare not doing unsigned comparison. I would like to kn...

0
Q: Unique and shared resource owner

AdamI need a unique_ptr and shared_ptr like structure, but instead of pointers, I would like to store some kind of reference to a resource. It is usually just an int and maybe some attributes. I would like to avoid using pointers, so these objects can be kept on the stack. I usually use these contai...

 
11:33 PM
0
Q: 3 last distinct values of a list taken from a list of dictionaries

TmSmthI have a list of orders (each order is a dict) which looks like this (simplified version) : [{'name' : XXX, 'id' : { 'order_id_local' : 'xxx_001'}}, {'name' : XXX, 'id' : { 'order_id_local' : 'xxx_002'}}, {'name' : XXX, 'id' : {}}, {'name' : XXX, 'id' : { 'order_id_local' : 'xxx_002'}...

0
Q: Optimizing double for loop

InKwon James KimI used minimum edit distance algorithm to find the bundle of the most similar strings in an array. So, I have to travel double for loop to compare all element. If the data is large enough, this algorithm is Inefficient. Values have rules 1. value’s length is 10 2. value is A-Z and can’t be dup...

 
11:54 PM
0
Q: Simple HackerRank problem, but cannot find error in logic

user10150308I failed a code test at a problem that should be very simple. But still, after submitting an incorrect solution, I cannot spot where my logic is going wrong. I want to learn from this let down so I can do better next time, but there is no solution online to this problem. Can someone let me know...

 

« first day (2452 days earlier)      last day (76 days later) »