« first day (1666 days earlier)      last day (2369 days later) » 

12:00 AM
RELOAD! There are 4740 unanswered questions (90.3564% answered)
possible answer invalidation by Luke on question by Luke: codereview.stackexchange.com/posts/181141/revisions
 
12:27 AM
0
Q: Elegant way to "construct" kind-of enum values in go

Michael LihsI'm quite new to Go and would like to improve my code. I have a representation for access levels in Go like this: type AccessLevelValue int const ( GuestPermissions AccessLevelValue = 10 ReporterPermissions AccessLevelValue = 20 DeveloperPermissions AccessLevelValue = 30 Ma...

 
 
1 hour later…
1:31 AM
0
Q: Reading serial data from an Arduino Metro Mini

ArticI have a metro mini which is sending raw serial data which to my computer. I have a working program written in C. Are there any improvements which I could make to the Windows C program which would make the program smaller or lessen the number of lines? Currently, I write to the serial port, and t...

 
2:03 AM
0
Q: rotating 3D bit board in C

ZacariazI've got a 64 bit bitboard, but instead of interpreting as an 8 by 8 binary matrix, as is usually the case, I've taken it to the third dimension, so to speak. Now mirroring and even rotating by 180 degrees on any individual axis is, if I'm not mistaken, fairly simple, but rotating by 90 degrees, ...

 
2:18 AM
0
Q: Bubblesort using Writer monad

robbie0630I still consider myself a newbie to functional programming, and I still have some trouble wrapping my head around a lot of functional concepts. Anyway, here goes: import Control.Monad.Writer import Data.Monoid bubblesort' :: (Ord a) => [a] -> Writer Any [a] bubblesort' [] = return [] bubblesort...

 
 
2 hours later…
4:13 AM
0
Q: Is there any way to initialize my tableViewCell with a model and use that inside the tableViewCell class to just populate the rest of properties?

HoneyIn the code below, I use a didSet to update the value of custom TableViewCell labels and image. I initially tried changing the init method of the my ArtistTableViewCell. I tried changing it to: init(style: UITableViewCellStyle, reuseIdentifier: String?, artist: Artist) { self.artist = ...

 
4:46 AM
0
Q: i Would like to refactor this code can anyone suggest me how to refactor this code in swift IOS

rami am new to swift programming i don't know how to refractor this code. i am using one service call in my project . for post and get i am creating same function i am repeating code mutiple times for different apis to send differnt kind of parameters. so can any one suggest how to refractor this f...

 
5:12 AM
StackExchange has a Code Review site. You should post there for comments/review of your code. - it's not exactly on-topic for StackOverflow. — SherylHohman 23 secs ago
 
0
Q: Multiplication flash cards quiz in python 3

Mike WynnNeeded a simple way for my son to be able to finish his homework for the week with flash cards in multiplication. So instead of getting out the markers and scissors I wrote this as a simple way to choose what numbers we are practicing for the week. I simplified the points system so the code works...

 
5:58 AM
-1
Q: Shorter way of looping regex.Matches

user67809I'm new and I'm currently trying to figure out how regex and its methods works is there a shorter way to C# this: using System.Text.RegularExpressions; int ow = 0; int ace = 0; int ore = 0; string bunch = Console.ReadLine(); foreach (Mat...

 
6:50 AM
0
Q: Convert complex C function to FORTRAN

Kamal Mahendra Sirisena.I am new to FORTRAN and stack overflow. We are converting list of C functions to FORTRAN. This is for academic purposes and we do not have much details about entire C program. Our objective is to convert C functions to FORTRAN without any compiler errors. My C function is as below barheaponarray...

 
7:31 AM
0
Q: SKAction on SKLabel with array of [Strings]

μολὼν.λαβέall, i have an a SKLabel, attached to a parent SKNode and an array of strings let configText:[String] = [ "Configuration", "Do stuff", "Do more stuff", "Nil", ...

 
8:00 AM
@SherylHohman Code review is only for working code. — Vladimir F 1 min ago
 
 
2 hours later…
10:02 AM
0
Q: Function to remove duplicated elements from an Array

mizechTask is to have a function which takes an array. Then removes elements from the array which are contained more then one time. Finally returns an array with only unique elements. Here's my solution: // Duplicates : 4 (3 times), 5, 9 (3 times) => Sum: 5 too much ! let withDuplicates = [1, 2,...

 
 
1 hour later…
11:14 AM
0
Q: Optimize and make more clear the code to compute the improper Euler integral and others

trafalgarLawwHow can I optimize and make prettier the following code? Main.cpp #include "UtilitiesP.h" #include "Simpson.h" int main(void) { double agm(1/functionsP::agm(1, 2)); double integral( (2/constantsP::kPi) * Simpson(0, constantsP::kPi*0.5, constantsP::kEps, functionsP::eliptic)); asser...

 
 
2 hours later…
1:06 PM
@Vladmir. Good point, and Thanks for the clarification. I may have misunderstood OP's question to be asking for a code review, in addition to a fix. I could have worded my response better. I didn't flag the question or down vote. — SherylHohman 26 secs ago
 
1:44 PM
1
Q: C++ Registry pattern implementation

HenrikSI created a template registry class. It supports custom factory functions and custom constructors. Any kind of feedback is welcome (style, performance, bugs) registry.hpp: #ifndef REGISTRY_HPP #define REGISTRY_HPP //STL #include <unordered_map> #include <memory> template<typename Key> class R...

0
Q: Project Euler 138 - C code not storing numbers correctly

John DoeI am a beginner in the language C and am aiming to answer problem 138 on Project Euler. For your benefit here is the link - https://projecteuler.net/problem=138 So show below is my code #include <stdio.h> #include <math.h> unsigned long long L(unsigned long long b); int main() { unsig...

 
1:58 PM
0
Q: C++ Binary Data Utility Class

john01davI have recently been trying to get a solid grasp of how to work with binary data, both for networking and file storage, in C++. In java, there are many utility classes that made this easy. Since these don't exist in C++, I figured making a limited class that does something similar would be a good...

 
2:29 PM
0
Q: C solution to "99 bottles" kata

JeroenI typically use high level programming languages like C# and JavaScript, but today I was doing the "99 bottles of beer" kata for an event using C. Below is my solution, which seems to work. Please let me know if there's any egregious mistakes or non-idiomatic pieces in there? #include <stdio.h> ...

 
2:44 PM
0
Q: Function to Check Empty Cells Found or Not in Datagrid Using VB.net

RelaxI want to check if any empty cells found or not in a Datagridview when save data to database so I written this function Public Function IsDataGridViewEmpty(ByRef dataGridView As DataGridView) As Boolean Dim isEmpty As Boolean isEmpty = False For Each row As DataGridViewRow In dataGridView.Rows ...

 
3:13 PM
0
Q: please i need an exaple how to build CSR sparse matrix c++ without libarary map

Marcel Nasr/* ......................................................................... please help*/

 
@CaptainObvious CV'd
 
@CaptainObvious CV'd
 
3:36 PM
I really should put in the work to get nuking powers back ...
3
 
@Vogel612 How did you loose them?
 
privileges bump on graduation
suddenly need double or even 4 times the rep compared to before...
I don't remember
 
1
Q: Movie ticket booking without GUI using code line interface in java CRUD

Bkumar4nbkJava movie tickets booking Using CRUD(Create,Read,Update,Delete) to book the tickets to movie it should contain theatre information with seating and theatre details

 
4:09 PM
@Vogel612 What nuking powers?
 
20k: delete votes
 
If this is working code that you'd like feedback on, see Code Review. — jonrsharpe 54 secs ago
 
@Vogel612 Just out of curiosity, do you see yourself here with the search filter? codereview.stackexchange.com/…
 
yes, why?
 
@Vogel612 Do you see me with this search filter? codereview.stackexchange.com/…
 
4:16 PM
nope.
 
Me neither...
Why?
 
because there are exact matches, I guess
as soon as I drop the "n" or add " F" you reappear
seems like a bug to me, tbh
 
@Vogel612 In that case, "Janos Veres" wouldn't show up in this search, right? codereview.stackexchange.com/…
Ah, exact matches are prioritized before normal matches
I show up on page 2
 
4:45 PM
1
Q: Need help shortening my code

Luke PowellI think my code is too long and would really like to shorten it without changing the final output as it does exactly what I want it to do. This is just one class which I wish to shorten. The first method runs a multiplayer dice game. Each round consists of three sets of throws with each set havi...

 
5:15 PM
0
Q: RxJS/ngrx: Logging observable values while extending service

Andreas JohanssonI'm trying to extend a service function which returns an Observable. The idea is to extend function so I can add a logging functionality whenever the observable emits a new value. fromEvent<T>(eventName: string): Observable<T> { super.fromEvent(eventName).subscribe( function next(dat...

 
5:29 PM
0
Q: Criticise my data structure choice for this Camera Purchase

DalamarHere is the text of the problem: https://www.hackerrank.com/contests/adobe-codiva/challenges/camera-purchase/problem Here is my solution: #include <cmath> #include <cstdio> #include <vector> #include <iostream> #include <algorithm> #include <unordered_map> using namespace std; int main() { ...

0
Q: Best practice for this python function

MarcI have the following input: R = 'r' _ = 'g' grid = [ [_,_,_], [_,R,_], [_,_,_] ] p = 1.0 / 9 initial_beliefs = [ [p,p,p], [p,p,p], [p,p,p] ] observation = R #result expected_beliefs_after = [ [1/11, 1/11, 1/11], [1/11, 3/11, 1/11], [1/11, 1/11, 1/11] ] p...

 
5:55 PM
Hey great question. I think you would get a better response and more help from a sister site of Stack Overflow called Code Review. codereview.stackexchange.comraykrow 55 secs ago
 
@CaptainObvious @CaptainObvious Broken code needs CVs.
 
6:37 PM
@pacmaninbw OP says it's corrected now
 
@skiwi You can't change loop variables within a loop without causing problems. It's still changing i in the loop.
It's changing i twice in the loop before it gets to the i++ at the top.
 
0
Q: Online javascript calculator performing addition, subtraction, multiplication and division. Any idea to make it object oriented?

Raunaq KoppikarThis is my javascript code for an online calculator with four basic operations: 1. Addition 2. Subtraction 3. Multiplication 4. Division. Is there any way to get the below given code in object oriented format. I tried from my end, but it isn't showing the same results. var calcTxt = document....

 
@pacmaninbw Ah, not arguing that, just saw that he replied
 
6:59 PM
0
Q: Searching for a binary tree for a vehicle with a given name

screencutSo I'm searching my binary search tree of Vehicle objects and I'm just wondering whether there would be much point/is it best practice to search if a node has a left/right child first like so - return n.hasLeft() ? find(name, n.left()) : null; Or just go with the foillowing, since it will retu...

 
7:30 PM
0
Q: Dictionnary comprehension

Francky_VLet's say the following code. dic = {} bin_rep = [1 if digit == '1' else 0 for digit in bin(n)[2:]] if len(bin_rep) < size_bin: bin_rep += [0] * (size_bin - len(bin_rep)) # turn this into dictionnary - might all be done better? for i in range(0, size_bin): dic[self.p.get_agents()[i]] = b...

 
7:49 PM
0
Q: Multi-client TCP server with thread for each client and DB connection pool

don-progI'm creating a Qt TCP(with SSL) server to which multiple clients should connect and use DB, this is the main task. So, I think I can use this architecture: each client has its own thread, and clients use DB via DB connection pool. Code: Client connection part main.cpp: int main(int argc, char ...

 
8:19 PM
0
Q: Web scraper for Football (Soccer) data with BeautifulSoup and Requests

iuvbioI wrote a web scraper to get football scores from http://www.weltfussball.de/. I'm getting the data for all seasons for the three major German leagues. It all works at the moment, but I'm sure it's possible to make it a lot more concise. import requests import os import pandas as pd from bs4 imp...

 
9:12 PM
@skiwi I've removed my VTC. I've removed most of my comments.
 
9:26 PM
0
Q: Find all occurrences of the word "the" without using regex

Eric WesselI have an assignment to find all occurrences of the word "the" without using regex: Use the indexOf method to do this. The word "the" could also appear in a larger word, such as "Theresa" or "other". Please confirm if this is the best way to do that. import java.util.Scanner; public class...

 
@pacmaninbw Ah okay, it's fixed now?
 
9:41 PM
0
Q: A "templated" doubly-linked list implementation in plain C - am I overusing the preprocessor?

MichailI've attempted to make something similar to C++ and D templated lists in plain C. In this gist there's the full code of the header file and test driver I'm using. I'll post below some excerpts from the header and all of the test driver. My main questions are: Am I overusing the preprocessor? Is...

 
9:55 PM
0
Q: std::shared_ptr doesn't free memory in a binary search tree

AtinI've been trying to implement a persistent treap (everything is fine with it) and I decided to use std::shared_ptr for getting rid of unused nodes. Don't be scared if you don't know about persistent treaps, treat is as a binary search tree. Here is my code: ` struct treap { int sum; int key...

 
 
1 hour later…
10:58 PM
0
Q: How can I report tasks like top does?

iletrasThis gets close but it varies from top too often. The key weakness, I believe, is counting the sleepers. How can it be made more accurate? local output=$(ps axo stat=) cpu_tasks_running=$(echo -e "${output}" | grep -c '^R') cpu_tasks_sleeping=$(grep sleeping /proc/*/status | wc -l) # sea...

 

« first day (1666 days earlier)      last day (2369 days later) »