@RubberDuck No, no, no: "Though I walk through the valley of the shadow of legacy, I will not fear the code, for I have my tests with me. 'Cause I've been writin' and debuggin' so long that, even my fellas think that my mind is code."
TBH I blame a lot of it on some kind of "rep skew effect", that seems to make people upvote your answers more with the more rep you have. #RichesGetRicher
I have seen UInts being natively supported in other languages. PHP allows you to install a third party extension, but I can't do that ATM, so I've decided to create my own class.
In which ways could/should I improve my code. Both in terms of overall code quality aswel as performance?
final cl...
I am developing a .Net application that involves reading data from XML and writing to HTML. The methods to do these tasks are all in the same class as the data they read/write are properties of objects of that class. The problem is that while they perform their function, they are rather long wind...
In the past I have always called the repositories directly from the controller, but that is a bad practice and now I am implementing a "Business Layer" to my project.
Would I have two UnitOfWorks? One for the Service and then one for the repositories?
BaseController:
public class BaseControll...
In February of 2015, I was promoted to Engineering Manager at Stack Overflow. This has made a lot of people very angry and been widely regarded as a bad move.
Problem
You are given n types of coin denominations of values v(1) < v(2) <
... < v(n) (all integers). Assume v(1) = 1, so you can always make
change for any amount of money C. Give an algorithm which makes change
for an amount of money C with as few coins as possible.
Code in C
#i...
i have an array from which i want to remove the duplicate elements..The logic i have used is kind of a brute force attack..But doesnot work..What am i doing wrong here??
public class HelloWorld{
public static void main(String []args){
System.out.println("Hello World");
int...
I have a port of titlecase, originally in Perl and ported to other languages such as JavaScript and Python.
import android.text.TextUtils;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
public class Ti...
Your question was put on hold by community members who deem the posted code "hypothetical", given the ellipsis. The question has already entered the reopen queue, but you can speed up the process by including the rest of the code for HomeController and EmployeeService, so that reviewers can comment on any and all aspects of the code, as stipulated in our help center. — Mat's Mug ♦6 secs ago
I am not going to hammer-reopen it, but if I weren't a mod it would have my reopen vote already.
@IsmaelMiguel you also posted a question that included a shitload of irrelevant generated code after being explained for over half an hour that you didn't need to include it, and you insisted on making the code compilable off the "ask" box after being explained that it didn't need to either.
I'll tell you a secret: these changes will be lost as soon as you change something in the designer. use the visual designer to modify the designer-generated code.
anyone with experience with WinForms will tell you: do not modify the generated code. your paddingX and paddingY fields are Trackbar controls that you can drag-and-drop from the toolbox onto the designer form. If you want to generate them at runtime, put them in the actual form subclass (settings), not in the generated InitializeComponents method. That code exists and is called from the derived class' parameterless constructor so that the designer knows how to instantiate them.
yes, but sometimes it's far easier (and actually safer, if you know what you're doing) to make a few line changes in the generated code than to fight with the visual designer
I've found two articles saying that Windows 10 spies on you:
TechWorm - Microsoft’s Windows 10 has permission to watch your every move
BoingBoing - Windows 10 automatically spies on your children and sends you a dossier of their activity
Is it true or fake? I know that Windows 10 sends malwar...
there are some quirks with the winforms designer and moving controls to different containers (e.g., it likes to break event subscriptions), so I'll usually do it in the code directly
@begueradj your quoted article talks about Cortana and then provides instructions on how to disable it. This is nowhere near the sensationalism you're making it out to be. Enabling Cortana tells you it's going to collect all of that information, giving the user a chance to cancel. The section you're quoting from the EULA was for the Windows Insider PREVIEW build, and as stated - if you choose to install beta software you choose to accept the terms it comes with, in this case - automated data gathering. — Flyk54 mins ago
Currently, your code is next to unreadable.
The variable names are too cryptic. Names like den and S don't tell anything about the context of the variable.
Please, use descriptive names.
You don't give space for your variables to breath. You crammed everything up and that makes it harder to ...
public int LastSecond
{
get
{
DateTime now = DateTime.Now;
int n = 0;
TimeSpan difference = new TimeSpan(0, 0, 1);
for (int i = _Frames.Count - 1; i >= 0; i--)
if (now - _Frames[i] < difference)
n++;
else
break;
return n;
}
}
As part of a project I'm working on, I need to measure FPS. In the past, I would do this within the actual project itself, but recently I've been trying to implement more abstract (and reusable) manners of doing such simple things.
So, I built an FpsCounter class that handles all this for me!
///
This stored procedure takes user defined table type as parameter. It contains data imported from excel file. Values inside that type are the same as in #InconsistentRestriction temporary table. It's working fine, but since I'm not an SQL expert I'm afraid it's not written the best way possible (o...
I wrote a program that constructs a dag (directed acyclic graph) and compares Dijkstra's algorithm against a shortest path algorithm especially for dags that runs in time \$\mathcal{O}(n + m)\$, where \$n\$ is the amount of nodes and \$m\$ is the amount of edges.
Because all the source code does...
give me a second to find a question of mine @EBrown I suggested something similar in a question of mine and someone told me that it was too much for a property.
thank you for that insight, almost all of this completely makes sense to me. I shouldn't perform function operations inside of properties they should be functions, is the biggest thing that I took from this. and in the beginnning is what I meant to do, but I simplified and did it wrong as you pointed out, thank you again. — MalachiDec 23 '13 at 14:22
I had thought so, not sure why I made them properties initially. I think I was going to compute the values and store them in the class, but then I realized, why bother? I would have to recompute them on each frame addition.
I was wondering how I could change the code below such the bmBc is computed at compile time . The one below works for runtime but it is not ideal since I need to know the bmBc table at compile-time . I could appreciate advice on how I could improve on this.
import std.conv:to;
import std.stdio;...
@Mat'sMug Aha, that might be the ticket. Can I tell it that it should start from the last element and work itself to the first? (I suppose that would be documented, of course. Let me do a quick MSDN search first.)
@Mat'sMug So n = _Frames.OrderByDescending(x => x).TakeWhile(x => now - x < difference).Count(); should likely do what I wish, without affecting performance heavily?
This site is so backwards sometimes. If I had omitted my code, people would be asking me "what did you try?" But now that I've posted pseudocode, now it's "Take it to code review"? Are you saying all algorithm-improvement questions fall into code review? Come on. — user8317843 secs ago
@user83178 If it's pseudo-code, and you are looking for ideas on the algorithm, perhaps Programmers.SE could help you. If you have a real, concrete example, then Code Review is the place to be. :) — EBrown50 secs ago