# Search Results

• ### C++ Euler-Problem 14 Program Freezing

##### - by Tim
I'm working on Euler Problem 14: http://projecteuler.net/index.php?section=problems&id=14 I figured the best way would be to create a vector of numbers that kept track of how big the series was for that number... for example from 5 there are 6 steps to 1, so if ever reach the number 5 in a series, I know I have 6 steps to go and I have no need to calculate those steps. With this idea I coded up the following: #include <iostream> #include <vector> #include <iomanip> using namespace std; int main() { vector<int> sizes(1); sizes.push_back(1); sizes.push_back(2); int series, largest = 0, j; for (int i = 3; i <= 1000000; i++) { series = 0; j = i; while (j > (sizes.size()-1)) { if (j%2) { j=(3*j+1)/2; series+=2; } else { j=j/2; series++; } } series+=sizes[j]; sizes.push_back(series); if (series>largest) largest=series; cout << setw(7) << right << i << "::" << setw(5) << right << series << endl; } cout << largest << endl; return 0; } It seems to work relatively well for smaller numbers but this specific program stalls at the number 113382. Can anyone explain to me how I would go about figuring out why it freezes at this number? Is there some way I could modify my algorithim to be better? I realize that I am creating duplicates with the current way I'm doing it: for example, the series of 3 is 3,10,5,16,8,4,2,1. So I already figured out the sizes for 10,5,16,8,4,2,1 but I will duplicate those solutions later. Thanks for your help!

• ### Beginning with first project on game development [closed]

##### - by Tsvetan
Today is the day I am going to start my first real game project. It will be a Universe simulator. Basically, you can build anything from tiny meteor to quazars and universes. It is going to be my project for an olympiad in IT in my country and I really want to make it perfect(at least a bronze medal). So, I would like to ask some questions about organization and development methodologies. Firstly, my plan is to make a time schedule. In it I would write my plans for the next month or two(because that is the time I have). With this exact plan I hope to make my organisation at its best. Of course, if I am doing sth faster than the schedule I would involve more features for the game and/or continue with the tempo I have. Also, for the organisation I would make a basic pseudocode(maybe) and just rewrite it so it is compilable. Like a basic skeleton of everything. The last is an idea I tought of in the moment, but if it is good I will use it. Secondly, for the development methodologies, obviously, I think of making object-oriented code and make everything perfect(a lot of testing, good code, documentation etc.). Also, I am going to make my own menu system(I read that OpenGL hasn't got very good one). Maybe I would implement it with an xml file, holding the info about position of buttons, text boxes, images and everything. Maybe I would do a specific CSS for it and so on. I think that is very good way of doing the menu system, because it makes the presentation layer separate of the logic. But, if there is a better way, I would do it the better way. For the logic, well, I don't have much to say. OO code, testing, debuging, good and fast algorithms and so on. Also, a good documentation must be written and this is the area I need to make some research in. I think that is for now. I hope I have been enough descriptive. If more questions come on my mind, I will ask them. Edit: I think of blogging every part of the project, or at least writing down everything in a file or something like that. My question is: Is my plan of how to do everything around the project good? And if not, what is necessary to be improved and what other things I can involve for making the project good.

• ### How to motivate as a project leader?

##### - by Zenzen
Ok so some of you might think this is not stackoverflow related, but since I got a similar question during an interview (for a J2EE dev position) I think you guys will help me in the end. The situation is simple: you're working on a project in a small group (4-5 people), you're the project leader and the guy who's the most competent (technology wise) is also slacking the most. What do you do to motivate him? The problem is, I'm having the same issue at the university - this semester we have a lot of projects going on (6 to be exact) so we decided to dived the work so everyone will do 1-2 projects in a technology he knows/wants to learn. It's been working well for the most part, the problem is the person whom we thought would finish his project way before us as he's the most experienced among us. How am I supposed to make him do his share properly? Till now he was just half assing his part by doing the bare minimum, with which the professor wasn't really pleased to say the least... Now it's only a university project, but in the future I might have the same problem in a real job and losing a really smart and experienced worker (as firing him is the only solution I can come up with now) would really be a waste. Aren't there any better ways? p.s. now that I think about it, are there any books that would help me in becoming a better project manager?

• ### What are you doing during project gaps?

##### - by Artic
What are you doing during project gaps?

• ### Distributed Development Tools -- (Version control and Project Management)

##### - by Macy Abbey
Hello, I've recently become responsible for choosing which source control and project management software to use for a company that employs me. Currently it uses Jira (project management) and Subversion (version control). I know there are many other options out there -- the ones I know about are all in this article http://mashable.com/2010/07/14/distributed-developer-teams/ . I'm leaning towards recommending they just stay with what they have as it seems workable and any change would have to be worth the cost of switching to say github/basecamp or some other solution. Some details on the team: It's a distributed development shop. Meetings of the whole team in one room are rare. It's currently a very small development team (three developers). The project management software is used by developers and a product manager or two. What are you experiences with version control and project management web applications? Are there any you would recommend and you think are worth the switching cost of time to learn new services / implementing the change? Edit: After educating myself further on the options it appears DVCS offer powerful benefits that may be worth investing in now as opposed to later in the company's lifetime when the switching cost is higher: I'm a Subversion geek, why I should consider or not consider Mercurial or Git or any other DVCS?

• ### Are project managers useful in Scrum?

##### - by Martin Wickman
There are three roles defined in Scrum: Team, Product Owner and Scrum Master. There is no project manager, instead the project manager job is spread across the three roles. For instance: The Scrum Master: Responsible for the process. Removes impediments. The Product Owner: Manages and prioritizes the list of work to be done to maximize ROI. Represents all interested parties (customers, stakeholders). The Team: Self manage its work by estimating and distributing it among themselves. Responsible for meeting their own commitments. So in Scrum, there is no longer a single person responsible for project success. There is no command-and-control structure in place. That seems to baffle a lot of people, specifically those not used to agile methods, and of course, PM's. I'm really interested in this and what your experiences are, as I think this is one of the things that can make or break a Scrum implementation. Do you agree with Scrum that a project manager is not needed? Do you think such a role is still required? Why?

• ### Are project managers useful in Scrum?

##### - by Martin Wickman
There are three roles defined in Scrum: Team, Product Owner and Scrum Master. There is no project manager, instead the project manager job is spread across the three roles. For instance: The Scrum Master: Responsible for the process. Removes impediments. The Product Owner: Manages and prioritizes the list of work to be done to maximize ROI. Represents all interested parties (customers, stakeholders). The Team: Self manage its work by estimating and distributing it among themselves. Responsible for meeting their own commitments. So in Scrum, there is no longer a single person responsible for project success. There is no command-and-control structure in place. That seems to baffle a lot of people, specifically those not used to agile methods, and of course, PM's. I'm really interested in this and what your experiences are, as I think this is one of the things that can make or break a Scrum implementation. Do you agree with Scrum that a project manager is not needed? Do you think such a role is still required? Why?

• ### Distributed Development Tools -- (Version control and Project Management)

##### - by Macy Abbey
I've recently become responsible for choosing which source control and project management software to use for a company that employs me. Currently it uses Jira (project management) and Subversion (version control). I know there are many other options out there -- the ones I know about are all in this article http://mashable.com/2010/07/14/distributed-developer-teams/ . I'm leaning towards recommending they just stay with what they have as it seems workable and any change would have to be worth the cost of switching to say github/basecamp or some other solution. Some details on the team: It's a distributed development shop. Meetings of the whole team in one room are rare. It's currently a very small development team (three developers). The project management software is used by developers and a product manager or two. What are you experiences with version control and project management web applications? Are there any you would recommend and you think are worth the switching cost of time to learn new services / implementing the change? Edit: After educating myself further on the options it appears DVCS offer powerful benefits that may be worth investing in now as opposed to later in the company's lifetime when the switching cost is higher: I'm a Subversion geek, why I should consider or not consider Mercurial or Git or any other DVCS?

• ### How to properly structure a project in winform?

##### - by user850010
A while ago I started to create a winform application and at that time it was small and I did not give any thought of how to structure the project. Since then I added additional features as I needed and the project folder is getting bigger and bigger and now I think it is time to structure the project in some way, but I am not sure what is the proper way, so I have few questions. How to properly restructure the project folder? At the moment I am thinking of something like this: Create Folder for Forms Create Folder for Utility classes Create Folder for Classes that contain only data What is the naming convention when adding classes? Should I also rename classes so that their functionality can be identified by just looking at their name? For example renaming all forms classes, so that their name ends with Form. Or is this not necessary if special folders for them are created? What to do, so that not all the code for main form ends up in Form1.cs Another problem I encountered is that as the main form is getting more massive with each feature I add, the code file (Form1.cs) is getting really big. I have for example a TabControl and each tab has bunch of controls and all the code ended up in Form1.cs. How to avoid this? Also, Do you know any articles or books that deal with these problems?

• ### MS Grad Student Project

##### - by Bernie Perez
I'm a computer science grad student at UCLA specializing in security and/or mobile devices. I'm looking for ideas for my M.S. Project. Something with research and experimenting or testing. I have a few in mind, just wondering if the community has some good thoughts. I'm currently working on a project that deals with offload security related operations to a grid-powered/cloud server to improve battery life on phones or tablets, aka Security-Aware software on mobile devices. I might be able to expand on this for my project... but I'm open to any new types of ideas. I have another idea about secure communications with a peer-2-peer ad-hoc network, but its seems a little dull. Hope this questions is not off topic for this StackExchange. I look forward to hearing your thoughts and ideas.

• ### Getting overwhelmed after starting a new project

##### - by Kian Mayne
I started a project (a Windows based timetable program that helps you stay organised with your subjects and assignments). The problem is that I'm not sure how I should manage this project and what order to build things. I.e. Should I build all the different interface elements then write the code or should I make an interface, code it, make another interface then code that? So my question is; how do I split up this longish project into small, ordered pieces to complete; and how should I order this?

• ### What makes for the ideal project? [closed]

##### - by Hans Westerbeek
I try to be careful when accepting assignments, to avoid mutual disappointment. So, I started to come up with a list of things that I consider ingredients for The Ideal Project: (in no particular order) What did I miss? What did I get wrong? Team size < 6 persons to avoid having too many meetings Team members must be dedicated to the project Gut-feeling-estimate (made by developers) of running period does not exceed 4 months. Projects longer than that tend to become open-ended, and are therefore not projects. Has a Product Owner who has mandate and is well-respected at their own company and who has a real interest in the long-term success of the project. Has no technical involvement from people that are not on the team. (yes that's you, Mr Architect That Doesn't Code) All the usual about quiet working conditions Exciting subject matter. Content management is just not as cool as controlling robots :)

• ### Community to discuss project ideas

##### - by Auxiliary
Although I already predict the down votes but the question has stuck in my throat for a while now. I think this has happened to many of us. Sometimes we find a great idea for a project and obviously think this is THE GREATEST idea ever but then one of the following things will happen: The project is a small one, so you might actually give it a try and see how it goes. The project is a big one, even a risk, and you just need a good programmer's community that you could just discuss your idea with them and see what they say and even get some help to make it happen. And there's always the possibility of others stealing your idea which is really bad. So could anyone suggest an online community or place or even method of talking about ideas and the ways of developing them? and do you think it's a good thing to tell others about your idea?

• ### Letting go of a project

##### - by SkyOrg
I've been the sole developer of a niche product for my company for nearly 6 years. I've grown quite attached to the project and I enjoy working on it. However, it was the decision of management to take the project out of my hands and move it under the wings of another team. Unfortunately, I'm having a hard time letting go of the project. I'm sad to see it leave my hands since I've put so much time into it and enjoyed working on it, but it also allows me to work on new things. I've even caught myself being a bit hostile to the other team, which is poor on my part. How can I convince myself to just let it go?

• ### Android Application for Final Year Project [closed]

##### - by user1070241
I hope this is the right place to post this question. Basically, I'm about to choose a Final Year Project for my third and final year in BSc Computer Science. I have worked with different apps and therefore I do have some experience with the Android SDK Platform in general. However, my question is this, how do you think an Android based project would go down with potential employers? I personally don't think the complexity of this project is lower than other projects proposed by my university. Please let me know what you think, and do share any experiences that you have had with this, if any. Thank you very much.

• ### How do I start a personal programming project?

##### - by Pureferret
I've just started a programming job where I'm applying my 'How to code' knowledge to what I'm being taught of 'How to Program' (They are different!). As well of this I'm taught how to capture requirements from clients, so as to start a new project. How do I do this for a nebulous personal project? I say nebulous, as I often find halfway through programming something, I want to expand what my program will do, or alter the result. Eventually I'm tangled in code, and have to restart. This can be frustrating and off putting. Conversely when given a fixed task, and fixed requirements, it's much easier to programme from a - b. So how do I plan a personal programming project?

• ### Project Euler #18 - how to brute force all possible paths in tree-like structure using Python?

##### - by euler user
Am trying to learn Python the Atlantic way and am stuck on Project Euler #18. All of the stuff I can find on the web (and there's a LOT more googling that happened beyond that) is some variation on 'well you COULD brute force it, but here's a more elegant solution'... I get it, I totally do. There are really neat solutions out there, and I look forward to the day where the phrase 'acyclic graph' conjures up something more than a hazy, 1 megapixel resolution in my head. But I need to walk before I run here, see the state, and toy around with the brute force answer. So, question: how do I generate (enumerate?) all valid paths for the triangle in Project Euler #18 and store them in an appropriate python data structure? (A list of lists is my initial inclination?). I don't want the answer - I want to know how to brute force all the paths and store them into a data structure. Here's what I've got. I'm definitely looping over the data set wrong. The desired behavior would be to go 'depth first(?)' rather than just looping over each row ineffectually.. I read ch. 3 of Norvig's book but couldn't translate the psuedo-code. Tried reading over the AIMA python library for ch. 3 but it makes too many leaps. triangle = [ [75], [95, 64], [17, 47, 82], [18, 35, 87, 10], [20, 4, 82, 47, 65], [19, 1, 23, 75, 3, 34], [88, 2, 77, 73, 7, 63, 67], [99, 65, 4, 28, 6, 16, 70, 92], [41, 41, 26, 56, 83, 40, 80, 70, 33], [41, 48, 72, 33, 47, 32, 37, 16, 94, 29], [53, 71, 44, 65, 25, 43, 91, 52, 97, 51, 14], [70, 11, 33, 28, 77, 73, 17, 78, 39, 68, 17, 57], [91, 71, 52, 38, 17, 14, 91, 43, 58, 50, 27, 29, 48], [63, 66, 4, 68, 89, 53, 67, 30, 73, 16, 69, 87, 40, 31], [04, 62, 98, 27, 23, 9, 70, 98, 73, 93, 38, 53, 60, 4, 23], ] def expand_node(r, c): return [[r+1,c+0],[r+1,c+1]] all_paths = [] my_path = [] for i in xrange(0, len(triangle)): for j in xrange(0, len(triangle[i])): print 'row ', i, ' and col ', j, ' value is ', triangle[i][j] ??my_path = somehow chain these together??? if my_path not in all_paths all_paths.append(my_path) Answers that avoid external libraries (like itertools) preferred.

• ### Project euler problem 45

##### - by Peter
Hi, I'm not yet a skilled programmer but I thought this was an interesting problem and I thought I'd give it a go. Triangle, pentagonal, and hexagonal numbers are generated by the following formulae: Triangle T_(n)=n(n+1)/2 1, 3, 6, 10, 15, ... Pentagonal P_(n)=n(3n-1)/2 1, 5, 12, 22, 35, ... Hexagonal H_(n)=n(2n-1) 1, 6, 15, 28, 45, ... It can be verified that T_(285) = P_(165) = H_(143) = 40755. Find the next triangle number that is also pentagonal and hexagonal. Is the task description. I know that Hexagonal numbers are a subset of triangle numbers which means that you only have to find a number where Hn=Pn. But I can't seem to get my code to work. I only know java language which is why I'm having trouble finding a solution on the net womewhere. Anyway hope someone can help. Here's my code public class NextNumber { public NextNumber() { next(); } public void next() { int n = 144; int i = 165; int p = i * (3 * i - 1) / 2; int h = n * (2 * n - 1); while(p!=h) { n++; h = n * (2 * n - 1); if (h == p) { System.out.println("the next triangular number is" + h); } else { while (h > p) { i++; p = i * (3 * i - 1) / 2; } if (h == p) { System.out.println("the next triangular number is" + h); break; } else if (p > h) { System.out.println("bummer"); } } } } } I realize it's probably a very slow and ineffecient code but that doesn't concern me much at this point I only care about finding the next number even if it would take my computer years :) . Peter

• ### Project Euler Problem #11

##### - by SoulBeaver
Source: http://projecteuler.net/index.php?section=problems&id=11 Quick overview: Take a 20x20 grid of numbers and compute the largest product of 4 pairs of numbers in either horizontal, vertical, or diagonal. My current approach is to divide the 20x20 grid up into single rows and single columns and go from there with a much more manageable grid. The code I'm using to divide the rows into rows is void fillRows ( string::const_iterator& fieldIter, list<int>& rowElements, vector<list<int>>& rows ) { int count(0); for( ; fieldIter < field.end(); ++fieldIter ) { if(isdigit(field[*fieldIter])) { rowElements.push_back(toInt(field[*fieldIter])); ++count; } if(count == 40) { rows.push_back(rowElements); count = 0; rowElements.clear(); } } } Short explanation: I have the field set as static const std::string field and I am filling a vector with lists of rows. Why a list? Because the queue doesn't have a clear function. Also practice using STL container lists and not ones I write myself. However, this thing isn't working. Oftentimes I see it omitting a character( function toInt parses the const char as int ) and I end up with 18 rows, two rows short of the 20x20 grid. The length of the rows seem good. Rows: 18 RowElements[0]: 40 (instead of pairs I saved each number individually. Will fix that later) What am I doing wrong?

• ### Project Euler #9 (Pythagorean triplets) in Clojure

##### - by dbyrne
My answer to this problem feels too much like these solutions in C. Does anyone have any advice to make this more lispy? (use 'clojure.test) (:import 'java.lang.Math) (with-test (defn find-triplet-product ([target] (find-triplet-product 1 1 target)) ([a b target] (let [c (Math/sqrt (+ (* a a) (* b b)))] (let [sum (+ a b c)] (cond (> a target) "ERROR" (= sum target) (reduce * (list a b (int c))) (> sum target) (recur (inc a) 1 target) (< sum target) (recur a (inc b) target)))))) (is (= (find-triplet-product 1000) 31875000)))

• ### Project Euler, Problem 10 java solution not working

##### - by Dennis S
Hi, I'm trying to find the sum of the prime numbers < 2'000'000. This is my solution in java but I can't seem get the correct answer. Please give some input on what could be wrong and general advice on the code is appreciated. Printing 'sum' gives: 1308111344, which is incorrect. /* The sum of the primes below 10 is 2 + 3 + 5 + 7 = 17. Find the sum of all the primes below two million. */ class Helper{ public void run(){ Integer sum = 0; for(int i = 2; i < 2000000; i++){ if(isPrime(i)) sum += i; } System.out.println(sum); } private boolean isPrime(int nr){ if(nr == 2) return true; else if(nr == 1) return false; if(nr % 2 == 0) return false; for(int i = 3; i < Math.sqrt(nr); i += 2){ if(nr % i == 0) return false; } return true; } } class Problem{ public static void main(String[] args){ Helper p = new Helper(); p.run(); } }

• ### Project Euler, Problem 10 java solution now working

##### - by Dennis S
Hi, I'm trying to find the sum of the prime numbers < 2'000'000. This is my solution in java but I can't seem get the correct answer. Please give some input on what could be wrong and general advice on the code is appreciated. Printing 'sum' gives: 1308111344, which is incorrect. /* The sum of the primes below 10 is 2 + 3 + 5 + 7 = 17. Find the sum of all the primes below two million. */ class Helper{ public void run(){ Integer sum = 0; for(int i = 2; i < 2000000; i++){ if(isPrime(i)) sum += i; } System.out.println(sum); } private boolean isPrime(int nr){ if(nr == 2) return true; else if(nr == 1) return false; if(nr % 2 == 0) return false; for(int i = 3; i < Math.sqrt(nr); i += 2){ if(nr % i == 0) return false; } return true; } } class Problem{ public static void main(String[] args){ Helper p = new Helper(); p.run(); } }

• ### Project Euler 9 Understanding

##### - by DMan
This question states: A Pythagorean triplet is a set of three natural numbers, a b c, for which, a2 + b2 = c2 For example, 32 + 42 = 9 + 16 = 25 = 52. There exists exactly one Pythagorean triplet for which a + b + c = 1000. Find the product abc. I'm not sure what's it trying to ask you. Are we trying to find a^2+b^2=c^2 and then plug those numbers into a+b+c=1000?