This is the repository of all knowledge regarding programming fuckups. I make them, you'll make them, the entirety of your computer experience is essentially a sea of fuckups from the 80's under a sea of shitty patches from the 90's, with code snippets from Stack Overflow running on top and advice from Stack Overflow keeping the broke-ass snippets working together.
I have created a salary calculator which takes into account tax and national insurance to give the user a specific salary after tax and national insurance.
Could anyone please assist me on how I can force the totals to be printed to two decimal places or if there is a currency library I can use...
What should I not do?
Do not change the code in the question
Do not add an improved version of the code
1. Simply accepting an answer
2. Posting a new question
3. Posting a self-answer
4. Sharing your code on an external site
Regular participants will be familiar with procedures and practices on Code Review. For example, we have rules against
asking hypothetical questions
appending to or modifying the question after receiving answers
answering in comments, even if the answer is brief
Those practices have been dev...
To follow up on Help spot deficiencies in our Help Center, let's collaboratively draft better Help Center pages.
For each Help Center page to be modified, post a Community Wiki "answer" containing the original text of the page. Please try to reproduce the markup as faithfully as you can. Then,...
@JeroenVannevel I think you can create a parameters collection and then assign it in the intitializer, but I think it looks just as messy as the alternative inside the using statement.
This probably belongs in codereview but you can precompute factorial 1..9 since they won't change for different numbers :) — The Archetypal Paul5 secs ago
@Duga I have a prime generator program in javascript, and it goes like this... var primes = [1, 2, 3, 5]; but unfortunately it only goes up to 4 primes right now /s
19! is a curious number, as 1!+9!=1+362880=362881 which is divisible by 19.
Find the sum of all numbers below N which divide the sum of the factorial of their digits.
Note: as 1!,2!,⋯,9! are not sums they are not included.
Input Format Input contains an integer N
Output Format Print the answe...
I've implemented the Equals() support for my class as follows:
public override bool Equals(object obj)
{
return Equals(obj as TwoDPoint);
}
public bool Equals(TwoDPoint p)
{
return ((object)p != null) && (x == p.x) && (y == p.y);
}
This obviously doesn't match the reference implementation...
Take a look at this page of the Help Center - What should I do when someone answers my question?
If you only read the text with special markup, as someone would when skimming the page, it reads like so:
What should I do when someone answers my question?
vote
accepting the answer
mark an answer...
I'm trying to implement a minmax algorithm with alpha beta pruning in a tic tac toe game in java. The code appears to be right but when I call the main cMove function it always returns [-2147483646][-1][-1] and when I try to add the obtained coordinates to the board it cause an `ArrayIndexOutOfBo...
I know what statistic I'm trying to find. I know what it's called, I know all its' technical specifications, but google won't give me a single site that will actually give me the damned figure.
> The code is not broken. It works as intended except for the fact that there is no way to tell if the SMS was sent and I need to figure out how to implement that.
@Mast I shouldn't have to. It's a legally mandated statistic used to benchmark £billions of pension assets, published in the bloody Financial Times but nowhere (it seems) on the internet (for free).
@Mast Just ring up the Office for National Statistics and ask nicely if they can spare some times to find me this one number because my company doesn't have a financial data subscription?
I have this function here:
<?php
public function assignData($data)
{
$aSqlData['company'] = $data[0];
$aSqlData['tx_trouserextend_contactperson'] = $data[1];
$aSqlData['username'] = $data[2];
$aSqlData['tx_trouserextend_commission'] = $data[3];
$aSqlData['tx_trouserextend_win...
@Mast It's published all sorts of places, including the markets pages of the Financial Times, just nowhere public, online, not-behind-a-paywall (that I can find).
@Hosch250 the real yield on the [ FTSE Actuaries Government Securities Index-Linked Real Yields over 5 Years ] assuming 0% and 5% RPI inflation, respectively, on 15th Feb 2015 (or the closest business day immediately prior).
@Mast I shouldn't have to. It's a legally mandated statistic used to benchmark £billions of pension assets, published in the bloody Financial Times but nowhere (it seems) on the internet (for free).
I've written a script that I would love to get feedback evaluating the following: Module Pattern implementation, robustness, conciseness, cross-browser compatibility. My goal is to eventually use this script and others, as part of my portfolio for a job application. So all criticisms are most wel...
My goal is to generate a sequence of random float from a seeded random generator. The sequence should be the same on any machine / any compiler -- this rules out the use of std::uniform_real_distribution since it doesn't make that guarantee. Instead we have to create our own version of this, whic...
Friends,
I have an application that allows a user to create a poll that includes questions and answer choices as part of the poll. The hierarchy is a poll has one or more questions, a question has one or more answers, and each answer has a vote.
The following code is my implementation that allo...
@mudasobwa has provided useful suggestions for improving your code. More generally, for that you should consider posting your code at SO's sister site, Code Review, where you will get varied useful suggestions for improving your code. Unlike SO, CR requires that the code you post actually works. — Cary Swoveland23 secs ago
You've asked several questions, and the only thing they have in common is that they all relate to your code. I consider this to be too broad for Stack Overflow. Instead, I recommend asking separate questions. For example, on Programmers, ask a question about how to deal with package names that include a version number, and another question about when you should build your own exception hierarchy to wrap API exceptions. Alternatively, pick some portion of your code and ask for open-ended critique on Code Review, as you have already done. — 200_success3 mins ago
So, I've created my first Chrome extension! What this does is it highlights every post on Reddit that comes from a source of dubious quality. It provides a few sources by default and allows the user to add or remove from this list. The user also has the choice between either highlighting the offe...
Talking about tech support: One of the IT guys was trying to tell our receptionist her computer was to be replaced. Our IT guy has no people skills and our receptionist has no technical skills. If I wasn't there to translate they'd have made a mess. Hilarious and sad at the same time.
@AlienHerbNite +1 for being descriptive.
Afar from that, it needs some serious clean-up.
There's way too much magic going on there and not enough self-documenting code.
if (data.crappyAction === 1) {
parentNode.style.backgroundColor = 'red';
}
if (data.crappyAction === 2) {
entryNode.style.display = 'none';
}
This isn't the place for codereview, but you need to clean up some stuff and make this so it can compile first. Even better would be to create an example that we can run to see your problem without the external dependencies. You don't need to dereference wg. Don't call wc.Done() in multiple places or you'll panic, just defer it once. You have a loop over an undefined c, which will never end unless you close c, so nothing in the goroutine will ever execute. You have a data race on the signalReceived variable. — JimB1 min ago
people writing "C# DOT NET" don't know what they're doing
it's like people writing JAVA
that said..
with sanitized as (
select *
,replace(replace(replace(replace(replace(LongDescription,char(10),''),char(13),''),':',' '),'$',' '),'L',' ') SanitizedDesc
from SomeStupidSystem
,case when product.MSRP is null and upper(left(ltrim(product.LongDescription),4)) = 'MSRP'
then cast(substring(product.SanitizedDesc, dbo.LastIndexOf(' ', product.SanitizedDesc) + 1, len(product.SanitizedDesc) - dbo.LastIndexOf(' ', product.SanitizedDesc)) as decimal(13,3))
else
case when product.MSRP = 0 then null else product.MSRP end end MSRP
@levantpied I've updated my answer, however I think your question is rapidly becoming off topic (probably as too broad). If you are able to provide a complete example on CodeReview (complying with they're posting guidance), I think you are likely to get a far more satisfactory answer. — forsvarir46 secs ago
I want to print a nice loading message with these three fading dots, while the main thread does some heavy IO stuff. This is why I implemented this:
(First time PTHREAD user here, good practices very welcome):
#include <stdio.h>
#include <pthread.h>
#include <unistd.h>
#include <stdbool.h>
sta...
A question asks to have a command-line invocation of FFmpeg reviewed. Is that reviewable code?
There is currently no language tag, though shell unix could be added.
Let's not discuss whether a shell command containing an AWK one-liner is on-topic; such a post could be considered a question abo...
I have an abstract base class. I have a method: init() which parses an array of values. If the value maps to a defined child instance, it creates an instance of that child, and calls init() on that child (in pseudo-code):
abstract class MyBase {
. . .
//resources can be an array of arbitrary...
You may want to submit your code to code review. I wouldn't add a constructor in Emitter only for this reason if it does not make sense. I wouldn't set the attribute to protected either. I would rather use a protected setter or super(launchAngle,0). — standelaune38 secs ago
I have a simple program that calculates and outputs the result's of all the bit operators. I'm planning to send it to my friend and explain him some stuff about them. Before I do that I want to know if I can do any improvements to it
internal class Program
{
private static int a;
privat...
I use .net 3.5 framework, so no tuples. I have many use cases where I have to create custom key for a dictionary. How can I make this better ?
public class CompositeKey<T>
{
public T Content { get; set; }
public Func<T, object>[] Lambdas { get; set; }
public CompositeKey(T obj, par...
@CoolestVeto At the top it says "The Java interpreters began development in mid-October and will continue to be developed for probably all of time." October of what year?