« first day (2856 days earlier)      last day (71 days later) » 

12:00 AM
RELOAD! There are 7343 unanswered questions (89.6075% answered)
@FranciscoNúñez it depends if the context (e.g. method) is static or not
A: When to use self over $this?

John MillikinShort Answer Use $this to refer to the current object. Use self to refer to the current class. In other words, use $this->member for non-static members, use self::$member for static members. Full Answer Here is an example of correct usage of $this and self for non-static and static...

Q: gpuIncreaseOne Function Implementation in CUDA

JimmyHuI am trying to perform the basic operations + with CUDA for GPU computation. The function vectorIncreaseOne is the instance for the operation details and gpuIncreaseOne function is the structure for applying the operation to each element in the parameter data_for_calculation. __global__ void CUDA...

@SᴀᴍOnᴇᴌᴀ to call class property or consr
3 hours later…
2:46 AM
Q: Class showing a format similar to var_dump v1.0.4

Francisco NúñezFirst of all I must thank for the help given in the previous post: Class showing a format similar to var_dump RC5 Version I have it deployed in a early versio v1.0.4: https://github.com/arcanisgk/BOH-Basic-Output-Handler As they should imagine; Thanks to your help, the main code has had serious c...

2:59 AM
Q: Class showing a format similar to var_dump v1.0.4

Francisco NúñezFirst of all I must thank for the help given in the previous post: Class showing a format similar to var_dump RC5 Version I have it deployed in a early versio v1.0.4: https://github.com/arcanisgk/BOH-Basic-Output-Handler As they should imagine; Thanks to your help, the main code has had serious c...

3:25 AM
Q: Simple To do List

sebas.I am working on a simple to do list and i was hoping if a experienced person could review my code in hope for feedback. I don't use any libraries as i haven't taken time to look about them. I decided to stick with plain js. Thank you for your time. let i = 1; function myFunction(){ n = i...

2 hours later…
5:32 AM
Q: New to programming advice and input on my first "real" Python project. What can I do to get better? best practices?

drebrbSo this is a project I have been working on for the last few weeks. Just started learning Python. Started out with bash scripting and got the itch to learn more. Anyway code fetches covid-19 data from the internet, assembles data the way I need it to, plots it on graphs that are saved as .png fil...

2 hours later…
7:06 AM
Stack Overflow is not an appropriate forum for broad architectural questions like this. You may find the Software Engineering or Code Review sites on the Stack Exchange network more accommodating. That said, a method should only need parameters passed that it needs for its work. If you are finding yourself passing a lot of parameters on a regular basis, your design is flawed. There are countless alternatives to the approach you describe above, many of which much more in keeping with general OOP principles, and which lead to easier-to-write, easier-to-maintain code. — Peter Duniho 32 secs ago
I'd delete for now and try testing any improved solution with large and wee double and many other values. Maybe post on Code Review. I think you would learn a lot. — chux - Reinstate Monica 52 secs ago
8:04 AM
Q: List parsing for 'cut'

slebaronI'm new to Rust and am learning by implementing my own version of cut. This is a snippet that parses the <list> of ranges required for the -f, -b, or -c options. The relevant section of the spec states: The application shall ensure that the option-argument list (see options -b, -c, and -f below)...

2 hours later…
10:11 AM
Q: optimize integer validation

finder2I have some classes with properties, wich could only have numeric values in a given range (e.g. 0 to 8). This should be validated and wrong values prevented with an exception. The given behavior may be implemented without duplicating the given code. There are some ValidatorAttributes in C# but I ...

Q: Simple library for an undocumented archive format

mindoverflowI'm writing a little library for some undocumented file formats. The original program uses a path string to find files in an archive and this function tries to do the same. The archive contains a magic string, an offset into the file list, the data in the files and the file list itself. A entry i...

10:35 AM
This isn't the place for asking whether your code looks good. Maybe take it to Code Review or Reddit. — Jake Jackson 17 secs ago
This is probably "primarily opinion-based" on SO, but you can ask on Code Review (read there help center before asking) — user202729 41 secs ago
2 hours later…
12:18 PM
Q: Query WordPress database, returning an array of rows

ddkThis is one of my first attempts at querying the WordPress database for data, and some my first PHP code ever, so please bear that in mind when commenting. It is supposed find data between two dates, and show it as HTML in a for each loop. How can this be made better? What is the correct way to q...

1:10 PM
Q: created sql query to REBUILD/REORGANIZE indexes

BharatI've created sql query to REBUILD/REORGANIZE indexes, but some of the avg_fragmentation_in_percent remains at 50% even after rebuilding them. really appreciate any suggestions. create table #tempQueries ( Query nvarchar(max), ) CREATE TABLE #TempTable ( ROWID int identity(1,1) primary ke...

1 hour later…
2:32 PM
hello good day for all
2:59 PM
Q: LC medium, matrix set zeros, accepted answer but not top

rplusgI've solved LC medium problem, set zeros. Below code is accepted and all test cases were passing. But my code came in the last 10% of accepted answers wrt performance. Can someone help me identify optimization opportunities? This is in C# and memory footprint is fine. public class Solution { ...

4:08 PM
Q: How to refactor the calculator code by applying Design Patterns (JavaScript)?

BeefNoodleI have two files named Calculation.js and Calculator.js. Can someone help me to apply the design pattern to the code? One pattern from each category can be applied to any of the two files. That means one file can be applied to two patterns, the other file will be applied to one pattern. For examp...

4:34 PM
Q: How to do this?

Izumi[![enter image description here][1]][1] Exercises 10 Address Book Entry (JAVA File) Your task is to create a class that contains an address book entry. The following table describes the information that an adressbook entry has. Class name: “PrelimAddressBookEntry_YourLastName” Attributes/Propert...

4:59 PM
Q: Python OOP - Web App (Flask) - User registration class?

Pierre-AlexandreI am working on a simple CRUD app as a personal project using Flask. I am currently working on the user blueprint and trying to use as less as libraries and no ORM (for learning purposes). On my blueprints, I have multiple folders including a user folder. I wrote 2 classes in blueprints/user/mode...

5:13 PM
I’m voting to close this question because this question might belong to another Stack site - codereviewbaduker 23 secs ago
5:50 PM
Q: How can I make this C++ code to obtain passwords more efficient?

GGryllsComments kind of explain it. Thanks for helping. Backspaces character only move cursor back and don't erase output so I need to overwrite them with ' ' to delete them. #include <iostream> #include <string> using namespace std; const string PASSWORD = "PASSWORD"; int main(int argc, char** argv) {...

6:20 PM
@CaptainObvious How to title
@CaptainObvious That's some low effort post...
@CaptainObvious More crap
We really, really should reconsider forcing new users to read the rules before posting.
7:01 PM
Please go through the intro tour, the help center and how to ask a good question to see how this site works and to help you improve your current and future questions, which can help you get better answers. You need to identify where your code is running slowly, show your attempts to improve it, and focus on what still isn't working for you. As given, this might be a candidate for Code Review, but not here. — Prune 58 secs ago
7:31 PM
Q: (C#) Avoiding redundant and not needed parameters in methods from other classes

LauraMayI wrote the following setup in a console application (screenshot) (don't get confused by the german language in the screenshot. My request should still be understandable) So I have 2 tanks and a pump and I can transport some water from one tank to the other tank. In the main menu below the vis...

7:52 PM
@Mast Long into the future in a galaxy very very close... QUESTION WIZARDS It is a period of mass off-topic questions. Moderators, in the review queues, have won...
8:10 PM
Requests for code review should be asked on CodeReview.SE — pinkfloydx33 26 secs ago
8:22 PM
Q: how to create api request laravel applying SOLID

shorif2000I am creating api request in laravel using index action in controller below. Is there any way to improve this public function index(Request $request) { $today = date('Y-m-d'); $validator = Validator::make($request->all(), [ 'subscriptionStartDate' => 'required|date...

1 hour later…
9:22 PM
@Peilonrayz I've downvoted that question years ago. It was a stupid idea then, it has proven to be a stupid idea today.
@Mast "it has proven to be a stupid idea today", do you have a source? Last I heard there was an increase in quality. Not really sure how else you could fix the problem, have like a "do you know the rules" test before asking a question
@Peilonrayz A quiz would be nice, like a captcha.
Source is personal experience, YMMV.
@Mast I'm sure convincing SE of the benefits of our long form captcha would be a journey ;)
1 hour later…
10:55 PM
Q: How to use the element ID in CSS when targeting html attributes?

Jack SmithI am having difficulties in targeting a html element through css code. Here is my coding so far? Where have I gone wrong. HTML: <!DOCTYPE html> <html> <head> <title> Spanish Invasion of the Iroquois Confederacy </title> <link rel="stylesheet" type = "text/css" href="Styleshee...

11:20 PM
Q: DI container class

Sarah SaadI have created this DI container class lib to be used to in any other external project as a learning exercise. Please review and would suggest any improvements or comments you have? import { IContainer, ServiceDefDep } from './container.interface'; export class Container implements IContainer { ...


« first day (2856 days earlier)      last day (71 days later) »