« first day (2625 days earlier)      last day (32 days later) » 

12:00 AM
RELOAD! There are 6816 unanswered questions (89.8641% answered)
 
 
3 hours later…
2:46 AM
0
Q: Tips for improving my code

Vaibhav yB ShahI am trying to get my code reviewedand figure out how I can improve? I work at a startupand there is no code review, only self-learning. I am looking for tips for everything from code optimization, better logging, better documentation, etc. I am attaching below a sample code for some MongoDB oper...

 
 
2 hours later…
4:48 AM
0
Q: Multiplying numpy arrays

JKRHI have written a function to multiply two numpy arrays. def ra(self): """Multiply Rotation with initial Values""" rva = self.r_array() * self.va_array() rva = np.sum(rva, axis=1) # Sum rows of Matrix rva = np.array([[rva[0]], # Transpose Matrix ...

 
5:00 AM
And if you have code that works but that you have been asked to improve, you should consider asking over at Code Review (after reviewing their rules, of course). — chrylis -cautiouslyoptimistic- 32 secs ago
 
 
3 hours later…
7:39 AM
-1
Q: how do i pick the result for my output with probabilistic manner?

evai have this program about mapping fire propagation, and it has the probability of burning with coding and the result of course would be different everytime. so how do i pick the output for my report? pb= p0*(1+pveg)*pw if pb>1: pb=1 d= np.random.choice([1,2],1,p=[1-pb,pb])

 
8:21 AM
Monking
 
8:48 AM
Monking
 
For me it feels that you don't (only) have a technical issue. It may be worth to go to your boss, ask for better team education, create better code guidelines, take part of beneficial code reviews, don't follow academic rules ( multiple inheritance is eval idiom ) and invest in software capital! "Improving" bad ideas will not help I believe. — Klaus 11 secs ago
 
9:15 AM
@CaptainObvious Broken
@CaptainObvious Broken
 
0
Q: Snake in Javascript

L292092I feel like there's something wrong with the way my code is styled but I can't quite place what's wrong with it. Perhaps the way I've represented the snake is a little convoluted? const HEIGHT = 20; const WIDTH = 20; const snake = function() { const snakeCoordinates = [[0, 0], [1, 0]]; c...

 
10:04 AM
-1
Q: Python Based Geodetic Transformation Calculator

JKRHI would appreciate any comments on this Geodetic Calculator that I have built. I have been coding (for fun) for a little while now, but this is one of my first "proper" programs. It started off as practice for A) coding algebra and algorithms and B) I am a surveyor and wanted to remember some of ...

 
10:29 AM
0
Q: FIFO for embedded systems

MrBitI wrote a simple FIFO based on pieces of code I found online. It's intended for embedded systems with very restricted RAM. It's supposed to be very simple and efficient. The size is always power of 2 (8, 16, 32, 64, 128 etc). fifo.h #ifndef FIFO_H #define FIFO_H struct fifo {...

0
Q: Project Euler #1: Multiples of 3 and 5 any solutions in c# with better runtime?

swapnil kumarusing System; using System.IO; class Solution { static void Main(String[] args) { int t = Int32.Parse(Console.ReadLine()); for(int a = 0; a < t; a++){ int currentNumber = Int32.Parse(Console.ReadLine()); int allSum = 0; for(int i = 3;i<currentNumber;i+=3)**Calcula...

 
11:07 AM
A thread.sleep is almost always going to fail any code review nowadays. Rarely good practice. I'd prefer not to see one in an answer. — Andy 1 min ago
"Is there any improvments I could implement in the code" -> codereview.stackoverflow.comAndreas 36 secs ago
 
11:42 AM
0
Q: React API calls in ComponentDidMount

johnst123vI'm making an API call in my parent component in React. I'm making a weather app, and theres two different endpoints I'm getting data from. I'm getting 5 day forecast, and the current weather data. I have two separate functions for the API calls, and I then call them functions in the componentDid...

 
12:06 PM
0
Q: Use an object as a property in react component (child)

mister nobodyI've just started learning React to move my blog from plain js, as react seems to be amazing for keeping things tidy and smooth. What I'm trying now is to create a "New Posts" section. My idea is the following: Create a parent component and load the "all posts" object as a state object 'Inherit'...

 
Monking
 
@CaptainObvious 2 more VTC.
 
@Mast ~blam
Monking
 
@Peilonrayz False alarm?
 
@Mast Yeah
The user seems to have a knack for posting questions that look off-topic, their second post says that the code is on-topic but only talks about errors...
 
12:23 PM
Yea, lots of iffy questions lately.
 
Monking
@CaptainObvious Can I get a sanity check by an embedded developer here?
 
Yeah, most of the Python ones have looked iffy / straight outa SO / boring
 
@Zeta Been a while, but sure, a moment.
What's your concern?
Both question and answer look perfectly valid on first glance @Zeta
There are more code smells than you've listed in your answer I suspect, but answers don't have to be exhaustive.
Writing a smart, quick, safe FIFO in C is not something I'd like to do as a hobby project. It's one of those things you write once, review once and never touch again. Don't touch what ain't broken.
The code provided by OP is not at that level yet, but your answer points in the right direction.
 
0
Q: Improved Tic Tac Toe game. Made in C

FrankforkFor my second week of learning C, I decided to remake the Tic Tac Toe game I made last week, but in a different style (as some of you recommended me). This is my final product on the whole Tic Tac Toe game idea, so I tried my best. I feel like it is a bit overkill, but I want to know your opinion...

 
OK, thanks for the check @Mast!
 
12:33 PM
No problem.
@πάνταῥεῖ Thanks for your comment. Actually I wanted to keep the question very simple and generic. My aim was to cute the execution time..Below i got a very nice answer and as non programer his answer is very nice and clear. Shall I still edit my question? — Tanvir 2 days ago
Can people please stop posting generic crap...
We'll have to be more strict with duplicates if this keeps up...
Oddly enough the answer is accepted. I'dn't have...
 
 
2 hours later…
2:24 PM
@Mast The problem seems to be around the title
Which has now disappeared
 
3:17 PM
There's nothing here to "make more elegant". If you have code you want reviewed, try our sister site Code Review. — Chris 33 secs ago
 
-1
Q: Error: TypeError: cannot use a string pattern on a bytes-like object

Shiva SinghI have been trying to create a function to input a series of URLs which contain images from an excel sheet. The function tries to create images inside a folder. These images are taken from the URLs given in an excel sheet. The main objective of this code is to take all the URLs from the excel she...

 
@Peilonrayz It's asking for explanations, the answer is not an answer and by the comments I'm not sure this is the actual code.
But honestly, it's answered. Who cares if it's crap except us.
 
@Mast I don't understand what it is you dislike.
 
3:32 PM
That's ok.
 
I do agree that it is a crap question tho. I used to hate programming challenges, but after only seeing NumPy questions this week I'd gladly welcome PCs back
 
lol
I was working on a GUI for programming challenges earlier today, but it's still beyond crap.
I hate GUIs...
 
A GUI for them, what does that entail?
What are you GUIing with? TK or something?
 
Roughly? A JSON file, the actual functions and a viewer.
challengeList = {
    "DNA" : {
        "Title"       :   "Counting DNA Nucleotides",
        "SubTitle"    :   "A Rapid Introduction to Molecular Biology",
        "SampleData"  :   "AGCTTTTCATTCTGACTGCAACGGGCAATATGTCTCTGTGTGGATTAAAAAAAGAGTGTCTGATAGCAGC",
        "SampleOutput":   "20 12 17 21"
    },
    "RNA" : {
        "Title"       :   "Transcribing DNA into RNA",
        "SubTitle"    :   "The Second Nucleic Acid",
        "SampleData"  :   "GATGGAACTTGACTACGTAAATT",
        "SampleOutput":   "GAUGGAACUUGACUACGUAAAUU"
def DNA(input):
    sequence = input.upper()
    count = Counter(sequence)
    if set(count) - set('ACGT'):
        raise KeyError("Invalid DNA nucleobase encountered. Aborting.")
    return "{0[A]} {0[C]} {0[G]} {0[T]}".format(count)
Something along those lines.
 
Interesting, I feel like I've seen those questions before ;)
 
3:43 PM
Been working on them before.
Not in Python though.
But I sure as hell am not going to do a GUI in something even more convoluted.
Not for V1.
 
0
Q: Is this way of handling events in a Xamarin project memory safe?

KevinI inherited a Xamarin project and I'm trying to find my way. The first task I completed involved creating a new reusable view and adding it to an existing screen. This was iOS specific, so I went and created a new .xib file to add in the relevant storyboard. I had some trouble figuring out how to...

 
And have been working on this GUI for a while too, but considering how awful I am at GUI and how perfectionist I am with such projects, it's going to be a miracle if it's finished before 2025.
Basically, I dynamically load a function.
 
I hate GUIs except if they're abstracted af. Kinda why I like HTML and CSS. It just seems like most frameworks are more of a pain to work with then anything
@Mast lol
 
@Peilonrayz Yup.
I mean, I get that you got to provide a lay-out some way. But why the heck does it have to look this complicated.
I tried XAML with C# once. Didn't like it, but it did have some good ideas. And me not liking it probably had more to do with C#.
 
XAML sounds cool. Like surely it wouldn't be that hard to allow a framework be configured through XML...
 
4:49 PM
Was stack exchanged down for a while about 3 hours ago?
 
5:20 PM
@pacmaninbw Didn't notice anything, nothing on stackstatus either.
 
0
Q: LZ77 Encoding and Decoding in Haskell

Mitchel PaulinI am trying to learn Haskell and figured I would kill two birds with one stone and also learn about data compression. My ultimate goal is to implement the DEFLATE compression algorithm in Haskell. To start I have implemented lz77. import Data.List import Data.Maybe import ...

 
5:46 PM
0
Q: Print Strings Alternatively in Two Thread

Janardhan MaithilThis code is printing foo additionally, one more time. Can see that foo thread is in wait mode and when bar notifies, it starts but ideally I want foo and bar to be printed only once. public class PrintFooBarAlternatively { public static void main(String[] args) throws InterruptedException {...

 
0
Q: Can I ask a question about a custom scripting language?

SetsuI recently asked a question and was reminded that pseudocode is not allowed on this site; I translated it because I felt the original code would have been confusing. The reason being that the scripting platform I'm coding for is likely a custom built one (using VB6 probably...something old) for a...

 
6:17 PM
@Feeds Thanks for the comment @Mast forgot to mention that D:
 
@Peilonrayz No problem, feel free to add it to your answer. No attribution required.
 
@Royi - Yes, I coded up a multi-threaded version of bottom up merge sort. Example code and the results can be found in this question . — rcgldr 18 secs ago
@Royi - The array could be split up into k parts, the k parts sorted via radix sort in parallel (multi-threaded), then merged. The bottle neck in radix sort is random access writes. I also tried doing most significant byte first, to create 256 sub-arrays, each of which would fit in L3 cache, but it was only a 5 % gain. I don't recall comparing times using multi-threading with radix sort. I did compare time for a multi-threaded merge sort. — rcgldr 30 secs ago
 
6:35 PM
0
Q: Bit manipulator (reader / writer)

HarryPlease take a review of my simple bit manipulator: #ifndef BIT_STREAM_H #define BIT_STREAM_H #include <cstdint> class BitStream { public: explicit BitStream(uint8_t* buffer, size_t buffer_size) : m_Buffer(buffer), m_BufferSize(buffer_size) { } virtual ~BitStream() = default; publ...

 
7:23 PM
0
Q: How to avoid the pause in the logout function below

cva6How to avoid the driver.pause in the logout function below. I want to verify if the button is present and if the button is present I want to click on it. I am using the pause to give it some time to load so the if statement does not fail. What is the best way to achieve this? logout () { ...

0
Q: Changing the environment if it sees the incorrect environment in the setting

cva6I am using the function below to change the environment. The way it works if it sees the wrong environment values then it click on it and it changes the environment. In this function, I am just using if and else statement. Is this a good code practice? This does the job however i feel like it doe...

0
Q: Is this the correct way to create a route to a specific .hbs file?

LV98This is my /forums page <div class="card-body"> <h5 class="card-title">2019/2020 Premier League Forum</h5> <a href="/Leagues/EnglishDivision/PremierLeague" class="btn btn-primary">View</a> </div> For the above code you can see the href pointing to a directory to premierLeague.hbs. This is ho...

0
Q: Securely connecting to my DB

user13477176Hello all I have a short question. Is this a good and secure way to connect to my DB ? session_start(); $servername = "localhost"; $un = "brandont_isson"; $password = "bigman23"; $dbname = "thesocial"; $timezone = date_default_timezone_set("America/New_York"); // Create connection $con = mysql...

 
7:48 PM
0
Q: Have to go through random pages before going to the logout page

cva6There are sometimes few hurdles when a test is failed on a different screen and somehow there is a different screen where the user has to click on the cross button and then go to the logout screen. Here I am using if statements to check if the different screens appear before it takes me to the ma...

0
Q: Find a positive integer within range using only elementary operations

SetsuBackground The platform I'm coding for is an esoteric scripting engine coded some time ago that only has limited capabilities. Because I cannot produce a version of the engine that can be run on its own (it needs to attach to a running instance of a game), I have translated the code into C# with ...

 
8:25 PM
@Zeta Congrats, it hit HNQ.
 
hmm ... I notice I'm writing in a very noun-heavy style for my thesis...
 
"The code I have seems to be working. There are no errors. " The question is off-topic on this site you might try Code Review. — Rubén just now
 
@Vogel612 What do you mean by that, like you're using a lot of jargon nouns?
 
that too, but I'm referring to constructions like:
 
@Vogel612 Just cut them out during the rewrite.
 
8:34 PM
> For the purpose of that identification the recursive typevalidation algorithm maintains a string during traversal of the object tree.
 
@Vogel612 I'm assuming the original is in German? Because that's gibberish in English.
 
there's one verb and one adjective in that sentence in German
yea, it's ... translated pretty closely
 
Just write it out how it feels now and see what's left of it during the rewrite when you're done.
 
yea, about that.... I'm pretty sure I won't get to rewrite most of that...
 
What, you'll be turning in your first revision?
 
8:36 PM
final handin is on wednesday, my advisor asked me for (by now only 6) pages of additional content by tomorrow night
 
@Vogel612 That makes little sense to me cause I don't know the nouns. But if you define them or explain them upon first encountering them it should allow you to be much more succinct right?
 
Oh
 
Good luck arjun. There are sites other than stackoverflow that you can ask more general questions on too! Checkout all the sites here maybe softwareengineering.stackexchange.com or codereview.stackexchange.com could provide more information — admcfajn 39 secs ago
 
With a deadline that close, I'd even more focus on getting it done first and making it pretty later.
 
Yeah, something is better than nothing that is pretty
 
8:37 PM
yea, it's just... that style of writing is pretty popular with the German equivalent of the daily mail
 
After all, a complete yet awkwardly written piece is worth more than an incomplete one.
@Vogel612 Unfortunate.
 
yea, that's a pretty fitting word
 
Not something you'd want your thesis to be associated with.
 
I throw around way too much jargon for that association :D
 
May not be as bad as you think then.
 
8:39 PM
it's not that the style is bad in itself, it's more that I'd prefer to find less ... boring ways of phrasing things
 
It's a thesis. In German.
There will be a certain level of boring.
 
hey at least I smuggled in 0xdeadbeef
so there is potential for jokes :)
 
@Mast lol
 
9:01 PM
0
Q: N-elements byte array to integer conversion (little/big endian and signed/unsigned)

LppEddI'm trying to come up with a function to convert byte arrays to their integer representation, using both endianness, and with a signed/usigned option. enum class ByteOrder { LITTLE, BIG } fun ByteArray.toInt(byteOrder: ByteOrder = LITTLE, signed: Boolean = true): Int { if (isEmpty())...

 
9:25 PM
0
Q: Saving an Array to PropertiesService in Google Apps Script

vinnyprimetimeI have the same array set up as a variable inside of each function - I want to make this easier to manage. The array contains multiple strings of values. I’ve attached code below that I've been working on. I would like to save this array to PropertiesService making it persistent across all execut...

 
9:51 PM
I think this belongs in codereview10 Rep 9 secs ago
 
 
2 hours later…
11:26 PM
0
Q: Codeforces 158A Runtime Error (Python)

PrathmeshSo I am very new to code and have learnt the basics of python. I am testing out my skills on codeforces by first solving some of their easier problems. I am trying to do 158A on codeforces. I think I have got it because it passed a few tests I assigned. So, I tried submitting it and it told me so...

 
Please direct them to Code Review instead, and post an answer for them there. :) — Andreas 29 secs ago
 

« first day (2625 days earlier)      last day (32 days later) »