@JeroenVannevel "If you regularly use Task.FromResult with the same value, consider caching the actual task. For example, if you create a Task<int> with a zero result once, then you avoid creating extra instances that will have to be garbage-collected." -- stephen "Tasks await ME" cleary
Write a C++ program that asks the user to Input and store the sales records from January to December. There are five sales persons working for the company. Find and display which:-
1. sales person has charted the highest total sales.
2. month has the highest total sales.
As the title and tags imply, I want to do text generation in order. In my program I have the user supply the minimum number of characters, the maximum number of characters, and a character set.
Ex: Min 1: Max 3: Cset "ABC"
A -
B -
C -
AA -
AB -
AC -
BA -
BB -
BC -
CA -
CB -
CC -
AAA -
AAB etc. ...
This question might be a good candidate for Code Review instead of Stack Overflow. If you have working code and are looking for specific ways to make it better, Code Review is often a better fit. Just be sure to check out their Help Center to make sure your question is on-topic there. — Alexis King22 secs ago
I'm new to Javascript and also code review. I tried looking for my answers but I couldn't seem to find simple ones that I understood. I've used jsfiddle to work on a tic tac toe game but I'm wanting to add a restart game button without refreshing the browser. I'm also hoping to keep score somehow...
> On your own, try modifying the program so that it uses and displays 1s and 0s rather than true or false. This may involve a bit more effort than you might at first think
Probably trying too hard, converting the values instead of the logic
This code is working fine for me and i want simplest code rater than this.
Function parent is defining parents of the tree and child function is for represent children. DisplayGraph() function show the tree in html element.
window.onload = function() {
arr();
parents(); ...
ok i gotta get home, but i'll leave you with the next part, if you're still interested -- implement and
static int and(int a, int b)
{
// ??
}
same rules -- all inputs are either 0 or 1. no ifs, cases, function calls, anything like that. answer will be a simple arithmetic expression, just like it was for not
@CodingChief There is a difference between not correct and not optimized. The code works for every case, but indeed rolfl his code is more optimized, and that is also the reason that his answer is accepted as correct one. — chillworld16 secs ago
monking @all
I wanted to put @rolfl also in the comment but can notify only 1 person ^^
I hope that he understand what a lovely community we are and loose his SO attitude when commenting some more here
Wrote a pretty crappy-looking Java class, @mjolka :
class NotTest {
public static int not(int a) {
int b = 1 - a;
if (b != 1 && b != 0) {
System.out.println("Value of 'b' cannot be reconciled to 0 or 1.");
return b;
} else {
return b;
}
}
public static void main(String[] args) {
int a = 0;
System.out.print(not(a));
}
}
switch (a) { case 0 : return 1; case 1 : return 0; default : System.out.println("Value of 'b' cannot be reconciled to 0 or 1."); Throw new AssertionError("Value of 'b' cannot be reconciled to 0 or 1.");
My question is, can this code be refined to be more efficient? It works fine, however I've noticed a small increment in time between requesting controllers/methods and I'm not sure where this slow behaviour is coming from.
note: the intention of this code is to check the URI string (I don't use ...
I am using the following code in order to retrieve the index for an object stored in a JavaScript array.
Scripts works fine, but I would like your opinion regarding performance.
Also would like to know also if using [].map() could be more appropriate of [].some().
http://jsbin.com/nasiyiyavi/...
I've implemented generic insertAt function which inserts value to a list independently from is list indexed or not. Here are some examples:
insertAt 1 5 [1, 2] == [1, 5, 2]
insertAt 1 5 [(0,1), (1,2)] == [(0,1), (1, 5), (2, 2)]
Here is code:
{-# LANGUAGE TypeFamilies, FlexibleInstance...
we have just started up a new app and we are using React with the Flux architecture, we have done our best to piece together what we think is the best structure for the app and would appreciate any feedback, suggestions etc. The component is essentially a settings page in a much larger system, it...
This is an assignment for an intro to assembly language course.
The assignment was to make a program with a menu that performed the following four arithmetic operations:
1. addition
2. subtraction
3. multiplication
4. division
The program works correctly.
Here are the reasons I'm posting my as...
What's more preferable, I know it makes no difference to the process but
<?php namespace MVC\something;
or
<?php
namespace MVC\something;
In terms of preference and any standards - which is better?
I'm creating a small project to understand some more php codes and learning them i created a working code but it's to big i want to shorter the code can someone help me to understand some more for loops and if statements in it?
Here what is al about;
Calling information from the database
$sql...
There are some issues with this code that could be improved on in terms of style, logic etc. Regardless if you get help here, I highly recommend you submit this code to codereview.stackexchange.com where you will get lots of tips to improve your coding. — Tom Dalton24 secs ago
@TomDalton It is true that there are some such issues that can be improved. However, it is important to make it clear that Code Review requires the code to be working as intended before being posted there. — Simon André Forsberg10 secs ago
I made this script so that i can scale objects for 3d printing from Maya.
i had fun making it. I'm sure it could be cleaned up or improved. if it can be cleaned up please let me know, im always for learning better programming.
## ((Ax - Bx)**2 + (Ay - By)**2 + (Az - Bz)**2)**0.5
import maya.cm...
Our orders module was in desperate need of a rewrite... So I began the process of rewriting that a few weeks ago. Now that's on hold because I need to rewrite the quality assurance module...
Knowing what you're doing is for people who know what they're doing.
@nhgrif - out of interest, you get a notification for:
Thanks for your code NHGrif! question: Where do you place the part of code after this sentence? "As one final note, rather than putting all of this code in our view controller, I'd probably abstract this into a stop watch struct. Something like this:" — Tjalling Dijkstra44 mins ago
We only accept working code. If a code needs fixing it does not belong on CodeReview. Go straight to Jail, do not pass Go, do not collect $200 — Dan Pantry2 mins ago
crontab with ntpdate will correct the time on regular occasions.
ntpd will measure the drift and jitter of your clock, relative to other accurate time sources, and will keep the time "groomed" on your system and it will never then go out of time by more than a millisecond.
with ntpd running, you can be almost as accurate, all the time, as an atomic clock.
Also, with a drift like yours, and odd timing, you could end up doing various odd things, like creating files in the future, which is a PITA.
I am burdened with the requirement of interacting with a C based library, which has a bunch of constant sized arrays (e.g. char[17]).
When trying to assign or read those properties from swift, they are represented as a Tuple type of that size..
As far as I know, you can't access tuples with su...