@Vogel612 I can agree that immutability can affect string operations requiring some sort of changes, but when they are just doing a substring and converting into a number, there really isn't any excuse for not making that blistering fast
I'm currently working on a project where I have to map some objects to several properties.
Basically I need a Dictionary with Tuples as keys and instances of MyClass as values.
As using tuples can quickly lead to an obscure (because of item1, item2... properties) and verbose code I decided to m...
I am fairly new to python. I implemented a short cross-validation tool for gradient boosting methods.
import numpy as np
from sklearn.metrics import roc_auc_score as auc
from sklearn import cross_validation
from time import time
def heldout_auc(model, X_test, y_test):
score = np.zeros((mod...
We have an AD domain that is at 2008 R2 levels. I have written a HTA which I use by right-clicking on a user from within AD Users & Computers and then selecting the HTA from the context menu that appears. The HTA gives me the display name and UPN for the user selected and allows me to hide the ...
@holroy: I know. I did not mean that this question could be transferred to Code Review as it is, but clearly the author's intention is getting a review of the code. — Christian Hackl57 secs ago
@Equalsk the nature of the question appears to indicate that the OP is looking to rewrite this routine with a different technology than VB. As such, this would be off-topic on Code Review as "code not written yet" (in the target technology). — Phrancis59 secs ago
I wrote the following function to find the longest palindrome in a string. It works fine but randomly it won't work for words like "noon" or "redder". I fiddled around and changed the first line in the for loop from:
var oddPal = centeredPalindrome(i, i);
to
var oddPal = centeredPalindrome(...
A lucky number is defined as a positive integer whose decimal representation contains only the lucky digits 4 and 7. For example, numbers 47, 744, 4 are lucky and 5, 17, 467 are not.
Now, suppose I want to add all Lucky Numbers under a given integer [N] to a vector, without using recursion. For ...
@holroy My Lenovo laptop is ancient. Intel has declared end of life for my processor. You can see the specs in my latest question (the Parallel Multiplier one) ;-)
@ambigram_maker That was kind of out of context... Had expected a response in comments, not here in chat... We had a little ramble earlier on by the way related to this question and why the Java version were so slow compared to the Python versions...
I have this functions definitions:
// This is a private function, don´t check for undefined arguments.
function _arrayKeyDiff(a1, a2) {
let r = {s:[], n: [], l: []};
for(let k of a1) if (a2.indexOf(k) === -1) r.l.push(k); else r.s.push(k);
for(let k of a2) if (a1.indexOf(k) === -1) r.n.pus...
@Rajesh The wording is somewhat unclear (I get the impression the OP might not be a native english speaker) but if they're just asking about "How should I handle unexpected inputs?" then it would be Off-Topic for Code Review. We review code that already does what it is intended to do, not feature requests. If the OP wants general feedback on what they've already written, that would be a perfectly fine question. — Zak40 secs ago
Opinion-based questions are off-topic here, but if you have working code that you'd like feedback on see Code Review (they will want actual code, not stubs as you've shown here). — jonrsharpe18 secs ago
@Zak Thanks. I was under impression, all reviews and improvement question belongs to Code Review and we just post issue here. I'll be more careful in commenting from now. — Rajesh17 secs ago
@rajesh that's quite alright. The golden rule of recommending Code Review is: "Does the code already do what the OP wants it to do?" and they just want advice on how it could have been done better. You might also want to read A guide to Code Review for Stack Overflow Users — Zak37 secs ago
I've been using this pattern in my JS code:
function Thing() {
var otherData = {
// Private variables?
name : "something"
}
var myThing = {
data: "somedata",
someFunction: function () {
console.log(otherData.name);
}
}
return ...
@Rajesh OP decided to follow your advice and posted it on Code Review. At the moment it has -2 and 3 close votes. Please refrain from making such recommendations if you're not sure how the next site will take it. — Mast29 secs ago
This is intended as a ready copy & paste version for including in the Auto-Comments script.
The Auto Comments script also has support for a "remote" feature where you can use this URL: http://www.zomis.net/codereview/auto-comments
###[Q] Broken Code
I'm afraid this question does not match what ...
I've migrated this post to our sister site, Code Review, since it is working code but you want to receive feedback on how to make it work better (faster, but you can do with some style tips too). — Martijn Pieters ♦49 secs ago
I have posted my first version of RockPaperScissors a while back. It was on an old version of python with improper use of some functions. This version was updated to a more recent version of python and has a little extra for users who run on terminal. Is there anything I should add or change? Are...
I'm relative new to python scripting, and I made a script the takes two raw data files, and merges them into one cvs file, but it takes a long time to complete, is there any logical structure I'm not aware of?
input_fileVms = open( 'vms.csv', 'rb')
if site == 'eg':
output_merge = open('merg...
@holroy at one point I had the "Q" ones as "C", but they're better off as "Q" because "C" would be a custom close reason - and "broken code" isn't a custom close reason
i am developing a website in asp.net using c#(html 5.0). i want to show tick sign when user fills a text box correctly.want complete method or code for it.plz help me.
@EBrown Yeah I get the point, but, for example, this : "What is using Programming;?" Is confusing. Is it about a tool that's used by Programming? Is Programming a tool? It's confusing IMO.
What my main question is, is since I'm new to JPA if I'm using an efficient way to insert the data fetched from the Twitter API in my database.
Well, it's not entirely bad, I understand that you need it because only your sqlmanagement.XXX classes are annotated with @Entity. You could improve...
okay I'm losing hope. anyone has any idea how to get a SSIS package to run through a SQL Agent job that's not owned by a sysadmin, using a proxy? I get the job to run, but the package fails with an authentication error - which makes no sense because the job itself authenticates correctly
I'm voting to close this question as off-topic because it belongs on Code Review, not Stack Overflow. — ArtOfWarfare32 secs ago
In addition to this being off-topic, I think you should edit this question to include the implementation of newthread. They're definitely going to want it if/when this gets moved to Code Review. — ArtOfWarfare30 secs ago
@ArtOfWarfare This would likely be closed on Code Review as stub code, due to the omitted code here. If the OP provides the full code, and isn't asking for new features, then it's on-topic. — Ethan Bierlein5 secs ago
@ArtOfWarfare 1. Speaking as a moderator of Code Review, I guarantee you that this question would be immediately closed on Code Review, for the reasons stated above. 2. "Because it belongs on Code Review" is not a valid reason to classify this question as off-topic for Stack Overflow. See the help center for a list of valid off-topic reasons. Also read A guide to Code Review for Stack Overflow users. — 200_success24 secs ago
I wonder which for loop looks clearer, is more readable and performs better:
for (int i = 0; i < arrayLength; i++) {
...
}
Or...
int i;
for (i = 0; i < arrayLength; i++) {
...
}
Notice the counter i declarations. Does it actually make a difference performance-wise if I declare the i...
http://www.commitstrip.com/en/2015/11/12/pay-to-pitch-to-randoms-the-next-big-idea/ CommitStrip Pay to pitch to randoms, the next big idea! CommitStrip 1447352405
Just had this diagnostic test of applid natural sciences, I was late because of a traffic jam, and then they start asking things I don't even know about, great :| Was totally useless
As a gamer, I want a version of windows with DX12. As a sane person, I want a version of windows without the built-in spyware. So, I'm stuck at an impasse unless/until I can motivate myself to add the necessary firewall rules to my router :|
To learn about classes, I chose to create a little something that checks if you have included the following:
@ sign
Provider (e.g. 'hotmail')
Domain extension (e.g. '.com')
It also checks if you entered spaces in the address and gave the option to keep them or get rid of them.
It's all writte...
@DanLyons I'm planning to upgrade my desktop PC to W10 with a clean install once I buy a 1 TB SSD, which I will only do if I decide to put my current 250 GB SSD in my laptop and stick 16 GB RAM in it, and then I'll also install the laptop OS
Note: similar to http://stackoverflow.com/questions/33677793/how-can-php-code-be-made-aware-of-specific-class-subtypes-passed-to-it-when-usi
I have a class called Assembly that hides implementation of underlying products. ProductA can have one set of getters, ProductB can have another.
Whil...
I have two SSIS packages that run scheduled overnight (via SQL Server Agent) as part of a larger SSIS deployment, without any issues. Everything is using Windows authentication, and the scheduled job is owned by a sysadmin (well, me) and run as the SQL Server Agent Service Account.
So, the data ...
I am working on a small tool using Java to update the Hyperlinks in an excel workbook automatically. I am using Apache POI API . Some of the cell has text and a URL with label. how would i replace the hyperlinks alone, without impacting the text in the cell.
code snippet:
Hyperlink link = create...
This might get better responses on Code Review SE. You've got a good start, as phflack mentions you want get/sets on some of your Node and Edge properties. I'm not sure why you want to avoid Graph being a Collection (List or Set or ...) of Node and Edge, it seems a perfectly logical way to represent a weighted digraph. — cobaltduck5 secs ago
there is a whole stackexchange site dedicated to code reviews — redFIVE13 secs ago
@redFive is correct, this would be a better fit on Code Review - note that you don't need to "simplify" the code you post there, in fact it's actually better to include all of it; reviewers like to see your code in its full context and glory! :-) — Mat's Mugjust now