« first day (2882 days earlier)      last day (1433 days later) » 

00:01
RELOAD! There are 7452 unanswered questions (89.5125% answered)
@CaptainObvious borked
@CaptainObvious asking for debugging help?
 
1 hour later…
01:03
0
Q: Dijktra's Algorithm Visualizer

TlomolokoA couple months ago I made an interactive dijktra visualizer that allowed the user to setup the map nodes and run the algorithm. I thought it was a good way to solidify my algorithm and html/css knowledge. I'd like for you guys to test my application out and give any advice in any way I could mak...

01:54
0
Q: Haskell Dynamic Programming on a Tree

Parth KohliHere is my shot at Homework 8 of CIS-194 (from Spring '13). The problem is about a hierarchy of employees at a company (a tree), each node being of type Employee, each described by a label (empName :: String) and an integer value (empFun :: Integer). We need to choose a subset of employees so tha...

 
2 hours later…
03:34
0
Q: Toy neural network give poor results

FodeyaI'm a beginner both in Python and Tensorflow. I made a toy neural network to learn both. The objective of the NN is to identify the module c, or separation between lines defined by random points, and the width ε of each line, as show on this image, which shows a single sample taken from the ones ...

03:47
This question should probably be asked on Code Review, codereview.stackexchange.com, rather than Stack Overflow - "requests for feedback" are not on-topic for this site. — Tieson T. 8 secs ago
 
1 hour later…
04:51
0
Q: Better way to write the LINQ queries

BunnYWe use EntityFramework Core and I have a function as below: private bool CheckForDuplicateNames(ProductDto productDtos) => RequestContext .MyDbContext .Products.Any(i => i.CompanyId == RequestContext.GetCompanyId() && ...

0
Q: Algorithm for auto tiling of tiles in a 2D tile map

Christian IvicevicIntroduction I have implemented an algorithm that applies auto tiling to a 2D tile map for a game, selecting the correct tiles according to their neighborhood. Given a string representation in a classic roguelike form such as this the algorithm yields a generated map with properly connected tile...

05:41
-1
Q: The quality of StackExchance and may be all there sites reviewer is so low quality

ShuvoThis is a very important web connecting platform where the people who know discuss. But some low quality employee of this company is vanishing the site. Having some amazing owner it is very disappointing. this is a very important topic that should be discussed first Points toward the validity ...

0
Q: caesar cipher (rot<2-25>)

Axel BozicI'm a rookie in c++ programming. Recently, caesar ciphers caught my eye. I ended up making a rot<N> text converter, where N is any value between 2 and 25. Please keep in mind that I'm still new to programming and don't know advanced level stuff. All your feedbacks will be appreciated. FYI, this w...

 
1 hour later…
06:45
If you want to improve on working code, you should post on codereview.stackexchange.comsuper 9 secs ago
07:06
thanks, I have repost on codereview.stackexchange.com.codereview.stackexchange.com/qu‌​estions/257663/…Yanyu Peng just now
07:21
0
Q: Emplace a lambda which captured a unique_ptr into container like queue

Yanyu Peng我想把一个捕获了unique_ptr的lambda放到一个容器里,但是在gcc 7.3.0 C++17下编译失败了。从错误信息看大致是构造function的时候,会调用unique_ptr的拷贝构造函数。 I'd like to emplace a lambda which captured a unique_ptr into a container, but it compile failed under gcc 7.3.0 C++17. From the error messages, It's calling the copy constructor of unique_ptr w...

07:47
0
Q: Returning a vector having squared, sorted (ascending) of the argument (vector)

zowhairstruct Solution { nums: Vec<i32>, } impl Solution { pub fn sorted_squares(nums: Vec<i32>) -> Vec<i32> { let mut b: Vec<i32> = nums.iter().map(|x| x * x).collect(); b.sort_unstable() } } fn main() { let a = Solution { nums: [12, 1, 2, 3, 4, 6, 9].to_vec(), ...

08:12
0
Q: Repository pattern with NHibernate and Autofac

biel salahere I leave my code for a repository pattern with NHibernate and Autofac. I would like to receive some feedback about it. Especially about the session handling with NHibernate. By now I don't like the way that is implemented. Currently the session is created in an IHttpModule on the beginning of...

0
Q: Modified Gantt Chart

Jaroslav Hradskýthis is my very first pandas/matplotlib code and I would be grateful if you can review my code and share your thoughts or ideas for improvement. Please focus on code, not the features of resulting chart. Thank you for you opinion. The purpose of code is to create Gantt chart showing my planning f...

09:02
0
Q: Markov Chain Monte Carlo (MCMC) wind simulate

kelamahimI want to generate wind data with the use of MCMC. The results I am getting are quite off from the measured mean values not sure why. SIMULATE WIND DATA ## Import the packages ######## from sklearn.cluster import KMeans ### Let's generate some "wind" data from Weibul ### Wind_sim=np.random.weibu...

09:27
0
Q: This returns a vector each element of which is squared and then whole vector is sorted in non-decreasing order

zowhairThis seems to be not so efficient: may be due to style or .sort_unstable() or anything else. Please review. impl Solution { pub fn sorted_squares(nums: Vec<i32>) -> Vec<i32> { assert!(nums.len() <= 10000); let mut b: Vec<i32> = nums.iter().map(|x| { assert!(*x >= -10000 |...

10:18
0
Q: Unable to figure out the determinant and row echeleon form

Jaskirat SinghI have created a basic program that calculates the basic operations in the matrix. In this program I have included the function of "Determinant" and "Row Echelon Form" but when I tried to run the function of determinant, it does calculate the determinant but do not print it and at the same time i...

10:40
Define "safe"? What exactly are you worried about? You're simply counting up whether some tests have passed. Incrementing a counter can't really go wrong (unless you accidentally have code elsewhere which incorrectly increments it when it shouldn't - but proper code review and testing would reveal that). It's the "if email address is ok" and "if password is ok" bits which are the things more likely to give you problems I would expect. But I don't know what you're testing for there, what your code is, or what your definition of "ok" is in each case, so I can't comment on that. — ADyson 59 secs ago
 
1 hour later…
11:43
Please take the time to rephrase your question or consider removing it if this is not possible. In it's current form nobody sees where you got stuck and what you actually want to achieve. Also, SO is not the site for asking for optimization options, try Code Review Stack Exchange for things like that. — Wolf 31 secs ago
11:59
0
Q: Simple Connection Pooling with psycopg2

BobI am currently using a SimpleConnectionPool from psycopg2 to lease transactions to a PostgreSQL database and would like a review of my current implementation. Code from contextlib import contextmanager from dataclasses import dataclass from psycopg2.pool import SimpleConnectionPool @dataclass ...

0
Q: Tic-tac-toe implementation

PadritonI created a tic-tac-toe game implementaiton in rust. What I can do to make this tic-tac-toe code a better code? game.rs pub struct Board { board: Vec<Vec<char>>, } pub struct Cell { x: usize, y: usize, } pub enum ErrCoordinates { InvalidSub, } pub enum ErrBoard { OutOfBounds...

I’m voting to close this question because it belongs on codereview.stackexchange.com. — connexo 25 secs ago
13:15
0
Q: Finding the right property value from array of objects

John ThomasI have a below snippet, here i am using array.find to find the first success case and end it. So here is the code snippet const USERS_LIST = [ { key: "john", location: "dublin", }, { key: "joe", subKeys: [ { key: "jane", locaction: "washington", }...

13:38
Tip: asking for improvements for working code would be a better fit for Code review. — El_Vanja 35 secs ago
Please read stackoverflow.com/help/how-to-ask. In the future please include your code and describe what issues you are having with your code. We can not give you opinions or best practise questions like that may be better suited for codereview.stackexchange.comDaImTo 57 secs ago
 
1 hour later…
14:48
Probably better for codereview.stackexchange.com because the code does work. However, in general, I'd say it's a very bad idea to do HTML sanitation yourself. I would highly recommend using a library for this. There are many that properly parse the HTML and then escape the <s. — Sumner Evans 6 secs ago
Welcome to Stack Overflow! Welcome to Stack Overflow! Visit the help center, take the tour to see what and How to Ask. Codereview questions are off topic at SO, but you could post it at codereview.stackexchange.commplungjan 34 secs ago
0
Q: Function to perform checks on data

Victor CorreraI'm currently trying to do data quality checks in python primarily using Pandas. The code below is fit for purpose. The idea is to do the checks in Python and export to an Excel file, for audit reasons. I perform checks like the below in 4 different files, sometimes checking if entries in one are...

0
Q: Registration and login via PDO [optimize]

xkp Hello, dont blame me iam trying to learn, the code works but iam not sure it is well optimized. Please tell me if you see something wrong. My goal is to achieve most optimized code (and learn something in between). User register -> check if username or email exists , if not = insert into databa...

possible answer invalidation by wefwefa3 on question by wefwefa3: codereview.stackexchange.com/posts/101816/revisions
Thanks @Sumner Evans. I posted this on codereview.stackexchange.com so hopefully this will help. I would have preferred to use HtmlAgility, but it did not work for me despite a lot of research. Maybe I'm missing something, but my requirements are fairly simple so it's a bit odd. — Scho 43 secs ago
possible answer invalidation by wefwefa3 on question by wefwefa3: codereview.stackexchange.com/posts/101816/revisions
15:19
Monking
0
Q: Method encodes all less than (<) characters in a HTML string, but not the HTML tags

SchoI am cleaning a HTML string to encode the less than sign (<) to a HTML entity (&lt;), but leaving the HTML tags as they are. An example is converting "<div>Total < 500</div>" to "<div>Total &lt; 500</div>". There's a number of posts addressing this including: https://stackoverflow.com/questions/5...

15:35
Please read How do I ask a good question? and How to create a Minimal, Reproducible Example. You might have a better chance of finding an answer on Code ReviewRojo 24 secs ago
15:46
0
Q: Change Django static directory name

zeuskedev 1Django static directory is named static by default and in the settings.py file there's STATIC_URL='/static/' and i wanted to change this to STATIC_URL='/cssandjs/'. If this change was possible then does that mean that in template files i will have to load static as {% load cssandjs %} instead of ...

16:01
@Duga Fine
0
Q: Template specialization and initialization - How can I simplify this?

RanzaI'm trying to use templates to customize the struct Field and it I'd like to know a way to simplify the part B of the following code. The code looks redundant in the sense that, I need to write SinePulse several times, also it would be best if the (default) initialization of fx was postponed sole...

0
Q: Optimize function parameter best value to avoid nested loop

TmSmthI have this function : def fct(data, name_a, name_b, param_a, param_b, param_c, param_d): df = data.loc[(data[name_a].notnull()) & (data[name_b].notnull()),[name_a, name_b]] df_corr = pd.DataFrame() df_corr[name_a] = df[name_a] df_corr[name_b] = df[name_b].shift(param_a)...

16:26
I would advise you to post this on the Code Review Stack Exchange, because your program already works as expected. — Andy Sukowski-Bang 29 secs ago
@AndySukowski-Bang when suggesting users post on CR it would be great if there was also a suggestion like "Please read the relevant help center pages like 'What topics can I ask about here?' and 'How do I ask a good question?". In the current form the code above would likely be closed because it doesn't have much of a description about what the function actually achieves. — Sᴀᴍ Onᴇᴌᴀ just now
0
Q: Small bash script to quickly edit scripts in $PATH

Elias Van OotegemStaying true to the mantra: "The third time you do something, you automate", I've built up a decent collection of shell scripts that live in ~/bin. Some of these scripts contain useful boilerplate code, or just stuff I can't bring myself to memorise (like colour output stuff). Other scripts I fin...

16:58
Monk
@CaptainObvious It doesn't look like there is much code to review there...
Welcome to Code Review! However, this looks like it belongs on Stack Overflow. In fact, it may already be answered there if you search for it. — Null 48 mins ago
is that a question for SO?
17:27
0
Q: PHP MVC API, separation of concerns: should the Controller make a new HTTP request to the API?

yes sureI'm having a huge doubt on how to connect the front-end of my application to its back-end. Separation of concerns is probably one of the most common pitfalls in PHP since the code may run all in the same machine. So my application has a single entry point where all requests go. Now, here are alre...

17:38
@SᴀᴍOnᴇᴌᴀ How were they even able to post it without 3 lines of code?
@pacmaninbw good question...
17:53
0
Q: Automatic saving of workspace variables for `DrWatson.jl`

Adomas BaliukaThe Julia package DrWatson.jl is aimed at scientific computing and data analysis. It describes itself as "scientific project assistant software". I recently decided giving it a try and like the functionality so far. Useful features, in my opinion, include the safesave method, which saves dictiona...

18:18
0
Q: Reduce function complexity and eliminate if else blocks in validation loop code

igodfriedHi everyone I'm trying to reduce the complexity of some of my Python code. The function below aims to compute the validation and test loss for a variety of PyTorch time series forecasting models. I won't go into all the intricacies but needs to support models that return multiple targets, an outp...

18:53
Is this common/legal/good practice I can only speak for myself, but this would fail code review with the recommendation that Allocate2D at the very least become a templated function. — user4581301 52 secs ago
19:19
More Pythonic in what way? There's a lot of stuff that could be improved here. What are you looking for specifically? If you want overall advice, it'd probably be better to ask on Code Review instead. — wjandrea 28 secs ago
20:47
@Mast you can move around a larger screen when you are RDP into a machine. so maybe I had something up on my Computer and I went to lunch, and I need to see if it is finished yet, I could RDP into it and check the status, good for lite tasks
21:09
If you're looking to improve working code, the best place to ask is codereview.stackexchange.com. — jaco0646 34 secs ago
This is more appropriate question for: codereview.stackexchange.comselbie 41 secs ago
0
Q: (in C-language) char mask or int mask

DIGORO(i'm russian) i not understand, what's better,char mask or int mask? int mask=15 //00001111 (bytecode) char mask=15 //00001111 (bytecode)

If you're looking for advice on how to improve already-working code instead of help solving a specific, narrow problem -- then our sister site Code Review might be of interest. Be sure to read their Help Center for the rules that apply there -- just like Stack Overflow, Code Review is specific about what constitutes an acceptable question. — Charles Duffy 1 min ago
 
1 hour later…
22:30
0
Q: Perceptron Algorithm in Python not Converging

Lburris12So I have created a simple perceptron algorithm in python with some help of numpy that looks like this: import numpy as np data = [] for row in open("input1.csv"): row = row.replace(',',' ') data.append([int(x) for x in row.split()]) weights = [0.0,0.0,0.0] learning_rate = 0.1 epochs = ...

22:56
0
Q: What can I do better to clean this code up, make it smaller? Just started practicing clean code, need advice

Ais tisI feel like this code could be cleaned up more or it could be shorter but and more understandable. Any advice/suggestion is appreciated. public string GetIPVersions(NetworkInterface @interface) { string ipVersions = ""; if (@interface.Supports(NetworkInterfaceComponent.IPv4))...

23:21
0
Q: Cleaner python code calculations

Dave WhyteNew-ish to python, looking for ways to make python code cleaner/better. calcul_plan: Function that returns a plan from an array of values mdp: Markov decision process spec. value: Array of values for each state (Numpy 1D array of float) returns: Plan (dict) that maximises future expected value, ...

0
Q: How to remove a else statement in PHP / Laravel

twiggI have a super simple method in a controller using the Laravel framework. It simply checks to see if a property on the controller is set or not and runs the appropriate code. if($this->term){ $documents = Books::search($this->term)->paginate(5); }else{ $documents = Books::...


« first day (2882 days earlier)      last day (1433 days later) »