« first day (194 days earlier)      last day (2538 days later) » 

12:32 AM
Q: Why does this not work for project euler question 2? (Python)

wioh#Problem 2 P2 = 0 fib= 0 f1 = 1 f2 = 0 debugP2 = [] while fib < 4000000: fib = f1 + f2 f2 = f1 f1 = fib if fib % 2 == 0: P2 += fib debugP2.append(fib) print(debugP2) print(fib) The answer should be fib but it doesn't work for some reason.

1:26 AM
Q: Organizing my javascript using module pattern and not sure if it's ideal.. any input would be appreciated

user2517626So i'm trying to organize the main.js file for a website thats only about 4 pages. When I got on the project there was a bunch of inline javascript all over the place so i managed to get everything into one file but i felt like i was entering callback hell so i opted for a solution and was advise...

1 hour later…
2:52 AM
Q: When is it appropriate to include a picture in an answer?

retailcoderIn spite of this moderator edit, which removed a picture that didn't add anything to the post besides a remotely on-topic caption about strings (the post was about string concatenation, the example with cats; the picture was a cat, with a string. haha...ha.), I promised myself (and the moderator ...

3:27 AM
@retailcoder: always one upping me! dang...lol JK
4:12 AM
Q: using only if -else statements tell me how many days its been since jan 1st

KeithYou will prompt a user for a month, a day and a year. You will then tell the user how many days since January 1 of that year the input date is. For example if the user inputs a 3 for the month, a 2 for the date, and 2000 for the year the program outputs the number of days as being 62. Note 2000 i...

@Malachi well it was a good answer, if you want I can take it back?
4:38 AM
Q: Stdin skipping fgets?

JackMy teacher wrote this, and I'm not sure if it works on her machine. I was supposed to add the line that says stuff = (char*)malloc..., which I believe is correct, but now I'm trying to test to make sure I did this correctly and it keeps skipping fgets despite the fflush. int warmup2(void) { c...

5:25 AM
@Malachi: As a matter of fact, JS was my very first language. And I haven't even taken a formal intro programming class prior to that. However, that was just a basic class and I haven't done anything in JS ever since. I'm not too interested in web development, though I have to be ready to learn anything.
3 hours later…
8:38 AM
Q: Reasonable use of the comma operator?

200_successI've just posted this solution in my review of @adrienlucca's question, which is to read three rows of six tab-separated doubles. #include <fstream> #include <iostream> #include <string.h> #include <vector> struct Sexdoublet { double x, y, d, m, c, t; friend std::istream &operator>>(st...

8:57 AM
Q: Dapper - test code

user1021726I'm comparing a few micro-ORM such as Dapper and a few others and I just want to verify that when they say: Performance of SELECT mapping over 500 iterations - POCO serialization This is what they mean, right? Stopwatch sw = new Stopwatch(); sw.Start(); using (SqlC...

1 hour later…
10:24 AM
Q: draggable one div to three divs with fiddle

zima10101I would like to drag and drop a div with width 60px (ccarcellbook) onto 3 divs with width 20px (ccarcell). Have got basic draggable function so that the big div replaces one of small divs, but dont know how to replace 3 small divs also if I drop "ccarcellbook" onto 3 "ccarcell" the div id return...

Q: Can you please rate my css...?

user2991456I am a total novice to web development, but I am trying to be a WordPress developer and have been actively at it for some weeks now. All self-taught with the world's best tool as my aid: the internet. Anyway, I was hoping that you guys could look at my (no doubt: shoddy) code and tell me what you...

11:17 AM
Q: Why would I want to always have to explicitly call a "base" method if I just want to use base functionality?

JeffI recently worked with an architect who structured his base class like this: public abstract class Base<T> { public abstract T Get(int id); internal T InternalGet(int id, IRepository<T> repository) { // Do more magic return repository.Get(id); } } And then in the...

2 hours later…
1:11 PM
@retailcoder, no thats ok you can leave it. Lol
@Jamal i need to be able to make some awesome websites. I want to make some on the side. And i want to create a browser game
1:23 PM
Q: Trying to find a better way of finding something rather then looping through list from top to bottom.

Maciej CyganI am having a slight issue here, i am trying to think of a faster way of finding two elements from 2 different lists that match. The problem is that if i have lists which both have 1000 elements ( rules ) and the very last one [index.1000] matches then in order to find it i have to loop through b...

1:43 PM
Q: PHP secure file upload example need feedback

Daniel The overall question is: I need feedback on the security of the idea and the script. Do i need to do more in raw code, or is this ok, taking account for my other informations. 1) Lets assume these following first: All images are stored on a subdomain eg. images.example.com The subdomai...

1:56 PM
Q: applicationDidBecomeActive: Am I causing a memory leak?

danin an ios app I´m calling this function everytime the app gets opened in the applicationDidBecomeActive: function. I´m using ARC. My concern is it could create a memory leak because it´s creating new instances of UIViewControllers every time the app gets opened from the background. - (void)showM...

1 hour later…
3:15 PM
Q: Dougles Crockford's alternative to using new in JavaScript

HMRI think he has some good insights but don't understand him at all when he starts about constructor functions. The following video for example: At At 0:50:25 some of his quotes about constructor function inheritance: This was the inheritance schema that was designed for the language ... I d...

1 hour later…
4:22 PM
Q: Is the name [test] okay for this tag?

JamalThe test tag was created very recently, and is so far tagged with one question: Dapper - test code Based on the title alone, well... the code within is meant to be test code. However, I feel the tag name is a bit ambiguous. Could the name also refer to unit-testing? What about the process of...

Q: A simple javascript plugin architecture

Mike RifginI've implemented the following code which allows me to bolt modules of code on to my core library via the prototype chain. It'q quite prescriptive so any user creating a module has to create an init method and also has to define a queue method: (working fiddle: http://jsfiddle.net/wG9Pv/) //Con...

4:49 PM
Q: How to implement request-accept feature in Rails?

regedarekI have 20 doctors. Logic which I want to implement: Each one of them sees calendar when can choose 3 shifts per month. When Admin lock a month doctor can trade his shift with another doctor. When he click Trade trigger send_request action which should send trade request to all other doctors wi...

5:15 PM
Q: C strings and character input, comparison

BojanI am learning c programing, for exercise I found a task to solve. It is something like a game hanging where someone chooses a word and other person guess letters. I have to check how many given words could be a correct answer to the choosen word. Input: 3 3 // numbers n and m n-number of words ...

6:08 PM
Q: Thread safe enqueue and dequeue method in Queue

KinjalAs an exercise, I have implemented a linked queue whose enqueue and dequeue methods are synchronized. There is a Producer thread which keeps inserting elements into the queue as long as there are less than 10 items in it. When the queue is full, the thread waits. The second thread Consumer keep r...

6:21 PM
Q: Advanced Calculator Kata

user341493This is the CalculatorAdvanced Kata from the Kata gem. I've just finished it and would love some feedback on my solution. Thanks! CalculatorAdvanced Kata Add Method Allow the expression to handle new lines between numbers - example: "1\n2\n3" computes to 6 - example: "...

Q: Function not running fully

MonsieurPoivronI'm doing the codeacademy tutorial in which you make a simple Battleship game. I have a function called "ask_input()" which asks the user to guess a column and row in which the target battleship could be. It seems that this function does not run entirely, since the "guess_col" and "guess_row" va...

6:47 PM
Q: My Redundant google api is Redundant

user2524908Im a mediocre programer at best, and pretty terrible at javascript. But I have been tasked to create a google maps application. This application is driven by a dynamic report with a java layer on top of it, this java layer spits out generated google api javascript. The problem I am running into...

1 hour later…
8:08 PM
Q: Backbone subviews with non-uniform layout

VLSI have a “featured projects” view that requires its subviews conform to a non-uniform grid: one narrow column with 3 items, then one wide column with 2 items, followed by another narrow column with 3 items. The width that is used for each subview is determined by the model’s display attribute. If...

1 hour later…
9:13 PM
Q: Python loop — help!

user32152this is the code that i have so far: i for range(10) j for range(10+i,end) print(j,end="") 10 11,12 13,14,15 16,17,18,19 20,21,22,23,24 25,26,27,28,29,30 31,32,33,34,35,36,37 38,39,40,41,42,43,44,45 46,47,48,49,50,51,52,53,54 that is what im trying to create and im stuck and am unsur...

2 hours later…
11:06 PM
Q: converting std::string to int without Boost

marcpI'm trying to convert a std::string to integer with a default value if the conversion fails. C's atoi is way too forgiving and I've found that boost::lexical_cast is quite slow in the case where the cast fails. Its because an exception is raised I imagine. I don't have c++11, so stoi is out. The...

11:26 PM
Q: Is there any way to make this program run faster?

AlexHow can i make this program running faster? On enter i have string from console. for example "1 1 7 3 2 0 0 4 5 5 6 2 1" and on exit will be "6 20". Do you can read code and exchange my methods and function on something, that just will run faster... import java.io.BufferedReader; import java...


« first day (194 days earlier)      last day (2538 days later) »