I was told to post the following question here.Any advice and suggestions will be greatly appreciated.
This is my first attend to use OOP JavaScript in my work. I know the concepts but implemented was more complicated than I thought. Now the code is a mixture of several things (JavaScript/jQuery...
I need to create a list or array of values calculated using function line_intersect from all combination of pair of data.But this expression takes too much time and memory,I cannot even execute it without crashing my computer.
How can I make it faster and less memory consuming?
intersections = ...
I have a some filters that chains around 30 Expression<Func<T, bool>> using linq to entities. Currently this is how I am managing them
...
//project filter
Expression<Func<Project, bool>> projectFilter = FilterEnabled();
projectFilter = projectFilter.And(GetProjec...
I finally made a "full dungeon crawler map" thanks to this.
The map looks great to me and I'd like to hear some useful advice from you. What I'm trying to do is to simplify my logic about 'detect boundary of rooms and paths'. Now, it's pretty complicated and in my opinion, it has some duplicated...
I do think the former is a bit obfuscated w.r.t. the latter, but this question would probably be better suited to the code review SE, otherwise it's likely to be closed as primarily opinion based. — David Conrad24 secs ago
I'm fairly new to regex expressions, but want to start working with them. I am seeking advice on what could be done better for the task at hand.
In particular, I need to test, if a provided string contains a potentially valid file name (the file might or might not exist on a path which might or ...
I'm a beginner with ramda and FP using Javascript.
I would like to have some coding advice. I'm building a project for fun and I'm a little bit confused on how I should code. Here an example:
Overkilled?
const add = classes => sel => compose(() => identity(sel), () => sel.classList.add(classes...
Can someone comment on if my design is correct for using and why (or why not)? I'm only adding relevant code to show the basic design. I've added comments to explain my design, not to defend or suggest it should be this way though. In this case, I'm using a logging example but the principle coul...
I've been trying to learn and implement Object oriented programming in Javascript.
Please could you provide some advice and feedback on the below code. (primarily on the application of OOP, overall code efficiency and proper use of patterns)
Code explanation
The code consists of a calculator c...
Below is a function that triggers after selecting from a dropdown to choose the floor. as you can see there are 3 levels of api calls ( regular http get requests with json responses) that chain together. the first 2 are regular requests and the 3rd one polls. how can I write this in a better way ...
I am currently working on a SharePoint 2013 project with custom application pages development. On one of those pages, there are multiple insert / update to database table operations. Here are the sample code I am working with:
Product.cs
class Product
{
public int ProductId { get; set; };
...
Recently I wrote a small piece of code for my project need and the code works fine...
if (Utils.nullOrEmpty(string1))
{
Config config = getConfig();
if (config != null)
{
doX();
}
}
else
{
doY();
}
if (Utils.nullOrEmpt...
This is an update of Test thousands of combinations quickly.
I have a physical robot which has a function, turn(degrees). For different robots, there will be small differences in the accuracy of the turn. I have fine turning variables, multiplier and adder. The degrees are multiplied by the mult...
One can easily notice that the output are not updated through code reviews. But you are right, it is just a workaround that's only convenient for very small projects I guess. Mine is a one man project with only a couple of generated CS files. — Slion55 secs ago
Public void GetPF(string bookId, IEnumerable<string> pFContentIds)
{
var result = (from procedureQuestion in session.Query<PFPQuestion>()
join procedure in session.Query<PFProc>()
on procedureQuestion.ProcedureContentId equals procedure.Id
where procedure.BookId == procedureQuestion.BookId &&
pr...
I would suggest moving this to CodeReview. Stackoverflow is more for bugs and issues, while CodeReview is more suited for optimizations and review of working code. — JRLambert21 secs ago
Why there is downvote ? if this question is not suitable for stackoverflow then it can be shifted to CodeReview. You ask, what you have tried, this is not free code site, and blah blah, but what happened here, OP show his efforts, he tried to solve his problem, Seriously day by day negative feeling is developing inside my heart towards SO ( because of ppl who love giving downvotes without explanation) — akash karothiya34 secs ago
For looking more simple. I want to make refactoring and review. How can i refactoring and review in this code?
IDictionary<String, Agent> idAgent = (IDictionary<String, Agent>)CacheHelper.Get(key);
if (idAgent == null)
{
lock (objLockUser)
...
Agree (I did mention that using it in one-off operations is fine) but still: if used in a loop, it has to changed. I have made this point when doing code reviews many time. — Jim Andrakakis14 secs ago
@WiktorStribiżew: I believe the unescaped parentheses is the main (or probably the first) issue since the OP states " if I give input as abc (1), then the first regex pattern returns zero matches". I intended to get back with the OP code review in a while to counter any further issues. — Dmitry Egorov9 secs ago
@SirRufo though it may look as if this question is more suitable for codereviewexchange, I actually want to know if my understanding of the PKCS11Interop usgae is correct. If I add it to codereviewexchange I may not get proper responses, codereviewexchange does not even have a tag for #pkcs11. — Aashish19 secs ago
With my current Implementation I do not get any of these errors but would like to know expert opinion here about my implementation. Please let me know if you see any problem or scope of improvement in my implementation. is clear asking for a code review — Sir Rufo30 secs ago
Note: I based my solution on this SO question
I have this list of dictionaries.
[{'checking_period': datetime.timedelta(0, 74327, 365993),
'error_margin': datetime.timedelta(0, 60),
'frequency_periods_num': 4955.157732866666,
'last_task_run': datetime.datetime(2017, 6, 22, 11, 51, 40, 406...
I want to fetch data from database using MySQLi. But I am having an error in
it. Please review my code and give me suggestions to improve it.
Code from class.php
class main{
public $host="localhost";
public $username="root";
public $password="";
public $db_name= "db_tvw";
private $img_path ...
I am try to download the entire HTML from every one of these 54897 pages. Selenium, however, doesn't to reload the page, when it clicks on next page, at least only superficially. After running the code, I realised that all 54897 were identical. Can anybody see a solution to this problem? Here's ...
This is a solution to a community puzzle from CodinGame. Input for the program:
1st line: Two integers, height and width of the grid.
Next lines: The given slider puzzle grid consisting of numbers from 1 to n and a dot representing an empty space.
Example:
2 2
2 3
1 .
Goal: Order the numbe...
I have this code
//TRIGGER MULTIPLE VIEWS, WALL AND FORUM
if(isset($_COOKIE["myticketroll-projects-sorting"])) {
$_SESSION['projectsDisplayMode'] = $_COOKIE["myticketroll-projects-sorting"];
}
if(isSet($_GET['mode'])) {
$_SESSION['projectsDisplayMode'] = $_GET['mode'];
}
if(!isSet($_SESS...
I've to simulate exactly a recursive algorithm with an iterative one.
Assuming that I have a binary search tree that contains only a key and two references at his right and left child I want to do this count:
CountOddRec(T)
ret = 0
if T != NIL then
if T->key % 2 = 1 then
ret...
I wrote a program that concurrently reads multiple files and makes a request to an API for each line of each file. The JSON response is then parsed and the "available_filters" field is extracted. The program then evaluates if each "filters" field inside "available_filters" contains numbers in its...
My jupyter notebook is here. I would love to hear any feedback about any problems that may be occurring in my data pipeline.
I already know that I still need to develop the following features:
Implement better hyperparameter testing for the various estimators that I am looking at, especially ...
I know I'm supposed to create properties like this:
class foo(object):
@property
def x( self ):
"Docstring"
print('getting x')
return self.__x
@x.setter
def x( self, value ):
print('setting x')
self.__x = value
But I do it like this:
c...
This is code which is currently running and my primary goals are:
remove redundant code, and have the ability to change static text
like sb.AppendLine("Some Test:") without the need for tinkering the
code.
public string GetTextReport(int Id)
{
var sb ...
I'v been developing a system where the mobile syncs data from the server.The phone can run offline but when connected to the internet it needs take care of inserted or updated data.
Here is the output result(this is just for demonstration purposes it will be changed a bit):
[
{
"ver...
I'm trying to change html dynamically based on data attr. I store the active element and after clicking my input, I want to change the text on some div.
The issue is when I click on the element, it changes the html for all elements with class .visible-mobile as opposed to only elements with clas...
There have been a lot of similar questions asked but all involve operands of same type or same generic type. This one in particular (How can I use a generic type parameter with an operator overload?) is close to what I am looking for but no answer or work-around.
Is it possible to do something l...
You may want to take this to the Code Review part of Stack Exchange. They do a lot of stuff like this over there in terms of "how should I refactor to make it better" or "is this well written out code." — Michael Platt14 secs ago
I have these two methods basically doing the same thing:
private void recreateBlocksIfNeeded() throws WplexError
{
if (this.blocksToRemove == null || this.blocksToRemove.isEmpty())
return;
final List<BlockVO> blocksToCreate = new ArrayList<BlockVO>();
for (final BlockDeleti...
I have some code in a particular coding language, and I am trying to clean it up by adding spaces around the variables. I wrote this code, and it works on small amounts of text and if I set a break point and run through it manually for large amounts of text. But when I try to run through it witho...
The code shows here is a demo of my application. The func1 always hang somewhere with reason I haven't figured out by now. Now I just want to write a watchdog for this process. If it didn't generate any data for some time (10 minutes here), watchdog will kill it and start a new one.
All the code...
I'm voting to close this question as off-topic because this is asking for a code review of working code, it belongs on codereview.stackexchange.com — Jarrod Roberson50 secs ago
@Peilonrayz Ehhh, in this case I think it's pretty clearly on the lighter side of gray, the OP shows a successful run, what the intended input and output are. The code works as advertised, it just needs to work better.
I've got this piece of code that you pass a string of special characters too and an index which points to a location in this string. The code will take the index, analyze the string, and return a new index of location of the proper grouping bracket. I.e., if index = 5, and my string is ![>[*[]^[#...
These AI stories remind me of the 'be careful what you wish for' trope. Kinda like the old programming joke: A programmer and their partner are getting up and organising breakfast, but they have no milk. So their partner asks "Can you go to the store and get a bottle of milk?". Just as he is about to step out the door, their partner calls out "Oh, and if they have eggs, get 6!". The programmer returns and places 6 bottles of milk on the kitchen counter. "Why did you get so much milk?!?" their partner asks, to which the programmer replies "Because they had eggs!" — RobotnikJan 15 '16 at 4:53
you did already answer your own question. what kind of attention do you think is required? A Better answer than yours? If you like review there is also [Code Review|codereview.stackexchange.com/] — stefan16 secs ago
@m69 well you see there's no answer yet. The situation is more that of a review (aka what could I do better implementing this) ... He doesn't have an actual problem with his code but is looking for more general advice and indeed, this might be better placed on the codereview site. — Felix Palmenjust now
I have come up with a class design for parsers (for xml,csv etc) and parser factory. I will be using it in my project.I will be configuring these as beans in the spring context file. I would like to get opinion on the class design.
public interface Parser<T> {
String fileFormatSupported();
...
This is a followup code review request for a previous post: Creating / Uncompressing zip files in VBA
I did most of the suggesttions presented in the last code post, but as I significantly improved the error handling, I'd like to show a new version for review.
The following is a description of ...
I have a working C# (version 5) function that I use to match an input string to one of many unique regular expression patterns and return the replacement string associated with the matched pattern (via Regex.Replace). I've tested it well enough to know that the code acts as intended and is reliab...
I am working on a game engine and also an editor.
My engine needs to register the levels to be instantiated. Since it's a templated class method I am thinking about automated code generation.
Upon saving in the editor, it will generator a LevelRegister.designer file, containing c++ code, whic...
@m69 In this case it seems like OP is just asking for an implementation of a very-well-known data structure, of which there are many already available online. IMO the best case scenario here is posting their working implementation to code review, any version of this question posted here would either be unclear/too broad/off topic or would just be adding to the noise. — Dukeling33 secs ago
@Icepickle, for all the goodies ... codereview.stackexchange.com :) — Rahul16 secs ago
I'm working on cleaning this code up a bit and was hoping for some suggestions. Right now it works well enough on a basic level, but it doesn't check for out of bounds numbers or improper input.
Also, one of my big concerns is too much nesting. Does the code look ugly? Any suggestions on how to...
I've written an experimental project, because I'm interested in running untrusted arbitrary C# code on clients which is automatically downloaded.
To do this, I am using AppDomainToolkit, which is a really nice library that helps setting up an AppDomain. However, due to the nature of AppDomains, ...
I wrote a program that replaces tabs with spaces. First, I defined maximum length of input string in constant MAX_LIMIT. Next, I declared procedure detab that takes two arguments: input string and maximum length. In the procedure I read characters until encountering EOF. I'm replacing tabs with f...
I'm fetching tweets from the Twitter API and display them in a TextBlock using multiple Inline elements so that I can highlight (and link) entities embedded in the tweet: hashtags, urls and user_mentions. media entities are currently ignored.
Tweets also usually contains emojis. From the API the...