This doesn't contain a specific question and working code and is therefore on topic on codereview.stackexchange.com . You can do something like syn_error ^= s[i] as a hint. The fewer branching instructions the better. Minimizing the number of variables (registers) also helps. — Maarten Bodewes57 secs ago
Recruiters are a curse on humanity. At best they are a potent symbol of market inefficiencies, but the reality is they usually introduce inefficiencies and obfuscation for little benefit to either party. — Flexo22 hours ago
@Legato I've tried, a couple of months back, to write a monopoly simulator to find the optimal tactic.
This is partly to blame on my wife whom challenged me to a match of said game.
I am fairly new to Python so I am trying to learn more about its conventions and ways to make my codes more efficient.
I am making a Blackjack game and so far have this class that draws, organizes, and scores a hand of cards.
class Hand (object):
def __init__(self, card=[], card2=[], score=0...
@ardaozkal, android doesn't allow synchronous calls on ui thread, so I had to figure out how to synchronize 3 calls. In the end, I just wrote some kind of CAS on each of the calls. @Vogel612, monking
and that sounds like you're doing something wrong when trying to restart your timer
> If the timer's task execution thread terminates unexpectedly, for example, because its stop method is invoked, any further attempt to schedule a task on the timer will result in an IllegalStateException, as if the timer's cancel method had been invoked.
> Java 5.0 introduced the java.util.concurrent package and one of the concurrency utilities therein is the ScheduledThreadPoolExecutor which is a thread pool for repeatedly executing tasks at a given rate or delay. It is effectively a more versatile replacement for the Timer/TimerTask combination
@OlzhasZhumabek it should, so long as you're actually newing up correctly (if you can even do that)
I am using this code:
$page = int(param('page'));
This sometimes results in:
warning: Use of uninitialized value in int
Is this a good solution to resolve this warning, or is better and more succinct code available?
if (defined param('page')) {
$param_page = int(param('page'));
} else ...
gonna grab a good book and have nice read. Cause my C++ way is a bit irrelevant in java :( I can't even write range loop. @Phrancis, you tried to apply? :D
But yeah I let them know I was interested, that I had lots of experience in SQL, was currently learning Java (which is in high demand here, along with C#) and had been exposed to a lot of various types of code
I have implemented a basic (naive?) LINQ provider that works ok for my purposes, but there's a number of quirks I'd like to address, but I'm not sure how. For example:
// performing projection with Linq-to-Objects, since Linq-to-Sage won't handle this:
var vendorCodes = context.Vendors.ToList()....
So we have:
2 types - Award and Cert
5 Levels
3 subjects
I.e. Award Level 2 in History, Award Level 2 in Art, Cert Level 2 in History, Cert Level 2 in Art, Award Level 3 in History, Award Level 3 in Art...et al
Sorry if its too easy, Ive spent the day thinking the answer lay in permutations an...
Does Code Review deal with "Workflow review" questions? I have setup some Jenkins jobs using pipelines and Jenkinsfile and I have a feeling that I'm not doing things the most optimal way.
@Vogel612 Judge for yourself: github.com/Zomis/Commons/blob/jenkins/Jenkinsfile . The thing is that to recommend better solutions, familiarity with Jenkins plugins would be handy. The solution I am looking for might just be "Use this Jenkins plugin, configure it like XYZ, run builds with ABC."
I am working on a biometric matching system and I would like to have few suggestions regarding vectorizing the following code:
ref_points=size(tpol,1); %number of rows=number of reference image points
in_points=size(ipol,1); %number of rows=number of input image points
radsize=7*ones(re...
I ran into a problem in my app where under some conditions, a view controller might be loaded more than once before its deinit (where I was previously removing the observer) is ever called. So the notification was being added twice occasionally and causing some problems.
To fix this issue, I ju...
I've made a couple of suggested edits to this question. The first one was rejected because it deviated from he original intent / it edited code. When I looked at the suggested edit, it did look like I had just hacked away at the code, so I wasn't surprised it had been rejected.
I made a second...
This may be more appropriate for Stack Exchange Code Review. In general I agree with you - layers for the sake of layers is not good design. Each layer needs a purpose; every class needs a responsibility. If you don't have any meaningful business logic, then the BAL may not be valuable for your case. — Tim Copenhaver14 secs ago
function rot13(str) {
var codeA = "A".charCodeAt(0);
var codeN = "N".charCodeAt(0);
var codeZ = "Z".charCodeAt(0);
var newArr = [];
for(var i =0; i<str.length; i++){
var code = str.charCodeAt(i);
if(code>=codeA && code<=codeZ){
if(code>=codeN)
newArr.push(String.from...
I was just asking this question over here:
http://stackoverflow.com/questions/37846123/n-tier-c-sharp-applicaiton-with-bal-and-dal-methods-with-exact-same-names-sign?noredirect=1#comment63152704_37846123
I'm on a project in which I'm failing to see the point of how a previous developer made dec...
Handling HTTP errors
This code seems to be intended to handle 404 Not Found response when downloading a url:
# Grab the page, raising an exception if it doesn't work
response = requests.get(url)
if '40' in str(response):
raise Exception('Couldn''t find page!')
Unfortunately this is very...
Actually, I have made 4 FizzBuzz, musical FizzBuzz with ChucK, SQL, Java, PHP. The musical one and SQL ones are pretty cool, maybe you should check them out
Last month we got together with many of you in the Tavern for our first Meta Stack Exchange Town Hall. Like we shared in my original announcement, amazing as meta is, we need to do more to keep lines of communication open with the users who work alongside us to make our software great in the long...
I'm trying to keep my data separate from my UI controls and as such have the following classes:
//Data classes
public class DataA
{
public int someNumber;
}
public class DataB : DataA
{
public int anotherNumber;
}
//ControlA only knows about DataA
public class ControlA : UserControl
{
...
I struggled for the last couple days on this question and finally came up with a solution. But it's got so many loops I get dizzy just looking at the code - from recursive functions with loops to loops within loops.
I really expected to find a canned function in a popular XML class to extract al...
I had a complex query in the controller like:
def outgoing_tasks
@tasks = current_user.
assigned_tasks.
uncompleted.
includes(executor: :profile).
order("deadline DESC").
paginate(page: params[:page], per_page: Task.pagination_per_page)
en...
As mentioned in the answers to a very similar question, scribbling over part of an image will destroy the original pixels, assuming that your editor doesn't store any layers or undo history. (Paint doesn't.) There are some things to watch out for, though:
The width of the blanked region places ...