« first day (2179 days earlier)      last day (1838 days later) » 

12:00 AM
RELOAD! There are 6001 unanswered questions (89.8426% answered)
 
12:46 AM
-2
Q: my kotlin code is to display an onboarding screen when app is launched

Favour Israelbut instead it keeps stopping even before it starts... this is the code(this is the fragment adapter class) package com.techytriumph.mytestapplication import android.support.v4.app.Fragment import android.support.v4.app.FragmentManager import android.support.v4.app.FragmentPagerAdapter class i...

 
1:25 AM
-3
Q: Linked list with memory leak issues

VildjhartaThe nodes seems to connect just fine until implementing my getName() function for variable assignment: > *** Error in `./zBunny.exe': free(): invalid pointer: 0x00007f0e528dab78 *** ======= Backtrace: ========= /lib/x86_64-linux-gnu/libc.so.6(+0x777e5)[0x7f0e5258d7e5] /lib/x86_64-linux-gnu/libc...

 
1:44 AM
0
Q: Calling a Function to Calculate Multiple Coefficients

OctaviusI'm working through a practice problem and am wondering if there's a more efficient way of writing my code and/or if the syntax for my pointers looks correct. The practice problem: Given the absolute temperatures Tc of a cold reservoir and Th of a hot reservoir (in degrees Kelvin), the coeff...

 
2:32 AM
Seems fine to me. CodeReview.SE might be a better platform for this sort of question — Zach Saucier 14 secs ago
 
3:22 AM
-1
Q: delete tree function

Accountant مI made this function to delete a directory with all it's contents recursively, will it work as expected ? is it safe ? I don't want to wake up one day with /home contents is gone :D public static function delTree($dir) { if(!is_dir($dir)){return false;}; $files = scandir($dir);if(!$file...

0
Q: Generating Biased Random Values (Walker's Alias Method)

Kittoes0124Am simply wondering if I made any egregious mistakes while implementing the Alias Method as an IEnumerator<TElement>; would also like to know if there are any sorts of general improvements that can be made to the design of the class. Usage: var rng = Pcg32XshRr.New(0, 1); var generator = Probab...

 
 
2 hours later…
5:22 AM
-1
Q: inputMismatchException

Chuzykim designing a class that stores the name of three runners and time it took to finish the race. this class has methods that return the name of the runner in 1st, 2nd and 3rd place public class runner { private String runner1; private String runner2; private String runner3; private ...

 
6:01 AM
1
Q: New Year Chaos JavaScript, needs to be sped up

RolandSimilar to this question but this is for python Original problem with description on hacker rank I am currently trying to iterate through large number arrays and count how many times numbers have been swapped. A sorted array looks like this: [1,2,3,4,5] and a number can be swapped only towards ...

 
6:59 AM
0
Q: Items also occurs in a set

thadeuszlayThe task You're given strings J representing the types of stones that are jewels, and S representing the stones you have. Each character in S is a type of stone you have. You want to know how many of the stones you have are also jewels. The letters in J are guaranteed distinct, a...

 
7:29 AM
codereview.stackexchange.com may be the better place for these kind of questions — Sreekumar P 13 secs ago
 
 
1 hour later…
8:36 AM
0
Q: finding a key from values(which are list) in dict

AkshayNevrekarI have a dict x = {'a':[1,2,3], 'b':[4,5,6]} and I have to extract a key based on an input, in this case assume it is 3 So my output should be a Here's my code: x = {'a':[1,2,3], 'b':[4,5,6]} n = 3 output = [k for k,v in x.items() if n in v] print(output[0]) Can it be done more efficie...

 
9:00 AM
possible answer invalidation by Accountant م on question by Accountant م: codereview.stackexchange.com/posts/217863/revisions
 
9:32 AM
I'm voting to close this question as off-topic because your code is working and you just want to improve it. You might be able to find better luck on Code Review.SE. — double-beep 20 secs ago
 
9:54 AM
0
Q: N-Repeated Element in Size 2N Array

thadeuszlayThe task is taken from leetcode In a array A of size 2N, there are N+1 unique elements, and exactly one of these elements is repeated N times. Return the element repeated N times. Example 1: Input: [1,2,3,3] Output: 3 Example 2: Input: [2,1,2,5,3,2] Output: 2 Example 3: ...

 
10:14 AM
-1
Q: bull and cow game

sumIn a game of Bulls and Cows game, I want to be able to have a list of all guess and be able to remove the item from the list base on the result of each guess made by the AI. For instance, if the first generated guess was 2 bulls and 1 cow. i want to be able to check all the remaining number in th...

 
10:33 AM
0
Q: "Detailed" exception class hierarchy

AnakhandI'm designing an modular exception class hierarchy to use in various projects. I intend to inherit from std::exception in order to be maximally compatible with any exception-handling code. A design goal is that each exception's what() method returns a string which contains a base message, which i...

 
11:25 AM
Monking
 
0
Q: Refactor code to comply DRY pattern

onedevteam.comI have bunch of if's in my console app, which check if command line parameters are valid, it all looks like this: void Main(string[] args) { listOfInputParameters = convertToParams(args); if (string.IsNullOrEmpty(listOfInputParameters.ParamName)) { ...

 
11:51 AM
0
Q: Asp.net networking/restclient layer

Shabir janI have been working on creating maintainable networking layer for our Asp.Net Core Web Api project. Right now I have created Generic methods for Get, Post, Put like this. public class BaseClient { private HttpClient _client; private ILogger<BaseClient> _logger; private string AuthTo...

0
Q: Writing classes to withstand future business logic changes

PipoTellsI have a processor class AbstractProcessor and multiple concrete classes of the same which gets called in order of the business logic. public Abstract class AbstractProcessor { public void doProcess(){} } The logic in my concrete classes keeps on changing depending on the business requirem...

 
@CaptainObvious Hypothetical, one we get every so often.
 
12:10 PM
0
Q: Compiling and throwing simple dynamic excepitons at runtime for JVM

t3chb0tI've been using my Dynamic Exception with C# for quite some time already and it saved me a lot of time. This means, I don't have to create a new exception class for each and every case. I wanted to have the same functionality on Android and in kotlin/java so I can do this: fun main() { throw...

 
 
1 hour later…
1:28 PM
-1
Q: Retrieving data from postgres using `extra` which is not preferred

Roman KozinetsHow to avoid using extra in this case? values = ('foo', 'bar', 'group') FooBar.objects.order_by('-id').extra(select={'group': "'stack_exchange'"}).values(*values)

 
2:07 PM
0
Q: Accordion component with Angular 7

michael.zechI have to made an accordion-, respectively "zippy"-component using Angular 7. I'm new to Angular. Just started with it a few weeks ago. But with some Google-usage I was able to implement the required feature. Here's the way it looks. In collapsed state: In expanded state: Here's the cod...

 
Thank you everyone! This site is truly amazing. Yes. I need to learn how to debug. I will make that my priority. Then go to codereview (didn't know that existed!) in future, if necessary. Going to delete this post in a few minutes. — aName 55 secs ago
Note that the codereview site is for working code. This site is for broken code. — drescherjm 21 secs ago
 
2:58 PM
Ahoy, mateys
 
0
Q: Reference in a nested struct

RonnieI would like to find an way to express the append_message() method so that I can hide away the serialisation. use std::sync::{Arc, Mutex}; const NUM_BUFFERS: usize = 10; const BUF_SIZE: usize = 10; #[derive(Copy, Clone)] struct Msg<'a> { channel_id: usize, msg_id: usize, seq_id: usi...

 
3:54 PM
Lambdas do not have static capture. There is no way to simulate your static members with lambdas. Which is jolly good because they ought to be thrown out of any code review, wuth prejudice. — n.m. 46 secs ago
 
4:23 PM
-1
Q: Jave program and test class to figure out 4 methods

Ty DorisSo Im having a bit of trouble figuring this one out. Theres 4 methods we must test and have a test class to allow users to input data. Just need a bit of help getting it running and maybe a better fibonacci method, mine is just all over the place. here are the 4 methods i'm trying to computer Met...

 
5:02 PM
-1
Q: Implementing a Stack container adapter to check whether brackets are balanced

eden10I am a beginner and I wanted to implement my own Stack container adaptor that uses a function that checks whether brackets are balanced or not. I tried implementing the function but I get an error of undefined reference to the Stack. I think this is because I made a wrong function call but I'm no...

 
There are a few ways. This is one. I've definitely seen it used in production codebases since whitelisting attributes is safer than returning all but a blacklist depending on security considerations. If your code is working (and it almost is: you need to return self.a, self.b, self.c from args) you might get better answers of this sort from CodeReview.stackexchange.com — Two-Bit Alchemist 19 secs ago
 
5:19 PM
I wonder if you are better off posting this on codereview.stackexchange.comDaveInCaz 12 secs ago
 
5:38 PM
 
-1
Q: Find the smallest element in a Array

VedantI was solving a question asked in interview by Uber. It says: Suppose an array sorted in ascending order is rotated at some pivot unknown to you beforehand. Find the minimum element in O(log N) time. You may assume the array does not contain duplicates. #include <iostream> int find_smallest(in...

-1
Q: Prompting the User to Input a Data Value into an Element in a Linked List

OctaviusI'm working through a practice problem that is having me build and modify a linked list over a series of steps. I am particularly interested in knowing if there's a more elegant way of prompting the user to input a data value for a new element in a linked list (see step 5 below). I'd also like t...

 
6:00 PM
-1
Q: How the code be more pythonic

BaRudWhile this code is working fine, I am not sure if this is really well written, and pythonic. Also, I don't really need ase_mod separate class. I could have done it in the same class, with functions. Kindly comment on this too. Also, I want to parallelize over X loop, while the magn loop will be...

 
If you have working code that you'd like to have peer reviewed to help improve, then Code Review was set up just for that purpose. — Ken White just now
This may be more appropriate for Code Reviewjmoerdyk 48 secs ago
 
 
1 hour later…
7:18 PM
0
Q: Query tuning for performance, rewrite suggestions

kevinCould you please go through the queries and its execution plan with all the cost and metrics and suggest tuning recommendations on query rewrite and index changes etc to reduce the cost and better the performance. (1) https://www.brentozar.com/pastetheplan/?id=rJdp6DsqN (2) https://www.bren...

 
7:45 PM
I'm voting to close this question as off-topic because it is asking for improvements for working code. ask on Code ReviewDaniel A. White 15 secs ago
 
7:57 PM
0
Q: Text-search optimization algo

jisuThe following code takes in two params. An array of sentences and an array of queries. Each query has one or more words. The function below prints out index of sentence for each query that has all the words in that sentence. This is functioning code. However, it is not optimized for large inputs...

 
8:36 PM
0
Q: Removing duplicate field entries from sorted csv data

Thure DührsenGiven the following input (cat i.txt), I want to remove duplicate field entries in each of the first three columns and none of the others. DLORENZ;EDDELAK;BCL;G1;2019-04-01;175 DLORENZ;EDDELAK;BRV/COV;G1;2018-01-31;165 DLORENZ;EDDELAK;BRV/COV;G2;2018-02-28;165 DLORENZ;EDDELAK;BRV/COV;WH;2018-05-...

 
9:15 PM
0
Q: Unmanaged byte array to managed structure

David MichaeliI have a need to turn byte arrays into various structures. First version: public static object ConvertBytesToStructure(object target, byte[] source, Int32 targetSize, int startIndex, int length) { if (target == null) return null; IntPtr p_objTarget = Marshal.All...

0
Q: Ordered List insertion

Garrett Lee MorrisonI am having trouble making the numbers that I put in the list go in order. I am making a program with a list where I can insert 3 numbers into that list. The 3 numbers should be sorted after inserted but are not. I have added a picture of the code and current output. #include "OListType.h" #incl...

 
possible answer invalidation by Kittoes0124 on question by Kittoes0124: codereview.stackexchange.com/posts/217864/revisions
 
9:34 PM
0
Q: Mario Party Snake and Ladders Board

gregContext Was inspired from this LeetCode post to do my own System Design exercise of the common Snake and Ladders problem. As I was writing the code Mario Party kept coming to mind so I added a little fun theme to it. Feedback Did I make the appropriate system design choices in terms of the cla...

0
Q: Copy files and folders from file share to SharePoint library

user51776I got below code from Phil Childs website. How do you add a delete block if files or folders do not exist on file share from below: function Copy-FilestoSP { Param ( [parameter(Mandatory=$true)][string]$LocalPath, [parameter(Mandatory=$true)][string]$SiteUrl, ...

 
9:48 PM
@CaptainObvious No code and no background for what the code is supposed to do.
Bad answer from first time user codereview.stackexchange.com/questions/207250/….
 
Again, I'd post the working code with byte buffers, and ask why it might run so much slower than with RandomAccessFile. You might be able to ask a specific question like that, rather than be sent off to the code review site (which fewer people read and answer at). Worth a shot, but I can't guess why the byte buffer isn't working for you without some code. — markspace 57 secs ago
 
@CaptainObvious Not the owner and doesn't understand the code.
 
10:10 PM
This may be a good fit for Code Review. — Jake Reece 56 secs ago
 
0
Q: Initializing Reinforcement Learning Q-Table State Space-Python

AcejhmThe code below is a "World" class method that initializes a Q-Table for use in the SARSA and Q-Learning algorithms. Without going into too much detail, the world has "Pickups" and "Dropoffs" that can become invalid after they are emptied/filled. Termination is achieved once all pickups are empt...

 
 
2 hours later…
11:51 PM
0
Q: Minimal Haskell Unit Testing Framework

Gregory NisbetI'm trying to come up with a unit testing framework for Haskell that is small and self-contained produces TAP-compatible output exits abnormally on failure (instead of relying on the TAP consumer to validate all the output). has a simple API with easy to understand compile-time errors. (That's ...

0
Q: TLE error: Remove element from LinkedList

AliceI am working on an easy LinkedList basic operation problem on Remove Linked List Elements - LeetCode Remove Linked List Elements Remove all elements from a linked list of integers that have value val. Example: Input: 1->2->6->3->4->5->6, val = 6 Output: 1->2->3->4->5 My s...

 

« first day (2179 days earlier)      last day (1838 days later) »