« first day (3058 days earlier)      last day (1183 days later) » 

00:03
REFRESH! There are 7815 unanswered questions (89.3169 answered)
 
2 hours later…
02:15
0
Q: Is there a better way to apply a filter over an Either right value?

Julian EspinelSuppose you have an IO (Either String (String, [Int])) and you want to filter the [Int]. Let's say we want to use the following filter: :t filter even Integral a => [a] -> [a] As far as I understand we need to lift this function to be applied to an IO (Either String, (String, [Int])), so I did: ...

02:40
0
Q: Recursively unpacking a javascript object

Miguel AvilaI'm seeing a React course and we where studying fundamentals of javascript for a while. We saw how to access the content of an object and display it in console. My solution for the problem of displaying an unknown object was the following: function unpackObject(obj, tabs = '') { const props =...

 
2 hours later…
05:05
Welcome to Stack Overflow. This kind of question is generally not on-topic on Stack Overflow and should instead be asked on codereview.stackexchange.combad_coder 53 secs ago
05:56
0
Q: PHP processed, HTML-CSS, CMS-agnostic, contact now panel

htmlizerI develop a CMS-agnostic PHP formatted HTML-CSS "contact now" panel, sticky in the bottom of a website screen. I format it in PHP because PHP supports include which I use a lot to well organize the code. The code is tested and works as can be seen from the following image. I ask a review of the c...

 
4 hours later…
09:35
0
Q: Exit a program after logging an unhandled exception

TanyaI have a program with 3 functions, where the output of the "n"th function depends on the "n-1"th function. Something like this from random import randrange def op_1(): if randrange(2) % 2: raise Exception('Unhandled exception occurred in 1') return 1 def op_2(a): if randrang...

 
2 hours later…
11:37
0
Q: Avoid global variable due to executor.map()

Lucifer UchihaI'm pretty new to python but after watching Mr Robot I felt inspired to make a CLI portscanner. With all the fancy console outputs you see in movies like a progress bar. It's finished and works nicely however I am not very happy with having to write twice global host_IP in main() and scan_tcp(). ...

0
Q: Rock paper scissors coding assignment

HartonI had a coding assignment to write a Rock Paper Scissors game. The main task is not to show a solution but rather to test the coding style. The rules are such: Problem: rock is "O", paper is "[]", scissors is "8<". George and John play RPC(rock, paper and scissors) a couple of times. I receive 2 ...

12:33
this question is more appropriate for codereview.stackexchange.comNoam Yizraeli 46 secs ago
13:14
0
Q: JavaScript change calculator

Breno LiraHello! I'm new at coding and I'm learning it on freeCodeCamp, that's the most hardest problem that I have already do at that site. After finishing it (after I vibrated as if I had won a world competition of something) I go straight to the internet to visualize another resolutions and try to under...

13:43
Thanks a lot everyone! I changed my code accordingly to your suggestions and pushed it for my senior engineers' code review! Thanks again for those really nice explanations! — firefighter 18 secs ago
14:03
0
Q: Refactor typescript long switch case that run different code in according to property value

chennyI have a typescript function that executes an array of actions on a given string value. This is the code: processValue(value: string, actions: Action[]): any { actions?.forEach((action: Action) => { switch (action.type) { case ActionType.Append: { ...

What is wrong with your code? You haven't told us if it works or not. Also, why even attempt to do it this way? Generally speaking, code reviews are off-topic for Stack Overflow. — jarmod 1 min ago
14:27
0
Q: c# number guessing game . after the first value, the rest does not work

Barkin Erkan Blockquote using RastgeleSayi; using System; namespace SayiTahminOyunu { class Program { static void Main(string[] args) { int deger; Console.WriteLine("Sayı Tahmin Oyunu \n\n"); Console.Write("Lütfen Zorluk Derecesi Seçiniz :1- Basit 2-Orta 3-Zor : "); don: Random ...

0
Q: Pseudo random numbers generator in C++

SteveLet's say I have following C++ code for generation of the pseudo random numbers uniformly distributed in range \$\left<0,1\right>\$ on 32 bits machine. #include <cstdint> float randomNumber() { static uint32_t next = 1; next = ((1103515245*next + 12345) % 4294967296); return sta...

14:51
This would be a better question for code-review. — U plus 263A 25 secs ago
0
Q: Recursive quick sort in python

FarzinI was wondering if there is anything that I could do to make my code look cleaner and more descriptive for educational purposes? def quick_sort(array, start, end): if start < end: pivot_index = partition(array, start, end) quick_sort(array, start, pivot_index - 1) quic...

0
Q: Linked List Implementation in C#

Tobi AlafinI wrote an implementation of the Linked list data structure. I mostly did this because it's the simplest collection data structure (at least the simplest to implement), and I wanted to practice implementing IEnumerable<T> and IEnumerator<T>. I also wanted to play around with generics. This was en...

"Is there a better way?" Yes, it's called Code Review Stack Exchange. — Rojo 14 secs ago
15:20
possible answer invalidation by Farzin on question by Farzin: codereview.stackexchange.com/posts/268083/revisions
@Duga thats okay
<pmlomg
This is a code review site question, but you also need to measure it, and make sure of what you're measuring. Printing to the terminal is really slow, compared to behind the scenes code. Try to "timeit" on the map generation, with no print. — Kenny Ostrom 47 secs ago
possible answer invalidation by Farzin on question by Farzin: codereview.stackexchange.com/posts/268083/revisions
 
1 hour later…
16:47
If the code you have works and you want feedback on how to improve it, the best place to ask is: codereview.stackexchange.comJonSG 1 min ago
 
1 hour later…
L3n
L3n
18:11
@SimonForsberg I create the commands in the place where the user messages come, from the handler of message events
I use the factory in such handler
> Passing both the A and B dependencies to the factory would make sense if that's all that's needed to create the other commands

Exactly, that was what I said, that it doesn't make sense here because that's not the case.
The commands are used when I receive the event of the user's message, which forwards to the command handler that makes use of the factory to find and execute the specified command
Also no this isn't console commands, it's for Discord
0
Q: Find Kth Element in the merged two sorted arrays?

Aryaman We have been given two sorted arrays and a number K . We have to merge the two sorted arrays in the sorted manner and return the element at the Kth position. My approach is to use two variables which will tell us where are we in the two arrays. Start comparing arr1[arr1_index] with arr2[arr2_in...

I probably should have added that I only been working with web development for less than 1 day. That is why I am asking the community. Good information about the codereview exchange, I didn't know that existed. And good information about the for inside of the while. Not sure why the down votes. Is stackoverflow for learning? Or punishing new developers for trying to learn? — portfoliobuilder 23 secs ago
18:41
@L3n Seems kinda pedantic there. Commands entered through a text only medium are commonly called console (text) commands.
possible answer invalidation by Peilonrayz on question by Lucifer Uchiha: codereview.stackexchange.com/posts/268075/revisions
@Duga No Duga, don't let them know about my AI D: (``` fix)
possible answer invalidation by Peilonrayz on question by Lucifer Uchiha: codereview.stackexchange.com/posts/268075/revisions
18:57
0
Q: Optimal Way to Sort Table With Ascending/Descending Order No Library

FirstDayCodingThis is my first day coding, and I need help with sorting a table in ascending/descending order. This is the function I have created so far. /* * A function to show sort data. */ function sortTable(n) { var table, rows, switching, i, x, y, shouldSwitch, dir, switchcount...

19:10
Regarding my previous comment, in your case, if "Currently programmers are adding new changes without approval" refers to changes that were not suggested by the code reviewers, then that is a problem. I think better training is in order, otherwise @matt's joke is less of a joke after all. — TTT 26 secs ago
 
2 hours later…
20:48
Questions about improving otherwise working code may be better suited for Code Review, but be sure to follow their content guidelines and How to Ask to ensure an on-topic question. As it stands, this question is too broad for Stack Overflow. — jmoerdyk 32 secs ago
hello guys some time ago I made this post which helped me a lot on a RC version.
https://codereview.stackexchange.com/questions/256388/class-showing-a-format-similar-to-var-dump-rc5-version

and the project / library will grow in code and in number of files up to the version 2, I am working on it in github.

I wanted to bring it again for you to review and test it if possible but due to the size I do not know how to make a legible, neat and adequate post.
1
Q: A small python game

BackpainYTMy teacher gave us this game to make. basically, the computer needs to generate randomly 5 letters and there would be 5 players if the player guesses the correct letter given by the computer It would print "good job" else "good luck next time", I would appreciate it if you could make my code a bi...

21:15
If you want help improving working code, you should post this on CodeReview.SE. If you do decide to do so, please delete the question here. — NathanOliver just now
@FranciscoNúñez-TodoPoderoso I know this post is related and only has one answer - does that help at all?
7
Q: How should I structure my post if my code is over 400 lines?

JensBMy code is around 480 lines and a little over 13,000 characters(12,000 if not counting spaces). It consists almost entirely of headers and implementation files, with a very short main.cpp. Should I put all my implementation into my header files when I post it on Code Review? That would shorten th...

0
Q: Why is my HTML5 canvas game laggy?

Pablo CamaraI don't understand why my spaceship movement seems so laggy.. Could it be because of the JS function "setInterval" ? What is the best approach on game performance with HTML5 Canvas? The code is quite short and simple, and you can find it here: https://github.com/Pablo-Camara/space-hack-refactored...

21:50
0
Q: Python's enumerate for C++

SourceChrisI implemented an enumerate() method for C++ containers similar to Python's enumerate to iterate through a range with an index and the actual value. I have the following questions: Does the usage of the Const template parameter make sense for this scenario? Do I need additional iterator methods d...

22:05
@SᴀᴍOnᴇᴌᴀ ok thank
23:04
0
Q: Simple implementation of various cache replacement policies

Node.JSI am new to golang and I tried to implement various cache replacement algorithms (FIFO, FILO, LRU, MRU, LFU) in a generic or flexible fashion. I added some tests as well. My implementation uses golang list package which is a doubly-linked list. I appreciate any feedback or review. Thank you. ==> ...


« first day (3058 days earlier)      last day (1183 days later) »