« first day (2808 days earlier)      last day (1211 days later) » 

12:00 AM
RELOAD! There are 7248 unanswered questions (89.6522% answered)
 
Lurch?
There was a name change?
 
no.
a hardware failure
 
ohh I missed a lot.
I didn't realize I had been that absent.
 
12:28 AM
0
Q: Primality Test Refactoring

dr vengyI devised a new primality test isPrimeNumber() below which determines if 1000000007 is prime. It works fine but the code looks unprofessional in my opinion. Is there any way to refactor it to make it more readable? Maybe inline the recursive gcd() function so everything is self-contained in the i...

 
12:53 AM
0
Q: Html Templating for a WIP static site generator, written in Javascript

HamBone41801I wrote this to go in my simple static site generator. it takes any plaintext file (but meant for html) and injects the specified file contents and other data at matching tags. This is my first "big" JavaScript project, and most of my knowledge has come from several-year-old posts on StackExchang...

 
 
1 hour later…
2:15 AM
Please don't use multiple ternary statements inline, instead use a computed function if at all possible. Sincerely, the guy who has to do your code review. — Our_Benefactors 49 secs ago
@Our_Benefactors - sincerely, the guy who has to maintain your code 2 years from now because there wasn't a code review. — Lawrence Johnson 1 min ago
 
2:33 AM
0
Q: An efficient way to order content in controller [Spring Boot]

KleronomasMy code works as intended. CategoryController class has getAllCategories method, which tells ContentOrderMap class to map differently ordered categories to their respective OrderType enum. The intention is whenever @RequestParam(defaultValue = "DEFAULT") OrderType categoriesOrderType changes from...

 
3:23 AM
0
Q: Efficient Multithreading in Python 3 - Webscraping behind a login

TheConfaxI'm a total beginner at Python and I would like someone to rate my code and to give me tips about talking between threads in Python. I don't know if I need these much threads for this script, but by doing so I was able to obtain a way faster response from the GUI. The code purpose is not importan...

0
Q: count pairs of matching integers in a collection in Common Lisp

user235906This defines count-pairs which takes a collection of integers returns the number of pairs of integers that are equal to each other. If the input collection has these integers ... 1 2 2 1 1 ... then count-pairs returns 2 because one pair can be made with the 1's a second pair can be made with ...

 
 
1 hour later…
4:32 AM
Just popped in to give a hearty f@$k y*u to DATETIME.
 
5:03 AM
0
Q: How to simplify this insertItemAt implementation in a B+tree?

Lance PollardI have adapted this from object-oriented methods to a more basic function style of JavaScript below. It is essentially a B+tree which doesn't do key-based lookup but does index-based lookup. And it has some added constraints of keeping arrays always powers of two up to 32 (1, 2, 4, 8, 16, and 32)...

 
 
4 hours later…
8:49 AM
0
Q: Thread Safe Python Client Server Service

ItayI had like to get some feedback about my Thread Safe Python Client-Server example. Is it really thead-safe? Do you see any dead-locks or other thread problems? # Server import socket import sys import threading import select class ServerConnection(): def __clientThread(self, callback, conne...

 
9:00 AM
@Vogel612 Great question, I think it's an authentication API thing problem but I honestly have no idea.
When I try to get something working, I first try to do it the "official" way, by following the manual.
Naturally that rarely works.
So scrapping parts is what comes later.
@Edward Inside or outside the container?
 
Does this code work? If so, this is off-topic here: ask on Code Review. If not, please explain what is not working and include any error messages you see. — Tangentially Perpendicular 24 secs ago
 
 
2 hours later…
10:54 AM
0
Q: Random Cave Generator Design Feedback

OviciorI am looking for feedback on my code's overall structure and design. I made a few concessions in reusability for the sake of not overcomplicating things (static/const public variables in the Game1 class) but think it's pretty usable otherwise. I would like to make this room generator easy to use ...

 
 
2 hours later…
1:12 PM
That is very danger, you can set random password and validate with that instead of real password. see this example codereview.stackexchange.com/questions/234821/…Dlk 21 secs ago
 
1:35 PM
Hi and welcome. Have you taken the tour and read How to Ask? Does your code work as expected? If yes, it's probably fine. If not, please update your question with information detailing what it's doing wrong. There is a site called Code Review if you want input on your solution. — DarkMatter 1 min ago
 
1:50 PM
0
Q: How can I speed up the processing of the received channel socket

Adam HThis currently runs with 1400+ sockets and manages data correctly and in the manner the application requires. I do have an issue with the HandleData method where the receive channel stacks an excess of messages. They eventually all get processed the channel rarely exceeds 250 items. Besides the o...

 
MOnking
 
2:40 PM
0
Q: Python Rest API user registration bassed on FastAPI framework

Давид ШикоI'm wrote an API for dating service. This is part related to user authentification, authorization, login and etc. FastAPI, in turn, is based on starlette web server. You may wonder what is fastapi.Depends... -It's interanly calling a passed function when endpoint is requested to satisfy shes depe...

 
Be aware if you have working code and are looking for general improvements, this seems more appropriate for CodeReview – be sure to check their question guide first, though. — MisterMiyagi 36 secs ago
 
 
1 hour later…
4:14 PM
Isn't "faster" off-topic for this site, and more on-topic for the code-review site? — DontKnowMuchBut Getting Better 46 secs ago
@DontKnowMuchButGettingBetter No. Not code review. — Daniel Mårtensson 34 secs ago
 
@Mast When running inside the tomcat:8-jdk8-openjdk-slim-buster container image, Tomcat runs as root.
I don't mess with Tomcat much (at all) so I don't know if it typically runs as root.
 
4:31 PM
@Edward you don't want tomcat to run as root
usually you'd lock it into a separate account
but a lot of package managers don't play nice with updating that on various distros, ....
 
I personally don't want to run Tomcat at all, but that's just me. :)
I was looking for a Tomcat deployment guide that would describe how to do it but didn't find any.
 
Yea, but if you have no other choice, it's better to lock down the program running on an exposed port into a different user
 
The way I'm running it in a container, there are no exposed ports, even to the host.
 
IIRC it's the following steps: 1. Create tomcat user and tomcat group, 2. chown all tomcat installation files to tomcat:tomcat, 3. adjust your service definition to run tomcat as tomcat, 4. restart the tomcat service
of course step 3 depends on which flavor of service daemon you're using
 
Hmm. I think I'll experiment with that later today.
I know nothing about service definitions or how/where they're defined.
 
4:35 PM
tbh, the provided container should be set up to use a tomcat user in the first place :/
 
Is that part of the war file?
 
@Edward no that's your OS services
systemd, init.d or whatever else you're using
 
Got it, thanks.
 
my service definitions are under /etc/systemd/...
 
0
Q: Read database from IO context and update UI from Main context in Kotlin

steve_79Still a bit new to Kotlin and coroutines, so I want to learn best practices. The following code seems to work as expected in it's original context, though the naming has been tweaked here. The list of widgets is retrieved from the database, and the UI is updated correctly. My main question is, in...

 
5:10 PM
This kind of questions is better asked at Code ReviewJens 24 secs ago
 
5:21 PM
You're probably looking for CodeReview. StackOverflow is for errors / problems with your code. — Just learned it 25 secs ago
 
@Vogel612 I've looked into it and within the container, there is no service definition for Tomcat
It's run solely via the catalina.sh script
 
yea and the service guarantees are provided by the container restarting if it fails ... ~sigh
 
So I wonder how much would break if I tried to run it as a separate user.
 
considering that the container is theoretically sandboxing it even if the tomcat gets pwn'd, I'd say it's fine to leave it as is...
not sure how much you want to harden that, though.
 
There's not a huge risk, it's true.
Although one could imagine that if one were to gain control of the container, it could be used for nefarious purposes, for example as part of a botnet
So I'd like to secure it as though it were a physical server that I cared about
 
5:27 PM
push it into a separate DMZ network then.
 
It already is.
I moved it yesterday
I think I can figure out how to run it as non-root user within the container.
I need to study more about securing containers anyway.
 
6:00 PM
0
Q: React Redux with functional hook example

testndtvI am having a hard time debugging the issue, where it seems the Redux store is not getting connected to the React component. Below is the codesandbox link with the entire code; https://codesandbox.io/s/crisil-tp7pv?file=/src/TestComponent.js I am having issues inside the following function i.e. ...

 
Perhaps ask on Code Review. But check their posting criteria first. — Peter Wood 21 secs ago
 
6:17 PM
This would be better fit on code review. BTW, there are multiple implementations of a 2D Ising on google. — ev-br 10 secs ago
 
-1
Q: C++ programs for Windows and Linux which let you lengthen the time it takes to access files REVISED VERSION

my_first_c_programI posted a version of these programs for review about a week ago and ended up getting good advice on how to improve them. this was the post which shows the old code: https://codereview.stackexchange.com/help/someone-answers Now that I've improved the code, I'm posting the new version here for rev...

0
Q: Processing Batch Job

DineroBackground I have a script that either takes a text file that contains a list of player_ids or not. If the user provides a player_id list i ensure that all the ids are part of the tranche date they provided and then run the process job for all the player ids in the list. If the user has not provi...

 
 
2 hours later…
8:18 PM
@Edward Some form of monitoring should be in place probably, although I don't have a clue how to cover such a thing except checking for average CPU/memory usage.
 
8:30 PM
0
Q: Basic Cpp TCP TLS Client-Server hashing code based on OpenSSL1.1.1 (detailed instruction included)

manhattanI wrote 'Client.cpp' and 'Client.cpp' that do the following. This is a part of the graduate research assistant screening process. Create a client and server program communicating over TCP socket. Establish TLS connection between the client and server Implement a hash service on the server Take...

 
If your code is working and you are just after comments about style and similar aspects, then you may want to consider the Code Review site. Fortran isn't a popular tag there, but there certainly are some things to say about this code. — francescalus 38 secs ago
possible answer invalidation by Diederick C. Niehorster on question by Diederick C. Niehorster: codereview.stackexchange.com/posts/254395/revisions
You probably need codereview.stackexchange.com - SO is for broken code, not working code — Caius Jard 41 secs ago
 
8:54 PM
@Mast Even better is that I can limit the CPU and memory use for the whole container.
 
9:20 PM
0
Q: Find a powerset of a set in C

anfauglitThe code below is an implementation of purely recursive solution to find a powerset of any given set. The input set is a string, and the output - array of strings. Both of them are wrapped into a structure for convenience. The underlying algorithm is pretty common one. The recursive function exe...

0
Q: is there anything wrong with my code

Mohammed AhmedI'm Mohammed new python developer and after some lecture want you guys to give some fo your advices about my currency converter project so that i can make it better, Thanks you and don't mind me if there's uncorrect english words me because my english is avarage us = 'US Dollar [$]' sr = 'Saudi R...

 
9:45 PM
possible answer invalidation by manhattan on question by manhattan: codereview.stackexchange.com/posts/254531/revisions
 
10:36 PM
0
Q: Convert string format python

sworI want fo fix number of digits after '.' in digit represented by string. Is there better solution than mine? My code def convert(s): """ Convert 1234.12345678 to 1234.123""" vec = s.split('.') if len(vec) == 2 and len(vec[1]) > 3: return vec[0] + '.' + vec[1][:3] return s

 

« first day (2808 days earlier)      last day (1211 days later) »