« first day (2298 days earlier)      last day (1704 days later) » 

12:00 AM
RELOAD! There are 6248 unanswered questions (89.8380% answered)
 
 
1 hour later…
1:20 AM
possible answer invalidation by Jamal on question by Rex Overflow: codereview.stackexchange.com/posts/225464/revisions
 
 
2 hours later…
3:42 AM
0
Q: Codeigniter update column if empty then update

hanafaraI have problems when my output only update column file1. I want to check if column file1 has value then update file2, and the otherwise if file2 has value update columns file1. I hope you can guide me what's wrong with my code: function update_files($data, $id){ $this->db->where('id',$id)...

 
your code is not as optimal as it could be ... i would head over to codereview.stackexchange they are probably better at optimizing this stuff ... for starters i think if list1 was a generator that might be slightly faster ... you can probably also eliminate large chunks of the test set by some methods — Joran Beasley 1 min ago
You might want to post on Code Review, I would suggest to loop through elements in document.querySelectorAll('select') and assign the event listener to each element. In setWeather you could differentiate between the elements by introducing a parameter to setWeather(event). Also, you might want to look into jQuery which makes things a bit easier. — shrys 21 secs ago
 
4:21 AM
 
4:44 AM
0
Q: Missing number in array

太極者無極而生This is from LeetCode: Missing Number Given an array containing n distinct numbers taken from 0, 1, 2, ..., n, find the one that is missing from the array. Example 1: Input: [3,0,1] Output: 2 Example 2: Input: [9,6,4,2,3,5,7,0,1] Output: 8 Note: Your algo...

 
Monking
 
If the code is working this question should rather go to codereview.stackexchange.comMarkus Deibel 21 secs ago
 
5:04 AM
0
Q: SQL Sub-query with running total optimization

h3nThe codes below get the rows of data until it reaches the total running quantity limit. Notice that the SQL uses sub-query. select *, sum(Quantity) over (order by id) as RunningQty from #PurchaseOrderProducts. I'm worried that the sub-query would get all the data from the table. Is there a way t...

 
5:42 AM
Monking
 
6:03 AM
0
Q: C++ SFML Animation System

Daniel GI'm attempting to write an animation system on top of SFML, and I've come up with a design where I can wrap sf::Drawable objects into a RenderComponent class, and the RenderComponent class can be given an Animation object at any time, which will overwrite a previous animation if one exists. Here ...

 
6:15 AM
Perhaps you want codereview.SE instead of stackoverflow? This question looks a bit too broad. — SOFe 15 secs ago
I'm voting to close this question as off-topic because it belongs to codereview.stackexchange.comP0W 49 secs ago
 
7:28 AM
> the code works, however
Either it does or it doesn't work.
 
@P0W If it works, yes. But it looks like a feature request the way it's written now and those are off-topic at Code Review. Please see their help center. — Mast 44 secs ago
 
 
1 hour later…
8:41 AM
-1
Q: Simulating Frisbee trajectories in Python

Kouta DagninoSo I've been trying to simulate the trajectory of a frisbee in flight thrown with different angles of attack/initial velocities. The differential equations used for the code are: $$\frac{dv_y}{dt} = k_L v_y^2 - g$$ $$\frac{dv_x}{dt} = -k_D v_x^2$$ where $$k_L \text{ is the transformed coeffici...

 
9:41 AM
0
Q: Basic Stack in C++ Using Array

etpcI wrote a stack class in C++ using arrays of fixed width. Could anyone review my code ? I didn't comment on any of the functions, because I thought class itself is self explanatory. Is it a wrong approach or which kind of comments can I write? #include <stdlib.h> #include <iostream> template <...

 
10:20 AM
-1
Q: Champions League Simulation

woody101298Here is my first attempt at creating a full Champions League Simulation, including drawing the groups and subsequent games and playing all matches. The code is very, very long and I am sure there must be a more concise way of writing it. One problem I could not get around was when drawing the g...

 
 
2 hours later…
12:07 PM
probably better suited for codereview.stackexchange.comMikeT 22 secs ago
 
12:25 PM
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 9 secs ago
 
12:39 PM
0
Q: How can I design a class layout that can elegantly be invoked statically and dynamically in PHP?

i336_QUESTION IS BEING EDITED+FIXED, PLEASE WAIT I'm working on a small logger class, and want to try to improve my ability to wrangle mastery of PHP OOPs. The logger itself is uninteresting, but makes for an ideal illustration of the kind of top-level, first-class system that might warrant Being ...

0
Q: list of dates with special formatting

shamalaiaI have a code that calls many times a function returning a list of the dates between two dates formatted as ('0001-01-01 00:01:00'),('0001-01-02 00:01:00'), ... The current solution is: import numpy as np import time from datetime import datetime beg = datetime.strptime('01 01 0001', '%...

 
@Tom would it work if they are Double . This is the entire code [codereview.stackexchange.com/questions/226346/…Miriam List 57 secs ago
 
12:54 PM
Monking
 
If your code doesn't work then it isn't really a candidate for Code Review. A minimal reproducible example would give enough information for someone to run the code and see the same problem. You have given no useful information about Arr2 even though it is central to the problem. You are apparently trying to add 1 to a type for which +1 is undefined. Why you are doing that and what you should do instead we literally have no idea, because you have not given us anything to go on. — John Coleman 12 secs ago
 
@Toby Speight Looks like an API to me : codereview.stackexchange.com/questions/209827/…
 
1:18 PM
1
Q: Count the frequency of items in an array

YexingysThe question is: Write a program that prompts the user to input ten values between 80 and 85 and stores them in an array. Your program must be able to count the frequency of each value appears in the array. So, is there have any more efficient ways to present the count for frequency number betwe...

 
possible answer invalidation by shamalaia on question by shamalaia: codereview.stackexchange.com/posts/226417/revisions
 
@Duga Formatting fix.
 
@ John Coleman , @JNevill. I had the code by it was way to slow so people from community helped me modify it. However now I want to modify as I posted it in here [codereview.stackexchange.com/questions/226346/… . I was trying to find a way to do it and thought that using an increment would help me on solving the problem.Sorry for the inconvenience — Miriam List 42 secs ago
Well the ID's can expose infromation about the data size nothing more nothing less. You can better post the source code off the PHP and Javascript if you worry about security.. But then i think the question is better suited for codereview.stackexchange.comRaymond Nijland 13 secs ago
That being said, I'm not at all sure what you are trying to do here. Your description above doesn't foot with your ask in codereview. You can't increment a string, so I'm not sure why you are trying. Perhaps you are misunderstanding what increment means or misunderstanding exactly what you are trying to increment? A clearer description of what you are trying to achieve here would really help. — JNevill 29 secs ago
 
1:38 PM
0
Q: Sorting, filtering and searching a list using jQuery

mpdcThis is my first time writing so much jQuery, and because of the amount of content on the page, I get a lot of the following console warning in Google Developer Tools as I'm changing filters: [Violation] Forced reflow while executing JavaScript took XXXms A working version of the full code ...

0
Q: PHP User class usability,maintainability,secure

Mourad KaroudiI'm new in oop programming pattern. I created this simple User Class and i'm wondering if it : Is following oop rules and logic ? Is maintaibable ? Is can be tested without any problems ? Can be expanded to a large user class (permissions,etc) ? Is secure ? this is my class <?php class Use...

 
Maybe @VLAZ pretty sure code reviews is out off topic there it more a thoery based website on small code parts.. — Raymond Nijland 36 secs ago
 
1:58 PM
1
Q: Bank ATM App Mockup - Implementing Domain-Driven Design (DDD)

Steve NgaiI have created this bank ATM app mockup which I believe implement some Domain-Design Design layered architecture, repository pattern and uow pattern, if not fully. In my solution, I have these projects (layer): ATM.Model (Domain model entity layer) ATM.Persistence (Persistence Layer) ATM.Applic...

 
2:18 PM
-2
Q: Is it possible to refactor and convert nested ifs into ternary expressions?

Dylan GodfreyI have ifs with similar logic for querying the database. Is it possible to reduce the ifs into ternary expressions? protected override List<SimpleExpressionBase> GetAdditionalFilterExpressionsForGET( EntityQueryParametersForGet queryParameters) { var expre...

1
Q: Java Networking Framework

imjxshSo I've just written a framework that is supposed to make it easier to create a network-based application (client-server) using the native java.net package. I was wondering if the structure of my code is well understandable and if there are ways to improve my code (in both, readability and perfor...

1
Q: Filtering a list of customers in Java based on three criteria

matvsLet's assume that you need to filter customers based on 3 criteria: name tags assigned to customer customer's location For some reasons you have to do it directly in your program code, without database queries or PL/SQL for that matter. Which of these two solutions do you find better in any t...

 
2:38 PM
0
Q: Convert HTML color to OLE

JoeliusI have this function that takes a string which represents a html-color and returns the OLE value for it. If the string is null or empty or it can't be parsed, it uses a default value. However I have to write that one line containing the default value twice and I don't see how I could remove this ...

 
3:05 PM
I'm voting to close this question as off-topic because posts asking "What do you think of my code?" belong on codereview.stackexchange.com. — Peter B 40 secs ago
 
3:30 PM
my naive algorithm takes a lot of time. Then show your naïve algo. The question might be better suited to codereview.stackexchange.comTheMaster 38 secs ago
 
0
Q: Optimising two for loops in Python

Jessica ChambersI would like to make this code more efficient, I have isolated the problem as being these two for loops: for i, device in enumerate(list_devices): for data_type_attr_name in data_types: result_list_element = { "device_reference": device.name, ...

 
@dfhwze doesn't really look like it, TBH
 
@Vogel612 that last block is the exact pattern of the other answer.
 
no actually it isn't....
and the code is really very much too simple to merit stealing
 
3:39 PM
I'll withdraw my comment then?
 
not really my call to make.
 
@Vogel612 Ok I won't make a point out of it :)
 
possible answer invalidation by Asadefa on question by Asadefa: codereview.stackexchange.com/posts/226352/revisions
 
@Duga no invalidation, but the question is a bit weird
 
posted on August 19, 2019 by CommitStrip

 
3:57 PM
0
Q: Custom ugly numbers and Knight dialer solutions' time and space complexity

Manuel PáezI recently solved the Knight Dialer and the ugly numbers problems, but I'm not quite sure if I got the time complexity right; hence I'm requesting the following: 1) Time and space complexity review on both method and explanation on why so. Knight dialer: (movs map has all the possible movements...

 
Monking
 
4:14 PM
Greetings, Programs.
 
1
Q: Sort, slice and rebuild new object with array data

t BookI'm using the matomo reports api to pull out some data in js. For some charts, I'm in the need to sort the array data based on inner property value ("val"), further to get only the 3 highest (Hong Kooong, Munich, Tokyo). Finally, this data should be used for the creation of a new key/val object (...

 
This might also be a good question for Code Review for help optimizing your current solution — G. Anderson 41 secs ago
 
Could someone explain to me why the lack of executable code on this question is ok? codereview.stackexchange.com/questions/226352/…
 
4:30 PM
@pacmaninbw I can't because I don't understand the question.
 
4:45 PM
If perf is important and you believe you have tests that demonstrate a significant difference between a dictionary-based approach and an explicitly-implemented state machine, then you should just use the latter. If you are curious about whether your dictionary-based approach could be improved you can post that to codereview.stackexchange.com. I don't plan to do any more searching for my post...archives of the old newsgroups seem to be incomplete, and there doesn't seem to be much point in digging it up anyway. — Peter Duniho 30 secs ago
 
@dfhwze The OP is asking which of 3 massive structures (they would be classes in most modern languages) would perform the best.
 
5:03 PM
@pacmaninbw I thought he asked about layout of this massive set of structures, rendering the question opinion-based
 
@dfhwze it is opinion based as well.
 
(2) closing votes now ;-)
 
this question rather belongs to codereview.stackexchange.comYour Common Sense 10 secs ago
Not the right tool or place in the process. Do you really want your code not to compile until you've documented it all? Not to debug? The right place for this is in code review, possibly with some help from an automated checkin script. — Gabe Sechan 38 secs ago
I would advise you to check out codereview.stackexchange.com, where questions about better ways to do code that is already working are more-on-topic. This site is for questions related to problems, like code that doesn't actually work. — rory.ap 38 secs ago
 
5:56 PM
0
Q: Sub-Middleware like options builder for an Asp.Net Core Middleware

NkosiBuilding upon a recent question I answered here Simple middleware pipeline builder (similar to asp.net-core) I came across a cross site question Stackoverflow: Adding middleware in Carter framework makes some URL to not trigger which looked like it could benefit from what I had learned from ...

 
6:16 PM
1
Q: Least cost swapping 3

Jan DyczI've decided to rebuild the code with advices from previous topic C++ Least cost swapping 2 I've also decided to change input from passing the file name to passing the content of a file, so i am wondering if the input checking is still correct as in previous version. Please review my code. #incl...

0
Q: Token class implementation

NutCrackerI have implemented Token and FieldToken classes as part of my project and would like to here some suggestions for improvement. First, Token class represents logical operators, relational operators, parentheses, etc. It does not hold a value, only type of the token (e.g. AND, OR, etc.). Here is i...

 
6:32 PM
No offense Martin, but I think I can only agree with the point #6. Your answer does not really answer the question. It looks more like a code review. — Dharman 56 secs ago
 
0
Q: Dynamically generate a constant list in ruby

queroga_vqzI have this class on my project, which I am using to populate a dropdown on my form. I wonder if there is any way to dynamically generate a constant list like the one I have below, since it would be basically 'db' followed by index # frozen_string_literal: true class GatherTaskHost LIST = [...

0
Q: Speeding up function in cython

Alex TI have rewritten my python code in cython in order to speed up it quite a bit. However after checking the code in jupyter it seems that part of it is still compiled as python code, therefore its not being sped up enough. My function is pretty basic, it gets start date, end date and creates array...

 
@Dharman oh yeah it is totally a code review! — Martin 23 secs ago
If your code is complete and work and you are looking for improvement suggestions, it should be on Code Review instead. This site is primarily for fixing broken code. — Carcigenicate 32 secs ago
 
6:55 PM
1
Q: Count the frequency of integers in an array

pacmaninbwI recently reviewed a question here on Code Review. The problem statement is Write a program that prompts the user to input ten values between 80 and 85 and stores them in an array. Your program must be able to count the frequency of each value appears in the array. I coded my own solution ...

 
Hi all readers. I presume @Holli posted this in response to a comment I wrote on an earlier SO. My plan was to do a proper writeup of the race because I thought that would be helpful. I'll still do that tonight if folk don't kill this question. Hi Holli. I apologize. If I'd known you'd be posting code without evidence of a race I would have directed you to post a question at codereview. Hopefully it'll all work out. — raiph 19 secs ago
That is inherently the issue, Daniel. That is essentially a discussion, and SO is not designed for that; I hope that doesn't come off as anything but a statement. If you end up having a coding issue, e.g., you put something together and you ended up using a bunch of nested if-statements and they didn't work, SO would be the place to post to help resolve the specific issue. if you have working code and need to optimize, CodeReview would be the place for you. — Cyril 58 secs ago
 
7:23 PM
@CommitStrip ugh tell us about it
 
It makes sense that you tried (successfully as far as you know?) to eradicate races. And seek a review. But that means the end result, in theory, belongs on codereview not SO. I'm personally of the "whatever works" persuasion. If you get a better response here then that's cool. I'll try to give you what feedback I can when I can here and/or on codereview. It's a heck of a lot of code for SO. I enjoyed it, 'cuz it's well written, but still. I'm not sure why you got a downvote but whoever it was hasn't voted to close, so that's good. I've removed the ipsum text in case that was the problem. — raiph 27 secs ago
 
7:41 PM
In the meantime I've upvoted this question to help it along as a separate question even if it might end up doing better in terms of answers on the codereview site. — raiph 23 secs ago
Also if this is working and you would like a review, please go here. — Çöđěxěŕ 11 secs ago
In the meantime I've upvoted this question to help it along as a separate question. I can see it maybe getting closed (I note someone's just voted to close it as "too broad"). And I can see it doing better on the codereview site if you post it there and P6ers with concurrency chops know that the post is there. Hmm. In fact I really like that as an idea. If you post it, then we can mention it at other locations, eg r/perl6. — raiph 48 secs ago
 
1
Q: Basic Queue in C++ Using Array

Erdem TunaI wrote a queue class in C++ using arrays of fixed width. Could anyone review my code ? I would appreciate any comment and recommendations. It works like a circular queue, so I handled back and front pointers in that manner. #include <stdlib.h> #include <iostream> template <class T> class Queue...

 
8:05 PM
I think you should split your questions. Question #1 is on topic for StackOverflow. Question #2 would be better at codereview.stackexchange.com after you have a working implementation. — Freiheit 24 secs ago
 
0
Q: How to make my backtraching sudoku solving algorithm in Python faster?

AlphaI wrote a backtracking Sudoku solving algorithm in Python. It solves a 2D array like this (zero means "empty field"): [ [7, 0, 0, 0, 0, 9, 0, 0, 3], [0, 9, 0, 1, 0, 0, 8, 0, 0], [0, 1, 0, 0, 0, 7, 0, 0, 0], [0, 3, 0, 4, 0, 0, 0, 8, 0], [6, 0, 0, 0, 8, 0, 0, 0, 1], [0, 7, 0, 0, 0, 2, ...

 
8:35 PM
@pacmaninbw It's not. Close as lacking context for not having any actual code in it.
DMGregory migrated it.
 
If this is working code and you're just looking for feedback on the structure I would suggest posting on codereview.stackexchange.com. as it stands this is primarily opinion-based and is likely to get closed here on SO. — wpercy 1 min ago
 
8:54 PM
0
Q: Adding more functionality to tkinter for projects

hunter.loganThis code adds the following functionality to the basic tkinter.Tk() class... settings-file interaction for persistent application settings fullscreen functionality using F11, can remember last configuration or be defaulted removes the need for multiple root.configure() statements removes the n...

 
9:14 PM
1
Q: Return all anagrams for a word matched against a list of words in a file

Răzvan Flavius PandaThe exercise description: Given a ‘words.txt’ file (attached) containing a newline-delimited list of dictionary words, please implement a small command line application capable to return all the anagrams from ‘words.txt’ for a given word. You can use any Scala library of your choice, no...

 
10:00 PM
possible answer invalidation by emadboctor on question by emadboctor: codereview.stackexchange.com/posts/226363/revisions
 
10:13 PM
-1
Q: Attempting to draw an sf::Text to the window crashes program

Darien MillerSo as I was in the process of revisiting my older SFML projects (2 -3 months old) to see if I can recompile them to get an updated executable, I noticed that each program that utilized sf::Texts was throwing a particular error. Once I closed the window, an exception was thrown and Visual Studio o...

0
Q: JPA Embedded or just use String?

Archimedes TrajanoI was wondering if I should bother with @Embedded or just use a String to represent a typical String value. Here's my code for a Localized lookup key @AllArgsConstructor @Data @Embeddable @NoArgsConstructor public class Localized implements Serializable { public static final String KEY_COL...

 
10:33 PM
You can post the slow part of your macro for review - it may be slow by design. Note here though. There is a site for code review :) — urdearboy 24 secs ago
 
0
Q: Excel's Dynamic Array Functions...In VBA (No Win 32)

rickmanalexanderIn recent months I have been trying to figure out how in the world one can mimic the functionality of Excel's New Dynamic Arrays exclusively in VBA. There are tricky ways to do this using the window's API, (see this link), and I have also found that one can utilize ADO with Querytables (see this ...

 
11:23 PM
If you can reduce you code to only a few elements (2 or 3) and post it on the codereview stackoverfow. There is probably somebody who is willing to do a (harsh) review for you. — second 33 secs ago
 
0
Q: Work order spatial query

User1973I have a script in a Work Order Management System (Maximo) that performs a spatial query. Details: Takes the X&Y coordinates of a work order in Maximo Generates a URL from the coordinates (including other spatial query information) Executes the URL via a separate script/library (LIB_HTTPCLIENT...

 
11:52 PM
0
Q: Quicksort with Insertion Sort and Improved Pivot Selection

markspaceHere's a Quicksort I had fun writing and improving, so I thought I'd post it here. In my (brief) testing it's about 15% to 20% faster than Java's Arrays.sort(). The sort routine is a fairly vanilla Quicksort. The main improvements are to the pivot selection, and the Quicksort switches to an In...

 

« first day (2298 days earlier)      last day (1704 days later) »