« first day (2256 days earlier)      last day (2057 days later) » 

00:00
RELOAD! There are 6222 unanswered questions (89.7450% answered)
00:33
0
Q: PayPal Checkout API with PHP - Sending and retrieving additional data safely

Learning and sharingI am learning to use the new API version of Paypal, and I have some doubts. Note: I've tried this on https://www.sandbox.paypal.com and it works, I have not done the tests on Live. onApprove: I need to send additional personalized data to Paypal, and once the user makes the payment, I re...

 
2 hours later…
02:13
0
Q: Minmum sum of elements, taken 2 at a time

NgmThe question is: Given an array of integers say [8,4,6,12,10] You can pop any two elements at a time and place the sum back into the array. Repeating until a single element (final sum) is remaining. What is minimum final sum, given that you are allowed to pop any two elements at a time? My ap...

 
2 hours later…
04:00
possible answer invalidation by Jamal on question by EML: codereview.stackexchange.com/posts/223513/revisions
04:16
-1
Q: Is it a proper way for using Task.Run(() => ... ) in C#?

bakunetI have a command exec metod that blocks UI and I just wanted it not to do it, so I wrapped method call with Task.Run. Note, that GetParsedHorseData is CPU work, not IO. /// <summary> /// on `Find` horse btn click, /// on `AutoComplete` of the horse name / jockey TextBoxes, ...

04:42
Sidenote: Having to explain that ll means long long means your code will likely fail a code review. Not a problem when competing, but often a problem when getting paid. — user4581301 35 secs ago
Monking
05:11
Quick clarification: What category does only asking for best practices fall under? I think i remember reading a couple comments that say this isn't allowed if it's the only thing asked about, but I'm not 100% sure. Note: This is in the context that this is the ONLY thing they ask about.
If there is a relevant Meta question that has answers addressing this question, a link would be fantastic :)
14
Q: Best practice questions

whirlwinI wanted to ask a question at Code Review, so I visited the FAQ. It says this is ok: Code correctness Best practices and design pattern usage in your code Application UI Security issues in a code snippet, etc. The performance of your code And this is not: Tools, b...

You may ask this on code review. — Ravindra Ranwala 58 secs ago
05:35
Awesome, thanks for the quick responses!
06:04
Monking
06:25
possible answer invalidation by dfhwze on question by dfhwze: codereview.stackexchange.com/posts/223697/revisions
06:37
0
Q: Regex Version of strip()

coderThis problem is from Automate The Boring Stuff using Python - Chapter 7. Write a function that takes a string and does the same thing as the strip() string method. If no other arguments are passed other than the string to strip, then whitespace characters will be removed from the beginnin...

0
Q: Fluent interface for building StateMachine definitions

AstiThis is on a resource constrained environment, so ideally everything will be statically initialized. Can't use new. It sort of looks readable like this: State states[] = { State(Off) .with(Transition().on(Dark).to(On)) .onEnter([]() { printf("Switch off"); }), State(On) ....

07:26
Monking
07:57
0
Q: Using BigInt in JavaScript, write a factorial function that takes either a Number or BigInt and returns a BigInt

太極者無極而生Is there anything missing or any pitfall when using BigInt? // Assuming n is an integer and is 0 or greater function factorial(n) { var i, result = BigInt(1); for (i = BigInt(2); i <= n; i++) { result *= i; } return result; } console.log(factorial(69)); console.log(fact...

08:17
0
Q: Own Authorization attribute

NetDevIn the existing system, we need to rebuild the user's authorization. The database includes Roles and Rights Roles were previously used but will be skipped in the new version All authorization will be based on Rights control I have prepared an attribute that performs such a task Controller: ...

 
1 hour later…
09:26
if your code currently works, you are better posting it on codereview.stackexchange.com to get it reviewed and optimised — Pete 56 secs ago
09:37
-1
Q: Compare more than 2 lists in Java

jack"mainList": [ { "cd": "CH", "desc": "Child", "childList": [ "A", "B", "C" ] }, ...

0
Q: Rust FFI and memory management

Mongus PongI am trying to expose a simple struct via FFI. Is this the best way to do it? I am not 100% sure about the get_text function. This is taking the string out of the struct and cloning it before returning a pointer to it. I suspect this is going to leak. Whats the best idiomatic way around this? Do...

09:55
possible answer invalidation by Asti on question by Asti: codereview.stackexchange.com/posts/223715/revisions
0
Q: python and numba. are wrapper functions leaky?

SumNeuronThis question combines two other codebases that I have put on this site: Questions: Coalescing ranges that have the same label Simple sharding of delimited files to more sophisticated Repos [lrng][repo 1] (handles labeled ranges) [parpar][repo 2] (handles simple sharding and multithreading...

0
Q: Deployment Automatization for docker builds, kubernetes deploys and secret injection [Bash]

Firat OezcanI've written a small script that automates the tasks I previously did manually for deploying onto our kubernetes clusters and I am quite happy with the results I have, but I do think that what my approach was (building a command and executing it at the end) could probably be improved. Especially...

0
Q: Yet another hash table in C

Leo Will be very grateful for thoughtful code review. I needed hash table (again) and I wrote one. Code here is here https://tinyurl.com/hashtable-c or inline: #ifndef HASHTABLE_DEFINITION // single file library cannot use pragma once #define HASHTABLE_DEFINITION // https://en.wikipedia.o...

If your code is working then this will be better asked on codereview.stackexchange.comB001ᛦ 29 secs ago
10:20
Since the code works fine and there is only trouble while scaling, you would be better off posting this on codereview. — Nuhman 38 secs ago
10:38
0
Q: Serial port library for unix systems in C using callback model

arcomberI wrote a blocking serial port library, Blocking serial port C library, but prefer non-blocking so wrote this library where user can specify callbacks. So it is event driven. The code assumes C99 or better. How could this be improved? The example is fairly custom to working in the UK with the...

10:58
-1
Q: Avoiding loops in a R code to optimize it

CaroleGEI have some troubles with a code which take a huge amount of time to run. Could someone give me some help? Thanks in advance! all_dist=c() ddim=dim(b)[1] ddimi=ddim-1 for (k in 1:dim(b)[2]){ for (i in seq(1,ddimi,1)){ for (j in seq(i+1,ddim,1)){ ze=(b[i,k])-(b[j,k])*(b[i,k])...

This is offtopic here. Try on another stackexchange sitevasily.sib 37 secs ago
11:34
I don't see anything wrong with this code or reasons why it wouldn't work, I feel like this question is maybe a code review question? — IsThisJavascript 12 secs ago
@CaptainObvious Off-topic – Initially no code at all, then non-working code was added.
@MartinR closed
11:58
0
Q: What is the best practice for storing and retrieving paths in C#?

Adam_KimberleyI am refactoring some legacy code. The code makes heavy use of hard-coded file path strings. I am unsure what to do with these and, more generally, what the best practice is for storing and retrieving file paths. Abstracting away from the details, I have an abstract base class which contains a p...

12:39
-1
Q: Monte-Carlo Pi calculation with akka negative values

FCorreiaSO im trying to use the Akka actor-message model to estimate the value of PI. I think im close, but so my im not there yet. I was able to have pi returning values from 1000 to -6000 and trying to fix the code it wont return any value, just stays in the limbo. Tried to change the message type or ...

0
Q: PDF page & word count, recursive searching of directory tree, output to excel

CamI wrote this program as part of a work-related problem but with a focus on improving my Python skills. The program was needed to do a word count PDF files. The problem was there were a large number of PDF files (over 1000) which were scattered over a drive. I made use of a number of modules to ac...

No, a lexer can make that determination, though the borderline between lexer and grammar is fluid. Here's someone (not me) working on a sample lexer for C99 that you may be able to draw some inspiration from. — 500 - Internal Server Error 29 secs ago
IIUC, I think this is a good answer to a similar question. It is on CodeReview. — Ben.T 42 secs ago
12:55
Because your code is working and you are just trying to improve performance, you may find more help by moving the question to Code ReviewEliahu Aaron 21 secs ago
0
Q: VBA: Windows Api Declarations For Compatibility

rickmanalexanderThis is an extension of my VBA:Reusable Progress Indicator post. I realised that I needed to add additional compiler constants for compatibility of the Windows API functions used in the HideTitleBar sub which is called on the Userform_Initialize event; however, I am unsure if they are correct for...

13:19
0
Q: how to make lower decimal javascript?

m.albanI am trying to lower decimal, can anyone help me to show how to use "toFixed" in this code? or if there is any other way? miniseconds/1000/60/60/24 so I get the number of days. I added return time2conversion/1000/60/60/24.toFixed(2); end of the line but got error. function () { try { i...

13:38
This is more of a question for codereview.stackexchange.com. — Ross Wilson 45 secs ago
13:59
0
Q: Conditional vs Logical Testing

Mohsen AlyafeiI would like to get your code thought and views on using conditional vs logical testing. For example: To test the conditions of truthness of all of the following variables, their currect status is as follows: a= True b= True c= True d= True e= True One could use as test as follows to ens...

0
Q: Unexpected segmentation fault when using function decorator (using closure) in c++

no.eyd.gnodI created decorator function to add functionality to existing functions. The program outputs correct function pointer addresses along with an elapsed time to iterate 10 x helloworld as expected. Yet, if I change decorator function to take the original_function by value (FunctionPointer original_...

This is probably pretty close to as efficient as it will get. Also this is probably more of a question for codereview. — Benno Straub 21 secs ago
14:19
0
Q: Calculate payback

crisestI want to know if there is a better way to do this function. The function is to calculate a payback. Basically, the company spend x amount of money and per year they will save some money overtime. They want to count how many years it takes to get the money back. I.E. The company spends 100k. yea...

14:40
possible answer invalidation by Cam on question by Cam: codereview.stackexchange.com/posts/223737/revisions
codereview.stackexchange.com/…

Is this PHP?

It looks a lot like JS with $ as variable prefixes.
Huh. It also seems like very very working JS code
Most scripting languages support the $, and it only uses standard operators/keywords, like + and function.
shrugs I guess I'lll delete my comment/
14:52
I wouldn't be surprised if it was valid PHP, JS, and Ruby.
Probably does the same thing in all of them too...
0
Q: Memory error with large lists in memory and time in swi-prolog?

VassAI have created the following code that takes as input two numbers and a list. The first number N says how many elements are in a list. The second number K says how many numbers are in a list ( if K=3 it means there are 3 different numbers in the list starting from 1 to K (1,2,3) ) . The program s...

15:28
Does anybody know about a good python book for a beginner ? My daugther wants to learn it.
15:56
Monking
Monking
@Heslacher "Python for Dummies"
16:36
Monking
@Heslacher do you want a physical book, or are you open to digital options?
@Heslacher We've had quite a few questions using this book, it seems ok. I learnt from a PyGame book, but I wanted to make games so that helped me get through the monster. Also this may be good if you're happy to sit with her to answer.
Once you get this running and working. Please take the code to codereview.stackexchange.com to get a run down of ways you can improve. — Martin York 45 secs ago
17:00
0
Q: Find A Series of Numbers Who when Squared and Summed are equal to a given Square

Cory HarperI am working on a CodeWars titled 'Square into Squares. Protect trees!' it can be found here: https://www.codewars.com/kata/54eb33e5bc1a25440d000891/train/javascript I have a working solution, the issue is that the performance is so horrid that if I run it with an argument higher than around 15 ...

-1
Q: Barebones implementation of a Singly Linked List in Go

Soumasish GoswamiHere's my first implementation of a Singly Linked List in Go. In its current implementation it supports two methods, Insert and Remove. Invite comments on style, efficiency, idiomatic usage of the language and just about everything. package ds import ( "fmt" "errors" ) type node str...

17:19
@CaptainObvious yeesh . the comment log...
^^ Thanks Vogel for cleaning it up
I did like the hamster/gerbil analogy :)
@SᴀᴍOnᴇᴌᴀ Thanks! and now, it's lost to the Great Bit Bucket in the Sky. :(
18:21
0
Q: NodeJS + Express: OOP VS Functional Implementation

Gavin YoukerOverview I am learning Node JS with Express by creating a project. Recently, I have made the decision to convert my project to OOP. However, I am uncertain if I want to keep it like this. I decided to do this because this is a collaboration project between a group of three people. Additionall...

18:39
It also works for anything you teach someone else to do. "Oh yeah, I trained a pair of neural nets, Emily and Kevin, to respond to support tickets."
6
19:13
@RMunroe Technically correct.
0
Q: Django Registration and Login on Same Page

SlabachI'm trying to have a registration and login form both on my index page (NOT separate login/register urls). I'm able to display the forms, but having trouble with submission. At first I just had the registration form and submission for account creation worked just fine, but adding the Login form h...

I'd be interested if there is a better way but I've previously done a similar thing using RxJS and subscribing to valueChanges codereview.stackexchange.com/questions/222712/…Andrew Allen 18 secs ago
19:43
please post remaining code to give us more context. Now it merely code optimization... well appreachiated at an SO sister site named "code review". — ZF007 6 mins ago
20:02
@Mast Technical correct is the best kind of correct
 
1 hour later…
21:03
0
Q: calculate quantities with price in ManyToMany relationship in django

namo is it possible to provide quantities for each individual product when we select multi items ? imagine we have two tables(models) names(product , store) in product table(product_name,price) and store table(many2many from products,and quantities ) we selected two items mac book pro , hp pro book is...

0
Q: JSON Parser, pulls data from a JSON file for analysis

Tony JThis is the first time I have programmed something that I will actually personally use, so I am happy about that. I tried to write good code whilst applying functional programming concepts. So no state, and a concise function. I know that when making the lists it pulls information from the JSON...

 
1 hour later…
22:04
0
Q: Rails 5.2 - how to dry out this callback code?

rmcsharryI have a model that is in a HABTM relationship with 2 other models: Activity.rb has_and_belongs_to_many :mandates, -> { distinct } has_and_belongs_to_many :contacts, -> { distinct } I had to add the following callbacks, since the models defined above have a 'score algorithm' that must be ...

Providing some sample of your code might help, but otherwise there are too many unknown variables that could be making your code take a long time. If you're looking to optimize, you could try posting your code on Code ReviewG. Anderson 5 mins ago
22:24
1
Q: Python Calculator using Postfix Expressions

sg7610Improved upon my previous calculator program. This program has the following features: Gives information using session prompts. Supports all common operators. Follows operator precedence. Use of identifiers is supported. Result of the previous expression can accessed by using the 'r' identifier...

Okay, sounds good. I got a nitpick comment about indentation on my code review. Sounds like debatable topic. I don't have a strong preference either way but second one would look a bit cleaner. — Techiee 49 secs ago
Welcome to Stack Overflow! Start with what you know. You can remove some duplication by doing var propName; if(...) { propName = "bike-insurance" } else { propName = "section_wise_container" }. Having said that, this question might be a better fit for the Code Review stack exchange. Check what their guidelines are before posting there, though. — jpaugh 22 secs ago
23:04
0
Q: Bodyless Self-Closing *for* Loop

TrunkI use self-closing bodyless for loop to quickly find an element within an array or collection. Learned it from a Java teacher. But I'm seeing warnings on certain IDEs that have a code inspection tool. For example, IntelliJ deems this construct to be a probable bug and objects to the empty body of...

0
Q: Custom model to count user interaction in application

khashashinIn language dictionary application users can add new words and do other staff with this word such as adding additional information to the word (description, etymology, speech parts, noun class etc.) I'll count all this information and maybe later create some application gamification based on this...

23:24
0
Q: Checking if object has only numeric values?

KyloRenI am trying to check if a class has only numeric values in it and then return a bool. At the present I am using reflecting to loop through the object (Which in some cases can have over 100 properties) and then check the property value with Regex to see if it is a numeric value. Code is as follo...

23:41
@Mast by "your argument" did you mean the answer I asked about?

« first day (2256 days earlier)      last day (2057 days later) »