I was just wondering is there a better way to implement a binary search than I am in my code? My function is taking 2 two lists - first_booth_voters and second_booth_voters with second_booth_voters being sorted and first_booth_voters not sorted. I feel like I am making an unnecessary amount of co...
I wrote this recursive function to get all constants from a class and its subclasses. Can it be simplified?
private static IEnumerable<FieldInfo> GetPublicConstants(Type type)
{
var subtypes = type.GetNestedTypes(BindingFlags.Public);
foreach (var subtype in subtypes)
{
fore...
Are you sure your algorithm works ? According to what you said - second booth voters being sorted and first booth voters not sorted , you seem to be using opposite , first booth voters as sorted . — Anand S Kumar7 hours ago
ahh crap I've copied and pasted the wrong version. Cheers — Mikey7 hours ago
Your naming seems inconsistent.
public interface OverviewView {
void register(OverviewPresenter p);
void initialize();
void show();
void rebuildWith(List<Translation> translations);
void showError(String title, String errorMessage);
}
You have both a show() and a showError(...
Otherwise I'll be running with the bounty with a tiny answer...
I've been fascinated about the concept of a web server that allows you to write the interaction in imperative style, instead of a collection of disjointed pages, events and callbacks. So I thought by clever use of asynchronous processing or continuations in C# it should be possible to approximat...
@Vogel612 Should you be modifying elements in the Iteratorwhile it's iterating?
That seems like a bad idea.
I refer to:
while (it.hasNext()) {
Element el = it.next();
String key = el.getAttribute(KEY_NAME).getValue();
if (!originalLocale.containsKey(key)) {
// LIVE COLLECTION!!
it.remove();
continue;
}
passedKeys.add(key);
}
We all know you can't do this:
for (Object i : l) {
if (condition(i))
l.remove(i);
}
ConcurrentModificationException etc... this apparently works sometimes, but not always. Here's some specific code:
public static void main(String[] args) {
Collection<Integer> l = new ArrayList<...
In this case, I would iterate it, add the ones you wish to remove to a new collection, then go through that collection and remove them from the original.
@Mat'sMug A Machine Object File, usually used with GNU gettext() functions. It's used by tons of programs to translate programs. If Java had a way to open those, you don't have to be making up such a mess to translate Rubberduck
So I have committed to making a German translation for the guys over at Rubberduck, which is localized via .resx files.
Now these files are basically XML-Files with a certain, rather simple document structure:
<root>
<!-- Snip -->
<data name="Resource_Key">
<value>Resource Value</value
@EthanBierlein I wonder who did, @Mat'sMug and I reopened it not to long ago, because a commenter said that the indentation fixed the brokenness of the code.
Everyone knows "99 bottles of beer on the wall".
Mat's Mug made a comment about mugs on the wall in The 2nd Monitor and I realized I never wrote a "beer on the wall" program. But that seemed way too easy, so I made it a "n number of x on the y" instead. It also seemed like a good excuse to use t...
This is a follow-up to an earlier discussion Feedback Requested: Design-Independent Graduation.
Like the title implies, design-independent graduation will go into effect and become a regular practice the second week of September! This means all sites which are cleared for graduation going forwa...
Meanwhile, one user decided to create three new tags for a question. Then again, he was only four rep from 300 (the elevated privilege level for tag creation).
In my angular controller, I am using 3 different functions to get the data. it works fine. but is there a way to simplify this?
here is my code :
"use strict";
angular.module("tcpApp")
.controller("projectSummaryController",
['$scope', '$routeParams', '$location', 'server', 'modalService...
i'm extremely new and learning via self taught method.
essentially forcing myself to use python / powershell when capable.
This creates a new file but omits any line that contains text i specify in remove_words
I'd like to try to also replace text in that process but I'm not sure how to tie th...
There are plenty of users on StackExchange that wouldn't mind helping out with site designs
So I ask
Why is there only one person working on site designs?
in response to
We have one designer working on site designs these days at any given time.
Ana's comment
Directly related to Design-Independent Graduation is on for early September!
So I ask
Why is there only one person working on site designs?
in response to
We have one designer working on site designs these days at any given time.
Ana's comment
@HDE226868 There's no list at this point, simply because we haven't made one yet (not because it's some big secret). We'll make announcements on site metas when they enter the process. — abby hairboat ♦38 mins ago
http://www.commitstrip.com/en/2015/08/19/password-memories/ CommitStrip - Blog relating the daily life of web agencies developers Password Memories CommitStrip 1440006302
I write a little code in Javascript, that takes array of objects and doing some sorting stuff and than output in HTML page. I set a goal to do it without any frameworks and in functional style in purpose to learning vanilla JS. It would be nice if someone said that if there is some bad code of ba...
I think we should consider doing away with the label entirely. The whole concept of waiting for "graduation" to get the features you need is too restrictive… no matter what you call it.
Instead, we should be looking at unbundling all the features that communities can really use when they have su...
I have just discovered the beauty of prepared statements in PHP and how they protect against SQL injection. In my first time using them, I am attempting to grab a hashed password from a database and seeing if it matches up against the password the user inputted into the login form.
Is this the m...
@animuson, seems like some sites get preference over others --> CR Meta Tracking Graduation seems Biology and Network Engineering were able to be fast tracked past us in the waiting line. why is that? their announcement came after ours and yet they are full graduated now, and Code Review isn't. — Malachi5 mins ago
This question seems like a better fit for codereview.stackexchange.com, as you don't seem to have a problem. You want to improve the quality of your code. — sstanjust now
When looking at people you may know on LinkedIn (requires you to be logged in) there are sometimes some annoying boxes that are for people who are email contacts but not on LinkedIn. I don't want to see these. If I wanted to connect with them and invite them to LinkedIn, I would have. So I wro...
"Yes, I am proposing to remove the whole graduation thing." -> I agree. I think that's probably in the works down the road. Like Ana said: this is the first step. We haven't made any changes to this process in 5 years, and we're finally re-examining it now. It used to be one step. Now it's two steps (phases). We'll keep working on it, and it will be more steps soon. — abby hairboat ♦1 min ago
> It seems like some sites have gotten preference because it's partially true. I'm not familiar with all of the factors that go into determining the order of site designs, but there have been a few times I remember where CMs have asked for individual sites to get priority.
I have a method the returns a Model as csv. Its there a way I can reduce this method to a few lines?
def to_csv
CSV.generate do |csv|
csv << ['id',
'published',
'update',
'title',
'number of views',
'number of favori...
It has been alleged that I have some checked-in code without review-board requests. I dont think that this is true, definitely not intentional. We use git for version control and review-board for well, reviews. Is it possible to clear my name and reputation from this incident?
The prime 41, can be written as the sum of six consecutive primes:
41 = 2 + 3 + 5 + 7 + 11 + 13
This is the longest sum of consecutive primes that adds to a prime below one-hundred.
The longest sum of consecutive primes below one-thousand that adds to a prime, contains 21 terms, an...
Some clarification:
This is only one step in a very long process of figuring out what it means to be what kind of site on the SE network.
We had the concept of a strict graduation for many years. You were a beta site until something mysterious happened and we descended from on high to tell you...
As part of a larger project I'm working on, I've made a function that aims to replicate, as best as I can, the placeholder part of the console.log() function usable in most browsers (also printf, AFAIK).
It replaces %s, %d , %i , %f and ,%o. It works by having 'unlimited' parameters (the replace...
To start, I have two columns in my sheet. The first column is a date and the second column is price. I want the prices separated into columns by their corresponding year.
To do this I am cutting and paste selections in a loop, however my selection is being pasted in the wrong places. I'm not sur...
Since your code works you this might be a better fit on Code Review (codereview.stackexchange.com) Stack Exchange which is a question and answer site for seeking peer review of your code. We're working together to improve the skills of programmers worldwide by taking working code and making it better. — scrappedcola31 secs ago
This Script will make it so that you are notified on the Desktop whenever new reviews are available, as long as you have a review tab open.
How to use
Install Greasemonkey (Firefox) or Tampermonkey (Chrome). These are userscript managers and allow the script to make use of GM_* functions
Insta...
I have a scenario. User will create a package and add tasks to that the package. For each task multiple users can be added as well. That's how I am trying to implement it.
public class Package
{
public string Name {get;set;}
public List<Task> TaskList {get;set;}
}
public class Task
{
...
I'm now venturing into the world of function writing. I have pieced this code together getting a head start from Dynamically create bootstrap alerts box through javascript. I have added animation on show and an automatic hide, but you'll see I'm repeating the call to the animation.
Challenges
...