I just wrote a program in C++ that makes a linked list and it seems to work. However, I can't figure out how to print out the resulting linkedlist as output. Here is what I have so far (it seems to work but doesn't print out anything, so I am unsure if I am doing the output wrong or if somethin...
The code below is an implementation of the Best First Search algorithm for navigation of the shortest path across a 2D NxN matrix. As a heuristic for the search I use the standard distance formula. The matrix is generated from a text file passed in as a command line argument,where the first line ...
I have a piece of code that I would like to refactor but can't figure how to do it. This is a method from a Play controller where I have to verify many precondition and respond different status for each case :
resource should exist or 404
revision should match the If-Match value or 412
payload ...
I'm attempting to generate non repeating random numbers between 1-5, 1-10, 1-20, etc. I'm on to the Fisher-Yates Shuffle but I'm not sure I've implemented it in the best way. My plan is to associate each random number to a predetermined variable name. I'm new to JavaScript and would appreciate an...
I've just written the most of the control code for an inflatable robotic hand. I'm working on the Arduino mega, with the usb host shield and an Xbox controller.
I refactored the code from one file to a bunch of smaller files and it looks good to me, but I come from a Matlab background and really...
I'm studying dagger 2 and created a simple app. My app also uses sugar orm to store data. My question is, should I use dagger 2 to inject my model object?
I'm developing an app which stores some different user settings in app.config such as connection strings, paths for saving reports, default printer e.t.c
For retrieving them I made a static class StoredSettingsTools which contains an Enum of settings types and a public method which calls (dependi...
I'm a beginner in JavaScript and lately I've been trying things with RequireJS, I'd like to get some feedback on how good/poor my code is and in what ways it can be improved.
My example below is just loading up social plugins - Facebook Like/Share, Twitter Tweet & Google +1. The code is function...
@Quill sir, I've seen you edited my post on code review and I guess you have put me a minus for this post there. In order to avoid misunderstanding and confusion in the future could you explain your decision please? (What I 've done wrong?) — whizzzkey50 secs ago
I have no idea how that code indentation got so badly mangled from the original SO post (which was correctly formatted) to this one, but I fixed it and looks like a decent, on-topic question now:
Here is a coding & math challenge. In the program below I am getting time limit exceeded error. How can this code be made faster and more efficient?
\$19!\$ is a curious number, as \$1!+9!=1+362880=362881\$ is divisible
by \$19\$.
Find the sum of all numbers below \$N\$ which divide th...
> I want to convert this code to OOP, and use OOP things. But I'm not sure which is better, and more correct: 1. thing I haven't done 1 2. thing I haven't done 2
Please could you give me some advice with code example how to use the OOP for this task?
Your question was downvoted because it's pretty much asking "please help me rewrite my code", which could indeed be the result of the peer reviews /answers you would be likely to receive on this site, however explicitly asking for specific help with specific improvements is generally frowned upon - but not necessarily off-topic. Keep in mind that reviewers are always free to comment on any & all aspects of the code. If you're not interested in such feedback, please see our help center. — Mat's Mug ♦5 secs ago
What do you suggest? If we have Jeff and/or Joel come and personally TP the offender's house, it might actually make the problem worse. — Adam DavisJun 15 '10 at 18:59
Apparently everyone gets burned by their Python unittests not running in the order they want.
I am not in the business of telling people not to do perfectly reasonable things they want to do, so I consider "write your tests differently" Not An Answer to the question "how do I control the order o...
> With that in mind, I also consider "Why do you want to control the order of unittests? Just write them differently" as a lame, non-answer to this CR post.
I'm developing an app which stores some different user settings in app.config such as connection strings, paths for saving reports, default printer e.t.c
For retrieving them I made a static class StoredSettingsTools which contains an Enum of settings types and a public method which calls (dependi...
I need to parse a simple JSON string (flat JSON, no hierarchy)
for keys and values, and there is a system constraint
that I cannot use any built-in JSON library and can only
read a string once due to latency requirements.
I need to use Python 2.7.x series and cannot use a higher version.
Here is...
I recently submitted an implementation of a singly linked list and tried to apply some of the suggestions on this implementation. I decided not to implement the List interface as I only wanted to practice what I believed to be the most important methods. I'm wondering how I could tidy this up som...
opção para aqueles que precisam de mais energia e um aumento de QI rápido. Ela aumenta a recordação de memória global, permitindo-lhe fazer melhor no trabalho, nas suas actividades desportivas, e na vida cotidiana. Ele ajudou os usuários allover o mundo sair da "névoa do cérebro" e exaustivo ment...
This is my first program I've written ever. Don't hold back on me. Any help and feedback is appreciated. This code wont work because it requires some keys, but I censored them out, but it does compile for me and works fine. I just want some feedback on dumb things I did and how to make it bet...
@JeroenVannevel bad javascript code, maybe. invariant is a popular library used to make assertions about valid input at runtime. You don't silently ignore errors, even in JavaScript :p
I am learning design patterns once more. The book mentioned above offers the examples in java, and I read them, write them and follow the book, I really like their kind of writing. But I gave myself two other exercises besides those in the book. I would like to port those java exercises to c# and...
@Quill it is a meta question disguised as a review
> So prior to flood this nice so-page with dozens of classes and interfaces, I would like to ask, whether it is ok, to do so, and if not, why or where could this be ok.
Take note of the following code. It is used to create a cookie on the client browser such that 25% of the browsers will have a value 0, and 75% a value of 1. Can anyone review the following code and try to detect the maximum number of problems in it?
Here is the piece of code.
// AB testing cod...
I am thinking of posting my first question here, in JavaScript. Is there a static code checker that could tell me everything that's obvious? Like pep8 or pylint for Python. That would make the question more interesting. Thanks!
@PinCrash / @Any SQL devs IDENTITY_INSERT vs inserting with IDENT_CURRENT?
I have to make an insert with foreign keys. I'm concerned IDENTITY_INSERT isn't very great given that you have to rely on the key being available in all environments.
JavaScript
For JavaScript, there are a few options:
JSLint (the original, created by Douglas Crockford)
JSHint (a community-driven fork of JSLint)
ESLint (an ES6-compatible fork of JSHint. Necessary if you want to lint ES6 code).
In all cases, if you're using a transpiler like Babel or Trace...
I have a cumulative transition matrix with probabilities for all the possible states from 1 to 5. Now the algorithm for simulating future states is following: the initial state is selected randomly, and a random value between 0 and 1 is then produced by uniform random number generator.To determin...
Yes, if the code is working it is a better fit on CodeReview — Breeze29 secs ago
@HimBromBeere Maybe. If the OP wants their current code reviewed as-is for feedback, then Code Review is the way to go. But questions asking "how can I change my program to do x instead of y" would be Off-Topic. — Zak36 secs ago
If your code is working, and you want general feedback on it (a "code review"), please post your question on codereview.stackexchange.com. If your code is not working, please edit your question to clearly state what isn't working, and any error messages you are getting. — Matt ♦33 secs ago
The part of your question that says I'm on to the Fisher-Yates Shuffle but I'm not sure I've implemented it in the best way makes it look like a Code Review question, but the fact that you don't understand how to assign individual values of the array to variables makes it doubtful that you've written this code yourself, which is a requirement on Code Review. — janos8 secs ago
Thanks for referring me to codereview.stackexchange.com and sorry for misplacing the question. Thanks for the advice others already gave me! — Goostrabha18 secs ago
I've made a method to extract excel data out of a existing excel file, it contains 3 tabs where info should be extracted from. The data should be stored to use local so it's always fast available. It is currently working but it seems like I have a lot duplicate code that could most likely be writ...
If you post this again on codereview please let me know so that I can post you the answer I used 15 minutes to write and could not post here because the question was closed before I can hit send. ;) — Sabrina_cs52 secs ago
Just a thought: Shouldn't this question be asked in codereview.stackexchange.com instead of asking it here, since that is meant for taking the review, how it can be improved etc etc ?? — user3514160just now
First time on stackoverflow, sorry, i don't see codereview.stackexchange.. — skyd49 secs ago
Not yet, but it is just because the test review we carried out yesterday was not on C# code, so without code lens, doh! We will try another one today, but although interesting it seems that this feature is fairly limited and a bit confusing. For example you can comment on code freely on any file on the web UI, without the need to initiate a formal code review even, but you can't — Techromancer54 secs ago
Well I just saw a second Meta question expressing strong ill-will for this site after first witnessing this, seemingly well-trodden, battlefield. Given that I am already weary of it, I can only assume that others are much more so, but bear with me.
The problem
Breaking this down into as simple ...
I have created a simple terminal program: it allows the user to enter a height and it will produce triangles of *s based on the height.
I have just started learning C# as practice for my internship. I would appreciate any feedback.
using System;
public class Triangle
{
public int height;
...
I'm testing Neo4j 2.3.2 and I've issues while importing a file.
First, I'm giving information about data. I've people works at companies and each person has at least one job title (a few has 2 job titles). In our logic, job titles are categorized and every job title has a code but the same code...
I request that you assist me get a better programming environment. As at now, I am an amateur programmer teaching himself programming on an android device. Kindly assist me where possible. Here is the campaign. Check out "Passion for Coding-Help Me Buy a Computer" on Indiegogo http://igg.me/at/4PfBeS-edFI/shre/12522044
> Bion was a psychologist who was doing group therapy with groups of neurotics. (Drawing parallels between that and the Internet is left as an exercise for the reader.)
@DanPantry I don't really understand your question... Are you saying you need to make an insert into table D, which includes foreign keys from tables A B & C, or that you need to make an insert into table A, then carry the primary key as a foreign key to tables B C & D?
@PinCrash I need to make an insert into table A, but I also need to make an insert into table B that has a FK to the record I just inserted into table A
flatten.py
from collections import Iterable, Mapping
from operator import methodcaller
from stack import Stack
class flatten(object):
"""
Iterator that walk through nested iterable.
If the initial item is not iterable, only itself will be yielded.
Args:
item (O...
A certain co-worker of mine has a habit of placing his foot on my desk while conversing with me. My desk is an L shape and where he stands is not across the desk from me, but at the end of one of the legs. This makes me uncomfortable as his crotch is at a relatively close distance to my face. I ...
This function try to scan the given function in n dimensions in the given range by adaptively divide the area into n+1 points polygon (e.g. triangle in 2D; tetrahedron in 3D)
async_scan.py
from initializer import RecursiveBoundaryCentreInitializer
from solver import Solver
from explorer import ...
var domains = document.getElementsByClassName('domain');
for (var i = 0; i < domains.length; i++) {
You can covert document.get* results into real arrays by using array.slice. That way, you can take advantage of the handy array methods like forEach.
if (data.crappyAction === 1) {
1 and crapp...
I did say it as a joke. While you may feel the urge to do so, it does come with consequences. I could imagine if you did do it it would be very hard to explain. Boss: "She punched me in the nuts!" HR: "How did she manage to do that?" Boss: "Well I had my foot on her desk and my genitals were facing her.." HR: "...Why was your foot on her desk in the first place?" — jcmackyesterday
I've heard some conflicting information as to why Deadpool breaks the 4th wall, especially regarding whether it's deliberate or not.
One side I've heard:
Deadpool knows that he's in a Marvel comic book and that he doesn't exist in real life, so he breaks the 4th wall constantly because of this...
I decided to try and complete the Parsing/RPN calculator algorithm from Rosetta Code in Rust. I'm still learning Rust and would appreciate feedback on my code.
use std::str::FromStr;
fn rpn(expression: &str) -> f64 {
let mut stack: Vec<f64> = Vec::new();
let tokens: Vec<&str> = expressi...
I've recently been tasked with migrating some code stacks for an applicatin that is moving from using Access to using SQL-Server.
I don't usually use Pivot all that much, and most of my code is scripting intended for in-house administration of our SQL Servers. As such my code is not that great. ...
@PinCrash Putting things in to Access is a major headache - what surprises me is that people are surprised when getting it out again is also a headache.
So I'm trying to remove the tmp/letter_opener folder. Everything works fine, just wondering if there's a better way to write it. My next step is to write some tests, to double check that I can only accept those inputs (currently failing)
#my_rake_task.rake
namespace :cleanup do
desc 'Deletes t...
I'm new to MVC and i'm having some difficulty on understanding the proper usage of ViewModels and Controllers.
I have this example where i will list several different informations in my HomeController as CTAs, Banners, News, Courses... and i came up with this ViewModel structure after some resea...
As @JimB said, this isn't a place for large code reviews - create and Issue for the library/package you are using. Here on SO, you need to narrow down to the section of code you have a question about, about 10 to 20 lines of code maybe and post it here in the question. Else, this topic can be closed. — eduncan91112 secs ago
So are you really just asking "should it evaluate to false?" Well, you wrote the class, so that's up to you. If you're wanting review comments for "working" code then go to codereview.stackexchange.com. — D Stanley48 secs ago
I'm relatively new to Java, and over the past week or so I've just been reading through the docs and messing around with it to better improve my understanding.
As stated in the title, I've created a method to convert numbers (between 0 - 999,999,999) into plain text, and I would love some feedba...
Many things but start with not using expr (which requires a sub-shell and is non-standard and largely obsolete) and just use shell arithmetic $(( num % 10 )). Also you can avoid using [/test` if you are checking == 0 and just use if ! (( num % 10 )); then (also shell arithmetic) since as the man page says "if the value of the expression is non-zero, the return status is 0; otherwise the return status is 1". That said I think this question is more appropriate for Code Review than here as the code works. — Etan Reisner24 secs ago
the test fails, but the inspection actually works in the VBE. something is broken with the combination of threading, parser state and resolver. my brain hurts.
I have 1 collection and 2 views bound to it. Both views are automatically updated whenever a new item is added to the collection. Well, so far nothing seems to be wrong. However...
The views display items based on 1 parameter. So whenever an new item is added to the collection I only want to upd...
so, I'll make an issue on my GitHub repo, and happily take a PR from a grownup with a strong stomach, a healthy heart, and more bravery than is really good for me :)
because you can create custom button types and Dialogs generally seem to be a PITA
@Mast those are even worse
I like where this is going though:
public void fileChoosing() {
if (model.isNotSaved()) {
view.showPrompt("Unsaved Changes",
"You have unsaved changes. Do you wish to save them before changing the resx-fileset?",
this::onSaveRequest,
() -> {});
}
resxChooser.show();
}