« first day (1969 days earlier)      last day (358 days later) » 

12:00 AM
RELOAD! There are 5623 unanswered questions (89.8624% answered)
3 hours later…
2:53 AM
Q: Method for creating and traversing a BST while also getting it's depth and width.

RickThis is a Class for creating and traversing a BST while also getting its depth and width. I feel like this can be factored down into something more elegant and shorter I also feel like the overall design can be improved. class BinaryNode { constructor(val) { this.val = val this.le...

3:30 AM
Sunday must be the new Monday....
4:14 AM
Q: c++ priority queue to vector conversion

RohanI am trying to implement heapsort and in the last line where I am trying to pop the priority queue so i can update the sorted value in the vector. But when I run the code it gives me an error which is void value cannot be ignored as it ought to be x[i] = heap.pop(); void heapsort(std::vector<T>&...

4:52 AM
Requests for feedback on working code are off topic on SO. You may get better luck on CodeReview. — DYZ 50 secs ago
6:00 AM
Don't expect a tool to find all problems with your code. In tricky cases they can only use some heuristics. Making the rules too strict will lead to a lot of false positives. It is maybe better to do some code reviews. — Henry 52 secs ago
Q: Web page's semantic elements

SStevenI request a review of the following web page, especially on the use of semantic elements: https://jsfiddle.net/SSteven/qt9d2sfw/ The HTML5 code is: <!DOCTYPE html> <html> <head> <title>Semantic page</title> <meta name="viewport" content="width=device-width, initial-scal...

Request for re-open votes, question was changed significantly enough to make clear it might just work.
6:50 AM
possible answer invalidation by D.Austerus on question by D.Austerus: codereview.stackexchange.com/posts/203964/revisions
7:08 AM
If you have questions about the quality of code, consider posting our question the code review forum. — TomBombadil 12 secs ago
@Duga That's vandalism.
@Duga He has learned his lesson :-)
7:24 AM
This might be better suited in codereview.stackexchange.comPhilipp 16 secs ago
This might be better posted on codereview.stackexchange.comScriptable 52 secs ago
7:39 AM
Also this is better on codereview — Saruman 1 min ago
8:16 AM
Technically correct, but you might fail every code review/job interview with that answer! — Gyro Gearless 37 secs ago
1 hour later…
9:24 AM
Q: how to retrieve data from foreign key in php mysql?

krishna0001$query_importer1 = "SELECT item_name FROM items where item_id ='".$row1["item_id"]."' limit 1"; $result_importer1 = mysqli_query($conn,$query_importer1); while ($row = mysqli_fetch_array($result_importer1)) { $item_id = $row['item_id']; $item_name = $row['item_name']; echo '&...

9:50 AM
SO isn't meant for code review. Please tell us what you expect to happen, what isn't happening, and what you have already tried to fix it? — evolutionxbox 49 secs ago
10:01 AM
This might also be a candidate for Code Review. — Florian Brucker 27 secs ago
I'm voting to close this question as off-topic because it probably belongs in Code Review SE — Vittorio Romeo just now
It would be better to ask this question on the Code Review Stack Exchange, since that is precisely what it's meant for. — dandan78 58 secs ago
Hi Ryan, welcome to SO. Your question my be better asked at code review. They will be able to help you with better structuring this function — Michael Hancock 48 secs ago
10:58 AM
nulls are a pain in java...
        List<TPropertyMapping> propertyMappings = Optional.ofNullable(serviceTemplate)
whereas in C# that'd be:
var propertyMappings = serviceTemplate?.getBoundaryDefinitions()
    ?? new List<TPropertyMapping>();
well that's doing a disservice to C#, tho...
var propertyMappings serviceTemplate?.BoundaryDefinitions?.Properties?.PropertyMappings?.PropertyMapping ?? new List<TPropertyMapping>();
traversing XMLs is just ugly no matter what way you pull it...
11:17 AM
Q: Javascript code to make Matrix wallpaper

Khushit ShahI am a javascript noob. I did this program for the sake of learning javascript in a better way. the code is to display matrix live wallpaper in the browser. Here is the code <!DOCTYPE html> <html> <head> <title>Hacker Live Wallpaper</title> </head> <body> <div id="wal...

11:34 AM
Q: Take a desired string, iterate through objects to see if it exists in a given field and append a number until a unique string is found

Geesh_SOI wanted to in the most generic way possible write a method in C# to achieve the following. Take in a string, a set of objects, and a function to access the field of a given object Look at all of the strings from the fields of these objects to match against provided string If provided string is...

11:44 AM
@Vogel612 Yup. Make a wrapper, make it good, forget how it works on the inside and use the bloody wrapper.
meh. not gonna rewrite the project twice over at the same time
gotta finish the first rewrite before doing the next
@Vogel612 One rewrite at a time is usually a good idea, yes.
as it stands I'm rewriting the XML traversal from a singleton holding maps over maps over maps of maps of maps and using QName and Strings to using POJOs
12:06 PM
Q: Codeforces: Queens, Again

Kian Leecode review friends/teachers! This is a trivial(no dfs/permutations/backtrace required) n queen problem from codeforces: B. 8 Queens, Again!! input 2 A1 B5 C8 D6 E3 F7 G2 H4 C3 E4 C4 E1 C4 F4 A8 G6 output Valid Invalid Here is my solution: queen.h #ifndef QUEEN #def...

12:18 PM
Hey guys, do you know of any good complex drawing recognition APIs, or am I better off writting one myself :?
I'm voting to close this question as off-topic because it is asking for a code review (and this thus too broad / opinion based). It could probably be adjusted to be on topic for the code review stackexchange. — Quentin 56 secs ago
Q: Coding beginner here, I have created a small and functioning program in ruby, I am looking for someone to help me clean this up

Ryan BarkerI am currently learning to code in ruby. I have created a small program that iterates through a directory of video files and opens one at random. The program is fully functioning (with the odd issue). The aim of my question is to hopefully gain some insight into how I can better structure the cod...

12:34 PM
You should ask for a code review or optimization in code at codereview.stackexchange.comM.A.K. Simanto 19 secs ago
12:55 PM
Q: Non-recursive BFS Maze Solving with Python

RobinI wrote this program to help me understand how BFS and Queues work. (Also DFS if I replace the queue with a stack). It works, but I'm curious how well I implemented the algorithm. Are there any obvious improvements? For example, I notice that there are duplicate values in the Queue. I understa...

1:27 PM
Q: A cross platform function to get current time in seconds with precision of micro second

heLomaNdouble time_in_seconds() { std::chrono::time_point<std::chrono::system_clock,std::chrono::microseconds> tp = std::chrono::time_point_cast<std::chrono::microseconds>(std::chrono::high_resolution_clock::now()); auto tmp = std::chrono::duration_cast<std::chrono::microseconds>(tp.time_since_e...

Q: How to connect a propery class/object with a collection (its database class)?

XavinI'm struggling with organizing my code regarding 'best practise'. In particular how I link a class with its collection class. I've 2 classes: class car { private $color; private $model; private $speed; public function getColor() {} public function setColor() {} public f...

static int[] Bubble(int[] arr)
        int n = arr.length;
        for(int i = 0;i<n-1 ;i++)
            for(int j=0;j<n-1; j++)
                    int temp = arr[j];
                    arr[j]= arr[j+1];
                    arr[j+1] = temp;
        return arr;
Please review the maximum index of i and j for this method of Bubble sorting.
That is i<n-1 , j <n-1
I checked and it gives the correct output but then maybe I havent tried a bitter case yet?
your whitespace is inconsistent. Let your operators breathe
@bruglesco Does that really matter?
Greetings, Programs.
well yes. Readability is extremely important but I am also certain that's not what you were asking, so in that regard no. Not at all.
2:31 PM
@Abcd Matter of personal preference, but if you're part of a team, it's important to follow the team guidelines so the code reads consistently.
after all if you want someone to read your code in order to help you make it easy for them
@Donald.McLean So what's the convention for whitespaces?
@Abcd Most people prefer to see white spaces around operators.
And it's more important in some languages than in others.
Thanx yes - The 'code review' is what I was looking for - will move it there — Johan Brittz 37 secs ago
so why are you using < n - 1? is that because you need to stop 1 index before the last index?
2:35 PM
@bruglesco For i<n-1 because I checked the worst case in which there will have to be (n-1) iterations.
@JoeDG Without a Minimal, Complete, and Verifiable example in a specific programming language like C, for a specific system, talking about optimization isn't very meaningful here. The size of the data types, the presence/absence of data cache, language details etc all matters. I would advice you to make a complete example in C instead and then post it on codereview.stackexchange.com. That site is appropriate when you seek to improve existing, working code. — Lundin 15 secs ago
you could probably do int n = arr.length - 1;
There are lots of languages whose syntax derives from C, and C derivative languages can be fairly terse, which can make reading harder.
For j<n-1 because in the end we will have to compare j and j+1 so if j+1 doesnt exist there will be an error.
@bruglesco Okay.
Also, this look like its designed for worst cases. How can we make it faster? Like for an already half sorted array input?
You have to ask someone with a little more knowledge about sorting algorithms than I
The best optimization for bubble sort is to exit early for a sorted array
meaning if at any time you iterate over the entire collection and don't make any swaps then you can declare the collection sorted and end the function.
2:40 PM
@Abcd You do realize you're in chat, right? We have a site for questions.
Q: how you get both text and numbers, floats, ints, doubles separated by , e.g something, 10.11

AniHow to you get both text and numbers, floats, ints, doubles separated by ,. E.g. something, 11.1 something, 22.2 something, 44.4 from a text file. This is what I have. How to read ifstream doubles and text to vector from each new line, separated by ','. if ( myFile.is_open( ) ) { while ( get...

2:59 PM
remove the static modifier on all classes. it is only required when manipulating a nested class. top-level classes don't need it. also, make your classes public, that enable cross-package visibility. and then? ask on codereview.stackexchange.comspi just now
@CaptainObvious This answer seems related.
Odd posts.
Q: Template needs professional scrutiny

Johan Brittzhttps://www.dashroadmap.org is a template that I want to use for multiple pages. Before I start loading data I want to be sure the template is as good as can be – I’m just an enthusiastic amateur at best. The website will involve continuous input of a lot of data so I would like the template c...

Q: Create thread for piece of code that can be stopped in the middle (Android Studio)

VipasanaI'm new to android development and I want to create a button to start a tempo beats (like metronome) and stop when clicked again (one button for both start and stop). When I click the button it starts playing 5 sounds one after another in one second delay and repeating that 5 sounds loop until I...

3:15 PM
@Mast he/she posted that code on some questions on SO as well.
Thanks, I'll move this over to codereview section — Eric Nguyen 11 secs ago
@Heslacher With enough links that might warrant a mod flag for suspicious behaviour.
IMO he/she wants to ask a question but couldn't work out how to do it properly. The question itself had been his/her last action.
3:37 PM
Q: MVC with JavaFX

Clem LemI'm making an MVC application with JavaFX for school. The game is just about some poneys racing horizontally. When they exceed the right border of the screen, they reappear on the left. This is my second time working on a Java project, so I would love some reviews on my code, especially based ...

IMHO, without Java 8+ you cannon escape the loops. Further more, if your code works your question is more suitable for code reviewzlakad 20 secs ago
3:53 PM
Q: Looking to modularize simple Javascript tip calculator

Eric NguyenI've built a fairly simple tip calculator. What I have so far is a bunch of functions to calculate each tip amount and calling each w/ eventListener. It works however trying to see if there's a better approach that would modularize the code. I'm thinking possibilities include passing functions a...

posted on September 24, 2018 by CommitStrip

4:35 PM
Is there a place where we can have a question reviewed before we post it?
@StevenVascellaro Yes, Meta Code Review
Is there a sandbox for questions?
Or at least, you can find there, in the most of the answers on "can I post this?"
@StevenVascellaro No.
Ok, thanks
You could either post it on Meta and try that as sandbox or leave something in this chat.
Feel free to blame me when people start yelling.
4:56 PM
I was considering stripping the example down to two pages instead of three, for a better minimum, complete, and verifiable example
IE: StartPage and SubPage instead of StartPage, PageOne, and PageTwo
@StevenVascellaro Which site are you planning to post on? "Minimum, complete and verifiable" are requirements on Stack Overflow. Here at Code Review we would rather you posted your real code, not some cut down version of it.
The problem with cutting down code is that all too often you end up cutting something that was important about the original.
The core issue of the code is switching between multiple frames. I originally posted my code as an answer on SO. However, I realized my code was difficult to scale when I used it in my own applications
Specifically, circular references if classes were separated into separate files
Let me rework this into a more "real" example
For example, here's a question where the OP asked about finding a perfect matching. What they really wanted was a maximum weighted matching, but they cut out the weights in an attempt to simplify the problem. This meant that the answers were useless.
That kind of questions about improvement of working code are probably better asked at SE Code Review. — πάντα ῥεῖ 18 secs ago
I suppose I'm trying to improve my answer that I gave to a question on SO
Q: Are reviews of code in Stack Overflow answers in scope?

TryPyPySay you spent some time on a code answer to a SO question (example). Is it OK to forward the same code to Code Review or should any comments be left to happen in SO? If it's OK to ask for a review, should we have a protocol for linking the two questions? Edit: I've forwarded some code here and h...

I wrote the code a while back, but in hindsight, I found that the answer I gave wasn't particularly scalable
5:16 PM
When you have the code working (not before). Please take it to codereview.stackexchange.com to show you better techniques. — Martin York 34 secs ago
5:46 PM
Q: C++ shuffle function Works sometimes

GabrielI'm New to c++ and i'm trying to make a "random" shuffle with a vector with It, but my code is not working ALL the time, and i cannot see why. Here's the code: vector <int> shuffle(int size, vector <int> d1){ vector <int> d2; vector <int> ind; int a, val; for (int i = 0; i < size; i++){ in...

If your code works, and you're looking for performance improvements, then you should ask on codereview.stackexchange.comAndreas 21 secs ago
anybody have any opinions about this SQL modeling?
Q: Modeling tabular structure in MSSQL to store data like Excel sheet applying Column inheritance

Guillermo SubiranI've created this database structure to store tabular information (it's a simplification of my real structure but enough to show the point). In it I have Sheets and each Sheet can define different Columns. The important part is that with this structure I can define different datatypes for each Co...

it has a bounty ending tomorrow
I'm not sure what I would say about it ...
6:18 PM
@Mast per se there's nothing wrong with creating one, though @StevenVascellaro
Q: Little css menu with three items

PhaedraI've made this little css menu and I wanted to know if I can make it with better css or anything else. Any suggestion is welcome :) https://jsfiddle.net/5xkghcju/1/ HTML <menu> <menuitem> <a href="#">Menuitem</a> </menuitem> <menuitem> <a href="#">Menuitem</a> </menuitem> <me...

Q: Url query function - on replacing value of the query

milesrI wrote a function that takes a url and an object as a second parameter and return a string that could replace your url. Use case would be for a search function. My issue is, when i do not know how to simply replace the value of the new search, because in my case i'm just concatenating it to the...

@Vogel612 What, creating a sandbox?
I'm voting to close this question as off-topic because it belongs on codereview.stackexchange.com. — Andrei Gheorghiu 56 secs ago
yea, exactly
6:40 PM
By answering off-topic questions you are inviting more "my code is bad, make it pro" questions, which lead to an overall decrease in SO's content quality. Besides, there is a dedicated community for code review. — Andrei Gheorghiu 20 secs ago
7:00 PM
I don't think StackOverflow is the proper place for a code review. There is another site for this. codereview.stackexchange.comRick S 22 secs ago
7:24 PM
Q: PHP - Login/Signup validation class

ManuAlvarado22I am working on a blog with PHP, specially in order to practice OOP. Since the blogging system will handle users, i thought that a Validation class would be a good idea in order to not repeat code for both login and signup validation. So far it works, but as you may notice, i'm using static met...

What is your question? You may have better luck at Code Review with this. — Symon 43 secs ago
possible answer invalidation by NetMage on question by NetMage: codereview.stackexchange.com/posts/204163/revisions
@Symon, no, CodeReview is for reviewing working and complete code. — Gert Arnold 16 secs ago
7:40 PM
Q: Game Server application

CleanCoderI'm trying to write game server core that I can easy extend to use for various games. From simple online Blackjack session, to MMORPG. Long story short, I came up with this solution: Firstly, we have common classes for both Server and Client. Those are simple data structures, probably will need ...

7:56 PM
And, only because I can't edit the previous comment: A guide to Code Review for Stack Overflow users states: "Before referring a Stack Overflow user to Code Review, consider: Is it really off-topic for Stack Overflow? Just because a question is said to have "working code" and seems to be on-topic on Code Review, doesn't mean that it is automatically off-topic for Stack Overflow."Tyler Roper 26 secs ago
Q: How could I refactor this so I use only one query?

Strahinja Saki GajicI have 3 tables: user_group_insurance user_insurance user_policy_group public function saveWithGroup($full_name, $email, $phone_num, $insurance_type, $start_date, $end_date, $group){ $instance = Database::getInstance(); //insert into user $statement = $instance->prepare("INSERT INTO user_ins...

Q: Python optimized base64 writer for streamed files

six8I needed to make a base64 file encoder where you can control the read buffer size. This is what I came up with and it's quite fast. It might be able to be simpler but still maintain its performance characteristics. Any suggestions? def chunked_base64_encode(input, input_size, output, read_size=1...

If you're going to make a case that this user hasn't made a legitimate enough attempt and as such, this is off-topic, then I don't take as much exception to that. Although, in such a case, I'd say your comment and closure vote ("...because it belongs on Code Review") was if anything, misleading. — Tyler Roper 42 secs ago
I'm not good at imaginary scenarios. I know what I'm doing when I'm seeing this code in a code review: rejecting it. In every single case I've seen such code it was some Java refugee trying to come to terms with C++ pointer semantics. There are no practical legitimate cases for such code. When I see one eyes I may change my opinion. — n.m. 26 secs ago
8:32 PM
@Duga seems to be okay
3 hours later…
11:10 PM
Q: Pomodoro Clock - Improving time complexity

GiaFil7So I'm trying to make a Pomodoro Clock in CodePen for freeCodeCamp from which I have some tests (which you can find in my actual Pen here: https://codepen.io/GiaFil/pen/mGogza). However, the tests timeout giving the following message: Timeout of 5000ms exceeded. For async tests and hooks, ens...

Q: Refactoring a class with lazy properties

Philip BlankenauI have a very large class complicated class that I feel could be refactored somehow. I'm just not sure how. Below is a miniature version of the structure of the class. One problem is that the real class is kind of a God class that's holding everything. Notice that I am passing the class to fu...

11:27 PM
Q: How do I code this in Python

Mike AustinCreates two variables: Num_1 and Num_2 Assigns the value 50 to Num_1 and 25 to Num_2 Creates a third variable Total; Total should add Num_1 and Num_2 Determines if Total is greater than 100, between 99 and 50, or less than 50 Using If, Elif, Else statements, do the following: If Total i...

Q: Search System - My code is safe?

Susiindex.php <form action="?p=<?php echo htmlentities($titleP, \ENT_QUOTES, 'UTF-8', false); ?>" method="post" value="" enctype="multipart/form-data"> <div class="input-group"> <input class="form-control searchInput" id="cxnome" name="cxnome" type="text" placeholder=...


« first day (1969 days earlier)      last day (358 days later) »