title: Optimizing programs by identifying and taking evaluation (calculation) shortcuts

text: Recently I am working on a project that involves a lot of simple numerical calculations being applied to large arrays. The numerical values are very simple but there are many different types, such as positive integers, negative integers, small floating point numbers, and so on. SIMD programming techniques (such as SSE) are widely used. I noticed that a lot of times processing speed can be improved if I can find shortcuts in the calculations. For example, if the inputs are integers and the outputs are also integers, I should try my best to avoid converting to floating point numbers if possible. For simple chained calculations this is easy. However, when we increase the number of operations that can be combined, we find that we have to manually code those SIMD instructions for each case. I have studied the approaches taken by various vectorization libraries, and observed that while their approaches are very elegant in code using metaprogramming techniques, most compilers aren't able to generate optimized machine instructions from the results. If I represent the calculations with command objects, will I have a better chance of matching small sections of the command chain and substituting with shortcuts?


title: When to do code reviews when doing continuous integration?

text: We are trying to switch to a continuous integration environment but are not sure when to do code reviews. From what I've read of continuous integration, we should be attempting to check in code as often as multiple times a day. I assume, this even means for features that are not yet complete. So the question is, when do we do the code reviews? We can't do it before we check in the code, because that would slow down the process where we will not be able to do daily checkins, let alone multiple checkins per day. Also, if the code we are checking in merely compiles but is not feature complete, doing a code review then is pointless, as most code reviews are best done as the feature is finalized. Does this mean we should do code reviews when a feature is completed, but that unreviewed code will get into the repository?


title: Calculation of Milestones/Task list

text: My project manager assigned me a task to estimate the development time for an iPad application. Lets assume that I gave estimation of 15 working days. He thought that the number of days where too many and client needed the changes to the application urgently (as in most of cases). So, he told me: "I am going to assign **two** developer including you and as per my understandings and experience it won't take more than **seven** working days." **Clarifications** I was given the task of estimating development time for an individual. How could I be sure that 2 developers are going to finish it within 7 days? (I am new to team & I hardly know the others abilities) **Questions**   * Why do most of project managers / team leaders have understandings like:      * If one developer requires N days,     * Then two developers would require N/2 days,   * Do they think something like `developer = s/w production machines`?   * Should a team member (developer, not team lead or any higher post) estimate other developers work? I didn't deny anything in the meeting and didn't said, but what should be the appropriate answer to convince them that N/2 formula that they follow is not correct?


title: Do TODO comments make sense?

text: I am working on a fairly big project and got the task to do some translations for it. There were tons of labels that haven't been translated and while I was digging through the code I found this little piece of code               //TODO translations      This made me think about the sense of these comments to yourself (and others?) because I got the feeling that most developers after they get a certain piece of code done and it does what it's supposed to do they never look at this until they have to maintain it or add new functionality. So that this `TODO` will be lost for a long time. Does it make sense to write this comments or should they be written on a whiteboard/paper/something else where they remain in the focus of developers?


title: Requirement, architecture data capture tool

text: Are there any tools available for the following use case: I am planning to write a complex application and now I just know about the basic functional requirments. I am refining the functionality with more and more details. I am also writing down how to implement this in software architecture perspective. I am in a situation where there are multiple ways implement a certain functionality and based on the selected approach, other parts of the program will also change. At this moment, I don't want to decide on the approach to use, I just want to list down all the options, present to a wider audience and get it finalized. Are there any standard software tools to do this? I know I can use MS excel or some mind mapper tools, but just thinking of some standard tools (not just for programmers, but for managers and other) availability Thanks, Den


title: What relationship would this be and how to implement

text: I have a pet project where I am making a Grade Book Application to better teach several different topics in DB, OOP and Planning. Im running into some issues with the database planning of things. For the record I am learning all of this by using online resources, books and trial and error in no way am I professional. I have 3 Tables (Teachers, Courses, and Assignments). 1) Many Teachers can Teach Many Courses - So this would be a M2M Relationship where I would need a third table to cross reference Teachers and Courses by their PK. Is it okay to have that third table have extra columns to show unique data about the courses like Title of the course or should that go into the course table? And if it depends how would you know which is the best way? 2) One Course can have Many Assignments or is it Many Courses can have Many Assignments? I feel this is a stupid question but I can not grasp on which would be a correct fact statement? 3) Does anyone know of any Database Diagrams that shown an example of a very simple gradebook layout, I have been looking on google but couldn't find anything that was not in my realm.


title: Sequentially/parallel algorithm for extracting blob outer perimeter/contour length

text: I have labelled the connected components in a binary image and found their areas and bounding boxes. The components are not necessarily filled, and may contain holes. I wish to identify the component that resembles a pupil the most. For this, I would also like to extract ( **only** ) their outer perimeter lengths, for calculating circularity, since these are good features for pupil detection. I plan to do this sequentially and then move the algorithm to CUDA afterwards, so the algorithm should be parallelisable to some extent. I should note that this work is for my thesis, and I am not asking you to solve anything for me, just provide some feedback on my research so far. I investigated tons of articles for this problem, but it seems most of them are concerned with connected component labelling and not feature extraction. Alas, I found three candidates, and ~~two~~ one of my own design:   1. **The Marching Squares algorithm**. It sounds promising (also embarassingly parallel), but it appears to extract all perimeter lengths, including inner contours, without modification, which will likely overestimate perimeter lengths. However, since I am looking for the pupil, a homogenously colored area, it will likely not overestimate the pupil. The overestimation might also yield bad results for other irregularly shaped blobs, which should be fine if they are then not selected.   2. **The Chain Code algorithm** (used by OpenCV's findContours function): Seems pertty good as well, and parallel solutions do exist, but I worry it might fail if the stopping criterion is not good enough (see here, at the bottom near Jacob's stopping criterion). However, it should be able to extract only the outer contour and give good approximations.   3. **The Convex Hull algorithms** : While parallel solutions exist, I worry that it might make a blob more circular than it really is, if points are scattered in a way that favors this. Should give good results for the pupil blob though.   4. ~~**Algorithm 1** : You could launch some threads that trace from each side of the blob's bounding box towards the opposite side. When the threads "hit" a pixel with the blob's label, they mark it as visited and sum the hits. When another side is traced, visited pixel are ignored, hit pixels are summed again etc., and the total is returned.~~   5. **Algorithm 2** : I also tried counting the number of pixels with a background pixel in their Moore neighborhood, but this overestimates the contour if enough holes are present. I would appreciate some suggestions before I try to code everything since I am on a schedule. Again, I'm just asking for advice, not solutions.


title: In what situations does it make sense to use an enumeration when writing object-oriented code?

text: Enumerations1 are often associated with procedural code rather than object- oriented code. They tend to give rise to similar switch statements scattered through the code, and in general, these are replaced by polymorphism in object-oriented code. For example, see _Replace Type Code with Class_ , _Replace Type Code with Subclasses_ , and _Replace Type Code with State/Strategy_ in _Refactoring_ by Martin Fowler. Closely related, see _Replace Conditional With Polymorphism_ in the same volume; Bob Martin also has quite a bit to say on the disadvantages of switch statements in _Clean Code_ (for example, heuristic G23 _Prefer Polymorphism to If/Else or Switch/Case_ ). However, since object-orientation, like any other good paradigm, can be a powerful tool but is not a silver bullet, are there times when using an enumeration is a good decision? * * * 1I use this term broadly; not just for something which is strictly an `enum` in a C-based language, but for any set of entities that are used to represent it (a class with a set of static members, etc...).


title: In Asp.net, how browser knows a textbox is registered with server side TextChanged event?

text: When I evaluate asp.net control events, I am not able to identify how the browser is aware of asp.net textbox is subscribed to serverside textchanged event or not. When I look the server generated HTML code, there is not information about the TextChanged event. **ASP.Net Declaration**               <asp:TextBox ID="txtInput" runat="server" OnTextChanged="txtInput_OnTextChanged"         AutoPostBack="false" />      **Server Generated HTML Code**               <input name="ctl00$MainContent$txtInput" type="text" value="SivaText Input ChangedText Input Changed.V ChangedText Input Changed.V Changed" id="MainContent_txtInput">


title: How to be better at reviewing code?

text: First I firmly believe in the code review process and always want someone else to review my code. My question really centers around how can I do a better job at performing a code review for someone else? I know that to perform a code review you need to have knowledge of the how the existing code works and a knowledge of what the local standard is, both of which I feel that I know very well. Still I feel like I never do a good enough code review for other people. Also I know that certain people seem to do a better job review code than others so I am wondering for those that are great code reviewers what are the techniques that you use?


title: Handling multiple clients using single application

text: We are developing an ERP web application using Vaadin framework where each of the potential client companies will have their own data and file storage. Current implementation only allows having one client company per application instance, what consequently requires separate database schema and file storage. Some of the clients may want specific customizations based on their needs. Having few clients doesn't cause much trouble, but if number of clients would grow, then maintaining dozens of application instances will be a real challenge. We are reaching that point where we have to choose one these options:   1. Improve our architecture to allow all client companies manage their data on a single application instance and restrict personal customizations to the application;   2. Stick with the current implementation and just keep increasing number of running application instances on the server. Which of these options is considered better practice and would make the system easier to maintain? Is there a different solution for this kind of situation? Edit: Application is currently in development stage. The server with all the potential application instances will be run by ourselves. Each instance will be deployed in a WAR package via Apache Tomcat server.


title: What technologies are used for an Android/iPhone App to interact with a database

text: Do Android/iPhone Apps use AJAX to interact with the backend? If yes, is this common? Or do most apps use a different method for fetching database information. And if so, what other methods are there? Are server-side languages ever involved, and if so, is that more common to see with app development?


title: What happens to get database information on the server-side with AJAX?

text: I'm slightly confused about how AJAX works. I mostly understand the PHP/MySQL model of retrieving database information for the user, but how does AJAX do it? From what I understand the AJAX engine sends an HTTP request to the backend which does some magic and returns XML data to the AJAX engine which translates it to HTML+CSS for the user to see, but what happens when it sends that first HTTP request to the backend? Is a server-side language acting as the middleman there to get data from the database for the rest of the process? Also, does HTML5 put any extra spin on the usage of AJAX?


title: Meaningful concise method naming guidelines

text: Recently I started releasing an open source project, while I was the only user of the library I did not care about the names, but know I want to assign clever names to each methods to make it easier to learn, but I also need to use concise names so they are easy to write as well. I was thinking about some guidelines about the naming, I am aware of lots of guidelines that only care about letters casing or some simple notes. Here, I am looking after guidelines for meaningful but yet concise naming. For example, this could be part of the guidelines I am looking after:   * Use Add when an existing item is going to be added to a target, Use Create when a new item is being created and added to a target.   * Use Remove when an existing item is going to be removed from a target, Use delete when an item is going to be removed permanently.   * Pair AddXXX methods with RemoveXXX and Pair CreateXXX methods with DeleteXXX methods, but do not mix them. As the above samples show,I would like to find some online material helping me with naming methods and other item complying with English grammar and word meanings. The above guidance may be intuitive for native English speakers, but for me that English is my second language I need to be told about things like this.


title: WCF vs Web API, Deeper details?

text: **Before I continue, I just want to mention I have heavily researched and searched on this topic, but I need the opinion of people who have worked/and or have practical knowledge with regards to this topic.** We are currently looking at developing an API so that clients can utilize this. We are definitely set on REST as opposed to SOAP, but I am still a little unclear about what exactly the difference is, if you go down to microscopic detail. Having a look at msdn (Choosing which technology to use), the link below: http://msdn.microsoft.com/en-us/library/jj823172.aspx The differences are clear. However, the first point states for **WCF** : Enables building services that support multiple transport protocols (HTTP, TCP, UDP, and custom transports) and allows switching between them. For **ASP.NET Web Api** : HTTP only. First-class programming model for HTTP. More suitable for access from various browsers, mobile devices etc enabling wide reach. So, both support HTTP, but WCF supports more protocols in addition. What makes ASP.NET Web API more suitable for, I quote: "More suitable for access from various browsers, mobile devices etc enabling wide reach." if both support HTTP? We have until now, relied heavily on PC use. What I am getting to, and finally my question is: We plan on going mobile, and moving a lot more to multiple devices, browsers etc. But I just would not like to go on a service on the basis of a bit of text saying "Web API" is more suitable? IS it more efficient, less resource intensive etc.? With regards to future proofing? Would we be better of with WEB API and why? Just lastly, we have existing SOAP services, everything we have is built in SOAP. Please do not hesitate to go into detail, I am not an experienced dev, just trying to add a contribution to this project. Just a last couple of requirements: 1) We plan on utilizing JSON. 2) We are limited to .NET 3.5/4. 3) Must be REST.


title: boolean operations in C using bitfields

text: I am trying to implement boolean data type in C. Basically, I am working with sets. The following code can be used to access each bit but I am unsure whether I can represent sets using this method. Can somebody clarify this for me?               struct SET {     unsigned int b0     :1;     // bit 0 single bit     unsigned int b1     :1;     // bit 1 single bit     unsigned int b2     :1;      unsigned int b3    :1;      };      I can define two structures s1 and s2.. and I will be able to access each bit of these structures (treated as boolean strings). I will have to perform set operations like UNION, INTERSECTION and MEMBERSHIP. Is this even possible in C? Note: I cannot use Java, only C.


title: Does it make sense to implement OAuth for a 2 party system?

text: I'm under the impression that OAuth is for authentication between three parties. Does it make sense to implement OAuth in a context where there is just a client and server. We have a server, and a client (HTML/javascript). Currently we authenticate via the normal "post credentials to server, get a cookie, use cookie to authenticate all subsequent requests" method. Will implementing OAuth be a benefit in this situation?


title: Do you consider mainframe as part of large application deployments?

text: When you are setting up your system landscape for large and/or multiple application deployments, do you consider mainframe? If not, why not? If so, what factors are you considering. If you take a _real_ TCO look at large ERP and/or consolidated application landscapes, mainframe is actually quite cost-effective. My own consultations have included recommendations for scale-up/mainframe/mid- size systems on some specific needs. Honestly, I've never had a customer take said recommendation, rather defaulting to countless scale-out VMs on Intel boxen (in non-trivial cost) and yet still to this day have system management and performance issues. Curious your take on this. We need to remember that the virtual machines we manage (and apparently love in IT departments) today have been done for decades on mainframe. Most mid-size and mainframe shops have small fractions of support persons managing larger and more complex applications. Your thoughts appreciated.


title: Are NoSQL databases going to take the place of relational databases? Is SQL going away?

text: Does anyone have experience with NoSQL databases (CouchDB, MongoDB, Google's BigTable, Dynamo, Cassandra...)? What was it like? Was it actual production/on the job experience? What will happen to the relational databases in 5 years? 10 years?


title: When is it appropriate to use Microsoft's Enterprise Library (EntLib)?

text: I'm not exactly sure when to use Enterprise Library, and when not to... and that is making me not learn it at all. I feel that I have enough of a reason to **start learning** then perhaps one day I'll **use** it. Are there times when I should use EntLib? When shouldn't I use it?


title: Have objects delivered in terms of code reuse?

text: I have often heard it said that objects have not delivered in terms of code reuse. Do you agree? If you believe that they haven't, why not?


How to choose the right next step in learning programming and mastering new technologies? I have experience with WinForms applications in C# .NET. Next what I see as a good area of expanding the knowledge is ASP.NET. Language I already know, C #, so I think there is now more a matter of mastering new technologies. Also I have interest in WPF. Perhaps the best is to work on ASP.NET and WPF at the same time. Sometimes the problem is when we do not have motivation, but also known to become a problem when we want to much :) How to choose a new technology for mastering and not lose sense of reality and practicality?


title: Switch interface implementation using configuration

text: We want to allow the same core service to be either fully implemented or, as other option, to be a proxy toward a client legacy system (via a WSDL for example). In that way, we have both implementation (proxy & full) and we switch which one to use in the configuration of the app. So in a nutshell, Some desired features:   * Two different implementation (proxy, full) instead of one implementation with a switch inside   * Switch implementation using configuration: dependency injection? reflection?   * Nice-to-have: the packaged delivered to the client doesn’t have to change depending on the choice between proxy or full   * Nice-to-have: Client can develop their custom implementation of the Core Interface and configure the applciation to use that one With this background, the question is: What alternatives we have to choose one implementation or other of an interface just changing configuration? Thanks


title: how to create a data model for the following problem

text: How to tackle 2-D and 3-D space in data ? lets say you are working on a power grid problem. You need to represent Towers; transmission lines; transformers and every thing else in a 2-D space. How would you design a Data Model for this 2-D space ? I can use a               class tower  {     int x_cor;     int y_cor;     string power_properties     }      But how to represent the ... say map of the power grid itself ? is there some standard solution to this ? some logical template people follow here ? i want to be able to slice this map by shape or area etc; i should be able to compose small maps to make a large one .. So what is the solution here ?? By the way i am not working on a power-grid project (LOL) so please keep answers generic .. P.S. non-noobs please help me make the question better.


title: Possible problems in a team of programmers

text: I am a "one man team" ASP.NET C#, SQL, HTML, JQuery programmer that wants to split workload with two other guys. Since I never actually thought of possible issue in a team of programmer, there are actually quite a few that came to my mind. delegating tasks (who works on what which is also very much related to security). I found Team Foundation Service could be helpful with this problem and started reading about it. Are there any alternatives? security (do now want for original code to be reused outside the project) How to prevent programmers from having access to all parts of code, and how to prevent them from using that code outside of project? Is trust or contract the only way?


title: Are there any technical obstacles for implementing `function* ()` syntax

text: In Python we have `yield` which is very similar to that one which is proposed in ES6 (in fact, pythonic co-routines were the main source of inspiration for implementing co-routines in I wonder what are the reasons for choosing a separate `function* ()` syntax for generators compared to just defining "regular" functions with yeilds - just like in python by the way? I'm talking strictly of technical issues and peculiarities. Why it had been decided that a separate form will be more appropriate?


title: How do you demo software with No UI in the Sprint Review?

text: We are doing agile software development, basically following Scrum. We are trying to do sprint reviews but finding it difficult. Our software is doing a lot of data processing and the stories often are about changing various rules around this. What are some options for demoing the changes that occurred in the sprint when there isn't a UI or visible workflow change, but instead the change is a subtle business rule on a processing job that can take 10s of minutes or even a couple of hours?


title: How to properly shield a Product Owner from outside?

text: **Update:** We are a very small team (3 people) and thus I (Scrum Master) and the Product Owner are also developers doing some coding. We are aware of this situation and we are actively trying to recruit some new talents. But it's hard! * * * Meanwhile... we need to adapt... so my question: The Product Owner complains about having too much outside noise (mainly stakeholders feature requests), and he can't focus on the sprint realisation. We agree that we should try to educate people on our process implications (sprint durations and product backlog), to reduce the noise. But as a Scrum Master, how am I supposed to shield a PO from outside? Isn't he supposed to be in contact with the management and business? Also, if people outside don't want to waste too much time learning agile, what is the best way to educate them?


title: How to cope with the problem of (compiling) a large code base?

text: Although I can code, I don't yet have any experience with working on large projects. What I did so far was either coding small programs that get compiled in matter of seconds (various c/c++ exercises like algorithms, programming principles, ideas, paradigms, or just trying out api's...) or working on some smaller projects that were made in a scripting language(s) (python, php, js) where no compiling is needed. The thing is, when coding in a scripting language, whenever I want to try if something works - I just run the script and see what happens. If things don't work, I can simply change the code and try it out again by running the script again and keep on doing that until I get the result that I wanted.. My point is that you don't have to wait for anything to compile and because of that it is quite easy to take a big code base, modify it, add something to it, or simply play with it - you can see the changes instantly. As an example I will take Wordpress. It is quite easy to try and figure it out how to create a plugin for it. First you start by creating a simple "Hello World" plugin, then you make a simple interface for admin panel to familiarize yourself with API, then you build it up and make something more complex, in the mean time changing how it looks a couple of times.. The idea of having to recompile something as big as WP over and over again, after each minor change to try "if it works" and "how it work/feels" just seems inefficient, slow and wrong. Now, how could I do that with a project that is written in a compiled language? I would like to contribute to some open-source projects and this question keeps bugging me. The situation probably differs from project to project where some of them that were pre thought wisely will be "modular" in some way while others will just be one big blob that needs to be recompiled again and again. I would like to know more about how this is done properly. What are some common practices, approaches and project designs (patterns?) to cope with this? How is this "modularity" called in programmers world and what should I google for to learn more about this? Is it often that projects grow out of their first thought proportions which becomes troublesome after a while? Is there any way to avoid **long compiling** of not-so-well designed projects? A way to somehow modularize them (maybe excluding non-vital parts of program while developing (any other ideas?))? Thanks.


title: How can a large, Fortran-based number crunching codebase be modernized?

text: A friend in academia asked me for advice (I'm a C# business application developer). He has a legacy codebase which he wrote in Fortran in the medical imaging field. It does a huge amount of number crunching using vectors. He uses a cluster (30ish cores) and has now gone towards a single workstation with 500ish GPUS in it. However where to go next with the codebase so:   * Other people can maintain it over next 10 year cycle   * Get faster at tweaking the software   * Can run on different infrastructures without recompiles After some research from me (this is a super interesting area) some options are:   * Use Python and CUDA from Nvidia   * Rewrite in a functional language. For example, F# or Haskell   * Go cloud based and use something like Hadoop and Java   * Learn C What has been your experience with this? What should my friend be looking at to modernize his codebase? UPDATE: Thanks @Mark and everyone who has answered. The reasons my friend is asking this question is that it's a perfect time in the projects lifecycle to do a review. Bringing research assistants up to speed in Fortran takes time (I like C#, and especially the tooling and can't imagine going back to older languages!!) I liked the suggestion of keeping the pure number crunching in Fortran, but wrapping it in something newer. Perhaps Python as that seems to be getting a stronghold in academia as a general-purpose programming language that is fairly easy to pick up. See _Medical Imaging_ and a guy who has written a Fortran wrapper for CUDA, _Can I legally publish my Fortran 90 wrappers to Nvidias' CUFFT library (from the CUDA SDK)?_.


title: Need advice on which route I should take for porting app from Android to iOS

text: I have developed this android application  and I am looking to port it to iOS. My questions are: 1) I am planning to finance the iOS development with the money earn't from the android sales which is about $200 at the moment. Would it be reasonable to get the project done for this amount even if it is outsourced to elance or odesk etc? 2) I have heard the code quality for outsourced iOS projects to be bad, I dont want any memory leaks and crashes because of overflows etc. 3) I currently dont have a full time job so I can technically do the project myself, however I dont have a apple pc or iPhone (dont really want to get them either). I know C pretty well but I haven't really released a major C project that must be 100% stable. How many hours to learn iOs and do the port? And would it be worth my time taking into consideration that if I do enjoy it I may get into it fulltime. 4) What would the demand be like for someone that can do Android and iOS? Thanks


title: Data encryption/protection - where to find info about high-level best practices

text: I feel that no one in the group I work in, myself included, _really_ groks encryption and security, or the reasons behind making certain decisions. For example, we recently had a conversation regarding encryption of data that we handle for another group that we work with - the data ends up in a database that is on our secure corporate network (I work in a small group in a large software company, so the integrity of the corporate network is very high), along with everything else we handle. Of course, standard guidelines call for "encryption" of this data. Obviously, that could mean many things - IPSec/encrypted connections, encrypted fileshares, encryption implemented in the DB (whole-DB or column), encryption of the actual bits in the file, etc. - and some people in the group are under the impression that the only kind of encryption that really counts is directly encrypting the bits that are stored, the argument being that everything else is too easy to circumvent - "if the DB is encrypted, I could still log into it and see the data there; if the file share is encrypted, as long as I have permissions to the folder I can just grab the file; but if the bits are directly encrypted, I won't be able to read it". My instinct says that that statement is based on limited understanding: they can see themselves logging into SQL Server Management Studio to see the data, but since they wouldn't know how to take a stream or array of encrypted data and use a certificate that they probably have access to to decrypt it, it's probably safe. Are they right? Am I right? No one seems to really know, so decisions get based on the opinion of the loudest or highest-paid person. Anyway, that's just kind of an extended example of what I'm talking about. I feel like it's the blind leading the blind here, with decisions based on limited understanding, and it's frustrating. I'm no expert on the technical bits of encryption, but I know how to use standard libraries to encrypt streams and arrays and the like - where I really need more knowledge is about architecting data security and information on which I can base decisions like the above. Where can I read about this kind of stuff?


title: Why don't we use browser detection and platform-specific CSS?

text: Nowadays, the common phenomena is to develop a website for a browser and then corresponding apps for Android phones, iPhone, tablets and so on. Since all the platforms come with a browser, why aren't companies using CSS to accommodate them? Surely we can detect from the request which browser was used and from which platform the request came. Reading those values, why don't we just implement the corresponding CSS for different platforms. Like we do for IE, Chrome and Safari. This way we can use the platforms' browser capabilities and don't need to develop subsequent apps for a platform.


title: Why is the Repository pattern needed in NHibernate?

text: I am reading the official Your first NHibernate based application. While the tutorial is good and easy to follow, I am wondering why the Repository pattern is used. In the various `Add`, `Update`, `Remove` methods in the `ProductRepository` implementation, the code is nearly identical - they are all using transactions, and the difference is in the "meat" i.e. call `session.Save` int the `Add` method, `session.Delete` in the `remove` method. ( _The page lacks HTML anchors, but you can search the page for the relevant code like`public void Remove`, `public void Add`_) That code just "feels wrong". Why is the author using the Repository pattern - is it just for demonstration of using NHibernate or is that required or some other reason? Ps. My background is from Ruby on Rails using ActiveRecord so I'm trying to make sense of how NHibernate works/is used.


title: Best projects that illustrate the strengths of the languages they are implemented in?

text: I'm looking for a who's who list of projects(open source) that really illustrate the strength of the languages they are written in. Ideally the project should make use of some features of a given language that would otherwise be clunky or difficult to do in another language.


title: Scrum and Scrum Master on a global team

text: I work in a company that runs on a model of using one developer as tech lead (me), with an onshore co-ordinator/developer who co-ordinates the offshore team, and on the offshore team there's an off-shore co-ordinator. It sounds bizarre but it basically works. The rest of the developers are offshore. I happen to be on a project now that has an additional onshore developer. My question is, do you think I can use some agile methodologies here in a loose sense (we're a waterfall company, but maybe I could do scrum, sprints, planning poker, etc)? Also, do you think we could benefit from a scrum master? What if I didn't have the additional onshore developer (so basically I'd be one of two onshore developers then, and neither of us might be on the project full time)? What about me giving up the coding I do and becoming scrum master & tech lead? See my comment below for my duties now.


title: Do Flexibility and Inconsistency,Unsafety Overlap?

text: I was lately doing some research about different programming languages. I was interested particularly to learn unique features of popular programming languages and situations where these assets shine. I believe this can help me to decide what language to use depending upon the problem to solve. I found that many languages offering high level of flexibility ("can adapt to new, different, or changing requirements") are also inconsistent, for example in JavaScript (just an example, no offense to js people), arguments of a function get be manipulated either by naming them in the function declaration (classic approach):               function max(x,y)      Or by using the `arguments` variable:               function max() {         if (arguments[0] < arguments[1])             return arguments[1];         else             return arguments[0];     }          c = max(1,2);      The arguments variable is useful for many situations such as function overloading, however, it defeats the purpose of function prototyping (which is to give information about the function), and I saw many JavaScript samples where the argument variable is being used despite there is no need for it, which clearly makes the code harder to understand and debug. I know that this depends heavily on the users of the language, but usually, code written in a language offering high flexibility tends to be unsafe, harder to understand,optimize and to debug. Do flexibility and inconsistency overlap? How do languages designers make the choice? Edit: I'm not critiquing any particular language here, I'm rather focusing on the relation between Flexibility,Safety,Consistency of programming languages.


title: How to make a GPL license with more severe penalties?

text: I am considering open sourcing some software, but when I read the answers on this questions, it seems like the penalty of ignoring a GPL license is rather small, compared to the costs of the suing party to document that the other party has included GPL code in their proprietary code and the costs of suing. Therefore, I would like to know if there is a way to make a license or some kind of contract before source code is accessed, which is stricter than GPL. What I want to achieve is that a company including GPL code in their proprietary code have to GPL their whole code, and not just rewrite the GPL code. Is this possible?


title: What exactly is "Web API" in ASP.Net MVC4?

text: I know what a Web API is.   I've written API's in multiple languages (including in MVC3).   I'm also well practiced in ASP.Net.   I just discovered that MVC4 has "Web API" and without going through the video examples I can't find a good explanation of what exactly it IS.   From my past experience, Microsoft technologies (especially ASP.Net) have a tendency to take a simple concept and wrap it in a bunch of useless overhead that is meant to make everything "easier".   Can someone please explain to me what Web API in MVC4 is exactly? Why do I need it? Why can't I just write my own API?


title: What useful expressiveness will be impossible in a language where an expression is not a statement?

text: I am contemplating writing a programming language. Most grammars define expressions as being a kind of a statement. But really I cannot come up with a single example of any useful expression that would pass as a statement. See http://stackoverflow.com/questions/19132/expression-versus-statement for an easy definition of expression vs statement. EDIT: Why are so many grammars making the distinction between expr and stmt when as noted in the answers, it makes no sense.


title: Choosing a restrictive licence for open source work

text: If you were putting some work of yours online (say, a research project still in development or something alike) and **_it had to_** be made available to the public, but you wished that if someone uses it, he has to acknowledge the original author (i.e. you don't want anyone pushing your research as their own) what would be a good licence to use? In other words, you wish to protect your own work which, were it not for some rules, would never been actually made public.


title: Science degrees that are complementary to programming

text: I hope this wouldn't be closed especially since I think a lot of people can benefit from this question that are in similar positions to mine. I'm been programming for a long time (since I was about 13/14, now I'm 22) and now I'm in that stage in life when I'm thinking whether and what to study. Since I'm programming for a long time I'm pretty certain that I will not pursue a degree in Computer Science/Software Engineering because I think a lot of the material will be about things I already know. Even if it will benefit me, I think I will lose a lot of motivation because I will be bored in class and I will always think to myself that "I'm wasting time" or that "I'm not really gonna use the material that is taught in this class". Science really interests me, especially Physics, but Chemistry/Biology is also interesting to me. and it's also possible to study two together like a BSc in Physics and Chemistry or Chemistry and Biology, which are both offered at the university I want to go to. So the question is, what Science degree can benefit me the most in a career as a programmer? Are there fields that incorporate software engineering and Physics/Chemistry/Biology and that have a lot of demand? or are expected to have a lot of demand? Are there any specific careers that you know of that incorporate software engineering and Physics/Chemistry/Biology? This is not a question of whether to study or not, this is a question of "if I decide to do a Science Degree that isn't Computer Science/Software Engineering, but which will benefit me as a programmer or widen my range of opportunities, which one do you recommend?"


title: Why interviewers want Optimal Algorithms

text: In an interview with a software company they asked me some algorithm design questions. Being strong in mathematics I was able to solve it mathematically, but each time when I propose my algorithm they were doubtful about its working and I have to prove it with examples. I didnt get a call for further rounds, I believe my solutions were correct. After googling I have found answers to most questions but they were implemented in a different way. Why do interviewers look for optimal answers rather than solutions, which came out of our thoughts rather than memorization of an optimal answer and delivering it.


title: What is the relevance of Unit Testing in an "Release early release often" environment?

text: Over last one year or so, I have driven my team towards the release-early- release-often mode of development (AKA: Rapid Application Development, not Agile). For more information about the manner in which we close the build, see my answer here: A simple ways to improve the release quality in RAD environment When we adopted RAD, people were quite independent and they were doing unit testing first; the integrated tests happened much later in the process. It was a natural process for them without much formal enforcement. Now the situation is quite different:   1. The entire platform is well integrated with established builds/releases working client-side without any hot spots.    2. New functionality requirements keep coming and we incrementally build them as we go.    3. The overall dynamics of the system are very important because while independent development groups might be following processes right, major failures have arisen due to complicated, non-obvious circumstances.    4. Many parts of the system involve new algorithms and research inputs so the challenges (and hence mechanism for testing) are not quite always foreseen correctly, like feature testing in well-defined software. Recently, I was trying to get better overall picture to see if we need process improvement. When I sat down with my team, many of them balked: "We don't do unit testing anymore!" while others thought we shouldn't start now because it will never be effective. Are unit tests useful in a relatively mature system? Should we at least need to weigh test scope depending on the maturity of units? Will unit testing slow down the pace of development? Is there a need to evaluate unit testing in a different way? What are the best practices of testing for a mature platform in a release- early-release-often environment?


title: Web Application: Combining View Layer Between PHP and Javascript-AJAX

text:
I'm developing web application using PHP with CodeIgniter MVC framework with a huge real time client-side functionality needs. This is my first time to build large scale of client-side app. So I combine the PHP with a large scale of Javascript modules in one project. As you already know, MVC framework seperate application modules into Model- View-Controller. My concern is about View layer. I could be display the data on the DOM by PHP built-in script tag by load some data on the Controller. Otherwise I could use AJAX to pulled the data -- treat the Controller like a service only -- and display the them by Javascript. Here is some visualization I could put the data directly from Controller:               Username <input type="text" id="username" value="<?=$userData['username'];?>">
     Date of birth <input type="text" id="dob" value="<?=$userData['dob'];?>">
     Address <input type="text" id="address" value="<?=$userData['address'];?>">      Or pull them using AJAX:               $.ajax({       type: "POST",       url: config.indexURL + "user",                       dataType: "json",       success: function(data) {          $('#username').val(data.username);         $('#dateOfBirth').val(data.dob);         $('#address').val(data.address);       }     });      So, which approach is better regarding my application has a complex client- side functionality? In the other hand, PHP-CI has a default mechanism to put the data directly from Controller, so why using AJAX?


title: Example of time-saving usage of compile-time meta-programming?

text: The webpage of Converge states that: > Converge has a macro-like facility that can embed domain specific languages > with arbitrary syntaxes into source files. I am most intrigued by the possibility to create domain specific languages. My understanding of the purpose of such languages, is that they enables the developer to become much more efficient when solving domain specific problems. So, I went on to read the "about" section. There are two examples of usage here, but none of them describe how the developer could save development-time by utilizing Converge. Can anyone come up with an example or refer me to an example? I am happy to read examples in other languages than Converge.


title: How to handle status columns in designing tables

text: How to handle multiple statuses for a table entry, for example an item table may have an active, inactive, fast moving, and/or batch statuses. And I wanted to handle them in single column with VARCHAR type. Also I might set each of those attributes as a boolean with different columns. But I am not sure what consequences this might lead to. So if you have experienced such situations which one would be the best way to handle it?


title: Retrying a statement or call in a catch block - code smell or anti-pattern?

text: I'm wondering how better to perform this operation for a large amount of files. The bit I'd like some thoughts on **whether this copy/paste is acceptable enough of a tradeoff**.   * try to write a file   * if the target dir doesn't exist, create it   * try again to write the file. If something else throws and exception, let it raise.               try{        File.Copy("@D:\foo.txt", @"C:\mydir\foo.txt");     }     catch (DirectoryNotFoundException){            CreateDirectoryForFile(@"C:\mydir");        File.Copy("@D:\foo.txt", @"C:\mydir\foo.txt"); //copy pasted from the try block     }      There's a simpler block that's easier to read, but leads to a higher number of disk IO calls that is necessary:               CreateDirectoryForFile(@"C:\mydir\foo.txt");     File.Copy("@D:\foo.txt", @"C:\mydir\foo.txt");      Can pattern 1 be improved?


title: Do delegates defy OOP

text: I'm trying to understand OOP so I can write better OOP code and one thing which keeps coming up is this concept of a delegate (using .NET). I could have an object, which is totally self contained (encapsulated); it knows nothing of the outside world... but then I attach a delegate to it. In my head, this is still quite well separated as the delegate only knows what to reference, but this by itself means it has to know about something else outside it's world! That a method exists within another class! Have I got myself it total muddle here, or is this a grey area, or is this actually down to interpretation (and if so, sorry as that will be off topic I'm sure). My question is, do delegates defy/muddy the OOP pattern?


title: Debug multiprocessing in Python

text: What are some good practices in debugging multiprocessing programs in Python?


title: Algorithm for detecting a knob-turning gesture?

text: What is the math to identify a gesture for the motion made by two fingers turning a knob (tracking two sets for xycoords)? Is there a library/api anyone is familiar with that contains a good library of gestures for multitouch applications?


title: Raw Sql vs SqlAlchemy when Django ORM is not enough

text: In a django project, if a situation comes that Django ORM is not able to execute some complex queries then there are 2 options:   1. Use Raw Sql queries    2. Use SqlAlchemy  I want to know if there are some rules like some pros and cons of both which can guide me to choose one of the above 2 options. Or is it entirely depends on what we like?


title: Theta notation on constant time. Why we use the 1?

text: In asymptotic notation when it is stated that if the problem size is small enough (e.g. `n<c` for some constant `c`) the solution takes constant time and is writen as `Theta(1)`.   Why we write `1` inside the `Theta`?   What does the `1` mean? Why not `Theta(c)`?


title: Generating CMakeLists.txt

text: I got a bunch of `C++` sources files and headers. They may use external libraries such as Boost e.g. I am interested in the process of building binaries for Windows and *nix.   * Makefiles (*nix) and .vcproj (Windows) call compilers with some specifications such as the order of compilation, compilation options and stuff.   * CMakeLists.txt can be used by CMake to build either makefiles or .vcproj and use very helpful commands such as recursive search of files, automatic linkage with known libraries, installers, variables that can be used in source files... Is there any existing tool that would generate a CMakeLists.txt from specified options ? Options could be like : scan this folder and make a library out of it, then scan this other folder and make an executable and automatically link both with Boost as well along with a user friendly installer with generated INSTALL.txt and README.txt. Something very powerful like that.


title: Getting out of my head

text: I've spent the last year as a one-man team developing a rich-client application (35,000+ LoC, for what it's worth). It's currently stable and in production. However, I know that my skills were rusty at the beginning of the project, so without a doubt there are major issues in the code. At this point, most of the issues are in architecture, structure, and interactions -- the easy problems, even architecture/design problems, have already been weeded out. Unfortunately, I've spent so much time with this project that I'm having a hard time thinking outside of it -- approaching it from a new perspective to see the flaws deeply buried or inherent in the design. **How do I step outside my head and outside my code so I can get a fresh look and make it better?** Is this a smaller issue than I think it is, or is this a problem experienced by others as well?


title: Does there exist a decent monetary bounty system for open source software?

text: I personally would be willing to pay $10 to someone who can offer to make microphone drivers work with one of my laptops under Ubuntu 10.10. I thought that other users could contribute to the same thing, and thus find a willing developer. Does there exist such a project(s)?


title: Is GCC dying without threads support on Windows?

text: I need some opinion. GCC was always a very good compiler, but recently it is losing "appeal". I have just found that on Windows GCC does not have `std::thread` support, forcing Windows users to use another compiler because the most exciting feature is still missing. But why really doesn't GCC still have threads support under Windows? License problems? ABI incompatibilities? (Well there are already several cross- platform libraries using multithreading: boost, POCO, SDL, wxwidgets, etc. Wouldn't it be simple to use already existing, and MIT/libpng licensed, code to fit this hole instead of shipping GCC releases with no thread support?) Recently, looking at compiler comparisons, GCC has the widest support for C++11 features with respect to other compilers, except for the fact that on Windows this is not true because we are still lacking atomics, mutexes and threads :/ I'd like to know more about this topic, but the only thing I can find is people asking for help because: > "thread" does not exist in std namespace Looking at tickets tracking and mail discussions of GCC/TDM-GCC, there were requests for thread support since 2009. Possible that after 4 years still no solution? What's really happening?


title: Custom animation iOS

text: I have seen animation, and i can't figure out how to do something like in this video(youtube). I want to discuss how it's made. I don't think that they're using sprites. I have one idea how to do this: for example i want to create animation of "walking" animal (when animal moves, he's legs "runs" moving animation), i should create customView with imageView of animalBody 3 and two imageViews of animal legs 2. Then i make hard coded animation of moving legs and voila, i have custom animation. When i move customView, then i should start animation of legs. But is there better approach to do this? Thanks! ![enter image description here](http://i.stack.imgur.com/f1mdB.png) ![enter image description here](http://i.stack.imgur.com/wSdey.png)


title: Web API URI Schema Design

text: I'm in the middle of designing an API for a very basic flashcard application for learning purposes and I'm wondering if you all think there can be any improvements. In the app, a Folder contains Folders and Sets. A Set contains Cards. The Homepage lists any top-level Sets and Folders that the I've created (but never cards). Here's the URI schema I've come up with: ![enter image description here](http://i.stack.imgur.com/r8lES.png) Does this seem ok? My goal is to keep the URIs terse/concise/simple and push any relationship metadata (parentFolderId, parentSetId, etc) into the body of the request. Thoughts?


title: What do I need to include in my OOP design document?

text: I am a graduate student in aerospace engineering. A lot of my Master's thesis has been on developing an OOP software architecture in MATLAB to facilitate control of Arduino-based vehicles (blimps, cars, quadrotors, etc). All my code is heavily documented, but my thesis itself needs to be more than a reference of every class and method - it needs to describe at a high level how each piece works together, and _why_ my architecture is the way it is. I only have a minor in computer engineering and I consider myself a pretty competent programmer, but I have no experience writing this kind of document. What kinds of things need to be included in the document? (Diagrams, paragraph explanations of how each class operates, etc)? I don't want to just rehash my code comments (although at the start of each file there's paragraphs of comments about how that class relates to other classes). I also wonder if it's necessary to get rather technical (I implement some fairly advanced MATLAB concepts [that is, advanced for non-computer engineers] such as listeners and callbacks); my audience also hails from an aerospace engineering background. Examples would be appreciated if they exist. **EDIT** : The part my audience really cares about is not the software architecture (the stuff this question entails); this document is really for people who will use my work in the future - who are **not** computer engineers! So I guess the main question is, what needs to be in the document such that people who are not up to speed on the project (and we can assume competent with the language) can understand the architecture, maintain and use the software?


title: Functional programming and stateful algorithms

text: I'm learning functional programming with **Haskell**. In the meantime I'm studying Automata theory and as the two seem to fit well together I'm writing a small library to play with automata. Here's the problem that made me ask the question. While studying a way to evaluate a state's reachability I got the idea that a simple recursive algorithm would be quite inefficient, because some paths might share some states and I might end up evaluating them more than once. For example, here, evaluating **reachability** of _g_ from _a_ , I'd have to exclude _f_ both while checking the path through _d_ and _c_ : ![digraph representing an automaton](http://i.stack.imgur.com/4JG7I.png) So my idea is that an algorithm working in parallel on many paths and updating a shared record of excluded states might be great, but that's too much for me. I've seen that in some simple recursion cases one can pass state as an argument, and that's what I have to do here, because I pass forward the list of states I've gone through to avoid loops. But is there a way to pass that list also backwards, like returning it in a tuple together with the boolean result of my `canReach` function? (although this feels a bit forced) **Besides the validity of my example case** , what other techniques are available to solve this kind of problems? I feel like these must be common enough that there have to be solutions like what happens with `fold*` or `map`. So far, reading learnyouahaskell.com I didn't find any, but consider I haven't touched monads yet. ( _if interested, I posted my code oncodereview_)


title: Is throwing an exception from a property bad form?

text: I've always been of the mindset that properties (ie, their set/get operations) should be fast/immediate and failure-free. You should never have to try/catch around getting or setting a property. But I'm looking at some ways to apply role-based security on the properties of some objects. For instance an Employee.Salary property. Some of the solutions I've run across that others have tried (one in particular is the AOP example here) involve throwing an exception if the accessor doesn't have the right permissions - but this goes against a personal rule that I've had for a long time now. So I ask: am I wrong? Have things changed? Has it been accepted that properties should be able to throw exceptions?


title: Sprite Sheets in PyGame?

text: So, I've been doing some googling, and haven't found a good solution to my problem. My problem is that I'm using PyGame, and I want to use a Sprite Sheet for my player. This is all well and good, and it would be too, if I wasn't using a Sprite Sheet strip. Basically, if you don't understand, I have a strip of 32x32 'frames'. These frames are all in an image, along side each other. So, I have 3 frames in 1 image. I'd like to be able to use them as my sprite sheet, and not have to crop them up. I have used an awesome, popular and easy-to-use game framework for Lua called LÖVE. LÖVE has these things called "Quads". They are similar to texture regions in LibGDX, if you know what they are. Basically, quads allow you to get parts of an image. You define how large a quad is, and you define parts of an image that way, or 'regions' of an image. I would like to do something similar to this in PyGame, and use a "for" loop to go through the entire image width and height and mark each 32x32 area (or whatever the user defines as their desired frame width and height) and store that in a list or something for use later on. I'd define an animation speed and stuff, but that's for later on. I've been looking around on the web, and I can't find anything that will do this. I found 1 script on the PyGame website, but it crashed PyGame when I tried to run it. I tried for hours trying to fix it, but no luck. So, is there a way to do this? Is there a way to get regions of an image? Am I going about this the wrong way? Is there a simpler way to do this? Thanks! :-)


title: get all the combination of a given set of numbers

text: I m trying to get the possible combinations of a given set of numbers say for example 123 The possible combinations would be 123 132 213 231 312 321 For this i have written a code as below -               import java.util.ArrayList;          /* Name of the class has to be "Main" only if the class is public. */     public class Main {          /**      * @param args the command line arguments      */     static ArrayList list;          public static void main(String[] args) {         // TODO code application logic here         Main nm = new Main();         nm.list = new ArrayList();         /*         for(int i=1; i<= 4; i++) {             list.add(i);         }              list.remove(list.indexOf(1));              for(int i=0; i<= 2; i++) {             System.out.print(list.get(i));         }         */         nm.test1();             }          public void test1() {                 for(int i=1; i<= 4; i++) {             if(!list.contains(i)) {                 list.add(i);                 test1();                 list.remove(list.indexOf(i));             }         }                    if(list.size() == 4)          {             for(int i=0; i< 4; i++) {                 System.out.print(list.get(i));             }             System.out.println("");         }     }      } This gives the correct output as shown here in the link I was thinking about if this the right approach or if there can be any optimizations done so that this code may be used to get combinations of numbers of 10 to 20 digits or more. Regards


title: Design pattern for handling a response

text: Most of the time when I'm writing some code that handles the response for a certain function call I get the following code structure: example: This is a function that will handle the authentication for a login system               class Authentication{          function login(){ //This function is called from my Controller     $result=$this->authenticate($username,$password);          if($result=='wrong password'){        //increase the login trials counter        //send mail to admin        //store visitor ip         }else if($result=='wrong username'){        //increase the login trials counter        //do other stuff     }else if($result=='login trials exceeded')        //do some stuff     }else if($result=='banned ip'){        //do some stuff     }else if...          function authenticate($username,$password){        //authenticate the user locally or remotely and return an error code in case a login in fails.     }         }      **Problem**   1. As you can see the code is build on a `if/else` structure which means a new failure status will mean that I need to add an `else if` statement which is a violation for the _Open Closed Principle_.   2. I get a feeling that the function has different layers of abstraction as I may just increase the login trials counter in one handler, but do more serious stuff in another.   3. Some of the functions are repeated `increase the login trials` for example. I thought about converting the multiple `if/else` to a factory pattern, but I only used factory to create objects not alter behaviors. Does anyone have a better solution for this? **Note:** **This is just an example using a login system.** I'm asking for a general solution to this behavior using a well built OO pattern. This kind of `if/else` handlers appears in too many places in my code and I just used the login system as a simple easy to explain example. My _real_ use cases are to much complicated to post here. :D Please don't limit your answer to PHP code and feel free to use the language you prefer. * * * **UPDATE** Another more complicated code example just to clarify my question:                 public function refundAcceptedDisputes() {                         $this->getRequestedEbayOrdersFromDB(); //get all disputes requested on ebay             foreach ($this->orders as $order) { /* $order is a Doctrine Entity */                 try {                     if ($this->isDisputeAccepted($order)) { //returns true if dispute was accepted                         $order->setStatus('accepted');                         $order->refund(); //refunds the order on ebay and internally in my system                         $this->insertRecordInOrderHistoryTable($order,'refunded');                                             } else if ($this->isDisputeCancelled($order)) { //returns true if dispute was cancelled                         $order->setStatus('cancelled');                         $this->insertRecordInOrderHistory($order,'cancelled');                         $order->rollBackRefund(); //cancels the refund on ebay and internally in my system                     } else if ($this->isDisputeOlderThan7Days($order)) { //returns true if 7 days elapsed since the dispute was opened                         $order->closeDispute(); //closes the dispute on ebay                         $this->insertRecordInOrderHistoryTable($order,'refunded');                         $order->refund(); //refunds the order on ebay and internally in my system                     }                 } catch (Exception $e) {                     $order->setStatus('failed');                     $order->setErrorMessage($e->getMessage());                     $this->addLog();//log error                 }                 $order->setUpdatedAt(time());                 $order->save();             }         }      **function purpose:**   * I am selling games on ebay.   * If a customers wishes to cancel his order and gets his money back (i.e. a Refund) I must open a "Dispute" on ebay first.   * Once a dispute is opened I must wait for the customer to confirm that he agrees to the refund (silly as he's the one who told me to refund, but that's how it works on ebay).   * This functions gets all disputes opened by me and checks their statuses periodically to see if the customer has replied to the dispute or not.   * The customer may agree (then I refund) or refuse (then I rollback) or may not respond for 7 days (I close the dispute myself then refund).


title: Java: The best way to learn it when MOOCs and books are not enough?

text: This topic was taken from Stack Overflow, but it was put on-hold due to Opinion-based question. So I moved it to here. I've had some great troubles with my homework exercises and I've used excessive time on doing simple programs like arrays and methods. For example it took me over 20 hours to create a program that asks user to enter row and columns size and then prints the matrix. I've read over 20 java books and tried 4 MOOCs, and even Buckys videos but it feels like I won't get in-depth understanding of Java fundamentals. Here's a list of problems that I face everyday when I'm coding java:   1. Problem solving   2. Creating methods and using them   3. Arrays   4. "I've no idea how to do this"   5. What is constructor and how to use it   6. "Where can I find help?" I've asked this question before but the answers have been like: "Read books" or "Just start coding" but neither of these haven't helped me because I've tried to code, but I haven't had any reasonable goals and reading books feels like eternal loop that just leads nowhere. I know that Internet is full of 'What is the best way to learn Java'-questions but I think that I've to try ask this because this topics question does not appear in Google Search + I think that there are people who are struggling with the same problem. Any advice would be appreciated. I'm eager to learn Java, I just need to find my own way to do it!


title: Communication between programmers and system engineers. Tool for planning builds and maintenance jobs

text: We have Development department and the department of System Engineers that works on a big project (development of J2EE application). We are using _Build management system_ , _Bug tracking system_ and a _Wiki engine_ in our work. Sometimes we have a situation when some developer initiate a server restart or an application build that breaks the debug process for other developers (in some cases developers using the same remote _Developer_ server). At the present moment we are using the _chat_ application for approving the process of restart\rebuild server (application). Can anyone share the experience of solving collision like I described above? * * * My vision is to use application which was able to do the following things:   * create request for server restart (or application rebuild\redeploy);   * subcribing for notification on "new request created" event;   * manual approving the request (by several members) and automatic approving of request (in case nobody declined the request during the some period of a time);   * subcribing for notification on "the request is approved" event;   * the request solving;   * subcribing for notification on "the request is solved (done)" event. It looks like the request has its own lifecycle or workflow. I think that some _Bug tracking system_ (for example, _by Atlassian Jira_ ) can help to create the request and can start the workflow on it. But this solution does not look perfect (even good) for me - its too "heavy and bulky".


title: How can I provide guidance on technology choices through user stories?

text: I'm a project manager for a team of firmware engineers making the transition to adopting Scrum and I'm moving to support the team in a Product Owner role. We've just gone through Scrum training and are beginning a month of coaching which is going to be invaluable. Coming from a technical background I can already see the challenge of shifting my point of view from the solution domain to focusing on business value. For me it's very tempting to think of "how" to solve a problem. But I like the concept of user stories and defining vertical slices of functionality that give value to the customer and letting the team determine the "how". Forgive me if this is a naive question, but as the PO how can I provide guidance on specific technical direction through user stories? My concern is that in some cases without guidance the team may head down the wrong path on key technical decisions. As a simplistic example I might have a user story: > As a clinician I want the device to record information about the patient's > treatment so that I can determine if the patient's therapy has been > effective. Now say time to market is critical and I want to fork out for an off-the-shelf file system stack to save time, what conveys that to the team? They might go off and start writing their own stack from scratch. Is this sort of guidance provided through:   1. Conversations during sprint planning and backlog grooming? But if so, is it my place as the PO to even be suggesting how to solve a problem.   2. Acceptance criteria? I don't really like this, I have a bad feeling about making acceptance criteria so prescriptive that they specify how to solve a problem.   3. Constraints? Thanks in advance. I could (and will) ask our Scrum coach but I won't be able to do that before Monday and this question has been really bugging me :)


title: Proper Architecture for DBContext and Migrations with Multiple Projects

text: I have multiple projects that will be using the same business objects (customer, order) but the projects operate in different databases within the organization and I would like to understand the proper architecture that I should create to service such needs. Here is a list of the different types of projects in play:   * ASP.NET MVC front end to handle all general user actions. This front end is deployed to a dedicated instance per customer.   * Centralized Windows Service to process FTP files and transmit the data to each customer instance.   * ASP.NET MVC front end to manage all customers and their instances. All business objects (customer, order, etc) are located in a Core class library. Each of the projects will need to use the business objects at one point or another but connect to a different database. Should the DBContext reside in the Core library or in the project? Should Entity Framework migration be located in the same location as the DBContext?


title: Python Socket Scripting. What am i doing wrong?

text: My socket program hangs at clientsocket, address) = serversocket.accept() and doesn't spit our an error or anything. I followed directions on https://docs.python.org/3/howto/sockets.html I've been trying to figure it out for an hour now, but to no avail. I'm using python3 btw. What am i doing wrong? EDIT: My intedentation is all screwed up because I pasted it wrong, but other than that my code is as I have it in my file.                   #import socket module         import socket         #creates an inet streaming socket.         serversocket = socket.socket(socket.AF_INET, socket.SOCK_STREAM)         print('socket created')         #binds socket to a public host, and a well known port         serversocket.bind(('127.0.0.1', 1024))         #print(socket.gethostname())# on desktop prints 'myname-PC')         #become a server socket         serversocket.listen(5) # listens for up to 5 requests              while True:             #accept connections from outside             #print('In while true loop') This works, but we never get to the next print    statement. Why the hell is it catching at line 20?             (clientsocket, address) = serversocket.accept()             #clientsocket = serversocket.accept()          print('Ready to serve')     #now we do something with client socket...     try:         message = clientsocket.recv(1024)         filename = message.split()[1]         f = open(filename[1:])         outputdata = f.read()         #send an http header line         clientsocket.send('HTTP/1.1 200 OK\nContent-Type: text/html\n\n')              for i in range(0, len(outputdata)):             clientsocket.send(outputdata[i])         clientsocket.close()          except IOERROR:         clientsocket.send('HTTP/1.1 404 File not found!')         clientsocket.close()


title: Could implicit static methods cause problems?

text: This is a purely hypothetical question. Say I create a class method that contains no references to instance variables or other resources. For example (C#):               protected string FormatColumn(string value, int width)     {         return value.Trim().PadLeft(width);     }      As far as I can see, there is absolutely no reason why this method could not be declared static:   * It only uses method-scope variables.   * It doesn't `override` a base class method.   * It's not `virtual` or `abstract`. My questions are:   Is there any benefit to calling a static method over an instance method?   If so, why doesn't the compiler implicitly convert this to a static method? I'm certain I've missed some key point here. Any ideas?


title: What effect does using multiple childViewControllers views inside a ContainerViewController have on memory?

text: I have three childViewController views inside my ContainerViewController and these three views are inside a horizontal scroll view. My intention is to build an app that has a custom camera on one ChildViewController view, a tableView which will display JSON data on another view, and a page which will show a list of the users friends. The reason I am building it this way is to achieve a dragging/sliding effect between the three different child views. Although I get the result I want from a UI/UX perspective, i'm not sure how this will effect memory and performance. If i'm not mistaken my containerViewController will be handling a lot of activity. Would there be an alternative way to architect this type of application? I understand I could have three separate view controllers using a Navigation Controller but than I wouldn't achieve the UI/UX experience I want. I'm really after the dragging/sliding between different pages experience, similar if not the same as Snapchat/Tinder


title: Which aids to decision-making exist for going open-source?

text: I am involved in the development of a software product that I'd like to see becoming open source. My bosses will ponder this request benevolently I assume, yet they still want to see some evidence that this is a good idea, at least that it is not a bad idea. They have little experience with open source themselves. We work in an academic public service environment, so financial interests are little to non- existing. I think their primary concerns are bad reputation by publishing a project and nobody is interested, and maybe the potential loss of control of the development process. I wonder whether there is (possibly peer-reviewed) material out there that advocates for going open source. But I'm also interested in documents describing a critical perspective towards such a step. Moreover, case studies would be helpful I think. The documents may be behind a journal paywall.


title: Anonymous access to api REST, protection

text: I have a public website that does not require authentication. It's a lighting calculator for indoor cultivation. Anyone can enter and complete the process and ultimately save your settings for future use sharing it on Facebook or twitter. The configuration is saved as a document in a database, using a REST api. At this time nothing prevents someone make a bot and fill my hard disk in a few hours. What steps can I take to give protection to my service?


title: What is the largest size a HashSet or TreeSet be?

text: So I am working on a solo project that involves **a lot** of strings. In one of my smaller test cases there will be _at least_ 70 million elements. So my question is, what is the largest possible size a TreeSet or a HashSet can reach until it can no longer grow **OR** until it reaches a size that it can no longer be feasible to use in terms of efficiency.


title: Using a zLib like icensed library which has dependencies on LGPL or GPL libs; what license am I able to release my project under?

text: If I use an Open Source library which is released under a zLib like license, but it has dependencies on libraries that are using LGPL or GPL; what license am I able to release my project under? If I read things I find on the net it sounds like I can sell my project but I can't stop people from distributing it freely as per GPL?


title: How to check the space complexity of this program?

text: I have written my version of strstr function in c. I am using a temporary array of size 26. Then is the space complexity O(1) or O(n)? This is my code :               void strcheck(char t[], int n, char p[], int m)     {         int i, j, k;         int temp[26];              for (i = 0; i < 25; ++i)             temp[i] = 0;         for (i = 0; i < n; ++i)         {             k = t[i] - 'a';             temp[k]++;         }         for (j = 0; j < m; j++)         {             k = p[j] - 'a';             if (temp[k] > 0)                 temp[k]--;             else                 break;         }         if (j == m)             printf("string occured\n");         else             printf("not occured\n");     }      The program is working correctly just wanna know about space complexity. Thanks


title: Video conferencing server architecture

text: I am developing a video conference application with the following requirements:   * Audio works like call conference, where all participants may talk at the same time.   * However, video works like broadcasting, where only one designated client broadcasts one video to the rest. Clients will be Android devices. One way of doing this is to use a SIP stack (e.g. Asterisk) and use its conference call capabilities; however the video conference part of Asterisk looks pretty undeveloped. Also, there might be some issues using SIP, as the app will be used over 3G and/or restrictive firewalls. Another way is to use streaming media server like Wowza, which while it is impressive on live video streaming, it does not seem to have a conferencing capabilities. Is there a better way to approach this? It seems that this use case is pretty common and there are various similar solutions for desktop apps.


title: What should a CS grad know?

text: In thinking of making a good introductory resource guide for new Computer Science students... **What is a good list of expected knowledge and ability for a computer science BS grad?** And if you graduated a while ago, how does this compare to the standards for graduates at that time? And, are there any things you would want college grads to know that most entering the field don't? Many thanks!


title: Object Oriented Programming Language performance ranking

text: After reading this post about ideal programming language learning sequence, I am wondering what would have been the answers if the question was performance -instead of learning- oriented ? Since there are many programming languages I chose to ask the question for OOL to be the least subjective. But any thought or comparison about no-OOL are appreciated :D If we omit the programming effort, time and costs. What is your ranking of the most powerful object oriented languages ?


title: Opinions on distribution of software via virtual appliance

text: I've created a distribution of my open source application framework in a working virtual appliance. It includes everything to get started with the tutorial. The distribution is Fedora 14 running Tomcat 5.5 and Oracle 10g Express Edition, plus my framework. It is completely preconfigured and boots into a working running copy. Would this be something you might try? What assurances might you need to get you to try it? **Edit:** The VM is just over a 2Gb download. Alternatively it is also available via 23Mb download for the source and a PDF detailing how to configure the Tomcat and Oracle dependencies.


title: I've failed at PHP several times. Is Ruby the Cure?

text: _Extremely, extremely_ subjective question here, but its something I've been struggling with for quite a while. I've seriously tried to become a reasonable PHP coder for the past several years. But I've really failed every time. I hate to describe myself as a beginner, b/c I've been designing websites (using WordPress, Drupal, etc) for years, but still I just can't seem get better at programming. Could it be that I have some kind of allergy to PHP? I went through Chris Pine's awesome into to Ruby about a week ago (for about the fifth time), and though it did all all seem much clearer to me than PHP, I wondered if I was just switching languages to find an easy way out? The things I struggle with in PHP all seem elementary—when to use a function, how to return database queries in foreach/while statements, when to turn those queries into reusable functions, adding arguments to functions, etc, etc. And all the OOP stuff that I keep seeing these days just files over my head. I guess my question(s) are: Am I going about learning how to program in the wrong way? Do I have some aversion to PHP that's preventing me from catch on? If I keep pushing at Ruby/Rails, will it just eventually 'click'. Or, the one I fear, am I just unlikely to ever be a programmer?


title: How to balance Front End and Back End coding skill

text: This is a question specifically for web applications developers. In recent years I spent most of my time on SaaS products, which leads you dig deep into more back-end stuff, like how to use less memory resources, make session working with load balancer, write efficient SQL queries, performance tuning, solving technique difficulty. There is no web designer working with us, generally what we get is a snapshot of what the system should look like, but nobody here cares how you produce it. Since now the company plan changed and they are going to change and the SaaS product will reach end of life soon, and I just feel I lack of those HTML/CSS knowledge, I mean I never got a chance to check those things as a whole stuff, but only learn from what I need to work out. All those above seems made me out of fashion about front-end skills, I seems tend to ignore learn things about it. Till just now I realized that might be a mistake I made, for instance I still tend to use table layout in HTML and just realized how bad practice that is recently. I start wondering if I were going to find a new job, how good should I be on front-end coding compare to back-end skills? Is it OK for now as more and more web designers or user interface designers are hired so we don't need to worry about Html/Css too much? Or should I pause my back-end skill improvement and jump back on front-end a while and then make it half and half? Sorry English is not my native language so there might be something expressed not that clear. Thanks for reading this long post!


title: OOP question for product catalog

text: I have a question bugging me for some days. I made a webshop for a good friend of me. The problem is I have an OOP class question. People can buy some clothing in the shop. The problem arise how to show different information for different products? What I have now is the following:   * abstract Product class   * Cloth extends Product   * Trousers extends Product Problem is that trousers can contain extra information like:   * fiber type   * structure How can I show those information in the shop? I query for all products and receive the Product class with only the selling price and name? What is the correct way to figure out it is a trouser to show those information like fiber structure on the detail page?


title: Are ASP.NET Web Parts useful & common enough practice in the real world, outside of SharePoint projects?

text: Studying for the .NET 70-515 exam. There is a chapter on Web Parts. I will suck it up and learn what I need to learn here, but... I am wondering, do ASP.NET developers in the real world often turn to Web Parts _outside_ of SharePoint development? I do not **ever** plan to deal with SharePoint - I prefer working on large scale public-facing web sites and applications - and Web Parts (SharePoint, too) hardly seem useful to me in that context. But what do I know? Help me understand the relevance or irrelevance of this technology, please. Should I keep ASP.NET Web Parts on my _ignore-list_ , if SharePoint is already on it too? Thanks!


title: Stored Procedures a bad practice at one of worlds largest IT software consulting firms?

text: I'm working at a project in one of the world's top 3 IT consulting firms, and was told by a DBA that company best practice's state stored procedures are not a "best practice". This is so contrary to everything I've learned. Stored procedures give you code reuse, and encapsulation (two pillars of software development), security (you can grant/revoke permissions on an individual stored proc), protect you from SQL injection attacks, and also help with speed (although that DBA said that starting with SQL Server 2008 that even regular SQL queries are compiled if they are run enough times). We're developing a complex app using Agile software development methodology. Can anyone think of good reasons why they wouldn't want to use stored procs? My guess was that the DBAs didn't want to maintain those stored procs, but there seem to be way too many negatives to justify such a design decision.


title: Basic Objective-C Questions

text: I'm new to objective C, I'm following "Objective C 5th Edition Stephen Kochan and I don't have anyone to ask my doubts to. I'm confused with this question: Q. Is it necessary to use "-" or "+" before every property or method declaration in Interface? What will happen if I don't use "-" or "+" before every property or method declaration in Interface?


title: Should I return iterators or more sophisticated objects?

text: Say I have a function that creates a list of objects. If I want to return an iterator, I'll have to `return iter(a_list)`. Should I do this, or just return the list as it is? My motivation for returning an iterator is that this would keep the interface smaller -- what kind of container I create to collect the objects is essentially an implementation detail On the other hand, it would be wasteful if the user of my function may have to recreate the same container from the iterator which would be bad for performance.


title: Is there a way for developers and their clients to make a 'safety net' for the final transaction of software for money?

text: First off, we presume that the projects in question are not large or important enough for the parties involved to establish a formal contract, and that the parties are not able to meet in person. So, how can the programmer(s) be sure that they will be paid(in full), and how can the client be sure that the their requirements are met, e.g. testing it without acquiring the full source code?


title: Comparing TCP/IP applications vs HTTP applications

text: I'm interested in developing a large-scale user-facing website that is written in Java. As for design, I'm thinking of developing independent, modular services that can act as data providers to my main web application. As for writing these modular services (data providers), I can leverage an existing framework like Spring and develop these services following the RESTful design pattern, and expose resources via HTTP with a message format like JSON...or I can leverage an existing network framework like Netty (http://netty.io/) and serialization format like Protobufs (https://developers.google.com/protocol-buffers/docs/overview) and develop a TCP server that sends back and forth the serialized protobuf payload. When should you choose one over the other? Would there be any benefit of using a serialization format like Protobufs and sending stream of bytes over the wire? Would there be overhead in just using JSON? How much overhead is there between using TCP/IP and using HTTP? When should you use Spring over Netty, and vice versa to build such a service?


title: Using home server to develop, moving everything out of local machine

text: I'm sorry if this question is too broad, but I hope it's not :) I'm thinking about setting up small & cheap home linux based server (one of those $200-$300 micro PCs), to move my whole development environment out from my laptop (databases, interpreters etc.). The main reason is - while I earn my meal coding PHP, I'd like to try new things that require installing new stuff and I want to keep my laptop running smoothly. Other reason is that I find setting up and maintaining dev environment on OS X somehow disturbing (you just can't upgrade PHP, you have to do some tricks to do this). Setup I thought about is: 1\. Mount server's drive via `Samba` 2\. Use `NetBeans` saving directly to server, work, run apps on server Keeping that in mind, my main (and IMHO quite specific) question is - will it work? I mean - won't this setup slow down my development instead of making it cleaner and separated from development machine? By slowing down I mean: samba issues, configuration issues, gotchas and so on. Technologies I intend to use: `mysql`, `postgres`, `php`, `pyton`, (maybe) `java`, (maybe) `RoR`, (maybe) `Solr`.


title: How can I update a large legacy codebase to meet specific quality standards?

text: There is a lot of information about tools and techniques for improving legacy codebases, but I haven't come across any successful real world case studies. Most advice is on the micro level, and while helpful, doesn't convince many people because of a lack of evidence it can help at the macro level. I am looking specifically for incremental improvements that have been proven to be a success in the real world when updating a large legacy codebase to meet today's quality standards, and not a complete rewrite. Before:   * Large: greater than 1MLOC   * Legacy: no automated tests   * Poor quality: high complexity, high coupling, high escaped defects After   * Automated tests   * Easier updates/maintenance   * High quality: lowered complexity, decoupled code, few escaped defects What kind of incremental steps have been proven in the real world to update a large legacy codebase successfully to meet above quality standards, without going through a total rewrite? If possible, include an example company or case study of a large legacy project that has gone through a "successful" quality improvement process in your answer to back it up.


title: Loading dynamic css based on user

text: I want to provide different UI theme based on user who logged in. For that I have came up with following 2 options:   * create separate files for all themes duplicating all the common css. This way I can easily do some login in scripting and get the required css file. But I end up having same css classes code in many different theme files. This is real pain when you have to change something common to all files.   * make a common file and separate theme files containing only theme specific css. This way everytime I need to load 2 css files, one - common file by default and then load theme specific file to override default css classes. Please help me to choose better option. If there is other simple and easy way to do it then please do let me know.


title: How I identify true error?

text: I am writing a program to scrap some data from the web. The pages are sequential ( 1,2,3 ... ), but I have no idea when will it stops. I combine a prefix and a integer to make a link for the python urllib to parse on it. For example : 'http://some.domain.com/page' + '1' + '.htm'. So the request would fail if the link is invalid, however, there could be some other error such as network error, connection timed out which will resolve itself. I could retry a couple of times on these error. Aside from 'Page not found' error, there could be other error such as 'Internal Server Error' which was thrown when the server is down. There error won't fix themselves. I should probably move on or stop the program. Back to my program. Because I don't know when is the page index are going to end, so I set the end integer to 9999. The links may run out after some hundreds. I should identify this and send a 'break' to it. What will you do? Gather all the possible error and put them on the exception line and treat them differently? Now I just stop after 10 failures.


title: Decorators in Python

text: I am just learning python, and I am currently playing with Tornado framework. I see this class:               class AuthHandler(BaseHandler, tornado.auth.GoogleMixin):         @tornado.web.asynchronous         def get(self):             if self.get_argument("openid.mode", None):                 self.get_authenticated_user(self.async_callback(self._on_auth))                 return             self.authenticate_redirect()      I am having trouble grasping what the decorator does there (@tornado.web.asynchronous). Does it overwrite that function? You can see the full source at https://github.com/facebook/tornado/blob/master/demos/chat/chatdemo.py


title: scons and python unit tests best practices

text: I am using scons to build a large project containing a mix of C++ and Python. I would like scons to run Python unit tests either using nose or not. Currently, we have a long list of tests files and run a test builder on each one. This causes each test file to be run as a separate script which feel inelegant and inefficient. Is there a better way of doing this?


title: which are the best front end web developer blogs

text: Looking for recommendations on industry-expert blogs from front-end web developers (emphasising RIA applications; e.g. HTML5, Javascript, AJAX, JQuery, Ext JS). Trying to sort out the best from the rest. Which blogs are the well respected and worth following?


title: Is there a name for the Builder Pattern where the Builder is implemented via interfaces so certain parameters are required?

text: So we implemented the builder pattern for most of our domain to help in understandability of what actually being passed to a constructor, and for the normal advantages that a builder gives. The one twist was that we exposed the builder through interfaces so we could chain required functions and unrequired functions to make sure that the correct parameters were passed. I was curious if there was an existing pattern like this. Example below:               public class Foo     {        private int someThing;        private int someThing2;        private DateTime someThing3;             private Foo(Builder builder)        {            this.someThing = builder.someThing;            this.someThing2 = builder.someThing2;            this.someThing3 = builder.someThing3;        }             public static RequiredSomething getBuilder()        {            return new Builder();        }             public interface RequiredSomething { public RequiredDateTime withSomething (int value); }        public interface RequiredDateTime { public OptionalParamters withDateTime (DateTime value); }        public interface OptionalParamters {            public OptionalParamters withSeomthing2 (int value);            public Foo Build ();}             public static class Builder implements RequiredSomething, RequiredDateTime, OptionalParamters         {           private int someThing;           private int someThing2;           private DateTime someThing3;                public RequiredDateTime withSomething (int value) {someThing = value; return this;}           public OptionalParamters withDateTime (int value) {someThing = value; return this;}           public OptionalParamters withSeomthing2 (int value) {someThing = value; return this;}           public Foo build(){return new Foo(this);}        }     }      Example of how it's called:                  Foo foo = Foo.getBuilder().withSomething(1).withDateTime(DateTime.now()).build();        Foo foo2 = Foo.getBuilder().withSomething(1).withDateTime(DateTime.now()).withSomething2(3).build();