Ethen, I don't understand the distinction you were trying to draw between an IDE and a text-editor that can run a compiler. What do you think an IDE is?
@nhgrif I was under the impression that an IDE has the compiler/interpreter built in to the application, rather than the compiler/interpreter being an external program that a text editor runs.
Dependency injection has it's ways but i am following through with a cover up on dependency injection towards high level learning of dum programming. is this considered programming ? no / just for probability tests and testing .
here is first interface injecting ready to injection
interface...
I cant seem to figure out how to change this to using a char input instead of an int. Can someone please help with this ?
/*
initialize stack pointer
*/
void init(int *top)
{
*top = 0;
}
/*
push an element into stack
precondition: the stack is not full
*/
void push(int *s,int* top, char ...
This is the interface to implement
interface buttonboolean
{
bool returntrueortrue(bool TRUE, bool _TRUE);
bool returnfalseorfalse(bool FALSE, bool _FALSE);
}
This code above is the interface to implement method returntrueotrue to return a boolean of true or true which is a logical...
I have made a basic stack class utilizing a linked list for data storage and \$O(1)\$ push and pop and just want some basic feedback on the class to see if there is anything basic I missed. It seems to be working perfectly and I know there are no memory leaks. I'm just being cautious and wonderin...
Question: Root to leaf path sum equal to a given number
Given a binary tree and a number, return true if the tree has a root-to-leaf path such that adding up all the values along the path equals the given number. Return false if no such path can be found.
I have written 3 solutions, one recur...
I completed a sample programming challenge and wanted to find out how I could make it more efficient. I'm trying to get better at writing more efficient code, so I would be interested in hearing ideas on how I can make the code more efficient. I ran it, and it works, just curious if there are ine...
Dependency injection is by means of having two classes that are loosely coupled into classes than are dependent on an interface , correct ? Therefore a dependency is no longer dependent on the derived class but a interface that implements method from a class that serves as a design patter substit...
This following code executes correctly.I was wondering if there are better ways to write this code instead of using while(true) and break.For example using expressions,flags, do-while,etc.
import java.util.ArrayList;
import java.util.Scanner;
public class Words {
public static void main(String[...
I have created a simple system to get hands on experience with OOPS design and some features in java.
The system is :
A ClassOfStudents contains Students
A Student contains list of scores
A Student can be a PartTimeStudent or FullTimeStudent
A score is valid only if it is between 20 and 100 ...
Find a peak element in array. Please consider I want only one peak element. Also my code should follow only C++11/14 and not C++03.
#include <iostream>
int peak(int * arr, size_t size)
{
auto start = 0;
auto end = size - 1;
//empty array
if(arr == nullptr || size <= 0)
{
...
i have a html table like
<table id="mytable">
<tbody>
<tr id="tr1">
<td><label>tr1</label></td>
</tr>
<tr id="tr2" colspan="100">
<td><label>tr2</label></td>
</tr>
<tr id="tr3">
<td><label>tr3</label></td>
</tr>
</tbody>
</table>
i want to bind data in column wise
how can i bind using those tr i...
I don't think this question would fare very well on Code Review in its current form, as the code appears to be incomplete. If the OP wants to replace ellipses with the actual code, then this would be a good candidate for Code Review. — Phrancis21 secs ago
I created monolog formmatter class ,currently I send log like this
$app['monolog.logs']->error(
'entity not found',
[
'trace' => __CLASS__ . '::'. __FUNCTION__,
]
);
I wonder is it good or bad practice to use debug_backtrace meth...
I would love my component to be reviewed. I am looking forward to responses mainly answering the questions:
Is my code violating the SOLID principals? If so, where and how?
Does my component contain any flaws?
Does my code contain any security issues?
Does my code follow the OOP principals?
Can...
It seems that your code currently works, and you are looking to improve it. Generally these questions are too opinionated for this site, but you might find better luck at CodeReview.SE. Remember to read their question requirements as they are more strict than this site. — Kyll23 secs ago
This is a copy of this question.
I have a JSON array or literal (passes through JSON.parse)
Requirement: an array of tasks which contains operations which are key/value pairs.
Array of tasks > Array of operations (array of operations at times will contain duplicate key/value pairs)
[
[
...
I just finished my first PyGame project here (GitHub), and would like to get some reviews on the code.
It's multiple files of code and few images for graphics, so I figured it's easier if I just link the GitHub project. Let me know if you guys prefer pasting huge amounts of code here directly!
What exactly is your question? If this is working code and you just want suggestions on how to improve it, your question may be more appropriate over at Code Review. — Blckknght32 secs ago
In the wikipedia article about the binary search algorithm (https://en.wikipedia.org/wiki/Binary_search_algorithm) a small paragraph in
particular got my attention.
Midpoint and width
A different variation involves abandoning the L and R pointers and using a
current position p a...
(@Zak, you can change your image Facebook one now)
the issue i had with facebook urls was not anything to do with FB images, but rather a security flaw in the Firewall at work
Instead of outright blocking connections to URLs, it would allow the connection to go through and then modify the response (which caused the chat room to fail)
This question is the second iteration of Counting Bloom filter library in Java. I did nothing more but fixing the remove method in order to fix an issue mentioned by JS1. I will present only the actual filter implementation as all other bricks required for running a demonstration are there.
Bloo...
If you multiple classes that you know you need to have the same methods/properties/events in, you declare an interface that specifies all those objects.
It's not necessary I suppose, but it makes certain things easier.
For example, I have an interface that declares common things between all my Network Messages.
Which means that when I go to process those messages, I can declare a variable of the interface type, and assign a strong type to it, then I can call methods on the interface that are implemented in the other type.
That interface, for example, means that I can keep a list of IMessageProcessor<T> objects to work with them, without needing to call the strong type methods.
interfaces guide you toward good information hiding. You should be able to work with an object through its interface methods, without knowing how those methods work. Ideally, all you should know about an object is its interface. You should not need to know its concrete class, and the concrete implementation of its methods.
In turn, information hiding leads to more flexibility. You can replace an object with a different implementation of the same interface, and the rest of the program doesn't need to change. Using interfaces everywhere gives you great modularity by having replaceable elements.
@EthanBierlein You lose type safety when you use object (the C# class, as Object in Java)
I made this jQuery plugin based on MixItUp and Isotope. In short, one needs to create an <ul> list filled with <li> that contain <img/>.
The plugin makes boxes out of this list and, according to classes added to the <li>s, makes them filterable. You can also order the boxes accordind to a data-o...
I've a working function. But it feels complicated and dont look too good, I would like to improve it. If you want to improve it, please let me know why and explain for me.
Cheers guys!
function Modes(arrays) {
var frequency = {}; // array of frequency.
var maxFreq = 0; // holds the ...
Voting to close as "too broad" (but "primarily opinion based" fits as well). Bottom line: this sort of question doesn't seem to me like a good fit for SO's format at all. Since they're (apparently) both working pieces of code, you might want to get each reviewed. Offhand, I don't recall whether they currently support direct comparison reviews like this though. — Jerry Coffin48 secs ago
I (rather hastily) put together a class that can convert to and fro from Roman Numerals and Decimals. I would appreciate critical points on everything, especially:
Shortening my code.
Choosing a better approach.
Using better/new features of Java 8.
And so on...
I didn't bother to add JavaDoc...
Problem here.
It's not exactly the brute force approach but I'm not using any sort of pre-calculated primes table, and I'm definitely not using the coprimality trick shown in the PE pdf. I'm finding the divisor count for each triangle number via its representation as a product of primes. More on...
Okay, so please share your attempts and describe where you are stuck, by editing your post; otherwise your question is off topic here in Stack Overflow (the post as it is now would perhaps fit better to Code Review, I think); — aschipfl21 secs ago
@rolfl I took your advice. I moved the approximate equality checking functionality to another method. The contract of equals() and hashCode() is now kept. (I didn't post it yet)
public class AbsoluteDifference implements DoubleComparer {
private double tolerance;
....
public boolean acceptable(double a, double b) {
return Math.abs(a - b) <= tolerance;
}
}
@janos Yes, I tested all possible cases. But I don't like my approach and I don't know a better one. That's why no JavaDoc. I'm waiting to document a better implementation.
I was thinking a bit and came up with an interesting problem, suppose we have a configuration (input) file with:
x -> x + 1
x -> x * 2
x -> x * x
x -> -x
And furthermore we have a list of Integers:
List<Integer> list = new ArrayList<>();
list.addAll(Arrays.toList(1, 2, 3, 4, 5));
Is there a...
@eliasah, I couldn't run the program on cluster because I am doing a code review. The original author was broadcasting single boolean or integer variables, which I believe is not worthy the overhead of creating a Broadcast object, but I couldn't find any article on related topics.. — Gongqin Shen29 secs ago
In computability theory, the Ackermann function, named after Wilhelm Ackermann, is one of the simplest and earliest-discovered examples of a total computable function that is not primitive recursive. All primitive recursive functions are total and computable, but the Ackermann function illustrates that not all total computable functions are primitive recursive.
After Ackermann's publication of his function (which had three nonnegative integer arguments), many authors modified it to suit various purposes, so that today "the Ackermann function" may refer to any of numerous variants of the original...
@ajameswolf This does not belong on Code Review. Broken code is off-topic there, and questions containing it will be closed. Please read the help center there. — Ethan Bierlein58 secs ago
@ajameswolf and please stop recommending Code Review willy-nilly if you don't really understand what's on-topic there — janos32 secs ago
This question can be improved to make it on-topic here, by following the explanations in the help center. And in any case, just because something doesn't belong here, that alone certainly doesn't make it belong to Code Review. — janos58 secs ago
Currently in The 2nd Monitor, there is a "recent questions" feed that is displayed by our very own Captain Obvious.
Would it be a good idea to have a "recent answers" feed, too?
Yes. Many answers go unnoticed and this will help in The Mission because users will be more aware of answers worthy ...
Or, we could just post it here and see if people start announcing they've blocked it?
@SirPython I didn't post it as an answer because I'm not sure how to say that I didn't vote and am not planning on voting because each side has a good point.
Also, I'm not sure if I want more feeds - the one in the RD room is bad enough.
TERMINOLOGY
We are given a directed acyclic graph (dag) \$G = (V, A)\$, where \$V\$ is the set of nodes and \$A \subseteq V \times V\$ is the set of directed arcs, and a weight function \$p \colon V \to [0, 1]\$. For any node \$u \in V\$, \$parents(u) =\{v \in V \colon (v, u) \in A\}\$, which is ...
Is this a good use of decorator pattern ? edit if no can I can receive some clarity as to why .
Program Class
class Program
{
static void Main(string[] args)
{
Car lambo = new CarLamborghini(new Decorator(new LuxuryCar()));
Car cheapyCar = new CarPinto(new Decorator(...
Can this code be modified and made simpler.
The object is to notify if a plane was found or not.
aircraft_identifier variable is a must, cpl_id and target_no are optional, and only either can be used at a time not both.
def decision_making(aircraft_identifier, cpl_id=None, target_no=None):
qo =...
@EthanBierlein I have voted to re-open your meta response. It was a valid recommendation, and all I did was share my opinion: others may disagree with me.