I am using the code below that loops around thousands of time, I need this to be as fast as possible, however I am not that expert in Javascript and all I know is using these are faster than doing it with innerHTML method.
Can it be faster or not? If yes, how?
var a,b,c,d,e,
trEl, tdEl,...
I'm trying to break up some procedural javascript code used for running an automation test.
The code is a series of steps that execute selenium webdriver commands within the neustar load testing framework. The framework is not too important for the purposes of this review. Its more the structur...
I wrote a simple 8-Puzzle and solver and am interested in seeing how it might be improved. Please let me know if any style or design changes might enhance the readability/performance of my code. Thank you!
import random
import itertools
import collections
class Node:
"""
A class represe...
@Donald.McLean Cool :) I have a project here consisting of multiple modules, and every module is linked to a different Git repo... The Git plugin doesn't completely like that
In the bottom right it shows you the current branch, it for example won't update when I select the project/module in the explorer;
and when I commit the changes, it automatically takes the changes from all modules by default, which I don't like either
I'm finally making the voyage back to IntelliJ via Eclipse. Currently my Eclipse is set up so that if I currently have a statement such as this (where ^ denotes where my cursor currently sits):
foo.bar("hello"^)
and I hit the semi-colon (;) key, it will automatically put the semi-colon at the...
One does have to be careful at the end of some lines. Scala considers that an complete statement followed by a newline is terminated. So if you have something like a = b + c + d, then you could move the d to the next line, but not + d
@skiwi You can, if you want. The one thing I strongly recommend you di is set up a plan for versioning so that you never run in to issues with new versions being considered old, etc.
Also, the 'push' from sonatype to maven-central is not immediate. It can take a few hours for the replication to happen. So, you can't push to sonatype and pull the build from maven-central immediately
I have a situation where some code is calling methods on an object after the object is disposed or it is calling dispose while a method is being executed. This is causing issues because the dispose method will null some stuff out and so I get NullReferenceExceptions.
My plan is to use Fody (an ...
I have the below method which is trying to move a file 3 times and throws an exception if it can't do it. The main reason for the try mechanism is in case the file is locked and not accessible which happens sometimes so we need to be able to try again.
This is my code but I am looking to improve...
I wrote the following and it appears to work fine, but I just want to make sure I don't make a stupid mistake: // $weight is in ounces (e.g. 5, 16, 102, etc.) $weightLbs = floor($weight/16); $weightOzs = $weight%16; That's correct, right?
Basic idea: one use case contains one or more use case stories (1 story = basic flow + 1 alternative flow) which can then be grouped in use case slices?
This is an attempt at the Factory Method Pattern
It emulates the logical model
and also the physical model
Resources:
http://en.wikipedia.org/wiki/Factory_method_pattern
http://msdn.microsoft.com/en-us/library/ee817667.aspx
http://www.oodesign.com/factory-pattern.html
Is this a correct ...
I ask you to check this solution, or propose something better. Design a data structure that allows to perform the following operations:
$$(a) initialization :: S_i = \emptyset, i = 1, 2, .., n$$ $$(b) insert (x, S_i) :: S_i = S_i \cup {x}, {provided\ that\ x\ is\ not\ present\ in\ any\ set}.$$ $...
It was my own site though, so I just left a disclaimer that if anyone was experiencing issues to try a different browser because I wasn't going to write a whole other site just to support IE.
Guiding you towards the "perfect" counterpart of this code will take some time, why don't you take yourself from the South-pole to the equater, so we can meet each other half way? because (respectfuly) this code is waaaay off. Oh and BTW: google: TMTOWTDI <= this means that "the perfect code" doesn't really exist, it all depends on what you need, and where — Elias Van OotegemJul 30 '13 at 14:28
I have to find a non deterministic way to get a random int-number between for example 0 and 5 using the factory method pattern. How is this working?
public class RandomIntGenerator {
private final int min;
private final int max;
private RandomIntGenerator(int min, int max) {
...
when you use while(string input = file.readLine() != null) (or whatever the exact syntax is), you're never going to actually be returning an empty string?
Just another case of a pissed-off user creating drama for the sake of creating drama. If he really wanted to leave for good, he would've done so already.
I am wondering what is the best way to map array values to properties in a class. Consider the following sample array describing information for an airport:
[0] "6523" string
[1] "00A" string
[2] "heliport" string
[3] "Total Rf Heliport" string
[4] "40...
> ...but this constant drama, these duplicitous rants where you feign ignorance and then resort to name-calling when it turns out you're not as clever as you thought you were... They're getting old. You weren't that good at it to begin with, and now that you've apparently reached the bottom of your little bag of tricks it's just sad. This isn't fun anymore.
It is first time for me asking a question on codereview, and it's kind of hard to grasp the workflow, what's allowed what's not.
After a question I asked on programmers.stackexchange.com : Is using generics to indicate some class/method is aware of a type good idea?, It was suggested by Rob-Y th...
today I experimented with HTML tables and populating them from a MySQL database. My code worked well for what I needed and as is the table looked something like this:
http://codepen.io/anon/pen/ogYRwj
However I ran into a major problem when actually integrating it onto my website. I use the inc...
hey @nhgrif! I have been playing with the bejeweled clone some more, and I was able to implement most of your code suggestions. However I was not able to implement the part with the reverse enumerator of the for loop. The reason why is that I want to start iterating at the point following the last orb that was marked for destruction, rather than grabbing all the orbs in the array. I have thought about another way to do it but I haven't tried to implement it yet
here is the part I am talking about:
//get the marked orbs
for (int i = kNumOrbsPerRow - 1; i >= 0; i--) {
DMOrb *orb = row.orbs[i];
if (orb.markedForDestruction) {
[markedOrbs addObject:orb];
}
}
//get the existing orbs in the proper direction
NSMutableArray *existingOrbs = [[NSMutableArray alloc]init];
DMOrb *lastMarkedOrb = [markedOrbs lastObject];
for (int i = lastMarkedOrb.boardPosition.x - 1; i >= 0; i--) {
[existingOrbs addObject:row.orbs[i]];
}
the other way I thought up was to only iterate over the array once, but then only start adding orbs to the existingOrbs array if they are above or below the index of the last marked orb.. but that may require BOOLs or some other fancy logic to enforce
Context:
€13000 banked on a 1% savings account.
€1700 banked on a payment account.
€1450 monthly income (after taxes).
~€400 monthly costs, and probably another €200-400 in incidental expenditures (food, games, clothing)
I'm 21 years old.
I have no debts.
I'm left with a good €650-€850 that I...
the way that you suggested with the reverse enumerator will grab all the orbs that are not marked instead of only the ones starting after the last one that was marked for destruction
@nhgrif I can't really answer that. I just have a feeling that it is done that way, even on Blizzard. Of all card-game code I have seen, I haven't seen a single one that randomizes every time. Doing a simple Collections.shuffle(deck); is a lot easier.
for this its an array. the reason why it matters is because the existing ones following the last marked orb will move down to the positions held previously by the destroyed orbs. here is an image that may help imgur.com/aEHzycN
@nhgrif Additionally, in some games, you can put cards on the top of your deck, then it is really important that your deck is in the same order so that you will draw that card again next time.
And, as a poker player, I will tell you that it's BETTER to think of the deck of cards in that manner, regardless of how it's actually implemented (and I mean even when you're dealing with a physical deck of cards).
Despite the cards being stacked up and clearly in a set, non-random order... you shouldn't think of them as being in a set, non-random order.
As everyone knows, the ruble is falling compared to the euro and it has been falling for a long time already.
The way I see it, the ruble will eventually get back up once the political situation around it is resolved. Is it naive to think I can just exchange - say, 500€ - for its equivalent in r...