« first day (2349 days earlier)      last day (1964 days later) » 

00:00
RELOAD! There are 6178 unanswered questions (90.0941% answered)
I'm voting to close this question as off-topic because it belongs on another site such as codereview.stackexchange.com and is opinion based. — lurker 40 secs ago
01:04
1
Q: NLTK Tokenization Optimization

Jerry M.I have an NLTK parsing function that I am using to parse a ~2GB text file of a TREC dataset. The goal for this dataset is tokenize the entire collection, perform some calculations (such as calculating TF-IDF weights, etc), and then to run some queries against our collection to use cosine similari...

01:15
possible answer invalidation by Jerry M. on question by Jerry M.: codereview.stackexchange.com/posts/230393/revisions
0
Q: clean approach to decorator that takes optional keyword arguments

rabbit.aaronI write decorators a lot in my work. Sometimes you need to write "decorator that takes arguments", it usually turns out to be something like this: def decorator(**kwargs): def _decorator(func): @wraps(func) def decorated(*func_args, **func_kwargs): # do somethin...

 
2 hours later…
03:06
1
Q: implement http server using libevent

陳 力#include "fmt/format.h" #include <cstdint> #include <cstdio> #include <event2/event-config.h> #include <event2/util.h> #include <evhttp.h> #include <memory> #include <type_traits> auto main() -> int { constexpr char host[] = "127.0.0.1"; std::uint16_t port = 5555; using event_base_ne...

0
Q: Driver program using custom 3D game engine

delimiterI am working on a custom game engine and have been fleshing out the various submodules (meshes, physics, shading, etc.) Here is a sandbox program that exercises the newly finished camera system. After much testing, the camera system will be integrated into the rest of the engine. This program l...

04:06
Asking for "better solution or packages to use" is off-topic at SO. Code Review might be an option. — LGSon 17 secs ago
04:31
0
Q: Optimizing Conway's Game of Life in C++

MattHow could I further optimize my implementation of Conway's Game of Life? And how would you critique my current strategies? I'm taking a C++ optimization class, the deadline has passed and my assignment has already been submitted. We were supposed to compile with these options: g++ me.cpp -std=c++...

It would help us to help you if you said what "not correct" means in your case. Is it producing an error? Is it failing to find your touch module? Something else? Or are you just looking for a code-review? — Matthew L Daniel 31 secs ago
04:47
Monking
 
1 hour later…
06:12
0
Q: HashMap implement in Python 3

brijesh kalkaniThis code relies on Python3.7.4 I have implemented code for HashMap. It works well. But if you think something needs to be improved, say it. class Hashtable: def __init__(self,size): self.size = size self.mainList = [[] for i in range(0,1)for j in range(self.size)] def ...

0
Q: Bash script to check available name in Github

chau giangI just wrote this script to check if the name (that has 2 characters: 1 alphabet and 1 number) in Github is available or not so I can accompany this name. Here is my script: #!/bin/bash for i in {a..z} do echo 'running ...' for j in {0..9} do out=$(curl -s -o /dev/null -w "%{http_cod...

06:32
@LGSon code review is not for missing features, it is for reviewing working code. Inside the OP's code, the feature of bundling both files in a zip file is missing. — Ferrybig 45 secs ago
07:05
I'm voting to close this question as off-topic because should be in codereview stackexchange instead. — alvas 59 secs ago
07:41
@LGSon looks like you didn't understand my question and giving off-topic reply like Codereview — GeeBee 44 secs ago
08:02
1. You need to explain the rule for getting only 3 keys in first row and 4 keys on next rows. 2. Maybe codereview.stackexchange.com is more suitable place for this question. — sanyash 36 secs ago
08:32
0
Q: Thread await and execute different methods based on some event or value

User3Use case: I am writing a proactive session updater; The use case is for parallel API calls or sequential API calls intercept the API call and check whether token is valid. If token is valid continue with call If token is invalid first update the token then continue with API call. This is a c...

1) Think about replacing threads with coroutines since they are favoured in Kotlin. 2) Your request sin't about fixing and error, but more like a code review/suggestion based. Maybe you need to post it in stackexchange.com — Neo 36 secs ago
09:01
@BartoszZasada, thanks for the reply! I have been trying to change the category to Code Review but I cannot find the way. Any suggestion pls? — Sauzer 54 secs ago
-4
A: Compare last modification time with specfied time

Deepakfile_mod_time = os.stat(file).st_mtime t = datetime.datetime.today() - datetime.timedelta(minutes=30) should_time = time.time() - (30 * 60) last_time = (time.time() - file_mod_time) / 60 if (file_mod_time - should_time) < args.time: print ("CRITICAL:", file, "last modified", last_time, "minut...

just a code dump
09:20
And this is not a "get code for free" website, nor a "review my code" one (that would be codereview.stackexchange.com ). — GPhilo 16 secs ago
For questions about working code (efficiency, security, clean coding,...), CodeReview is better suited. — trincot 16 secs ago
09:36
1
Q: Calculating silence in a WAV file

LewistrickI made this script to calculate the amount of silence in seconds in an audio file. Is this a good method to do this, and if yes, can it be improved? It takes about 4 seconds for 20 audio files, which seems pretty long to me. The audio file is split in windows of win_size seconds. Every window th...

Monking
09:54
@Sauzer codereview.stackexchange.com is a different site, you'll have to post your question again there, and close this one. — Bartosz Zasada just now
0
Q: Any advice on how to reduce the runtime of this image tracking code using opencv in python

WrongEngineerHi someone suggested i should maybe try get some help here. I wrote this code to track small moving objects falling down a chute, the code work buts runs to slowly using 60 fps 1920 by 1080 footage the code only runs at about 10 fps. The problem there is somewhat self explanatory as I need the p...

10:37
0
Q: Work-In-Progress Lexer for Hobby Programming Language

ArnilSo, purely out of desire to learn, I decided to take on a project of making my own very basic programming language from scratch. After which, I made a lexer. I've tested the lexer (but only a bit) and it seems to work. But, I tend to doubt myself a lot (which might actually be a good thing). So...

0
Q: Calculating the total sum of inversion count for all subarrays

MadfishMy approach was to visit all inversion count pair and count how many subarrays these pair contribute. but visiting every pair requires O(n*n) time, but I want an optimized version of this. something like O(nlogn). Can I do something with the Fenwick tree? e.g. if arr = [1,3,4,2] , then total inv...

Monking
10:55
Since your code is working, you could ask for improvements on the Code Review Stack Exchange site. I'm sure you will get many helpful suggestions for improvements. — Raimund Krämer 28 secs ago
-1
Q: Understand the template used by other competitive programmer for writing the code faster in competitions

Suraj SharmaRecently I was going through some of the solutions of best competitive programmers in the world and I found out that those people use a template while writing the programmes in a particular language preferably in C++. I use C Programming language to write programs and will soon migrate to C++. ...

11:08
@CaptainObvious Yea, that's not what we do here.
Unrelated:
5
A: Was the retroactive change to CC BY-SA 4.0 approved by Stack Exchange's lawyers?

Kevin GranadeThis has been answered elsewhere, but the ToS includes two license clauses, one of which is CC-BY-SA, and the other is this: You grant Stack Exchange the perpetual and irrevocable right and license to use, copy, cache, publish, display, distribute, modify, create derivative works and store su...

0
Q: A nanny finder website created using reactjs and firebase used as a database

Shefali UpadhyayThe website is created using reactjs and firebase as the database. We are adding new user details, displaying the user details, modifying the data, as well as deleting the data from the firebase. I have coded by researching and learning. The entire code is in https://github.com/Shefali-Upadhyay/...

11:41
Monking
Its a last resort but id get dragged through the mud in a code review — Bill 42 secs ago
12:04
It is a requirement by our architectures. No offense but that is really not the question anyways. Task.WaitAll / Task.WhenAll should behave as described in the documentation. If this would be the case we would not write here. Actually you might be right i could stop disposing them besides that codereviews would not get accepted it does not clearify the problem that is occuring. — Jens Marchewka 45 secs ago
12:39
0
Q: NgRx effect to poll a remote resource and compare modified headers

Brian JWhat it does: The NgRx effect solves polling for remote resource URLs and triggering a browser refresh when they have changed. Key points: The effect is triggered in reaction to an action GetApplicationComponentssSuccess. The payload from the action contains the resource URLs to poll Each re...

13:20
0
Q: Singly linked list implementation in python 3

brijesh kalkaniI have implemented a Singly linked list. It works well. But if you think something needs to be improved, say it. This code was tested in Python 3.7.4. class Node(object): def __init__(self, data): self.data = data self.nextNode = None class LinkedList(object): def __in...

@CaptainObvious
13:40
0
Q: This script is to extract how many hotels AMAN has in each available combination of continents

shi95This script is to extract how many hotels AMAN has in each available combination of continents. For the convenience of reproduction dummy data is being used. In actual application, the data source would be a file. The information would be written into database. raw = ['Asia', 'BMBNKORA', 'Bhut...

0
Q: How to write this method with similar checks and multiple returns more elegantly?

karvaiI have written the following method which works as expected. But is there a way to write this more elegantly in Java 8? Appreciate any feedback. Thanks. private String get(Details details, Value value){ Type type = Type.getEvent(details.getType()); if(type != null){ if("SAMPLE"...

0
Q: Rust echo implementation

Cyril DanilevskiI'm learning rust, and I rewrote echo from the manpage, and got the following: // echo in rust - display a line of text use std::env; static HELP: &'static str = "\ echo the STRING(s) to standard output.\n\ -n do not output the trailing newline\n\ -e enable intepretation of backslash es...

13:56
Greetings, Programs.
JAD
JAD
o/
0
Q: Generating sequential alphanumeric values that match a certain pattern

DannnnoI'm working on generating large volumes of test data for some performance testing. Part of this is going to involve generating a lot of values that represent an "MBI", which is a certain kind of alpha-numeric identifier. This identifier has the following rules: Is alpha-numeric (uppercase on...

@Donald.McLean 0x486920446f6e2c20686f7727732073706163653f
5
14:21
0
Q: dynamically produce heat-map data points rather than use client-side hard coded values

stack rookieI have a working google-maps heatmap application which can be seen here which plots the proliferation of foxes in an area. As it currently stands, the heatmap points are hardcoded into a client side JavaScript function. function getPoints() { return [ new google.maps.LatLng(55...

@DerKommissar How long have you been planning this one?
@Donald.McLean Greetings User.
3
14:41
0
Q: Speeding up large file write to disk in c++

stasI need to write a large csv file to disk. I've reduced the problem to the below code. When I compile with VS 2017 run on my Windows 7 box it runs on average in 26 seconds. Could someone suggest a way to speed this up without changing the data container or output format? Any help will be appre...

14:58
@pacmaninbw Thought of it today.
Thought, "how can I mess with Don?" And bam.
3
If you want help improving working code you should post this on CodeReview.SE. If you do decide to do so please delete the question here. — NathanOliver 7 secs ago
@DerKommissar LOL
15:11
I'm voting to close this question as off-topic because it is asking for a better way to do working code. ask on Code ReviewDaniel A. White 13 secs ago
15:22
0
Q: database connection, fetching rows and handling error in csharp

AppDeveloperFetching database records and displaying as JSON. Asking for revision to ensure if everything's ok, i.e. connections are properly handled and closed in case of error. public class Department { public Department(int id, String name) { this.Id = id; this.Name = name; } ...

Iheanyi Ekechukwu on October 09, 2019

“I think that this is successful because…”

“I don’t think is successful because…”

“The way you did X strengthens this work because…”

“I think that the direction of X is stronger because…”

“I don’t like the way this code is structured. Use a hash map instead of an array.”

“Have you considered storing it in a hash map instead of an array? I think that might have better performance.”

15:42
0
Q: Closest element in std map when discarding values

ErikI have the following situation: I have two std::map<int,float> and I want to go through the first map one by one and find the element in the second map with the key closest to the key in the first map. Now, this plain situation is obviously addressed in other question like e.g. this one, but here...

0
Q: SharedPreferences Singleton Wrapper

nullmnI was wondering wether my implementation of the PreferenceService below is thread safe or could cause memory leaks. Android Studio gives me the warning "Do not place Android context classes in static fields". But since this warning is known to show in some cases where it does not really apply I...

16:15
@DerKommissar lol
16:41
@Mast First rule of optimization, don't. codereview.stackexchange.com/questions/230403/…
17:05
I'm voting to close this question as off-topic because improvements of working code belong in Code Review, not Stack Overflow. — Prune 14 secs ago
17:19
@pacmaninbw I know. Is that a response to something I recently said?
@Mast You didn't quite say it in your comment on the post, the intent was there. I happen to be big on optimization, but it can be carried too far.
When someone starts using #define to speed things up in C++, I start wondering how far they will go, and the obvious statement is to re-write it in assembly.
17:47
@DerKommissar Good.
I sometimes have to reverse engineer binary messages for the IPC protocol that the archive system uses, so I can actually read hex-ASCII fairly well.
18:25
0
Q: GMAIL API -Create/Send/Search messages for keyword

BlackCurrantI have written below code using GMAIL API reference which creates a basic message, sends it and also lists all the messages from user's mailbox matching a keyword.It works fine. Looking for experts comments to improve it . Here is the code- #!/usr/bin/python # -...

18:45
-1
Q: MySQL query to plot a histogram of song ratings

K. P.I wrote code to plot a rating distribution, which looks like this: The most important function is the stats function: function stats($songID){ $st=$this->conn->prepare("SELECT (SELECT COUNT(*) FROM list WHERE SongID=:songID), (SELECT COUNT(*) FROM list WHERE SongID=:songID...

19:15
Note that it doesn't make your code any more efficient - it only makes Excel stop redrawing. There's quite a bit of room for actual efficiency enhancements here, feel free to post your (entire) code on Code Review if you'd like feedback on any/all aspects of the code, and learn a bunch of new concepts. — Mathieu Guindon 5 secs ago
19:26
-1
Q: wrapper script invokes nested shell script which uses read -p for user input and doesn't work when called from wrapper but does when called directly

user138278The wrapper script invokes delete_vm.sh, which has the user confirm the deletion. However, delete_vm.sh works just fine when I invoke it directly but not when invoked from the wrapper_script.sh this is wrapper_script.sh #! /bin/bash vmguests=virtual_machines.list script_bin="${HO...

0
Q: Validate (Possible) File/Directory Path

G_Hosa_PhatI am working on a "comprehensive" library for use in my internal applications and I have created a working method (as far as all of my testing has shown thus far) to ensure that a file/directory path is - or, at least, could be - legitimate and should be accessible to any user of the same applica...

It's an interesting question for which an efficient (dynamic programming) solution exists, but it does belong at Code Review. Don't think of Code Review at SO's poor relation; you'll get excellent assistance there. A DP solution would first obtain all the paths from 1 to 2, then, using that information, all the paths from 1 to 3, then, finally, using all the prior information, all the paths from 1 to 4. — Cary Swoveland 35 secs ago
19:46
-2
Q: Inherited class calls initialization code in base class

Étienne LanevilleI am interested in hearing your opinion on the approach I have taken to have inherited classes initialize their base class. Here's a Machines collection class from that maintains a list of Machine objects. Each Machine needs to be able to inform its parent, using a delegate, of something they do...

 
2 hours later…
21:47
Don't worry about it for now, so long as it works as intended, it being inefficient will definitely be fully addressed in details over on Code Review! — Mathieu Guindon 53 secs ago
22:09
0
Q: Excel Import Data from Different Workbook Dynamic Headers

user211091I have this code below that copies data into a master workbook, in sheets "Inputs1", by matching the column headers from the master workbook with the source workbook. If a column header matches, it will copy and paste that column to the related column in the master workbook. The macro works grea...

0
Q: Determine the output of Java Program

Subba LakshmiPredict the output of the following Java program: What would be the output of the following program public class Test { static int x = 11; private int y = 33; public void method1(int x) { Test t = new Test(); this.x = 22; y = 44; System....

 
1 hour later…
23:13
If your code works fine, this should be posted on the code review site: codereview.stackexchange.comSyntaxVoid 14 secs ago
I'm voting to close this question as off-topic because it is asking for a code review, and belongs on codereview.stackexchange.com. — ekhumoro 56 secs ago
23:49
"I'm looking for tips/suggestions on how this code could be optimized/made more efficient." That's what codereview.stackexchange.com is for — juanpa.arrivillaga 22 secs ago
@DerKommissar @Donald.McLean I don't convert hex to ascii in my head unfortunately. codereview.stackexchange.com/questions/230458/…
I'm assuming this has something to do with Donald's job.

« first day (2349 days earlier)      last day (1964 days later) »