@PeerNet Code Review is meant for fully working code The O.P. states he didn't tested it. If the code is broken, the question will be closed as off-topic. Before going ANY further, the O.P. should test it. Then, if it works as expected, he can post on Code Review. — Ismael Miguel30 secs ago
In computer security, a DMZ or demilitarized zone (sometimes referred to as a perimeter network) is a physical or logical subnetwork that contains and exposes an organization's external-facing services to a larger and untrusted network, usually the Internet. The purpose of a DMZ is to add an additional layer of security to an organization's local area network (LAN); an external network node only has direct access to equipment in the DMZ, rather than any other part of the network. The name is derived from the term "demilitarized zone", an area between nation states in which military operation is...
I haven't written any Java in years and I wanted to catch up a little, especially on newer features. I started looking at streams and aggregate operations and came up with the following solution to Project Euler #7 (find the 10001st prime).
package com.example;
import java.util.stream.IntStream;...
If this code is fully working and you'd just like to improve upon it, you might be better off posting on CodeReview as Praveen suggested. But please make sure to read their How to ask page. — SuperBiasedMan44 secs ago
I have an angular function which passes in two date objects and compares them returning one of two strings which are then passed as a class name to an html element. The idea being that if the date is older than a specified amount the element can be highlighted using the class name.
I now need a...
Hi @lharby, your question doesn't appear to fit what this site is about; Questions containing broken code or asking for advice about code not yet written are off-topic, as the code is not ready for review. After the question has been edited to contain working code, we will consider reopening it. We don't write code for you, but we will review code if it's working. You're not asking for a review here but rather for someone to help write an extension to your function, which I would say is probably off-topic — Dan Pantry17 secs ago
After populating the stock_tmp table, i'm running this SQL in a single query. I don't think this code needs additional locks to prevent people from seeing incorrect data. Is that correct?
DELETE FROM stock WHERE ean NOT IN (SELECT ean FROM stock_tmp);
REPLACE INTO stock SELECT * FROM stock_tmp;
var arr = "5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,8,8,8,8,8,8,8,8,8,8,5,10,8,8,8,8,10,10,8,12,10,10,8,10,10,8,8,8,10,10,10,8,10,10,8,10,5,".split(',');
I was recently reviewing a question, which (if I had paid better attention to the question from the beginning, I may have noticed before answering) had a SSCCE as its primary code example.
At first glance the question is asking which way is the best way to make their UI scalable in the future. I...
As stated in the Help Center, one of the criteria for a question to be on topic is:
Is it actual code from a project rather than pseudo-code or example code?
What is the rationale for that rule?
Every once in a blue moon, a question gets posted (often as a new user's first post) where the OP is asking a quite specific question about very minimalistic code, for example:
if (strstr($url, "?")) {
$url = strstr($url, "?", true);
}
There is something to say about this code, of course....
This is related to Why is hypothetical example code off-topic for Code Review?
Which is related to On-Topic question #3:
Is it actual code from a project rather than pseudo-code or example code?
It seems that we're not quite consistent in our treatment of "example code", which is what this...
The difference between hypothetical code, pseudo code and example code is not important. The only important difference is between real code and not real code.
@Zak Stack Exchange.
The pro-tem mods asked for 5 but we got 4.
@DanPantry If you think a question deserves to be migrated, feel free to flag it with a custom flag.
hmm... this is strange.... when I run the election data, @Mat'sMug was the third one to be elected and I was the fourth. If I change the election to only require three candidates, it says that I would have been the third and then @Mat'sMug wouldn't have been elected. Is there a bug in my code?
I have code that converts each character of String to int and returns the difference between odd and even numbers. Can this code be simplified ? I want to know how to make my code more simple.
int compareSumOfDigits(String N) {
int e=0,o=0;
for (int i =0;i<N.length();i++){
int t = Character....
I have a class Fighter in a software for planning boxing events. I implemented its hashCode() and equals() since I collect them in various data structures in many places.
Now I want to persist specific planned boxing events which themselves contain the same Fighters in different lists. I am u...
I have code that converts each character of a String to an int and returns the difference between odd and even numbers. Can this code be simplified? I want to know how to make my code more simple.
int compareSumOfDigits(String N) {
int e=0,o=0;
for (int i =0;i<N.length();i++){
int t = Charac...
I'm new to Haskell and am confused by why my code seems to preform so poorly, and wonder if there's something I've not grasped about the coding philosophy behind the language, or the best way to take advantage of its features.
For example, I have started, as an exercise (yet another) simple Enig...
@Vogel612 SO mods says that it was a very broad 'improve performance of my code coz it is slow' question. it would likely have been closed as "too broad" on SO.
So, this site is called "Code Review"...
What we do here is... ask for and write Code Reviews, naturally.
However, I feel that there are a whole bunch of different thoughts floating around about what a Code Review really is.
On Code Review, what is a Code Review?
(And what is it not?)
This q...
Our Help Center says:
Do I want feedback about any or all facets of the code?
However, sometimes we might have some code that we are aware has flaws in it, or we would just for one reason or another want reviewers to not comment about something.
When asking a question on Code Review, can w...
I know this has been asked here and here, but I have the same idea with a different possible implementation and I need some help.
Initially I had my blogstories table with this structure:
CREATE TABLE IF NOT EXISTS `blogstories` (
`uid` varchar(15) COLLATE utf8_unicode_ci NOT NULL,
`title` ...
On the job references thing. The advice I've been given (from experienced corporate people) is that references shouldn't be in your application unless they're asked for.
For a lot of companies, screening people by their references only happens several screening steps into the process, and many only check references once they've decided they'd like to hire you.
tl;dr if/when a company wants your references, they'll ask for them. until then, leave them out.
N.B. this is general corporate and anglo-centric. standard practice may be different elsewhere.
I've voting to close this question as unclear. There are no details provided on how to get from A to B. Is the difference that we want the characters in the middle? Do we want to just eliminate any emoji no matter where it is? Do we want to simply trim the first character of each end no matter what it is? Do we want to trim characters off the ends but only if there are emojis? There's no clear description of what is actually trying to be accomplished. If the question is literally 'How do I return "hello World"?', then the answer is simple: return "hello World". — nhgrif1 min ago
You claim that your "code is a generic approach at providing code that can be trivially multithreaded to run these calculations on a Comparable[]". I see a number of problems with this statement.... most obviously, you are not using generics at all, even when they are needed, as Comparable is a g...
I'm voting to close this question as unclear what your asking. There's no indication at all of exactly what is wanted here. Do you want to just return "hello World"? return @"hello World". Do you want to return just what's between colons? Do you want to strip everything left of the left-most colon and everything right of the right-most colon? There is no clearly defined input-output criteria for this question (as we see with the resulting list of questions that all solve the problem with a wild array of approaches). — nhgrif8 secs ago
What that means is that if you use an Objective-C library that returns an NSString, Swift will receive it as its String struct, rather than receiving it as an NSString class.
SO user Hot Licks has suggested that Swift and Objective-C are too complicated to use as a learning ground for OOP fundamentals and recommended Java as simple enough...
Is my current understanding of the graduation progress correct: We have all the functionality of a graduated site but we don't have our own design yet?
@nhgrif I thought there was some small difference, but I'm likely mistaken. Also, if I recall there is no public/private. I don't think they're that far off, but the syntax alone is different enough IMO. Though the functional stuff in Swift is pretty nifty
The syntax though, should only be a problem when it comes to learning Objective-C after you already know another language. I don't see how it's a problem with learning it as your first OOP language...
@nhgrif Yeah. I was just never impressed with it, but I'm pretty sure that's my anti-apple bias showing. :( And it's quite verbose, however, I think whatever works works. I'd just prefer to teach one that is a bit more canonical.
I think, from what I've seen, Swift would be a good language to start learning, especially with that playground or whatever they have, and that you can get a bit of functional concepts in there. ObjC I'd stray away from just because it sounds like Apple's hoping to get rid of it, and the whole NS, and [self doStuff: x and: y] is a bit annoying. Then again, what do I know?
It's all in the variables.
Take, for instance, your p object. You pass the same p object to both threads. Now, I'm not sure if Parallel.Invoke is capable of detecting this, and as such is executing them in serial (albeit with significant overhead) or not, but I do know that if it is not detectin...
I did not do any actual benchmarking (I leave it up to you), but my guess is, that the fastest solution for value types would probably involve using unsafe code. You can start by using default PtrToStructure method, and see if its fast enough in your context:
public unsafe static T ConvertTo<T>(...
I'm playing around with some code I have and i'm trying to return more than one select statement from a database and have the following code.
public IEnumerable<MemberProfile> ProfileForMember(string id)
{
// string sanitziseId = Data.SanitizeInput(id);
const stri...