« first day (2581 days earlier)      last day (1433 days later) » 

12:00 AM
RELOAD! There are 6679 unanswered questions (89.9564% answered)
 
12:11 AM
0
Q: Open-addressed C hashmap

G.K.I implemented an open-addressed, double-hashed hashmap in C, now looking for some advice on improving it. Thank you. hashmap.h: #pragma once #include <stdbool.h> typedef struct hm_hashmap_t *hm_hashmap_t; hm_hashmap_t hm_init(void); void hm_destroy(hm_hashmap_t hm); void hm_set(hm_hashmap_t...

 
 
1 hour later…
1:26 AM
0
Q: how to do unit test elegant in my application

Xu HuiI have a application deal with graph computation. I want cover unit test on to it, but I found it is hard to do the test. The main class is shown as follows: Grid store the graph strcture GridInput parse inputfile and save into Grid. GridOperatorA do some operator on Grid. GridOperatorB do so...

 
 
2 hours later…
3:19 AM
You should post code as text, not as a screenshot of code. If it's too long to put in the question, I'd recommend putting it in pastebin or something. Additionally, if you don't have a specific problem but instead seek feedback, I'd suggest checking out the code review stack exchange: codereview.stackexchange.coma.deshpande012 53 secs ago
 
4:00 AM
0
Q: Implementing a binary search tree using std::unique_ptr

Gaurav SharmaI have implemented a binary search tree with 2 operations to begin with. I have tried to implement it using the best practices I could think of. Overall, I am happy with the implementation. But, I want someone else's opinion about what they think about the design or any bad practice I have used. ...

0
Q: Kinematics Simplification

Antonio AyalaSo I created a one dimensional kinematics equation solver which has been successful, however was interested in simplifying my code. My code works once user inputs the the given variables, then boolean tests the provided variables to provide the appropriate equation used to solve, based on the mis...

 
4:39 AM
after your sugession, i made few improvement and posted in codereview.stackexchange.com/questions/243048/…rho 7 secs ago
 
0
Q: matplotlib fixing axis scale and alignment

rhoThere is few points In the script I don't like I think it can be improved, but I need a second opinion, here is the interactive plot I'm trying to build. here is the code with thought in comments. #!/usr/bin/python3 from functools import lru_cache import numpy as np import scipy.stats as ss...

 
5:49 AM
Yes, but before you send people to CR, they need to be writing reasonable questions. OP went and dumped this over there without taking their tour or reading their how to ask page. In the future, don't recommend a migration without directing them to relevant pages like how to ask. — ggorlen 13 secs ago
 
6:41 AM
I’m voting to close this question because belongs on codereview.stackexchange.comDrew Reese 31 secs ago
 
7:15 AM
The fact that the code isn't working isn't obvious from the text. I thought you were asking for a code review. You should probably edit the question to clarify this, also please describe the behavior you do get. Is there an error? Did you check in the developer tools of the browser? What did you find? This could be a good question but it needs expanding. — Uberhumus 34 secs ago
 
8:05 AM
-1
Q: How does the computer place ships in random locations in the battleship game in Java?

AnonymousThere will be two players in the game, one will be human and the other will be a computer. The game board will be 10x10. At the beginning of the game, two players will have 5 ships: 1 of size 1, 1 of size 2, 1 of size 3, 1 of size 4, 1 of size 5. The ships are randomly placed on the board by the ...

 
8:47 AM
This is not a code review service. However, you might be interested in Code Review. But be absolutely sure to read their guidelines. As asked, I'm sure this question would also be closed there. — Flimzy 59 secs ago
 
Kaz
9:12 AM
@DanPantry Dan!
Been a while :)
Current situation aside, how's life going these days?
 
9:40 AM
0
Q: Clean code architecture in Golang

akahhorhttps://github.com/Abdukahhor/swe Sample project in clean code (Golang). Can you review the repo? Is it done correctly ? handlers: any transport layer http web api, grpc, graphql and etc. app: Business layer storage: Database and caches services: external services package main import (...

 
9:58 AM
Sorry for the comment, not trying to make a code review or anything :) — Juan Ramos 21 secs ago
If it's working you should post your question at codereview.stackexchange.com instead. — emix 28 secs ago
 
Monking
 
Well constructed question, but since it's actually working it may possibly be better at place over at CodeReview? I'll leave that up to you. — JvdV 55 secs ago
This seems better fitted for code reviewAhmet 34 secs ago
 
10:14 AM
@Kaz Things are alright, thanks. I am rapidly moving up the career ladder and working on things I am interested in. Dipping my toes into data analysis. Almost broke an entire Pyspark cluster by using CROSS JOIN aka The Bad Join
I discovered the upper limit of AWS compute capacity by doing that
3
 
nice to see you here from code review ;). — rho 58 secs ago
possible answer invalidation by Peilonrayz on question by Enrico Mosca: codereview.stackexchange.com/posts/242996/revisions
 
0
Q: How do I create accordions without using repetitive functions? - Vanilla JS

Jon NicholsonI'm writing code for some accordions at the moment, using some simple vanilla JS (strictly not jQuery, has to be vanilla) and it feels like my code is really inefficient. Here it is at the moment: // Variables let down = document.getElementById("chevron-down-1"); let down2 = do...

0
Q: Created a Coffee machine project using python oop

Akanksha JainMachine.py It class containing some default values class Machine: dict_coffee = { 'Cappuccino' : 100, 'Cafe Latte' : 200, 'Espresso' : 300 } quantity = [2,2,2] power_status = False Coffee_Operator.py operator class. Here operator c...

-1
Q: LSTM Neural Network

Vincent R. PanahiI have tried to build a neural network comprised of ten neurons, but I don't know if my code in Python is any good. I applied the equations for an LSTM neuron in the code, for it to work, and then I made a network of neurons. Would this work or is it just a failed attempt? h = hidden layer num...

 
10:29 AM
@Duga Sole answerer :)
 
11:05 AM
Hi! Welcome to SO! This site is not really a good fit for code reviews or how to's. Instead we're giving specific answers to specific questions. Try to narrow down the problem to a specific piece of code, include that in the question, describe what you think it is supposed to do and what doesn't work, then we'll be glad to help :) — Jonas Wilms 37 secs ago
 
@DanPantry that sounds ... expensive
 
11:19 AM
Let's, uh, wait and see
As it turns out AWS will indeed scale to 3TB RAM if you tell it to
 
11:41 AM
0
Q: Code optimization: Java - find unused methods and class file

Madhubala GowthamanIs there any online tool or open source available to find the unused methods and class is there in java source directory? example: public class myClass{ public void myMethod(){ //MY CODE IS HERE } public void mySecondMethod(){ //MY CODE IS HERE } } In the ab...

0
Q: How do I quickly look for parents containing their own code as child?

Tim StackI have tree-like data that is constructed of Parent codes that contain Child codes which may act as parents themselves, depending on if they're marked as "SA". This data is present in an Excel sheet and looks like follows: | Tree Level (A) | Code (B) | Spec (C) | Comm. Code (D) | Parent Code (...

 
Aren't you taking up a full box alone at that point?
 
12:05 PM
0
Q: Should I use object attributes inside methods or wrap them in functions an pass the attributes as parameters?

Omar Farragclass Command(BaseCommand): """ BaseCommand provides `names` attribute """ def __init__(self, s_string): self.s_string = s_string def search(self): return [x for x in self.names if self.s_string in x] VS class Command(BaseCommand): """ BaseCommand ...

 
This question really belongs on codereview.stackexchange.comJames_D 31 secs ago
as for me it may not be good place for your question. Maybe ask on Code Reviewfuras 49 secs ago
 
12:29 PM
0
Q: Why is my Python thread pool faster than my Go worker pool?

loudcrowdI have recently been digging into understanding Golang concurrency, in particular the use of channels and worker pools. I wanted to compare performance between Go and Python (as many have done) because I have mostly read that Go outperforms Python with regard to concurrency. So I wrote two prog...

 
@DanPantry Meh, CROSS JOIN isn't a bad thing if used properly. It's just easy to abuse.
I'm getting so tired of people saying "<x> is bad" in this industry. Pull your head out of your rear for 10 seconds and understand that the fact that <x> exists means that it was, and likely still is, a good answer to a problem.
 
@DerKommissar I have a feeling it was a joke :)
 
 
1 hour later…
1:42 PM
0
Q: Read value stored in a particular cell of a Pandas DataFrame

John SmithI have written the following line of code to look up the value stored in a particular cell of a Pandas DataFrame: row_index = curve_config['Curve Name'] == curve_name curve_type_df = curve_config.loc[row_index]['Curve Type'] curve_type = curve_type_df.to_string(index=False)[1:] The context in ...

 
1:59 PM
CROSS JOIN is not bad, but CROSS JOIN is very bad on hundreds of millions of records
 
2:12 PM
So, could you post the code and ask a specific question. Code review is elsewhere. — mrblewog 38 secs ago
 
@DanPantry Ehhh....I still disagree there. I have a query for work that has 3 CROSS JOIN's in it, and creates a several-hundred-billion row result set, but we use it to filter them down to a single row. We're basically joining every client with every product with every zip-code in the U.S., and then pulling the fee for the Client + Product + Zip for the single row we look for. As long as your query is structured properly, SQL will only do the needed joining.
Because we filter down to the Client + Product + Zip, SQL doesn't actually do any other cross joining, just what's needed based on the filter clause.
 
2:35 PM
I can tell you for sure that the cross join was a bad idea because it balooned memory usage to 3TB and broke analytics for everyone for a few hours
This is not a matter of opinion; my usage of cross join was bad :P
hundreds of millions of records * ~45k
 
Your usage may have been bad, but cross join is not bad. It's just easy to abuse/misuse.
Just like Functions, SP's, Views, etc.
Computed columns aren't bad, but I can show you how to abuse them to do things that should never be done.
My point is I am really, really tired of people saying "<x> is bad" because it's possible to make a major mistake with it.
 
2:51 PM
Greetings, Programs.
@DerKommissar Almost any really powerful language feature can be abused to do things that should never be done. Operator overloading
 
Even non-powerful features can be abused.
You can abuse short-circuiting logical operators, even though they seem so innocent.
 
Power corrupts, and more power corrupts more.
 
I love abusing iterators, see it's so readable! lambda it: any(it) and all(it)
 
Hmm, I've never thought about abusing short-circuited logical operators. On the other hand, I pretty much only use the for expressions that start with "variable != null" or the like.
 
I should probably go back and edit that answer...
 
2:58 PM
Fun fact: and takes precedence over = in PHP, so $var = true and false will set it to true, even though true and false is false.
It's equivalent to ($var = true) and false.
Does that make and bad? No...just means you need to take care with it.
 
"Takes precedence" means goes first, so that statement is wrong.
 
You're right, I have "takes precedence" backwards, the point is the same.
 
@DerKommissar what in the world were they thinking having the assignment operator have such a high binding precedence?
that's like having $var = 2 + 3 assign 2 instead of 5
 
I can't tell you that, I don't know why and and && exist either, but && and and don't work at the same precedence levels.
There's and + &&, or + ||, then xor and ! which are obviously different/.
 
Sounds like I need to give PHP a hard pass because it's just stupid.
 
3:02 PM
Someone needed it, so it's there.
 
@Vogel612 I'm genuinely not surprised, all I've ever heard is that PHP is jank central.
 
It just has a lot of legacy bits and bobs.
Part of that is because the development of PHP was driven by what people needed, as they needed.
As opposed to Java, Kotlin, or any .NET language, where some "overlords" said "the language needs this, regardless of whether someone wants it or not."
Sure, most of the features turned out nice, but some of them are just ugly.
 
Actually anymore I can't even say most of the features turned out nice. C# these days is a collection of garbage.
But hey, that's the future. We have to have every language be a "one size fits all" disaster. God forbid we let languages be good at a single thing and make them cross compatible.
 
@DerKommissar That's why Scala is a better version of Java than Java is.
 
3:20 PM
-1
Q: Is there a way we can optimize this stored procedure?

John BristiwThis stored procedure is taking a longer time to complete and is creating multiple blockings on the database. Can someone have a look please help me optimize this? CREATE PROCEDURE [dbo].[sp_EOMWriteToHistoryResetMeterReads] @AccountID as int, @CurrentMonth as VarChar(3), @CurrentYear as Va...

 
Three computers, four monitors, three mice, three keyboards. Great way to confuse yourself.
 
@Donald.McLean would a KVM switch (or multiple) help?
 
I'm not sure it would. I recently moved the computers around so that the cameras on my work computer are not facing directly at my windows, since we're being strongly encouraged to add video in some meetings. Now things are in a different place from where I'm used to them being. I'll adjust eventually.
All the mice are wireless, and one of the keyboards is too. The other keyboards are the built in laptop keyboards.
 
3:38 PM
@Donald.McLean @Donald.McLean For a while I had 3 Linux computers, 1 Windows 8 machine connected to a single monitor, mouse and keyboard through a KVM switch, it wasn't confusing at all. That may not suit your needs.
Towers, the laptops were connected by internet.
@Kaz Good evening
 
Kaz
@DanPantry Glad to hear it :)
Out of curiosity, what's the going rate for a good data analyst these days?
My company finally got the message about me being underpaid when I quit and allowed them to persuade me to stay, on double my previous salary. Plus equity. But it never hurts to keep an eye out for other opportunities.
 
3:58 PM
I don't know, Kaz. I'm not a data analyst, I'm a security engineer :)
I earn 68k euros plus a variable bonus annually between 0 to 12.8k euros (based on performance, it is expected I will hit the 12.8k euro mark) plus an additional bonus every year of about 5k euros until 2023
so total comp would be 85.8k euros per year in Dublin for a mid level security/software engineer
 
4:12 PM
0
Q: What can I do to remove the lag that I get cause of my Game Loop?

Nike_SchuhI need help fixing my gameloop. Sometimes the game feels very laggy and I think the reason is that the tick() method is called slower then the render() method. What I want is that update is called as often as possible and the tick method gets executed with some kind of value that determines how f...

 
I'm a "senior software engineer" though from a what-I-actually-do view, I guess you could call me a full-stack web app developer.
 
I kinda.. do everything I'm asked
I'm a full stack software engineer, security engineer and I'm currently doing data analysis as well as business risk analysis
in addition to being a community manager
At any other company I would likely be a senior engineer, though
 
The author didn't specify such case. Again this is not codereview stack exchange — Józef Podlecki 58 secs ago
possible answer invalidation by Eliahu Aaron on question by Darek Majcherczyk: codereview.stackexchange.com/posts/233083/revisions
 
4:41 PM
> Reviewed this Dec 1 '19 at 14:36: Reject
Why's it getting accepted now?! :O
 
@Peilonrayz maybe some OPs just don't engage in the site like we do...
 
@SᴀᴍOnᴇᴌᴀ Why would the site give them a notification of a rejected edit from half a year ago
 
@Peilonrayz the OP got a notification of a rejected edit?
(for posterity) and @pacmaninbw and @Mast
 
@SᴀᴍOnᴇᴌᴀ How else would they see it?
 
well the OP should always get a notification of the suggested edit right, since, even if it is rejected by the community, the OP can approve it (as was the case here)
 
4:52 PM
@SᴀᴍOnᴇᴌᴀ Yes.
 
@SᴀᴍOnᴇᴌᴀ sigh
@Peilonrayz I'm guessing here, but perhaps there was an e-mail with a suggested edit link in it that never expired.
 
0
Q: Smallest and largest palindromes

GraphicalDotI am new to rust and this is a program that finds out the palindromes between a range. All tests have been passed but this program is really slow in finding the 4 digits Palindromes. This is an exercism exercise and Palindrome struct and struct methods new, value, and insert must be used in the ...

 
5:15 PM
I am working on a simple C project for my uni and after finishing it, I'd love to get it reviewed since I am more acquainted with Java styles, conventions etc and have hardly any experience with C but posting my project on CodeReview may lead to it being plagiarised by others, so what should I do?
 
@Archer To post on Code Review you have to provide the code in the body of the question. If you don't we can't help you. All we can say is your princess is in another castle.
3
 
5:33 PM
@SᴀᴍOnᴇᴌᴀ The edit should have been made by the author, not some other user. It would change reviews.
 
@Archer If you don't want to post uni code, then maybe generate code for something else that you are comfortable posting, e.g. code challenges
@pacmaninbw Agreed ... apparently the OP approved the edit today
 
@SᴀᴍOnᴇᴌᴀ And it still hasn't been applied.
 
Good.
 
@Duga rolled back by Peilonrayz
given the rate at which the OP takes actions it could be a really long time before there would be an answer to this question (if ever)
Did you write this or did you find it elsewhere? — Mast Nov 29 '19 at 19:23
but I'm not holding my breath for that
 
5:44 PM
Monking
 
@SᴀᴍOnᴇᴌᴀ There already is an answer.
Actually not such a bad answer.
 
@pacmaninbw I meant an answer to the question Mast asked in a comment (that I cited after that)
 
5:57 PM
0
Q: Controller in Laravel with parsing, creation and relationships

AdamI have a store method on my TrainingsController that stores a training session. A training is made up of many attributes and some relations. I am using a form request for my validation. public function store(StoreTraining $request) { // Parse Trainer from request if (is_array($r...

0
Q: Designing a public facing Java interface for future extensibility (API evolution)

Arch101I develop an in-house Java framework. I provide an interface so that my end users can provide their own custom implementation (i.e. plugin/SPI). public interface SomePlugin { SomeResponse doSomething(SomeRequest request); } There are a number of small configurations to be made, some requir...

 
6:19 PM
@SᴀᴍOnᴇᴌᴀ It's asked and answered. Forget it exists and move on, I guess.
The Q.
Comments are only comments. If I'd take it personally every time I'm ignored, lol.
It happens.\
 
0
Q: Finding the class to which the IP address belongs

Vijay AntonyI have tried the code for finding the class of the IP address the user inputs, and printing the network and the host bits in the IP address. Could someone please review this approach and provide suggestions. Thanks:). #include<stdio.h> #include<stdlib.h> #include<string.h> #include<sys/socket.h>...

0
Q: Justifying text in python

d4rk4ng31Well, its my try to solve the PS mentioned here. Please review justifyWidth = input("Enter the width: ") wordList = [word for line in open("text.txt") for word in line.split()] statementList = list() statement = list() filledPlaces = 0 for word in wordList: if filledPlaces + len(word) <= jus...

 
6:45 PM
Hey there!
 
0
Q: Sudoku-Solver with GUI - follow-up

vulpini99Background A few months ago, I asked this and this question on my implementation of a Sudoku-Solver. I now tried to further improve this little project. Changes Minor GUI-changes Input validation "Reset"-button Check if solution is unique (This question on stackoverflow helped) Naming Structu...

 
what do you think should be good?
- Fill the buffer & flush it out at once
- Fill one buffer at a time & flush one at a time. Repeat.
ofc, profiling would be good, but veterans of this site should have something to say ?
 
I think you should profile
7
 
How big is the buffer?
And how quickly are you filling it?
 
6:51 PM
@DerKommissar that was in python, I'm writing in C++ just to improve the perf, so can't tell right away
but final file size in binary mode was ~128mb
in ascii, ~500mb
@DerKommissar bigger & more complex the mesh is, preparing the data takes more time
 
Meh, as long as you're not flushing an exorbitant amount it should be fine
 
"it" ?
 
Whichever you choose
 
in python it gets really wild.. peak memory usage is four times the final file size
so 2 gigs
 
Flushing 100 meg at once is a bit much, why not keep it smaller?
 
6:55 PM
Best we can do is guess at it
 
@DanPantry that should this site's motto
@Mast oh wait, I clearly put something wrongly
buffer meant one type of data ready to be flushed
 
@ankii So why aren't you doing it?
 
@Mast it's past midnight & I felt like chatting
3
 
lol
 
@ankii so vertices, then vertex normals, then texture, then faces
 
6:59 PM
I just looked up the docs for timeit and now I feel like facepalming. I always used it so janky when I could have just done timeit.timeit('fn()', globals=globals()) 🤦
 
what's globals ?
another function or some magic to get all required variables into timeit, for fn ?
 
Yes, globals is a function that gives you a dictionary of all your globals. It's to get fn into the timeit.
Before I was doing something like timeit.timeit('fn()', 'from ??? import fn') wat
 
whenever I needed to time something , I went the good old
a = time.time ()
// code
b = time.time ()
print b-a
 
Tbf timeit just does that under the hood
 
good night!
 
7:23 PM
Closed.
 
7:37 PM
FYI for working code that you want to optimize, this site is a better place: codereview.stackexchange.comjss367 40 secs ago
 
7:59 PM
0
Q: Entity Framework 6 using Repository and Unit Of Work Patterns

mark02I have the following method that contains the logic for saving Nunit tests to a mysql database: public void AddModelToDatabase(FileReportModel Model, UnitOfWork UnitOfWork) { var project= UnitOfWork.Projects.AddProject(); var namespace_id = UnitOfWork.Namespaces.AddNames...

 
8:24 PM
0
Q: How does one increase effeciency of the memory functions of CUDA code?

tuskiomiI have the default code snippet that comes with the nvidia nsight eclipse V10.2, but I've modified it to do some profiling: /* ============================================================================ Name : Project1.cu Author : [] Version : Copyright : If you find this...

 
@eusoubrasileiro, I see he got a useful answer on scicomp. I haven't looked at that board before. More often I object to referrals to codereview. numpy questions on SO cover both debugging and enhancement ("vectorization") topics. — hpaulj 45 secs ago
 
8:48 PM
-1
Q: Is it running on a linear time complexity?

BobbyWhat my code try to do here is to sort items trough 2 dictionaries. If they are similar or the same, I create a new list to append them. The test file is relatively big, around 2000 data each dictionary. My concern is that i need to maintain a linear time complexity trough out the code and i am...

 
9:13 PM
0
Q: User Access Authorization for Web Resources

Daniel SeguraIm refactoring a large internal legacy application and part of the stuff I want to get rid is the widespread code repetition. I'm starting with the way the website checks if a User can access a route e.g., '/admin` and which parts should be rendered or not. I made this little function and wo...

0
Q: How can I use Task Async Await to read files content from multiple directories recursive?

Benzi Avrumiusing System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.IO; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows.Forms; namespace Search_In_Files { public partial class Form1 : Form...

 
9:26 PM
Looks like a question for Code Review to me ... — Run_Script just now
 
@CaptainObvious makes me think of this answer because there is a variable for each letter of the English alphabet...
 
@SᴀᴍOnᴇᴌᴀ Wow, just wow. That's a cross language duplicate :O
3
 
10:29 PM
It also makes harder to merge unwanted code to the master branch. -- this statement is not accurate. Merging in Git is easy. What could keep your code outside the master branch is a policy enforced by Github, Gitlab, Bitbucket (or whatever software runs on the server that hosts the Git central repository) and is properly configured for team work. These are not part of Git itself, they are extra packages that wraps Git and provides a nice UI for administration, constraints, pull requests and code review. — axiac just now
 
10:55 PM
0
Q: js: if else then store data (easy)

erkster23I just need some help rewriting this so I don't spam my db with one of the values being null! sad for me to have to post and ask this but I'm trying to better understand this all byte by byte :) ws.on('update', function(message) { // Rewrite this entire bit to save the data in each burst...

 
11:22 PM
Hey Adil, welcome to SO. For questions of this type, I'd recommend checking out code review instead, as that's more aimed towards coding habits, critiquing etc. Happy coding :^) — Diggy. 48 secs ago
 
11:46 PM
"Was it incorrect to call upper() on the input?" Do you mean lower()? If so, then this is a common way to allow case-insensitive input and is fine. For more feedback, post your working code at our sister site Code Review. — Code-Apprentice 30 secs ago
 

« first day (2581 days earlier)      last day (1433 days later) »