> You've earned the "Revival" badge (Answered more than 30 days later as first answer scoring 2 or more) for "Wrapper class for the Rotten Tomatoes API".
Link
I have written a solution for problem 28.Since I am a beginner , I am looking for suggestions for improving efficiency in my program.
This is the code:-
from timeit import default_timer as timer
start = timer()
def find_sum(limit):
limit*=limit
num=1
add=2
result=1
while...
@200_success also if you are dealing with individual objects you can just give them singular names, like "form." If you're dealing with collections and you're using jQuery, you're probably not using querySelectorAll or getElementsByTagName or the excellent forms API, so all your collections are probably jQuery objects. So a variable with a collection of forms can just be named "forms," there's no need to name it "$forms."
How can you have a self regulating group of moderators in a community?
Moderators regulate the community, but there is not an official way to moderate the moderators themselves.
Here in StackExchange you have the community managers that could remove a moderator if it was necessary, the same in ...
This is my sample code to find maximum occurrence of characters in string in C#.
How can I make it better?
public static int GetMaximumOccurence(string str)
{
int _maxcount = 0;
foreach (char c in str)
{
int ix = str.IndexOf(c);
int count = 0;
while (ix!=-1)...
If your meta site does not have a post to nominate Moderators, start one now! Pro Tem appointments will begin about two weeks after the site is created. The more guidance we receive, the more informed our choice.
Moderator Pro Tempore
Each nomination should be a separate answer. Link the n...
The goal of the code is to
initialize a Dialog with settings
make sure the object is reusable
Setup the options to reuse the code
I'm not quite sure if this is overkill, or I am going about this problem in the entirely wrong way. Any input would be appreciated.
var myDialog = myDialog ||...
The index manipulation version is not obvious at all. I'm assuming someone would be skimming the code, not parsing every little bit. You'd have to catch the fact that i and j are moving opposite to each other and have a think about why it stops when they cross. The second way actually says "reverse" in the code and compares. — Carlos7 mins ago
Most Recent Leaderboard @ 2014-07-29
Last Tournament invalidated by a bug introduced by Sheldor (stupid sheldor) in the orchestration app. Will fix tonight and post a new tournament then.
Full output logs from the tourney are available at - https://raw.githubusercontent.com/eoincampbell/big-ban...
I'm working on a client-side Api for my Asp.net MVC application and I'm not quite sure I've got the code right. This Api allows me to call server-side action methods via ajax and I've designed it to have a similar call syntax like jQuery uses.
Is the variable HomeActions._ajaxSettings static the...
Given a Doubly Linked List which has data members sorted in ascending order. Construct a Balanced Binary Search Tree which has same data members as the given Doubly Linked List. The tree must be constructed in-place (No new node should be allocated for tree conversion). This question is attribut...
Although this site mainly caters to moderators, anyone is still free to contribute. A non-moderator may even have some good questions to ask. However, this may not always be the case.
What if some frustrated users decide to complain here about moderation activity on any site, most-likely from ...
Here's what I ended up with for Learning Python the Hard Way Ex 51 with image upload (save and display).
The app:
import web
import shutil
import os
urls = (
'/', 'Index',
'/images/(.*)', 'images' #this is where the image folder is located....
)
app = web.application(urls, ...
Schema
I think your schema looks good, I wouldn't change anything.
Nitpicking
I think some sections could use line breaks and indentation to make more sense. Also comments throughout would help follow the flow of the code.
For example, this:
WHILE i <= maximum DO
INSERT INTO inner_set (val...
IocainePowder, Ruby
Based off (shamelessly stolen from) the RPS strategy here.
The bot looks chooses a guess identical to the Markov bot, but then assumes the opponent has guessed what it's going to choose, and chooses a move to beat that one accordingly.
Note that I've just adapted the basic...
I've been reading "Head First Java" and some of the early projects surround basic swing and basic MIDI.
So I've put the two together and written a basic "Synthesiser"/"Piano" using what I have learned.
I know that I need to add some safety features and there's probably some method optimisation ...
Is this alright to use this approach to run threads? It gives you the ability to close/terminate the thread instantly even it is running a time consuming synchronous method like WebClient(Download funtions).
public class Processor:MarshalByRefObject
{
private AsyncOperation _operation;
...
@skiwi the JS thing is annoying... someCondition && (foo = bar), yuck
but that's a different operation... == works fine in JS, same as = in SQL
I like the way Lua handles it, someCondition and (foo = bar) is just an invalid expression by itself... can't have expressions floating around that aren't part of statements
Winston's answer points out some improvements to your algorithm. There are other ways in which we can slightly improve the speed of this.
In Objective-C, for loops (and while and do...while) loops are handled one iteration at a time and the exit condition is checked on each iteration of the loo...
I'm not sure how I feel about this comment. For now, I'm simply not replying to it...
all valid points, the task given was to reduce if/else blocks so with your notes taken into consideration is my revision sufficiently executing the same way? — erik5 hours ago
He's asking me if his new code is performing with the same results as his old code.
Which, it does look like it is, but by even commenting on that question, I'd essentially be making his question off-topic... because his code should be working to the best of his knowledge.
If I spotted a non-obvious flaw, I'd point it out sure...
is this a stupid question to post on this question?
what if you have a line of 5 points and a sub-line of 3 points where the first and the last points of the line are not part of the subline? will this program say that the sub-line is not part of the line? — Malachi26 secs ago
You might catch me into going deep into that question when I'm drunk but otherwise there's no way I'll ever be interested enough in such a general question
You can use regex for this using the matches method of the String
sample:
String s = "The wold is big";
if (s.matches("(.*)(is|are|was|were)(.*)")) {
System.out.println("lawl");
}
Objective-C code clean up
This question is asking for a review of a code rewrite.
I feel like the code snippet above "My Review" is irrelevant and potentially distracting. However, the user has included it because, as part of his question, he's asking whether or not his rewrite produces the sa...
Objective-C code clean up
This question is asking for a review of a code rewrite.
I feel like the code snippet above "My Review" is irrelevant and potentially distracting. However, the user has included it because, as part of his question, he's asking whether or not his rewrite produces the sa...
I just read "Is 'guns don't kill people people kill people' a good argument?" and it reminds me of another argument. I would like your opinion on whether or not it is a good argument.
Gun Control is like trying to reduce drunk driving by making it tougher for sober people to own cars.
I don...
This is a programming contest question. Question as follows
Problem Definition
An ISBN (International Standard Book Number) is a ten digit code that
uniquely identifies a book. The first 9 digits are used to represent
the book and the 10th digit is used to ensure that the ISBN is
corre...
Find the union and intersection of linkedlist, given that elements dont repeat in a single linkedlist. This question is attributed to GeeksForGeeks. Looking for code-review, optimizations and best practices.
public class IntersectionAndUnionLinkedList<T> {
private Node<T> first;
private...
It is a bit hard to tell what algo does. For one thing, some of its data members are all public, but they should all be private. There's also quite a bit of inline code, making it hard to read. For this, I'd recommend putting the implementation details in a separate file, and just have declara...
This is from some time ago and I'm not working on it anymore. I actioned much of the style feedback, but some I preferred to leave as before. — alan2hereMar 27 at 19:00
A dollar word is a word for which the sum of the values of the letters adds up to 100 ($1.00).
"a" has a value of 1 and "z" has a value of 26. Special characters such as apostrophes are ignored.
First try looked like:
import string
valMap = {}
for index,item in enumerate(string.lowercase):
...
My Function class is similar to std::function but uses stack allocation instead of heap allocation.
This code uses some features (placement new etc) and it seems rather delicate so hence this review request.
I have one test that causes a segmentation fault with clang++ (see below).
#include <c...
@Mat'sMug you're getting good with string functions and MySQL I assume... perhaps give skiwi's post a try sometime :D
I should have a good answer on it, I tried one thing but it didn't work, now I got a better idea.
Converting an array into a column turned out to be more challenging than expected, it turns out
I thought I'd be able to "SQL inject" the array into an insert into, surprisingly MySQL did not let me inject it. I should try with PHP next time, seems to work good at that :)
I know this is an old post, but it got bumped and I noticed this oddness:
public string Print(int number)
{
if (fizzChecker.IsFizz(number) && buzzChecker.IsBuzz(number))
{
return "FizzBuzz";
}
if (fizzChecker.IsFizz(number))
{
...
Have you worked with VSTO at all? I should probably look into it.
Well it is code.. OP is asking to validate against the pseudo-code, which I guess is off-topic... but given it's answered and the answer says the code is correct, I'd just leave it alone.