title: What is the right way to group this project into classes?

text: I originally asked this on SO, where it was closed and recommended that I ask it here instead. I'm trying to figure out how to group all the functions necessary for my project into classes. The goal of the project is to execute the following process:   1. Get the user's FTP credentials (username & password).   2. Check to make sure the credentials establish a valid connection to the FTP server.   3. Query several Sharepoint lists and join the results of those queries to create a list of items that need to have action taken on them.   4. Each item in the list has a folder. For each item:      * Zip the contents of the folder.     * Upload the folder to the FTP server using SFTP     * Update the item's Sharepoint data.   5. Email the user an Excel report showing, e.g.,      * Items without folder paths     * Items that failed to zip or upload Steps 2-5 are performed on a periodic basis; if step 2 returns an invalid connection, the user is alerted and the process returns to step 1. If at any point the user presses a certain key, the process terminates. I've defined the following set of classes, each of which is in its own .cs file: `SFTP`: file transfer processes `DataHandler`: Sharepoint data retrieval/querying/updating processes. Also makes and uploads the zip files. `Exceptions`: Not just one class, this is the .cs file where I have all of my exception classes. `Report`: Builds and sends the report. `Program`: The main class for running the program. I recognize that the DataHandler class is a god object, but I don't have a good idea of how to refactor it. I feel like it should be more fine-grained than just breaking it into Sharepoint, Zip, and Upload, but maybe that's it. Also, I haven't yet worked out how to combine the periodic behavior with the "wait for user input at any point in the process" part; I think that involves threads, which means other classes to manage the threads... I'm not that well-versed in design patterns, but is there one that fits this project well? If this is too big of a topic to neatly explain in an SO answer, I'll also accept a link to a good tutorial on what I'm trying to do here.


title: Branch per feature: What are the actual benefits (and risks)?

text: I've read quite a lot of posts lately about different branching strategies (e.g a lot of links from To branch or not to branch?), and while almost every article explains on how to do this or that strategy they rarely explain the why. Currently our team is investigating whether or not to switch to "feature branches". We're currently using a "everyone commits to trunk" model and we have release branches, which we use to do hotfixes to previous releases. All in all, this model has worked very well in the past. So actually I'd say - if it ain't broken, don't fix it. However, there might be a point that I'm missing, so I'd like to ask: What are actual tangible benefits of using a feature branch strategy over "everyone commits to trunk"? What are the drawbacks of feature branches in your experience?


title: What can I do to keep my skills sharp without the internet?

text: This probably sounds like a funny question from the graybeards out there, but I seriously don't know what I'm supposed to do without the Google to offer help. Long story short, I'm planning on being pulled away for a deployment overseas. Things I can expect from this:   * lots of downtime   * effectively no internet   * probably electricity I will be bringing a laptop with me, but I'm making an assumption that what little internet access I do have will probably be spent talking to my kids and family via Skype and IM. To add to that, the internet overseas is controlled tightly, so no USB sticks, external HD, or connecting my laptop up. What I can see on the screen will be probably all I can take away from it (when or if I have it at all). * * * I'm looking for ideas on things I can download on my laptop for a lengthy time away from the internet. I'm not too concerned which platform, language, or kit I download, since I will have alot of time to get proficient at anything. I really just want a fairly self-contained, well-documented and rich environment that I could download the whole thing and not feel the internet is even necessary to code in it. Am I asking too much in this always-on Internet connected world?


title: How do you learn to take a more OO approach to problems?

text: I have been learning C# and am trying to tackle some common projects / works of my own to become even better. Currently I am working on understanding the Mars Rover Problem. I read the description and have seen several solutions, they seem nice and follow the principles of OO design.   * How do you come to understand what classes you need to make for a project?   * Is there a book I can read to grasp the concept of OO design better? I understand in theory, but I just don't get how and what I would do when actually given a problem. For instance I see the Mars Rover problem and instantly in my head I think Ok I can get that done with just 3 classes, a Rover, Grid and a CommandCenter class. Then I look at online examples and there are a lot more classes, interfaces and overall breakdown.


title: Learning good OOP design and unlearning some bad habits

text: > **Possible Duplicate:**   >  What books or resources would you recommend to learn practical OO design > and development concepts? I have been mostly a C programmer so far in my career with knowledge of C++. I rely on C++ mostly for the convenience STL provides and I hardly ever focus on good design practices. As I have started to look for a new job position, this bad habit of mine has come back to haunt me. During the interviews, I have been asked to design a problem (like chess, or some other scenario) using OOP and I doing really badly at that (I came to know this through feedback from one interview). I tried to google stuff and came up with so many opinions and related books that I don't know where to begin. I need a good through introduction to OOP design with which I can learn practical design, not just theory. Can you point me to any book which meets my requirements? I prefer C++, but any other language is fine as long as I can pick-up good practices. Also, I know that books can only go so far. I would also appreciate any good practice project ideas that helped you learn and improve your OOP concepts.


title: Local Stack vs Call Stack

text: On the matter of Recursion: When you create a recursive function, you create a call stack. Ok, no problem; However, a comment on this page (look for comments by "LKM") triggered my curiosity (and google was no help):   * What is a local stack?   * Why would it be faster than a call stack?   * How would you actually implement it (pseudo-code, js/php/ruby/python are ok)? Subsidiary question (might deserve another question, but I don't know on which (.*\\.)?stack.*\\.com to ask): In these conversations about programming, I often see the "recursion" theme and how bad/newbie programmers don't grok it. I'm self-taught, and I never understood what the big fuss is all about. I use recursion a lot in my everyday coding, both for solving problems and sometimes just because I think they are beautiful. But these articles make me feel like maybe there is something there I just don't see. So:   * What's all the fuss about recursion? What's there not to grok?


title: Many small scripts, one repository or multiple?

text: A co-worker and myself have run into an issue that we have multiple opinions on. Currently we have a git repository that we are keeping all of our cronjobs in. There are about 20 crons and they are not really related except for the fact that they are all small python scripts and essential for some activity. We are using a `fabric.py` file to deploy and a `requirements.txt` file to manage requirements for all of the scripts. Our issue is basically, do we keep all of these scripts in one git repository or should we be separating them out into their own repositories? By keeping them in one repository it is easier to deploy them onto one server. We can use just one cron file for all the scripts. However this feels wrong, as the 20 cronjobs are not logically related. Additionally, when using one `requirements.txt` file for all the scripts, it's hard to figure out what the dependencies are for a particular script and they all have to use the same versions of packages. We could separate all of the scripts out into their own repositories but this creates 20 different repositories that need to be remembered and dealt with. Most of these scripts are not very large and that solution seems to be overkill. A related question is, do we use one big crontab file for all cronjobs, or a separate file for each? If each has their own, how does one crontab's installation avoid overwriting the other 19? This also seems like a pain as there would then by 20 different cron files to keep track of. In short, our main question and issue is do we keep them all closely bundled as one repository or do we separate them out into their own repository with their own requirements.txt and fabfile.py? We feel like we're also probably looking over some really simple solution. Is there an easier way to deal with this issue?


title: Month long creative challenges for programmers?

text: Does anybody know of any one month creative challenges for programmers, sort of like National Novel Writing Month (NaNoWriMonth) but for programmers. One month in which you must create something, not just a series of challenges for you to overcome, or problems for you to solve. Something like: National Website Building Month (NaWebBuMo), or National Game Building Month (NaGaBuMo), but real instead of fabrications spun from my mind? I'm looking for something that asks that you have a (relatively) finished product at the end of thirty days.


title: Distance Education in Computer Science - HCI

text: I have been a software engineer / graphic designer for a few years and have recently been considering furthering my education in the field. (It was actually a very generous Christmas present) I would primarily be interested in something like Human Computer Interaction or a similar "creative technology" that involves heavy UI/UX Design, prototyping or Information Architecture. Anyways - I still plan on working full-time and was looking into part-time distance programs and was wondering if anyone had some experience with pursuing a similar degree (either from a distance or in-person) and could share their experiences. Thanks!


title: Writing Tests for Existing Code

text: Suppose one had a relatively large program (say 900k SLOC in C#), all commented/documented thoroughly, well organized and working well. The entire code base was written by a single senior developer who no longer with the company. All the code is testable as is and IoC is used throughout--except for some strange reason they did not write any unit tests. Now, your company wants to branch the code and wants unit tests added to detect when changes break the core functionality.   * Is adding tests a good idea?   * If so, how would one even start on something like this? **EDIT** OK, so I had not expected answers making good arguments for opposite conclusions. The issue may be out of my hands anyway. I've read through the "duplicate questions" as well and the general consensus is that "writing tests is good"...yeah, but not too helpful in this particular case. I don't think I am alone here in contemplating writing tests for a legacy system. I'm going to keep metrics on how much time is spent and how many times the new tests catch problems (and how many times they don't). I'll come back and update this a year or so from now with my results. **CONCLUSION** So it turns out that it is basically impossible to just add unit test to existing code with any semblance of orthodoxy. Once the code is working you obviously cannot red-light/green-light your tests, it usually not clear which behaviors are important to test, not clear where to begin and certainly not clear when you are finished. Really even asking this question misses the main point of writing tests in the first place. In the majority of cases I found it actually easier to re-write the code using TDD than to decipher the intended functions and retroactively add in unit tests. When fixing a problem or adding a new feature it is a different story, and I believe that this is the time to add unit tests (as some pointed out below). Eventually most code gets rewritten, often sooner than you'd expect--taking this approach I've been able to add test coverage to a surprisingly large chunk of the existing codebase.


title: How do you learn to program?

text: > **Possible Duplicates:**   >  I still can't figure out how to program?   >  I'm graduating with a Computer Science degree but I don't feel like I know > how to program I don't known if you guys have super brains specifically for programming but I would like to know how you do manage to learn, understand and apply Java programming. I am in grade 11 and we have learnt statements, objects, classes and arrays. We get programming test each week and I'm failing them. Now we have a project to do BlackJack using a JPanel form. Also memorizing the while loop is not the problem; I think that the problem is applying it to the situation (my friend never programs the same way as the teacher but still gets the same results).


title: Is it necessary to map integers to bits in a genetic algorithm?

text: From what I've read, genetic algorithms are usually (always?) applied to chromosomes of bits. So if a problem involves maximizing a function that takes integer values, the integers are first encoded as bits. Is this mapping necessary? It seems that you could take chromosomes of integers and apply crossover and mutation directly. So, if I have a function that takes 35 integer inputs, I can just apply the genetic operators to those integers, rather than on the 35xB bits (where B is the number of bits needed to encode an integer). Is there a reason this isn't done? Perhaps the algorithm would suffer because the problem is defined more coarsely (that is, a problem can be defined with shorter chromosomes if we're not using bits), but I'm curious if anyone has a better answer.


title: Is there a license where all rights are granted?

text: The licenses I know, including open source and the less restrictive ones like BSD, make it mandatory to:   * Retain the copyright notice, and/or:   * Indicate that the precise part of source code was written by the original author. Let's say I want to share source code I've written and I want to grant all rights, including the right to:   * Remove the copyright notice or substitute another one,   * Sell the source code or use it in a commercial product with no restrictions,   * Never indicate that this source code was written by me¹, but at the same time disclaim any warranty as it is the case in BSD license. Are there licenses which match this case? Note: public domain is not a solution, since the term is unclear and change from one country to another. * * * ¹ Why would anyone do that? Because we all have pieces of code which are not worth real licensing, but still useful for the community (example: removing diacritics from a text). Providing it "completely free" is in this case much for friendly that saying that in order to use your code, the person must read a few paragraphs or pages of an UNREADABLE ALL CAPITAL text, understand it, accept it, and then copy-paste your name and copyright notice every time the code is used.


title: Switch to Java?

text: I have been doing .NET and MS tech/arcitecture for 4+ years. I have reached a dead end in my current job and is considering moving to a new job. Most of the current available jobs in my city are Java based. J2EE and the like. Is it wise to leave all those years of experience and start from scratch in the Java world?


title: Possibility to switch over to Java from .Net

text: I am an MCA fresher and will be working on dot Net for next few months (almost 10-12 months). After that I want to switch over to Java. How is the possibility that I can switch over to it? What type of preparation I am supposed to do? I am also planning to appear for SCJP but don't have any knowledge how to get registered an registration fees. Please also guide me what is company's approach towards the candidates switching their technologies. What are the things that companies look for?


title: Planning Poker and wordy developers

text: My team is composed of 4 developers; all seasoned and skilled. One of them is a wordy, well intended chap who insists on defining the technical solution to our stories before we put down our estimates with Planning Poker. He refuses to estimate if he doesn't have a rough idea of the agreed technical solution (which sounds reasonable, right?). The problem is that our estimating sessions are taking forever to finish!! In your experience, how do you deal with this kind of personality when playing the planning poker?


title: How should I implement Transaction database EJB 3.0

text: In the CustomerTransactions entity, I have the following field to record what the customer bought:               @ManyToMany     private List<Item> listOfItemsBought;      When I think more about this field, there's a chance it may not work because merchants are allowed to change item's information (e.g. price, discount, etc...). Hence, this field will not be able to record what the customer actually bought when the transaction occurred. At the moment, I can only think of 2 ways to make it work.   1. I will record the transaction details into a String field. I feel that this way would be messy if I need to extract some information about the transaction later on.   2. Whenever the merchant changes an item's information, I will not update directly to that item's fields. Instead, I will create another new item with all the new information and keep the old item untouched. I feel that this way is better because I can easily extract information about the transaction later on. However, the bad side is that my Item table may contain a lot of rows. I'd be very grateful if someone could give me an advice on how I should tackle this problem. **UPDATE:** I'd like to add more information about the current design.               public class Customer implements Serializable {         @OneToMany         private List<CustomerTransactions> listOfTransactions;     }          public class CustomerTransactions implements Serializable {         @ManyToMany         private List<Item> listOfItemsBought;     }          public class Merchant implements Serializable {         @OneToMany         private List<Item> listOfSellingItems;     }


title: name convention for variables in C#

text: I'm watching a video on C# about Variables. The author declares a variable inside a method and he named it like this: string MyName ="James"; my question is: which convention is recommended by .Net Framework. Is it Pascal casing as in the above example or is it camel case?


title: How/Where do I give my github commit a version?

text: I 'm just learning to give project versions. I understand writing details about the changes in my project when committing, but where should I put my version number for my project?


title: what is storing data in constant space?

text: "bloom filter allows us to store data in constant space" Can someone explain what exactly does that sentence means?


title: Why would I learn C++11, having known C and C++?

text: I am a programmer in C and C++, although I don't stick to either language and write a mixture of the two. Sometimes having code in classes, possibly with operator overloading, or templates and the oh so great STL is obviously a better way. Sometimes use of a simple C function pointer is much much more readable and clear. So I find beauty and practicality in both languages. _I don't want to get into the discussion of "If you mix them and compile with a C++ compiler, it's not a mix anymore, it's all C++" I think we all understand what I mean by mixing them._ Also, I don't want to talk about C vs C++, this question is all about C++11. C++11 introduces what I think are significant changes to how C++ works, but it has introduced many special cases, exceptions and irregularities that change how different features behave in different circumstances, placing restrictions on multiple inheritance, identifiers that act as keywords, extensions of string literals, lambda function variable capturing, etc. I know that at some point in the future, when you say C++ everyone would assume C++11. Much like when you say C nowadays, you most probably mean C99. That makes me consider learning C++11. After all, if I want to continue writing code in C++, I may at some point need to start using those features simply because my colleagues have. Take C for example. After so many years, there are still many people learning and writing code in C. Why? Because the language is good. What good means is that, it follows many of the rules to create a good programming language. So besides being powerful (which easy or hard, almost all programming languages are), C is regular and has few exceptions, if any. C++11 however, I don't think so. I'm not sure that the changes introduced in C++11 are making the language better. So the question is: **Why would I learn C++11?**


title: Where does "method" as a special term in OOP originate?

text: "Method" is a special term in Object-Oriented Programming. Does anyone know when the word began to be used in this particular sense, and in connection with what programming language or other branch of quantitative learning?


title: Serializing network messages

text: I am writing a network wrapper around `boost::asio` and was wondering what is a good and simple way to serialize my messages. I have a message factory which can take care of dispatching the data to the correct builder, but I want to know if there are any established solutions for getting the binary data on the sender side and consequently passing the data for deserialization on the receiver end. Some options I've explored are: passing a pointer to a `char[]` to the serialize/deserialize functions (for serialize to write to, and deserialize to read from), but it's difficult to enforce buffer size this way; building on that, I decided to have the serialize function return a `boost::asio::mutable_buffer`, however ownership of the memory gets blurred between multiple classes, as the network wrapper needs to clean up the memory allocated by the message builder. I have also seen solutions involving `streambuf`'s and `stringstream`'s, but manipulating binary data in terms of its string representation is something I want to avoid. Is there some sort of binary stream I can use instead? What I am looking for is a solution (preferrably using boost libs) that lets the message builder dictate the amount of memory allocated during serialization and what that would look like in terms of passing the data around between the wrapper and message factory/message builders. PS. Messages contain almost exclusively built-in types and PODs and form a shallow but wide hierarchy for the sake of going through a factory. Note: a link to examples of using `boost::serialization` for something like this would be appreciated as I'm having difficulties figuring out the relation between it and buffers.


title: How do you run a sprint retrospective to maximize participation and honesty? And what about follow up on action items?

text: I've seen it done as a free-for-all where the scrum master just asks everyone to throw out comments. Or a time-boxed session where "anonymous" comments are posted on the walls bucketed by category. My current team is constrained by being spread out, so it has be done online/over the phone. What is everyone's best experience with soliciting constructive feedback? And how do you follow through on action items for improvement?


title: How analysis is different from design?

text: I'm sure you all have heard managers saying that "we need an analyzer", or "we need a designer". While I'm a .NET developer, I hardly can differentiate an analyzer from a designer (not web designer or UI designer). Who is analyzer? Who is designer? Do they overlap?


title: Are "Proactive" designs on new projects useful?

text: When starting a new project, are "proactive" designs useful? I mean, if you create a UML diagram/Activity diagram/Use Case/Class diagram/etc. for anything and everything can think of, then when you _think_ you're done, you start coding. Afterwards, you realize an important feature or method was left out. All your spiffy UML diagrams are nice stacks of worthless paper now. Is it easier/better to design one class, work on it a bit, refine it, then work on it more?


title: I think client's project will be a flop; should I discuss with him?

text: I have a meeting with a prospective client tomorrow for a certain e-commerce project he wants to commission. I had an overview of it over the phone and from what I understand there are gazillion such concepts already floating and most of them are disasters and I have reasons to believe that his project is significantly likely to have the same fate. Should I raise/discuss the commercial feasibility of his idea with him or simply accept the project, give my best and leave out all the rest?


title: Is it best to minimize using pointers in C?

text: I think most people would agree that pointers are a major source of bugs in C programs (if not the greatest source of bugs). Other languages drop pointers entirely for this reason. When working in C, then, would it be best to avoid using pointers whenever practical? For example, I recently wrote a function like this:               void split(char *record, char *delim, int numfields, int fieldmax, char result[numfields][fieldmax]);      While not as versatile as a dynamically allocated variable, in that it requires the programmer to know the number of fields in advance and anything over `fieldmax` is truncated (which is sometimes acceptable), it eliminates the need for memory management, and the potential for memory corruption. I think this is a pretty good trade, but I was wondering what the opinions of other programmers on this were.


title: Should non-interface code be hidden from the client?

text: I am working on a library which had several headers that are meant to only be used by the library itself. I also have a few classes and functions in headers that I do not want the client to use. For instance, I have a header that contains debugging functions, but they should not be used outside of the library as it could cause problems. Should this code be hidden from the client? If so, how?


title: How Do Computers Work?

text: This is almost embarrassing ask...I have a degree in Computer Science (and a second one in progress). I've worked as a full-time .NET Developer for nearly five years. I generally seem competent at what I do. **But I Don't Know How Computers Work!** Please, bare with me for a second. A quick Google of 'How a Computer Works' will yield lots and lots of results, but I struggled to find one that really answered what I'm looking for. I realize this is a huge, huge question, so really, if you can just give me some keywords or some direction. I know there are components....the power supply, the motherboard, ram, CPU, etc...and I get the 'general idea' of what they do. But I really don't understand how you go from a line of code like `Console.Readline()` in .NET (or Java or C++) and have it actually _do_ stuff. Sure, I'm vaguely aware of MSIL (in the case of .NET), and that some magic happens with the JIT compiler and it turns into native code (I think). I'm told Java is similar, and C++ cuts out the middle step. I've done some mainframe assembly, it was a few years back now. I remember there were some instructions and some CPU registers, and I wrote code....and then some magic happened....and my program would work (or crash). From what I understand, an 'Emulator' would simulate what happens when you call an instruction and it would update the CPU registers; but what makes those instructions work the way they do? Does this turn into an Electronics question and not a 'Computer' question? I'm guessing there isn't any practical reason for me to understand this, but I feel like I should be able to. (Yes, this is what happens when you spend a day with a small child. It takes them about 10 minutes and five iterations of asking 'Why?' for you to realize how much you don't know)


title: Is it ok to write "extra" unit tests?

text: My understanding of how TDD should work is that you write a failing test for the next bit of functionality you want to add to a function or object, code until the test passes and then write the next test. Is it ever ok to write tests that pass with the code as is? One example of that happened today. I was writing a function that could Manchester encode an arbitrary number of bits. I wrote failing tests for encoding one single bit and coded until it passed, then wrote a failing test for passing two bits to the function and coded until it passed. But the solution I used to handle two bits made the code work for any number of bits. Because passing a byte to the function will be it's most common use, I added a unit test to make sure it worked for 8 bits, which did in fact pass. Did I violate TDD principles? Is there anything wrong with adding redundant tests just for my peace of mind? I understand part of the problem is that I could have written a faulty tests and would never know because it didn't fail in the first place, but I'm not sure what the alternative is.


title: Creating a webservice API - how much "credit" should I give the client/developer

text: When creating a web service API, how much should I count on the developer to act by my rules? We are really aimed on creating an API so the developers shouldn't develop client side logic too much... for example, if in one of my methods we require the client to send us a unique ID - we are relying on the client that the ID sent is really unique - so the client should also keep track of it's requests and add logic to it's code. is it ok or should we try to solve ths kind of issues in a different more transparent ways?


title: Split skilled Scrum team

text: A Scrum team has been forced together and is feeling very uncomfortable. They are constantly saying that it is not working for them and that they are fed up with hearing the words _Agile_ and _Scrum_. They are feeling that the business if simply forcing a new buzz word on them. They don't have any Agile experiance before this, including the Scrum master. Also, the team consists of a very disconnected skill set.   * 1 manual tester   * 1 .NET developer   * 2 Cobol developers   * A BA turned PO   * The scrum master The .NET dev doesn't want to learn Cobol and the Cobol devs don't want to learn .NET. I've been asked to help out with making them more Agile, however, one of the main tennets of Agile is that the power for change must lie with those with the domain knowledge. Kanban could help, but it wouldn't tackle the broken skill set. _Any advise on where to start?_ Currently my plan is to start with the PO and see how stories are being written, but I am not sure where to go from there.


title: Uniform variable naming across HTML, CSS and JS

text: I'm sorry if this is opinion based, but how do you guys make sure that HTML, CSS and JS have uniform variable naming? I use vim, but I don't know if IDEs are smart enough to do this on their own. In case it's not clear, the issue is that if I change a variable name in HTML, I need to go and change the variable names in CSS and JS.


title: What's a "Polymorphic method"?

text: Sometimes people use the phrase "Polymorphic method/function". Does it mean:   1. A method that takes a Polymorphic type as a parameter, and performs some operation on it. By "Polymorphic type" I mean a super-type with multiple sub-types.   2. An abstract or virtual method in a super-type, with multiple sub-types that implement/override the method differently.


title: Are 'The Pragmatic Programmer' and 'The Mythical Man Month' good books for people with limited practical experience programming

text: I was once told to read the books titled 'The Pragmatic Programmer' and 'The Mythical Man Month'. I have very little experience programming (basic HTML, CSS and JS). If I were to purchase these books, read through them, would it be beneficial to me with such a limited understanding or would I benefit from them? I ask because I am currently learning HTML5 and CSS3 from an online source and want some general reading material to add to my kindle.


title: Designing online exam

text: I need to design an online exam server for an exam like GRE in which question difficulty increases if you answer correctly and decreases if you answer wrong. > Questions are multiple choice questions > > Difficulty scale of question is 1-10, 1 being the easiest and 10 being the > hardest. > > If two continuous questions are answered wrong, decrease the difficulty by 1 > and if two questions answered right increase the difficulty by 1. > > Test starts with a question of difficulty level of 4. > > Question carries marks equal to its difficulty. **My question is** : Which data structure should I use to store the questions? Which is the best algorithm to fetch the question by its difficulty, etc.? I am currently considering a doubly linked-list:               struct node {              int data;         node *prev;         node *next;         int n         int MAX;     };      Here, 2 n's we need to store. One is MAX (actual size) and n is possible random size to pick questions from n - MAX we selected already for each double linked list you can add extra int data where you can store prev link, next link, pointer to array, int Maxdata(MAX size), int n(current size). Each node is a pointer to an array of questions for each level. If the answer is correct, it moves next node and picks the random questions from that list, otherwise it moves to the previous node and picks a question. For example, let's say an array has 10 questions 1 - 10. Since the array size is n = 10, you know that   1. now you selected a random question rand() % 10 = 6 th questions   2. now swap the question number 6 & 10, make n-- and return the 6th question   3. now n = 9 so next time 10th will not be considered   4. random will return 1 - 9 only Is there any better way of doing it?


title: Is there a difference learning VBA on Mac vs Windows

text: I'm a programmer who'd like to learn VBA, but I don't have a Windows box. However, I have a MacBook Pro with the latest version of MS Office for Mac on it (2011 I think). Since I work in a .Net shop, I'd like to learn VBA. Is there anything I'm missing out on not having a Windows machine to learn it on?


title: Why isn't functional language syntax more close to human language?

text: I'm interested in functional programming and decided to get head to head with Haskell. My head hurts... but I'll eventually get it... I have one curiosity though, why is the syntax so cryptic (in lack of another word)? Is there a reason **why it isn't more expressive** , more close to human language? I understand that FP is good at modelling mathematical concepts and it borrowed some of it's concise means of expression, but still it's not math... it's a language.


title: Assignments in mock return values

text: (I will show examples using php and phpunit but this may be applied to any programming language) The case: let's say we have a method `A::foo` that delegates some work to class `M` and returns the value as-is. Which of these solutions would you choose:               $mock = $this->getMock('M');     $mock->expects($this->once())          ->method('bar')          ->will($this->returnValue('baz'));          $obj = new A($mock);          $this->assertEquals('baz', $obj->foo());      or               $mock = $this->getMock('M');     $mock->expects($this->once())          ->method('bar')          ->will($this->returnValue($result = 'baz'));          $obj = new A($mock);          $this->assertEquals($result, $obj->foo());      or               $result = 'baz';     $mock = $this->getMock('M');     $mock->expects($this->once())          ->method('bar')          ->will($this->returnValue($result));          $obj = new A($mock);          $this->assertEquals($result, $obj->foo());      Personally I always follow the 2nd solution, but just 10 minutes ago I had a conversation with couple of developers who said that it is "too tricky" and chose 3rd or 1st. So what would you usually do? And do you have any conventions to follow in such cases?


title: What would you think about a new Java persistence tool, that's not really an ORM?

text: ## Persistence in Java Over the past years, I have gathered experience in the field of persistence abstraction in Java, using concepts such as EJB 2.0, Hibernate, JPA and home- grown ones. They seemed to me to have a steep learning curve and lots of complexity. In addition, as a big fan of SQL, I also thought that many abstraction models provide too much abstraction over SQL, creating concepts such as "criteria", "predicates", "restrictions" that are very good concepts, but not SQL. The general idea of persistence abstraction in Java seems to be based on the Object-relational model, where RDBMS are somehow matched with the OO world. The ORM-debate has always been an emotional one, as there does not seem to exist a single solution that suits everyone - if such a solution can even exist. ## jOOQ My personal preference of how to avoid ORM-related problems is to stick to the relational world. Now the choice of data model paradigm should not be the topic of discussion as it is a personal preference, or a matter of what data model best suits a concrete problem. The discussion I would like to start is around my very own persistence tool called jOOQ. I designed jOOQ to provide most of the advantages modern persistence tools have:   * A Domain Specific Language based on SQL   * Source code generation mapping the underlying database schema to Java   * Support for many RDBMS Adding some features that few modern persistence tools have (correct me if I'm wrong):   * Support for complex SQL - unions, nested selects, self-joins, aliasing, case clauses, arithmetic expressions   * Support for non-standard SQL - stored procedures, UDT's, ENUMS, native functions, analytic functions Please consider the documentation page for more details: http://www.jooq.org/learn.php. You will see that a very similar approach is implemented in Linq for C#, although Linq is not exclusively designed for SQL. ## The Question Now, having said that I'm a big fan of SQL, I wonder whether other developers will share my enthusiasm for jOOQ (or Linq). Is this kind of approach to persistence abstraction a viable one? What are the advantages / disadvantages you might see? How could I improve jOOQ, and what's missing in your opinion? Where did I go wrong, conceptually or practically? ## Critical but constructive answers appreciated I understand that the debate is an emotional one. There are many great tools out there that do similar things already. What I am interested in is critical but constructive feedback, based on your **own experience** or articles you may have read.


title: What is the aim of software testing?

text: Having read many books, there is a basic contradiction: Some say, "the goal of testing is to find bugs" while other say "the goal of the testing is to equalize the quality of the product", meaning that bugs are its by-products. I would also agree that if testing would be aimed primarily on a bug hunt, who would do the actual verification and actually provide the information that the software is ready? Even e.g. Kaner changed his original definition of testing goal from bug hunting to quality assessment provision but I still cannot see the clear difference. I perceive both as equally important. I can verify software by its specification to make sure it works and in that case, bugs found are just by products. But also I perform tests just to break things. Also what definition is more accurate? Note above I am primarily referring to software testing as a process.


title: Should I still consider using Appcelerator Titanium for building mobile apps if I don't have any web dev skills?

text: I'm an experienced desktop developer who's recently begun writing iOS apps and would like to venture into Android development as well. I've been hearing a lot of talk surrounding the Appcelerator Titanium framework lately, but I'm not sure I fully understand it's purpose. As I understand it, it's a framework for building native mobile apps using web technologies. If I don't have any web dev skills, are there any ways that using Appcelerator Titanium would benefit me? Thanks for your thoughts, I'm going to continue researching this right now.


title: Forking an open source project nicely

text: It's time. You've worked long and hard to add your vision to the open source project you love, on which you've worked, debated, and to which you've contributed inestimable amounts of code and insight. But it's not going to work out with the existing developers. **You finally need to fork the code.** How do you do this and remain on the best terms possible with the existing project? How do you not say, "Oh yeah? Fork you!" Aside from the mechanics of cross-polination and assuming that the reasoning for forking is sound, logical, and acceptable, what issues come up? Competition? Resource sapping? User poaching? How do you go through this arguably difficult and long process until you've diversified enough that these are no longer seen as problems? Rather than discussing the reasoning behind the decision, please assume that you have already been convinced that forking the code is the best overall solution, and now the point is to move forward in the best way possible.


title: What is the name for a NON-self-calling function?

text: I have a collection of normal functions and self-calling functions within a javascript file. In my comments i want to say something along the lines of "This script can contain both self-calling and XXX functions", where XXX is the non-self-calling functions. "Static" springs to my mind, but feel that would be incorrect because of the use of static methods in PHP, which is something completely different. Anyone any ideas? Thanks!


title: Types of databases

text: I read that there exists three main types of databases               * Transactional (Client-Server database// OLTP database)     * Decision support system (DSS) (Data warehouse database // Data mart // Reporting database)     * Hybrid      What is the type of database considered for a social network, like Facebook or Twitter? I guess the category is:               Transactional > Client -Server database.      From the book: **A transactional database is a database based on small changes to the database (that is, small transactions).The database is transaction-driven. In other words, the primary function of the database is to add new data, change existing data, delete existing data, all done in usually very small chunks, such as individual records.** But, as I said, I am not sure.


title: How to unit test a missing case in a switch statement where all cases are true

text: I often use `enum` types in my code with a switch to apply logic to each type. In these cases it's important that each `enum` has code implemented. For example;               public enum eERROR     {         REQUIRED,         DUPLICATE,         UNKNOWN,         MISSING_VALUE     }          public void Error(eERROR pError)     {         switch (pError)         {             case eERROR.REQUIRED:                 // ......                 return;             case eERROR.DUPLICATE:                 // ......                 return;             case eERROR.MISSING_VALUE:                 // ......                 return;             case eERROR.UNKNOWN:                 // ......                 return;         }              throw new InvalidArgumentException("Unsupported error type");     }      At the bottom I've added an exception as a last resort check that a programmer remembered to add any new `enum` types to the `switch` statement. If a new type is added to `eERROR` the exception _could_ be thrown if the code is not updated. Here is my problem. The above code generates unit test coverage of only **99%** because I can not trigger the exception. I could add a generic `unhandled` to `eERROR` and call `Error(eERROR.unhandled)` just to get **100%** coverage, but that feels like a hack to solve something that is not a problem just to get full coverage. I could remove the line but then I don't have the safety check. Why is _99%_ a problem? because the code base is so large that any uncovered method doesn't move coverage to _98%_. So I always see _99%_ and don't know if I missed a method or two. How can I rewrite `Error()` so that all newly added enums that are not added to the switch will be caught somehow by the programmer, and also be covered by tests. Is there a way of doing it without added a dummy enum?


title: How to deal with Interviews where HR is missing?

text: The situation: Person X, who already has a full-time job, applies to Company A. Money is good at A, but the real reason X had applied is 'cause the work at A really excites X. Next someone from the technical dept. from A calls up X, gives some assignment and holds a round of technical interview over phone. X does very well in all of it so far. Finally, X asks the tech guy from A "What's next?" The guy says we'd get back to you in 3-4 days time and then doesn't call up in the next 3-4 days. X is confused. He's got the mail-id of the tech guy but not sure if he should inquire -- this is no HR after all. In fact HR was never anywhere in this process. What should he do? **My Take** : Don't mail. You already have a full-time job and this shows desperation. **The Problem** : This isn't me and people tell me that some companies wait for candidate to get back just to double check their interest level. * * * **Update** Mailing the engineering team proved very useful, they apologized for being busy and now I am told the next round is early January.


title: Which is more important in a web application code promotion hierarchy? production environment to repo resemblance or unidirectional propagation?

text: Lets say you have a code promotion hierarchy consisting of several environments, (the polar end) two of which are development (dev) and production (prod). Lets say you also have a web application where important (but not developer controlled) files are created (and perhaps altered) in the production environment. Lets say that you (or someone above you) decided that the files which are controlled/created/altered/deleted in the production environment needed to go into the repository. Which of the following two sets of practice / approaches do you find best:   1. Committing these non-developed file modifications made in the production environment so that the repository resembles the production environment as closely and as often as possible.   2. Generally ignoring the non-developed production environment alterations, placing confidence in backups to restore the production environment should it be harmed, and keeping a resolution to avoid pushing developments through the promotion hierarchy in the reverse direction (avoiding pushing from prod to dev), only committing the files found in the production environment if they were absolutely necessary in other environments for development. So, 1 or 2, and why? PS - I am currently slightly biased toward maintaining production environment to repository resemblance (option 1), but I keep an open mind and would accept an answer supporting either.


title: Question about modeling with MVC (the pattern, not the MS stuff / non web)

text: I'm working on an application in which I'm looking to employ the MVC pattern, but I've come up against a design decision point I could use some help with. My application is going to deal with the design of state-machines. Currently the MVC model holds information about the machine's states, inputs, outputs, etc. The view is going to show a diagram for the machine, graphically allowing the user to add new states, establish transitions, and put the states in a pleasing arrangement, among other things. I would like to store part of the diagram's state (e.g. the x and y state positions) when the machine information is stored for later retrieval, and am wondering how best to go about structuring the model(s?) for this. It seems like this UI information is more closely related to the view than to the state-machine model, so I was thinking that a secondary model might be in order, but I am reluctant to pursue this route because of the added complexity. Adding this information to the current model doesn't seem the right way to go about it either. This is the my first time using the MVC pattern so I'm still figuring things out. Any input would be appreciated.


title: Alternative Scripting Language to Lua?

text: I would like to add scripting support to an applications and with plenty scripting languages available I am a bit overwhelmed. At first I thought about Python but I guess Python is a little too big for my taste and the application (although I like it very much, it gets a lot of things right in my opinion while the syntax is clean and simple especially if you are not doing heavy OOP). I am also very fond of Lisps. I like scheme and it is the perfect extension language - at least in some ways, but I would like to stay syntactically more conservative. I remember having heard a lot of positive things about Lua and indeed Lua seems a good possibility. Unfortunately there is this one thing that really "turns me off": Its the `local` keyword for local binding. This is really ugly to my taste and I frankly do not quite grok why languages are still designed this way and in essence knowing about `local`. This is also a major drawback of JavaScript in my opinion and I feel like it all boils down to bad language design. My major concern is, that a user might just override a function from just within her/his function just by omitting `local`. But then Lua gets a lot of things right, size, speed, and it is surprisingly scheme-esque. Yet I am really afraid that it is not suitable for non- programmers who have no sense of scope.   * Any alternatives on the horizon?   * Might hacking the Luacore to make local the default be an option? Lua sources appear to be quite decent and modular, so this would be an interesting project ;)


title: Is it safe to assume that one controller will only ever use one primary model?

text: So, I'm designing an MVC framework. In the name of keeping everything statically typed and non-magical, I've come to quite a problem with "automatically" passing models to a controller. So, traditionally, I usually see no more than one model used at a time in a controller as far as automatic-population. For instance, take this tutorial. There is a method like this in the controller:               [HttpPost]     public ActionResult Create(Movie newMovie)     {              if (ModelState.IsValid)         {             db.AddToMovies(newMovie);             db.SaveChanges();                  return RedirectToAction("Index");         }         else         {             return View(newMovie);         }     }      My concern is passing a `Movie` model to the `Create` method which is populated by FORM values "magically". In my API, this should be easily possible and would look something like this at routing:               var movie=router.Controller((context) => new MovieController(context))                      .WithModel(() => new Movie());     movie.Handles("/movie/create").With((controller, model) => controller.Create(model));      My concern with this is that it is much harder to have multiple models because of limitations with C#'s type system. Of course, the controller can always manually create the models from FORM values and such, but it's not nearly as pretty. So, my question: Is it common to have something like `Foo(Movie model)` and `Bar(SomeClass model)` in the same controller class? Is it a good idea for me to attempt to support such a scenario, or is it just a symptom of putting too much unrelated logic in a single controller? Note: if you're concerned about how this fluent API is even possible, the answer is generic delegates.. lots and lots of generic delegates :) (but so far very little reflection)


title: How to develop a Delete command through Behavior Driven Development?

text: I am trying to develop a Delete command through BDD that will simply delete an user from the database, given user_id as a parameter. What can be some possible behavioral tests that will drive me to write a proper implementation for the command?


title: Writing OOPS code in Non Object Oriented Language

text: I was reading some article on the internet as I was preparing for interview and I found out below statement- > Writing object oriented code, even in non-object oriented language? Is this statement true?? Can anybody provide an example to justify the above statement if somebody asked me this question in the interview. And when do we write object oriented code in non object oriented language? I mainly worked in Java. So any example corresponding to that will be helpful. Thanks in advance.


title: Is the market of small-scale development/production tools that difficult?

text: I was wondering, is there an economic rationale in developing and marketing a small tool (standalone or rather plugin)? Of course, let's assume that the tool does indeed solve a real problem from the production process. And by small, I mean an application that can be developed by 1-2 developers within 2 years. Do you know any contemporary success stories? I have two observations that make me wonder:   1. Anyway I turn around people ask for free and preferably open-source tools. Even when the price is low, and the software is worth its price, I see this big reluctance to spend any money on commercial development software. An application author would probably have to assume that only a very small percentage of all people who might find his application useful, will actually purchase it.   2. I've seen a few good commercial software examples that after some time started offering free licenses. The most notable example for me was gDEBugger from Graphic Remedy. Last time I checked it didn't even had any worthy competitor (commercial or noncommercial) in the market of OpenGL debuggers. I have no idea what might have made them do that, other than poor sales.


title: Should I fork for a major re-write that uses a small amount of the original code?

text: I'm writing a library. It's a completely rewritten version of another one, to suit my needs (PCL compatibility, mainly). However, the API will be completely rewritten, as I'll need to change a lot of stuff around for PCL compliance. Also, as it is a rewrite, I won't be able to just start from the library and just change it bit by bit, as I typically see with forks. I tried that, but it just didn't work. So what should I do? Should I fork here or should I make a new library?


title: Deploy PHP project without giving away the source code?

text: I am working on developing range of web based software solutions. But the problem is that for some clients we need to deploy the applications in their local intranet. In such a situation I have to stick with Java as development language as I cannot give away the source code of the project. Now in order to tap on more consumers we put these solutions online. Now considering the fact that Java hosting is more expensive than PHP we are left with no choice but to again re develop the entire solution in PHP. Thus we end up having two version of same solution for maintenance and upgrading in different platforms. So can any point us to some good solution in which we can have the online solution and also have a deployable version of the application in which we can ship the application without its source code and at the same time we also need the application to be cost effective from hosting point of view?


title: How to find method and class usages along git repositories

text: We got some code in a git repository that's used along different projects (with git different repositories), the problem is that we got now so many different projects that's difficult to track which projects will be affected and how when there is a change in the shared module. Is there any way to find classes and methods usages along different git repositories? Or who would you manage an architecture like that?


title: Is it possible to shuffle team in between a sprint?

text: We are working on scrum framework. Now a situation arise that we have to shuffle 2-3 scrum team members in between sprints. Is it possible to shuffle sprint team members in between a sprint? What are the potential drawbacks of doing this?


title: Migrating Web based projects from Java to PHP

text: At our work place after hours of coding, testing and QA we have successfully added a couple of software tools in our product line. We specialize in web based software solutions so in order to tap on more users we are now considering putting our developed solutions online for hosting and providing online access to all our clients for their products. But what is coming in our way is that we have developed all these solutions in Java and compared to PHP Java hosting is very expensive. So we are now planing to migrate all these solutions to PHP while also maintaining their Java counterpart. How we should start with these migration task? We used AJAX in all our Java based solutions. Tech specs are   1. Front end web pages in JSP   2. Back end server side in Java using Apache Struts2   3. Database in MySQL   4. PDF report generation using iText PDF lib. for Java NB: We have started a little with Code Igniter Framework in PHP.


title: Java Frameworks

text: I would just want to ask what Java frameworks are worth learning, specially when it comes to web applications, but other frameworks are welcome too. Could you please state:   * The learning curve    * The availability of resources   * The performance of that framework   * Would you recommend it or not I want to study frameworks on my free time. If it's not too much a bother thanks to those that will answer! If it's too vast: How about for web applications? Should I learn Spring or Struts 2? iBatis or Hibernate? Stuff like that Still if it's vast: What frameworks would you recommend out there? Really. Anything. I want to learn and I'm used as a JEE guy now so if it's related with web app then I would take that as a bonus.


title: Can You Make An Entire Website With JavaScript?

text: I have looked at the aims of Java-script and it intends to `provide and enhanced user-interface and dynamic websites`. I am trying to get into the Web Development Business and am learning Javascript. But unfortunately, I have never seen an entire website implemented in Java script. Javascript is usually just used for Ads. People use things like PHP or ASP .NET (and C#) for serious web development. So will learning Javascript seriously enable me to make **Dynamic Websites** , and are there any good websites made with Javascript. Is Javascript a good choice for making websites? Is it even possible?


title: How do you keep consistent self confidence while coding?

text: As the number of bugs in a codebase increases, that number not only decreases the quality of the code, it also affects the mindset of the developers. Developer self-confidence falls when things are not going well. If self- confidence is not right, things more easily become a mess. How do you guys keep your self confidence up in these situations?


title: What algorithm should I use to find the shortest path in this graph?

text: I have a graph with about a billion vertices, each of which is connected to about 100 other vertices at random. I want to find the **length** of the shortest path between two points. I don't care about the actual path used. Notes:   * Sometimes edges will be severed or added. This happens about 500 times less often than lookups. It's also ok to batch up edge-changes if it lets you get better performance.   * I _can_ pre-process the graph.   * If it takes more than 6 steps, you can just come back with infinity.   * It's acceptable to be wrong 0.01% of the time, but only in returning a length that's too long.    * All edges have a length of 1.   * All edges are bidirectional. I'm looking for an algorithm. Psuedocode, english descriptions, and actual code are all great. I could use A*, but that seems optimized for pathfinding.   I thought about using Dijkstra's algorithm, but it has a step which requires setting the shortest-path-found attribute of every vertice to infinity _(If you're wondering about the use-case, it's for the Underhanded C Contest.)_


title: What is watershed in the context of image processing?

text: I am new to image processing using Python. Now I am learning OpenCV and the mahotas module in Python. Many functions in these modules are related to watershed of an image. I don't know what watershed means for an image. Here is an example from the OpenCV documentation: http://docs.opencv.org/search.html?q=watershed&check_keywords=yes&area=default


title: Naming conventions used for variables and functions in C

text: While coding a large project in C I came upon a problem. If I keep on writing more code then there will be a time when it will be difficult for me to organize the code. I mean that the naming for functions and variables for different parts of the program may seem to be mixed up. So I was thinking whether there are useful naming conventions that I can use for C variables and functions? Most languages suggest a naming convention. But for C the only thing I have read so far is the names should be descriptive for code readability. EDIT: Examples of some examples of suggested naming conventions:   * Python's PEP 8   * Java Tutorial I read some more naming conventions for java somewhere but couldn't remember where.


title: How can this all fit into 64kb?

text: So, I am here at assembly 2011 and there was this demo played: http://www.youtube.com/watch?v=69Xjc7eklxE&feature=player_embedded It's one single file only, it says that in the rules. So I repeat, how have they made this to fit into so small file?


title: Looking for a large collection of XML files

text: Hey, I'm writing a program that I need to test with 1000s of XML files - any idea where I can get some?


title: What is the clause in an employee contract that says they own all your code?

text: I am looking at my employee contract and I can't seem to figure out where it might say that they own all the code that I write, be it at work or at home. Any examples of what the wording could be like?


title: stackoverflow induced passivity - how to cope?

text: After not _really_ working on my pet project for a while, I discovered Stackoverflow and upon perusing it more intensely I was quite amazed.   I'm a bit of a perfectionist, so when I found eye-openers here highlighting many of the mistakes I made, I first wanted to fix everything.   However, it's a **pet** project for a reason: I'm self-taught and I'm studying psychology, so programming skills can never become priority one (though it often helps, even in this field). Issues that stuck out were   * numerous security issues (e.g. CSRF-prevention and bcrypt eluded me)   * not object-oriented (at least the PHP part, the JS-part _mostly_ is)   * no PHP framework used, so many of my DIY takes on commonly-tackled components (auth, ...) are either bad or inefficient   * **really** poor MySQL usage (no prepared statements, mysql extension, heard about setting proper indices two days ago)   * using mootools even though JQuery seems to be _fashionable_ , so there's more probably always going to be better integration with services I'd like to use (like google visualization) So, my SO-induced frenzy turned into **passivity**. I can't do it all (soon) in the rather small amount of spare time I can spend on working on my project.   I can leave some of the issues be in good conscience (speed stuff: an unfinished & unpublished project will never become popular, right?).   No clear conscience without good security though and if I don't use a framework for _auth_ and other complex stuff I'll regret having to do it myself. One obvious answer would probably be going open-source, but I think the project would need to become more impressive before others would commit to it. I can't afford to employ someone either. I do think the project deserves being worked on, though. How should I tackle it **anyway**? What's the best practice for little-practice people? * * * I couldn't edit my question, because it was transferred. I would have emphasised, that I have a working product, but like so many pet projects it will _never be finished_ , so I intended to make things easier for myself in the future too. Some of you mis-guessed my problem as being afraid to get started, but I couldn't react up here, sorry. I'm surprised that no one seems to think that using a framework would be a good way to relieve myself of some responsibilities (such as implementing an authorization module that conforms to these specs.   Or is it just too hard to turn to something like an MVC when you have been working process-oriented before?


title: Build automation: Is it usual to use QMake for non-Qt projects?

text: So, I'm planning to write a C++ library and I want it to be cross-platform, and as this library won't deal with UI and I want it to have as little dependencies as possible, I won't be using Qt (actually Qt won't really help me to achieve what I want, all I plan on using is STL and Boost). Now when it comes to build a cross-platform project, I really like QMake as it's extremely easy to use and I have experience with it. I also heard good things about CMake, though I really doubt it's as easy to use as QMake. Anyway, here is my question: Should I stick with build automation tool that I know or is QMake just out of context for a non-Qt project? Should I take this as an opportunity to learn CMake? Or is there a better alternative to these two?


title: What information should be in the github README.md?

text: What information would you expect to see in the github README? Should everything go in the README? i.e.   * Introduction   * Installation   * Versions   * User Guide   * Implementation   * Testing   * Related Resources Or should you just put certain things in the README (Introduction, Installation, Versions) and the other information is best placed in the Github wiki?


title: Cold, neutral attitude to programming languages - sign of a pro developer or not

text: A profesional developer Zed Shaw says this: > Which programming language you learn and use doesn't matter. Do not get > sucked into the religion surrounding programming languages as that will only > blind you to their true purpose of being your tool for doing interesting > things. So, being neutral to languages is a sign of a good/pro developer? We see worshipping and holywars what language is better. The good coder does not care about tools, he only thinks what software he writes (like writer does not care about pen he uses - he thinks about the BOOK content)   1. should a programmer develop total ignorance to language as tool he uses?   2. **is it a sign of pro developer** , if he does not care what language to use?


title: How to create a Web app that "interacts" with email?

text: I have a web host that supports cPanel and email addresses. I'm interested in creating a web app that checks for email messages, reads their contents and then does something with them, like interact with a database. For example, Bob with email bob@gmail.com links his email address to his account on my web app. He sends an email to storethis@webapp.com with subject "Shopping List" and message "Apples, bananas, kiwis, milk", along with an attachment. The web app receives this email, and then parses the email's contents and stores this data into a database. How can I implement this?


title: How a port "listens", pull or push?

text: When you write a code to listen from a port, like 80 for example, what happens under the hood? Is the method the OS uses to listen is pull, or push? In other words, does the OS checks that port every x milliseconds for example? I just don't get it. The more I think about it, the more it seems to me that it can't be anything other than pulling. I mean, even if OS set a callback function, still something should understand that new information has arrived to call that callback function. That **something** still should use pull to understand the arrival of the new data. How a port listens?


title: Why many programming languages have only 2 data-structures: arrays and hashes?

text: Many programming languages have only those 2 structures, and even some languages that have more structures still only provide special syntax for those 2; usually, `[]` and `{}`. Why is this? Is there anything special about those datatypes that is necessary for the completeness of the language?


title: Program Structure for Table Cells Representing Objects

text: So I have a program with "cue" objects and each have their own table cell. The thing is that the table cells have loading bars on them that represent the progress of the cues. This presents the following question: How should I structure the program? Should the objects representing the Cues store pointers to the table cells, allowing them to update the table cells themselves, or would some other program structure work better. Sorry if this question is too general, but I couldn't really find anything at all about this when I searched around on google and the website. I fairly new to iOS development and my programs structure is already getting chaotic. The suggestion I gave was just my initial instinct, but it's probable wrong...


title: Warning-free Objective C code

text: I am currently creating my first iPhone app in Objective C and getting a lot of warnings because I've in many places taken advantage of the fact that Objective C is a dynamically typed language. I get a lot of 'class' may not respond to '-message:' warnings. Should I strive to remove all these warnings? If yes, then what's the benefit of having a dynamic language at your disposal?


title: How can be get sure that we're not implementing micromanagement in the field of software development?

text: As I got the feedback of developers about scrum methodology in this question, on whether it turns active developers into passive developers or not, I encountered the word **micromanagement**. However, Wikipedia doesn't explain this term in the context of specific and tangible examples, and this, can result in different interpretations of micromanagement. Can anyone point to some well-known micromanagerial issues in the world of development (of course, with reference)? What practices could be regarded as micromanagerial? How can we get sure that we're not implementing micromanagement in our working environment?


title: Scrum taskboard with QA stage

text: I've been reading this article by Mike Cohn about Scrum task boards. One query I have is how this fits into a workflow where there is QA stage performed by testers who aren't developers. It seems that many tasks could not easily be QA'd in isolation. A practical alternative could be that the "To Verify" process should be carried out by another developer in the team, and then to have an additional stage after DONE to QA the whole story (probably after deployment to a stage/test environment). Does this seem right?


title: "A line comment acts like a newline"

text: I'm reading the Go language specification. The section on comments states: > Line comments start with the character sequence `//` and stop at the end of > the line. A line comment acts like a newline. What is the point of specifying that a line comment acts like a newline? Couldn't line comments simply act like empty strings? Lines (except the last) end in a newline anyway, so any line (except the last) will act like two consecutive newlines. If the last line has a line comment, then it can also safely act like an empty string.


title: Explain to a non-technical manager that the tool he chose isn't apt

text: My non-technical manager just paid for a license to use a tool which designed to pick mentions of your brand name at blogs, "social media", comments, etc. and gauge the sentiment (positive, neutral, negative) of the post. What he wants me to do is use it to do a task which can only be achieved with a certain level of natural language processing and hence shows up unrelated results for whatever query you can try. I want to be able to explain to him that this tool is designed for task X and what we are trying to do is task Y. Y cannot be modelled as X. And all the success of the tool he cites as proof is proof of X which is not Y.


In some articles and books that I read, I some time see the term 'Bootstrapping'. For example I see this sentence "Bootstrapping X.JS" in angular js document: http://docs.angularjs.org/tutorial/step_00 > Bootstrapping AngularJS apps automatically using the `ngApp` directive is > very easy and suitable for most cases. In advanced cases, such as when using > script loaders, you can use imperative / manual way to bootstrap the app... What is the meaning of bootstrapping in software development?


title: Server and MySQL safety for Java / JDBC applications?

text: I have an external java application which use JDBC as to reach an MySQL database. This will be used by many people and is going to store all the people's data on the same server / MySQL. As I bet people will be able to crack the .jar and see the source, I expect them to be able to cheat the program by editing it and making it get information from other users even when they are not allowed to reach said information. Is there any standard way to protect a server so people should only be able to reach the information their account is connected to even if said people are able to change the source? Cheers, Skarion


title: Should I use native android junit framework?

text: Can anybody share a reason (or list of reasons) of not using the native android junit framework but a standalone one like robolectric or something like that? I'm just trying to understand what framework to learn.


title: Address validation service for a public website

text: Given the following scenario:   * There is a public website (with about 50-100 visitors a day)   * Visitors register for the services offered by the company who owns the website   * Visitors tend to give wrong information regarding address and phone number that slows down the process of their registration, therefore their transactions and general happiness about the services of the company   * Generaly the address validation adds value to the website I am looking for a service for a reasonable price, that has:   * Up to date postcode and address database    * Easy to integrate API   * Address validation check    * All this with a reasonable price I am looking specifically looking in the UK. What I have found so far are companies having these services for on ridiculously high price. We are also considering buying the PAF database from RoyalMail and implement such a service for ourselves. Any help, suggestion is very much appreciated and thanks very much in advance!


title: What are the common mistakes when you are a good coder in C and PHP and you start coding in Java ? What are good tips when switching?

text: What apsects of Java are the most diificult to learn when coming from such a background? What common mistakes do people make ? What are the top timesaving and produtivtity increasing tricks ? If you had a room of C/PHP coders who were about to start development using Java what advise would you give ? This is my list of topics so far (in no particular order):   * Use jodatime instead of the standard library , and also less importantly the guava library.   * Arrays are zero indexed   * I'd also highlight the pass-by-value/reference aspects of Java, and the fact that > >     String s1 = new String("test"); >     String s2 = new String("test"); >     if(s1 == s2) // will be false >     if(s1.equals(s2)) // will be true >     * Introduce the concept of design patterns and give a quick overview.   * Introduce Spring (it will be used) and the concept of dependency injection Is there anything obvious I am missing.


title: What are the steps in beginning a large project, when all I have is a big idea?

text: I am computer engineering student. I've been thinking about how I can handle a big project. What should be my first step to reach my goal in a more efficient and effective way? When I come up with a project, I don't know how I should start working on it. Many times, I just ignore it. However, I don't want to ignore my project ideas anymore. Now, I am asking to all of you, can anyone share his/her experiences? How should I start a project when all I have is an idea?


title: Payment Gateways and RESTful API

text: I have a RESTful API that offers eCommerce functionality. One area I'm struggling to decide on the correct implementation is how to process payments. Lets say I have the following URI GET .../checkout/{id}/payment. This resource provides details to the client application of what details needs to be submitted to make a payment. The specifics of the information in the resource depends on the implementations below **Implementation 1** The resource contains basic payment fields to be filled in like card number, billing address etc. The data is sent to the API using POST .../checkout/{id}/payment. The API then submits a request to the payment gateway (e.g. paypal), waits for the response, and then sends an appropriate response back to the client application. **Implementation 2** The resource contains details of how to submit a request directly to the payment gateway (e.g. paypal). The client submits the payment to the gateway, waits for a response, and then sends the payment reference (normally always provided by a payment gateway) back to the API using POST .../checkout/{id}/payment. The problem I am having is that both have pros and cons. Implementation 1 I would say is the more fail safe method as everything is contained in one request to the API. The API can then update backend tables once the payment has been processed, and return success or failure status to the client. Since the API is sending a response to the gateway, it knows the response it receives is genuine. Implementation 2 frees the API from having to process the payment which is great, but requires the client to make two requests. One to the payment gateway and one to the API with the reference. Additionally, how can I validate the payment reference on the API without calling the gateway? A dishonest client could send any reference back to the API which then may be incorrectly marked as paid. Just wanted to throw my ideas out there, but if anyone has a really good solution for implementing Payment Gateways and RESTful API web services that would be great. **UPDATE** Just thought of an **Implementation 3**. I could actually create a separate smaller API to handle the payments. It would work in a similar way to implementation 1 except that the client application doesn't post to api.site.com/.... but posts to gateway.site.com/... This give me a degree of security as I control the code on gateway.site.com and ensures that api.site.com isn't being bogged down by waiting for the payment provider to respond. The gateway api then essentially becomes a client of the main API and posts the payment success details to it. Any thoughts on this?


title: What to watch out for when writing code at an Interview?

text: I have read that at a lot of companies you have to write code at an interview. On the one hand I see that it makes sense to ask for a work sample. On the other hand: What kind of code do you expect to be written in 5 minutes? And what if they tell me "Write an algorithm that does this and that" but I cannot think of a smart solution or even write code that doesn't semantically work? I am particularly interested in that question because I do not have that much commercial programming experience, 2 years part-time, one year full-time. (But I am interested in programming languages since nearly 15 years though usually I was more concentrated in playing with the language rather than writing large applications...) And actually I consider my debugging and problem solving skills much better than my coding skills. I sometimes see myself not writing the most beautiful code when looking back, but on the other hand I often come up with solutions for hard problems. And I think I am very good at optimizing, fixing, restructuring existing code, but I have problems with writing new applications from scratch. The software design sucks... ;-) Therefore I don't feel comfortable when thinking about this code writing situation at an interview... So what do the interviewers expect? What kind of information about my code writing are they interested in?


title: Are short identifiers bad?

text: Are short identifiers bad? How does identifier length correlate with code comprehension? What other factors (besides code comprehension) might be of consideration when it comes to naming identifiers? Just to try to keep the quality of the answers up, please note that there is some research on the subject already! **Edit** Curious that everyone either doesn't think length is relevant or tend to prefer larger identifiers, when both links I provided indicate large identifiers are harmful! **Broken Link** The link below pointed to a research on the subject, but it's now broken, I don't seem to have a copy of the paper with me, and I don't recall what it was. I'm leaving it here in case someone else figure it out.   * http://evergreen.loyola.edu/chm/www/Papers/SCP2009.pdf


title: Best practices: Ajax and server side scripting with stored procedures

text: I need to rebuild an old huge website and probably to port everyting to `ASP.NET` and `jQuery` and I would like to ask for some suggestion and tips. Actually the website uses:   * `Ajax (client site with prototype.js)`   * `ASP (vb script server side)`   * `SQL Server 2005`   * `IIS 7 as web server` This website uses hundred of stored procedures and the requests are made by an `ajax call` and **only 1 ASP page** that contain an huge `select case` Shortly an example: JAVASCRIPT + PROTOTYPE:               var data = {         action:     'NEWS',         callback:   'doNews',         param1:     $('text_example').value,         ......:     ..........};     AjaxGet(data); // perform a call using another function + prototype      SERVER SIDE ASP:               <% ......     select case request("Action")     case "NEWS"         With cmmDB             .ActiveConnection = Conn             .CommandText = "sp_NEWS_TO_CALL_for_example"             .CommandType = adCmdStoredProc                   Set par0DB = .CreateParameter("Param1", adVarchar, adParamInput,6)             Set par1DB = .CreateParameter(".....", adInteger, adParamInput)             ' ........ ' can be more parameters                  .Parameters.Append par0DB             .Parameters.Append par1DB                  par0DB.Value = request("Param1")             par1DB.Value = request(".....")                  set rs=cmmDB.execute                  RecodsetToJSON rs, jsa ' create JSON response using a sub         End With     .... %>      So as you can see I have an `ASP` page that has a **lot of CASE** and this page **answers to all the ajax request** in the site. My question are:   1. Instead of having many `CASES` is it possible to create dynamic `vb` code that parses the `ajax` request and creates dynamically the call to the desired SP (also implementing the parameters passed by JS)?   2. What is the best approach to handle situations like this, by using the advantages of `.Net + protoype or jQuery`?   3. How the big sites handle situation like this? Do they do it by creating 1 page for request? Thanks in advance for suggestion, direction and tips.


title: Alternatives to foreach iterators involving ref and out

text: I am trying to make a flexible particle system for my XNA game, and I've got these interfaces:               public interface IParticle : IUpdateable     {         bool Alive { get; }         float Percent { get; }     }          public interface IParticleEffect<T>         where T : IParticle     {         void Apply(GameTime time, ref T particle);     }          public interface IParticleEmitter<T> : IUpdateable         where T : IParticle     {     }          public interface IParticleRenderer<T> : IDrawable         where T : IParticle     {     }      The idea behind this system is that the client code only needs to derive from `IParticle`, then make a compatible subclass from `IParticleEmitter` and `IParticleRenderer`, and everything else just automagically works behind the scenes. (I'm actually in the middle of writing everything at the moment, but the latter two would have an abstract base class available.) Anyways, some particle systems like to use mutable structs for optimization purposes, and that's perfectly reasonable. My system only provides the skeleton, and if the client decides that "Hey, structs are the way to go!", then my system should support whatever the client code throws at it. This is why my `IParticleEffect.Apply()` method takes a particle by **ref** \-- it's cheaper to pass a struct by reference than it is to copy it. Unfortunately, it breaks when collections are involved, because the foreach iterator doesn't play nicely with objects passed by **ref** or **out**. Eric Lippert explains why here. So, now I have a design decision to make:   1. Completely disregard structs, and change my constraint to `where T: class, IParticle`. This potentially hurts future optimizations, but makes it much easier to work with collections.   2. Change anything that uses `ICollection<T>` or `IEnumerable<T>` to `IList<T>` so I can manually poll it via an indexer. This makes it potentially more powerful, but at the cost of using a deeper interface (list) to store my objects.   3. Something else I hope this question isn't too "it depends", but I am curious as to what strategies I can apply here to make it work the way I want. * * * **EDIT** : I realized that I could also include a local variable such as:               foreach (var particle in SomeParticleCollection)     {         var p = particle;         SomeEffect.Apply(ref p);     }      However, `p` would still have the net effect of copying it, which is also not ideal.


title: When is it appropriate to use a bitwise operator in a conditional expression?

text: First, some background: I am an IT teacher-in-training and I'm trying to introduce the boolean operators of java to my 10th grade class. My teacher- mentor looked over a worksheet I prepared and commented that I could let them use just a single & or | to denote the operators, because they "do the same thing". I am aware of the difference between & and &&.   & is a bitwise operator intended for use between integers, to perform "bit- twiddling".   && is a conditional operator intended for use between boolean values. To prove the point that these operators do not always "do the same thing" I set out to find an example where using the bitwise between boolean values would lead to an error. I found this example               boolean bitwise;     boolean conditional;     int i=10, j=12;     bitwise = (i<j) | ((i=3) > 5); // value of i after oper: 3     System.out.println(bitwise+ " "+ i);     i=10;      conditional = (i<j) || (i=3) > 5 ;  // value of i after oper: 10     System.out.println(conditional+ " "+ i);     i=10;      bitwise = (i>j) & (i=3) > 5;   // value of i after oper: 3     System.out.println(bitwise+ " "+ i);     i=10;      conditional = (i>j) && (i=3) > 5;  // value of i after oper: 10     System.out.println(conditional+ " "+ i);      This example shows that if a value has to be changed by the second half of the expression, this would lead to a difference between the results, since bitwise is an eager operator, while the conditional behaves as a short circuit (does not evaluate the second half, if the first half is false in the case of && and true in the case of ||). I have an issue with this example. Why would you want to change a value at the same time as you do a comparision on it? It doesn't seem like a robust way to code. I've always been averse to doing multiple operations in a single line in my production code. It seems like something a "coding cowboy" with no conscience as to the maintainability of his code would do. I know that in some domains code needs to be as compact as possible, but surely this is a poor practice in general? I can explain my choice of encouraging the use of && and || over & and | because this is an accepted coding convention in software engineering. But could someone please give me a better, even real-world, example of using a bitwise operator in a conditional expression?


title: Apps being portable

text: I haven't found much on this, but what I did find doesn't explain it well enough (at least for me). What makes the application I make portable?   Or what defines a portable application?   Is there a specific difference that makes an app portable or not? I always thought if I just made an executable file and some images I could just copy that folder and take it to another computer on a flash drive. But, if you could what is the purpose of having "portable" apps? I know I have asked a range of questions, but I suspect an answer that addresses one of the questions will cover them all.


title: Random forest ML algorithm suitable for use on cluster based HPC?

text: I need help in identifying a better algorithm. I have developed a script using pythons scipy package to analyse a rather large model that I wish to solve. The model contains over 12GB of data including over 500 parameters. The problem is that when I run small simulations of about 0.5GB of data with 20 parameters it can take my computer a decent amount of time if I allow a reasonable number of iterations through the random forest classifier. Currently my script is only using one core, so I guess that making the script multi-threaded would be the first step. But I do not believe this will be enough given how complex the model is. I am willing to explore the use of a cluster based HPC solution but I am not sure how to go about this. Are there better algorithms I can use, or is there a cluster based algorithm that would be more appropriate?


title: How to solve "train wreck" properties problem that violates Law Of Demeter?

text: I've been reading about law of Demeter and I would like to know how to solve this traversing model properties problem that I see a lot on Objective-C. I know that there is a similar question but in this case I'm not calling a method from the last property that do some calculations, instead, I'm just setting values (Ok, I know that getter are methods but my intention here is just to get the value, not to change the state of some object). For example:               self.priceLabel.text = self.media.ad.price.value;      Should I change that for something like:               self.priceLabel.text = [self.media adPriceValue];      and inside the Media.m               - (NSString *)adPriceValue {         return [self.ad priceValue];     }      and inside the Ad.m               - (NSString *)priceValue {         return [self.price value];     }      Is that a good solution? Or Am I creating unnecessary methods?


title: Dealing with bad job description and interviewing applicants

text: My employer has been looking for a new web developer as well as a DBA for a while now with little success. I just saw the job description, and now I can understand why we are getting no interest - they have lumped together three jobs into 1 position: web developer, DBA, and marketing SEO/Analytics expert all under the title of "Webmaster". It's hard enough to find someone who can do any of those individual things well, let alone somebody who can do it all (or wants to be called "Webmaster" these days). Part of their motivation is, no doubt, saving money by hiring 1 person to do three jobs and underpaying that person. But now I have to deal with interviewing people for this position (that is, if we ever get an applicant), and trying to figure out what this person is _really_ going to be doing once hired. Have you had experience with this sort of thing? Either as an applicant or as an interviewer. And how did you deal with it? Assuming that rewriting the job description to something more realistic isn't an option, what would be the best way of handling this (finding the right person, interviewing them effectively, etc.)?


title: How to better performance

text: In one of my interviews I was asked a vague question, I'm still not sure of the answer. We have a client and a server they are placed apart. The network that connects them has high latency, which is dominating the performance. How can we improve the performance. Note that we can't change the network's topology. I was thinking of caching, breaking the request to multiple smaller requests and opening multiple connections with the server. Any ideas? Please note that the question description is vague and I wasn't supplied with more information about the situation. **Clarified question:** How should the client-server communication be designed in order to get the best performance on a network that has big latency?


title: Any Course/Lecture videos on Design Patterns

text: I am planning to read some design patterns and I took the book on "design patterns in C++' by gang of four. However, I am not really some one who reads book and prefers reading slides/watching course lectures and then apply and read the book. I cannot find any course lecture videos on net(yeah, its not that important a course as algo/OS). Any one know any course website, preferably on C++


title: Add a unit test for each new bug

text: In my job all developers that resolve a bug have to add a new unit test that warns about this type of bugs (in the case it occours again). If a unit test is not possible (for example, a webpage design issue), then QA department has to create a test case to manually check it. The idea behind this is that if a defect has not been detected before the product release is because there isn't an appropriate unit test to detect it. So the developer has to add it. The question is: is this common in any software development methodology? This technique has a name? I would like to learn more about it, but I need some information to start with it.


title: Developing Android apps for someone else

text: We have developed several apps and published them on Android Market. We are now writing an app that another company will brand and sell through their own publisher account. The other company has no experience with Android Market or with Android development. I'd appreciate any insights from others who have faced similar situations. I'm specifically concerned about the following areas:   1. **Signing the app**   The alternatives we see are: sign with our usual key; create a signing key pair specific to the other company and sign with that; or help the other company install a development system, generate a key pair, and do the signing themselves. The latter would require us sending them the project sources, which presents its own problems. Other than our concern about sending the source, does the choice matter in any way?   2. **Licensing**   Since the license check will be done against their account, the code will need to embed their public key for decrypting the license response. Is there any reason they should be concerned about sharing that key with us? Are there any alternatives to them sharing the key with us?   3. **Publishing**   The other company is responsible for all marketing and sales; we are responsible for the app development. From what we can tell, Android Market is not set up to allow a clean separation of these roles. (It assumes that the developer will also be the publisher.) This makes it difficult to work out a division of responsibilities for the publication process. Our initial thought was to deliver the .apk file to them and let them handle it from there. The licensing issue was the first indication that we were being naive about this. The publishing process itself is rather technical, and we see two alternatives: walk them through all the steps or ask them to give us access to their publisher account and do it ourselves. What do others do?