I'm trying to practice STL so I implemented breadth first search and depth first search. I have designed the graph class so that vertices can be arbitrary hashable object.
Any feedback would be appreciated
#include <deque>
#include <vector>
#include <unordered_set>
#include <unordered_map>
#inc...
Hello: I am a newcomer to the world of Clusters so I am looking for pointers:
My application most closely resembles that of a market trading application. It is a .NET 4.5 Console Application written in C#, using Entity Framework 6, that only interfaces with a database and a 3rd party API.
What ...
Can someone suggest where I can post this open-ended question? I love SO... I tried codereview.stackexchange.com as suggested above but it was rejected there as well. — Ed Landau7 secs ago
@bansi, Please read a Guide to Code Review for Stack Overflow users. Especially if code is broken, it is not suited for Code Review. And this code looks broken as the braces don't seem to match up or there is some really strange indentation issues — holroy38 secs ago
@holroy as per OP the code is working and need optimization. Perfect candidate for Code Review. — bansi32 secs ago
A quick paste into VS reveals no missing braces. As long as the code functions (which the OP claims it does), it should be on topic for Code Review — Quill - HAT MANIAC53 secs ago
If you post it to Code Review make sure to include the heading, so that there are no brace problems. And as long as it does work, we can help you out. — Quill - HAT MANIAC27 secs ago
@dilhan, Sorry, for branching off into another discussion, but as it stands the code is broken, and it'll be closed on Code Review. If you post the actual working code, we could help you, but we do need to see the entire code. If not, you are better off here at Stack Overflow. — holroy7 secs ago
And allowing him to come over with something obviously being closed, is not making for a good experience for anyone. But I'm going to step back, I've made my point that if he cross posts it'll be closed, which you most likely agree on.
And he gets a closed question on both sites, and leaves with a very bad experience. I believe it's better to try giving him advice as soon as possible, to help him get the best possible experience and hopefully a resolution to his issue.
I have created a StopWatch class to measure the performance of any code. I use this StopWatch code in any of my multithreading projects as well.
public static class StopWatch {
public static ConcurrentHashMap<Long, Long> histogram = new ConcurrentHashMap<Long, Long>();
/**
* Creat...
I have a below code which constructs the URL given a FlowType enum.
private String getURL(FlowType type) throws Exception {
StringBuilder url = new StringBuilder();
if (TestUtils.isProduction()) {
if (type.equals(FlowType.HOLDER)) {
url.append(VISITOR);
} els...
Yesterday morning I decided to stop procrastinating and start learning me some Haskell.
So far I've made this, which is a simple cli 'dice rolling' utility that can be used like:
$ ./dice 3d20
You rolled: 17
The code looks like this:
import Data.List.Split
import Data.Char
import Control.Mon...
@Kent That tip may or may not work, depending where you use it. I found that tip elsewhere on the Internet, and made use of it, and then when I changed some things in my program it suddenly didn't work anymore. See here for more info: codereview.stackexchange.com/a/114723/92925 — RenniePet36 secs ago
I have made todomvc for ember v2 https://github.com/izumeroot/ember2-todomvc
I am beginner in EmberJS. I need your opinions about this application.
May be you will find some bad solutions.
My implementation works without controller. I use components instead controllers. Because in documentatio...
#define N 3000
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int system (const char * string);
struct student // declare the structure type struct student
{// The following four behavioral structure member
char name [20];
float score [5];
float aver;
int cla;
};
void input (struct st...
I need the byte representation of a given type, especially double, float, int8, etc. What do you think?
typealias Byte = UInt8
enum ByteOrder {
case BigEndian
case LittleEndian
}
func pack<T>(var value: T, byteOrder: ByteOrder) -> [Byte] {
let valueByteArray = withUnsafePointer(&va...
Usage of Conditions Variables with Pthreads
I saw this closure today. Why is this closed as off topic? This contains code written by me, and I received a very nice answer.
What point am I missing?
I request a review on the way multiple producers and consumers access multiple shared queues.
What I have done here requires the threads to check for the space in queues minimum two times. Can it be made better someway?
Of course, I can create another queue where these queues will be kept in th...
The code has been test to work by the parameters listed below I just wanted to know if there were any details that I missed or blatantly overlooked. Thanks in advance.
Develop a Java application that determines whether any of several department-store customers has exceeded the credit limit on a ...
Requirement
I have an entity named ImportData which can be processed once in order to extract data from a file fed to the application.
I need to make sure that, in case of concurrency, only one process is capable of processing that import data. Other processes shall not attempt to read the file...
If you're looking to get a code review / tips for improvement, I suggest looking at Code Review (be sure to check their FAQ for what's on topic though). — Jeroen43 secs ago
Yes this code grew sort of organically which is part of the problem and part of the problem is a recursive algoritm which makes debugging hard. Maybe I should crosspost this to code review? — Thijser42 secs ago
"Implement this class.. it's supposed to store a bunch of objects coming from different containers of multiple types in the same file and also enable to do the reverse"
because who needs type-safety or object-specific serialization policies?
@Thijser Code Review is only for code that is already working as intended. Once you've got it working though, feel free to bring it over. — Zak15 secs ago
@Vogel612 I'm surprised that constricting the method signature is considered a bad thing
I can understand changing it outright to use custom types
But if you use a covariant generic constraint, IMO that should be fine because you haven't changed the behaviour, you've just given a better compile-time hint
I probably used covariant wrong there. What I mean is derived type, but covariant sounds more fancy.
Flawed Logic
Dirk Reichel makes a good point that the logic for DetermineNextTickState isn't expressed correctly and should be If numNeighbours = 2 Or numNeighbours = 3.
Additionally, this If x <> y Then is going to cause completely flawed results (it won't even have the desired semantics when ...
In Apple's software, are there any hidden tributes or memorials to Steve Jobs?
Someone told me you can find his glasses in an app but I can't find them.
I have 2 lists. One list of objects & one list of int as follows:
class Test
{
int id{get;set;}
string name {get;set;}
}
List<Test> lstTest = new List<Test>();
lstTest.Add(new Test{Id = 1, Name = "Name1"});
lstTest.Add(new Test{Id = 5, Name = "Name5"});
lstTest.Add(new Test{Id = 3, Name...
I got praises from my co-workers for writing the major feature I worked on in a very readable, documentable way. All because they've seen the hell that was his implementation of it (but in Java)
So extremely convoluted.. Values come from 20 different places, often an interface that magically appears
Code should be able to be read through. Yesterday I explained my implementation to the CSO and I was able to do so by just looking through the code from the entry point and following the branches
I've written wonderful code, if I may say so myself. It's accompanied with 183 tests (183 more than they had before) and very extensive documentation so they can't mess anything up