I am looking for people's opinions on my use of a set of non standard "standard classes". Basically I am working on a 'modern' C++ Lexical Analyser and Parser Generator duo to replace flex and GNU Bison which will work as a library and tool combination. Anyway to cut to the chase I have a number ...
The following class is a helper to avoid OutOfMemoryException exceptions being thrown when the list is to large so that it is added onto the large objects heap. To do this it adds the items onto the heap as smaller arrays contained inside of a list.
Some quick notes:
I prefer not to use var.
T...
@zaftcoAgeiha : It might needed to be done from within a python application itself, like in my case and the reason I came here for : ) . I did the same using "sed command" invoked on the shell from python script but my code reviewer didn't want to spawn a new process for such a simple thing..... Both have pros and cons, like in python file needs to be read in memory and can be an issue for large files but I need to get my code checked in : ) — ViFI42 secs ago
I think what he was trying to do was to add that as a convenience method, e,g., if you just loaded a hundred Bitmap s and you wanted to get rid of them all at once
It won't do anything except make your code easier to read. I didn't even know you had an issue to be honest, you never mention one in your question. Sounded like you wanted a code review. — dan18 secs ago
So, I go a notification about a badge on meta, which got me looking at a post there, which in turn got me going to codecrap.org, where I found codecrap.com/content/8205 .... Sometimes people are actually brilliant.
This is a very basic Mailer service that I put together after finding out that MVC Mailer doesn't play nice with MVC 5.
public class MailerService
{
private const string domainEmail = "[email protected]";
private void Send(MailMessage mailMessage)
{
using (var smtpClient = n...
I wrote my first Python program today after working through a few books. I decided to build a group initiative tracker for our D&D group and was hoping to get some feedback. Critiques on code efficiency, formatting, suggestions etc would be appreciated. My plan is to eventually take this from a c...
This code is from a tutorial and it says it should run but it does not. I get these errors. Why? Does this have something to do with python 2 VS 3? How do I fix it? Thanks!
Traceback (most recent call last):
File "BounceGame.py", line 8, in
class PyManMain:
File "BounceGame.py", line 31...
A slightly earlier draft of the same program is up for review but it's easier to read on GitHub with line numbers and syntax highlighting. — luser droog5 secs ago
/*Hello All I have written code for multi producer single consumer code with bounded buffer.
1. Please review the code and suggest for any improvements or mistakes
2. I Welcome all your valuable suggestions
*/
#include <stdio.h>
#include <stdlib.h>
#include <pthread.h>
#include <unistd.h>
#incl...
Assume we have an string that contains the character 'c'. This character can be located anywhere within the string. The exercise is to remove 'c', and the characters that, if exist, are on its immediate left or right. I have devised an algorithm, assuming that 'c' = '*', which its flowchart can b...
I've got this working almost to where I want it. The part I can't get right may be due to the programming so I'd like to get a review.
I'm making JSON calls to the Twitch API that sends back a list of people who are streaming video on code camps channel on the Twitch website.
I have a semi pop...
Question (15 marks)
You’re required to build a game ‘Boom-The-Battleship’ in C program that fulfil the below requirements/rules:
• The mission of the player that plays the game is to find the battleship of your enemy through a masked out map.
• The game should have a 20 rows x 60 columns si...
Original question can be found here
I took the advice I got to heart, and re-wrote it. Once again I'd appreciate any advice as to how I can improve this using best practices.
Jar.java
package com.tn.jar;
public class Jar {
private String itemName;
private int numberOfItems;
priva...
Here is the code https://ideone.com/JwjssZ which is my solution of http://www.spoj.com/problems/EC_CONB.
If there is a compilation error in the code, it should appear in ideone also but it doesn't.
Can I get a little help here?
Thanks.
I'm new to this competitive programming world. This morning I came across this question, which required the time to be less than 1 sec. But my code runs for 1.000069 sec, thereby rejecting my solution.
Question:
There are N chocolate boxes, and you will be given with a chocolate index for wh...
bonus points for having to navigate through massive crowds to get home because everyone was queued up along the city center to await the welsh football team's return
I've been interested in writing a very basic Pokémon battle sim the past couple days, nto really sure where to start though. the actual sim would be easy, it's the whole taking-in-of-turns etc thing that isn't.
I know there is already one, but this might teach me a good deal about FSM etc so it would be interesting to write my own.
I don't think it would be feasible to recommend it as a full community challenge, but maybe something cut down a bit. Perhaps a simple battle sim that allows for 2 players to take turns (could be AI or another player, it doesn't matter)
you're welcome tos uggest it as your own, but I don't think I could come up with a formal challenge that would either be too challenging or too easy
I would appreciate if you tell me your opinion on this solution. The point is that I'm creating a web page which has two types of users with very similar permissions. Person and Company. The main difference is in their attributes and probably different billing.
I've created only one userprofile...
I'm voting to close this question as off-topic because it's asking us to do a code review on working code. Code Review would possibly be a better fit, but make sure to review their help center before asking. — theB41 secs ago
Supercool and helpfully commented. I wish I could contribute to a code review, but I'm a novice. My only comment on the markup is that if you want to emphasize the user it seems to me that leaning more heavily on HTML and CSS could be useful. (In paritcular, the tag names, the ability to specify an external style sheet, and the CSS synatx for style sheets.) Finally, you are probably aware of anastigmatix.net/postscript/Hyphenate.html but just in case. — Alan54 secs ago
Supercool and helpfully commented. I wish I could contribute to a code review, but I'm a novice. My only comment on the markup is that if you want to emphasize the user it seems to me that leaning more heavily on HTML and CSS could be useful. (IViz, tag names, external style sheet, and the CSS synatx for style.) Also: anastigmatix.net/postscript/Hyphenate.html just in case you missed it. Finally, have you using restructured text as your markup? It seems you would like your raw documents to be very readable, and the (Python) parsing code is public domain and well tested. — Alan36 secs ago
In order to divide an IEnumerable in C# by a predicate, I implemented the following (in a static class):
public static IEnumerable<IEnumerable<T>> SplitBeforeIf<T>(this IEnumerable<T> input, Func<T, bool> pred)
{
//This exists to store the predicate satisfier, which I kept as
//the first...
So I've been developing a simple CMS both for practical use and learning about Laravel, and I decided to implement a simple service that makes it possible for the administrators to send messages to one another. However, the finished javascript code, while completely functional, ended up being a b...
and unanswered includes questions with answers if all answers have 0 score
There used to be a page with a quick summary of the number of users, questions, answered % etc. It was in the sidebar. I cannot find it anymore. Is it hidden for graduated sites?
Oh, didnt know codereview was a thing. I was wondering why all the down votes. I'm not sure how compatible smart pointers are with Unreal Engine but I'll keep them in mind as I move forward :) — Ozzadar41 secs ago
I'm trying to add several information into one Node in a singly linked list... How do I do that?
After asking the user for several vehicle information: plateNo(String), vehicleType(String), serviceType(String) I will have to store this information for each vehicle.
I have to use a singly linke...
I am new to Java and StackExchange in general, but wanted to get some input on the code below for a CS class I am taking. It is a program that plays the Hi-Lo guessing game with numbers. A user may choose to quit midgame by entering 0 and then they are prompted to play again if they choose. If ...
> At 39 lost all his money ( circa £3.60ish) . But despite all the adversity and through shear determination .. he managed to complete his first Novel ! ....He plans to read a 2nd very soon
I am working through the Free Code Camp projects. I am not asking for a solution. I am asking for a review of my code that doesn't work.
In one project called "Pairwise" there is a given array of numbers and a single given number for input. You go through the array and add two numbers in the ar...
@Phrancis okay, I'll work on an answer, it might take a while though. I've never implemented IEnumerable or IEnumerator but I think I can figure it out
> The following class is a helper to avoid OutOfMemoryException exceptions being thrown when the list is to large so that it is added onto the large objects heap.
@t3chb0t The list is being loaded from a file, the object is so large that it gets added onto the Large Object Heap that has different memory managements. By adding the arrays into the list it isn't added onto the LOH and avoids the exception — TheLethalCoderyesterday
Could you explain a bit more about why you're loading that large amount of data in the first place? Is there no way you can load in the data via a stream and split up the work amongst many processes? I'd imagine you might get better bang for your buck than trying to hamfist your way into going past CLR limits. — Dan Pantry5 secs ago
I wouldn't use a finaliser in this case if his concern was deterministic memory management
Finalisers in C# are undeterministic - they are called when the object is destroyed. That could be a long time after you as a programmer decide it should be
Dispose is useful for when you are trying to deal with non-managed resources like database connections or whatever
Those types of resources have extra "things" to them that can't be removed just by simply removing the object from memory, like, well, database connections, file handlers, w/e
You can't rely on when the finaliser is called, but that may be a considerable amount of time after when you want the connection to be closed (in my example).
@jrh It's extremely deceptive. In my very short review I mentioned that OP should either make the Dispose behaviour more obvious, or do away with it altogether.
In the words of the Rust masterrace (@skiwi), this behaviour would not be allowed as it's not safe
Esp if it crosses multiple threads, that just seems like a really bad idea
The following class is a helper to avoid OutOfMemoryException exceptions being thrown when the list is to large so that it is added onto the large objects heap. To do this it adds the items onto the heap as smaller arrays contained inside of a list.
Some quick notes:
I prefer not to use var.
T...
My program will divide the decimal (30.0575) by a range of fractions (1/1, 1/2, 1/3, ..., 1/48) leaving me with list of improper fractions that look like this:
> 1/1 * 30.0575
> 1/2 * 60.115
> 1/3 * 90.1725
> ...
> 1/48 * 1442.76
My program will then "pick out" the improper...
In order to divide an IEnumerable in C# by a predicate, I implemented the following (in a static class):
public static IEnumerable<IEnumerable<T>> SplitBeforeIf<T>(this IEnumerable<T> input, Func<T, bool> pred)
{
//This exists to store the predicate satisfier, which I kept as
//the first...
@StewieGriffin You should mention why numel is preffered over length. I have used matlab for a few years, but someone not familiar with the software probably dont. The reason I have heard is that numel is much faster for matrices.
Pick a style guide.
Your whitespace is truly amazingly horrific. I'm not sure why you have 7 lines of whitespace or your for loop declaration is on a different indent to your closing brace for it, but try and keep things consistent.
A lot of your code would be a lot more readable if you kept y...
I'm implementing a file upload using a nodejs. I've got fully functional code. However, it feels overly complicated and I'm hoping there would be an easier way to implement the same thing?
In particular what I want to achieve is
Write the request to a file
Send upload progress information
S...
Challenge:
Given an array arr, find element pairs whose sum equal the second argument arg and return the sum of their indices.
If multiple pairs are possible that have the same numeric elements but different indices, return the smallest sum of indices. Once an element has been used, it cannot b...
Please view the code in a repo here: https://github.com/bitttttten/react/tree/prototype/app
I'm just trying to learn the basics of React and Flux, and the above code works and I can see it works nicely.
I have a few questions, however:
Why do you often see that people take their actions out o...
Please view the code in a repo here: https://github.com/bitttttten/react/tree/prototype/app
I'm just trying to learn the basics of React and Flux, and the above code works and I can see it works nicely.
I have a few questions, however:
Why do you often see that people take their actions out o...
@N3buchadnezzar Your highest rated question has 23 upvotes, and your example in the question has a result of 23. As a mathematician, what are the probabilities?
The How do I write a good answer? page seems to be generic SE help page rather than specific to Code Review, can this page be updated with specifics? Is there a help page on how not to answer a question?
I know this question has almost been asked before with this question. Two things prompted me...
Ok so I wrote this code a little while ago and ran it a bunch of times trying all possible combinations just to make sure it all works and it worked fine and no errors came up but now when I bring it up in eclipse it shows red dotted lines under like the class name, the equals' and equalsIgnoreCa...
I'm writing a review and I'm trying to suggest using a templating library but it seems the template element is throwing a bit of a spanner in the works
I started this because I thought it would be a fun and easy way to brush up on my C++. It turned out to be a lot more complicated than I thought. I learned about std::allocator and move constructors and other things I had never seen before, so it was a good learning exercise.
The interface is ba...