title: What standard to use for RESTful JSON API

text: I am currently reading the book RESTful Web APIs by Leonard Richardson, Mike Amundsen and Sam Ruby, that describes the Collection+JSON pattern, and while searching around the web during my exploration of the information in the book, I stumbled upon JSON API. Now I am thinking which to choose? And are there many more attempts and standardizing how a RESTful JSON API should look? So I looked around and found that big players like github invents there own! (Github+JSON) Others just use plain old, no standardized JSON formatting. So what is up with this? Are people actually using Collection+JSON or is it as standardized as Github+JSON, in the practical world? What about JSON API? What have others betted on? What are others doing in this matter?


title: Open Source license compatibility checker

text: Is there a tool available for checking if various combinations of open source licenses are compatible with each other? I'm planning on building various tools that use an Apache license for distribution because Apache's licence seems to strike a good balance between being permissive and being enforceable in law. However, I'd like to include components from other open source projects in my code base, or make adaptors available to allow the end user to integrate such components into my code base. For example, I want to include a rich HTML editor such as CKEditor or TinyMCE in the package, but would doing so violate the licence of either project? I'm pretty sure that if I used GPL code it would force me to make my project GPL as well and I really don't want to do that. But what about MPL, LGPL, etc? I'd rather make such decisions purely on technical grounds but if you're doing open source it would be silly to ignore the wishes of other open source projects. I've tried looking for tools to help decide whether license X is compatible with license Y, if so which direction they're compatible in (X can include Y without issue, but if Y includes X then there could be problems, etc), and what the consequences on your licensing terms are if you include code with alternate licensing terms. All I've managed to find so far, however, is lists and charts that tend to be geared to comparing other licenses against GPL. If there is a tool out there to help with licensing issues I'd appreciate being pointed in the right direction.


title: Reducing number of php files used in project

text: I am developing an application in which I have a Class containing various methods. The problem is that i need to call most of the methods on form submission. For that reason, I have to create a new file on each form submission. On every file, I have to create an instance of the same class and then call the appropriate method. Is there any better way to call methods in such situation so that I don't have to create multiple files having similar functionality in php? I surely don't want to use any framework.


title: How to encrypt data using the private key?

text: I understand that in asymmetric crypto systems:   1. The public key is generally used to encrypt data and only the private key can be used to decrypt that data.   2. It's trivial to derive a public key from the private key (see this SO question). Firstly, is this correct? My goal is to supply data with my application that is _difficult_ to decrypt and _impossible_ to change, and so I want to be able to encrypt my data using a private key (which only I have) and allow my application to decrypt that data during runtime (hiding the public key as much as possible). I understand that this isn't fool-proof, however, I want to stop casual re-use of the data supplied with my application. Can anyone suggest an algorithm (preferably part of openssl) that can be used to achieve my goal? Looking at `RSA_private_encypt`, for example, shows that the encrypted data is of size `RSA_size()` (something like 128-bytes), which is because that function is used to generate signatures, not encrypted data. Is there a private encryption algorithm that generates data equal to the size of the plaintext data?


title: Recreating files from shell script or java?

text: I have java application which takes a file, which is created by a process running on terminal. I start the process using a small shell script. Then run the Java application and it reads the file created by the process. Whenever this system runs created file need to be removed so that the process creates it using the same name. I have no control over the file creation process so I cant overwrite or append to the file. My question is, on which part should the file be deleted? In the Java application or the little shell script i wrote? I'm sorry if other aspects of the system seems poorly designed but as I said I have little control over it.


title: Can a type provider mimic an anonymous class?

text: I'm working on building a website using the F# MVC 5 template, and I noticed that the template creator uses formally declared types for the route defaults. In VB.Net and C#, this is typically done with anonymous classes, but these don't exist in F# my current work around is to use an Expando Object, like this:               [<RequireQualifiedAccess>]     module RouteConfig =              let private createDefaults (propValuePairs : seq<string * obj>) : obj =             let defaults = ExpandoObject() :> IDictionary<string,obj>             propValuePairs |> Seq.iter (fun (key,value) -> defaults.Add(key,value) )             box defaults                /// create a pair, boxing the second item         let inline private (=>) (key : string) value = key, box value              let RegisterWebApi =             Action<_> (fun (config: HttpConfiguration) ->                 // Configure routing                 config.MapHttpAttributeRoutes()                 config.Routes.MapHttpRoute(                     "DefaultApi", // Route name                     "api/{controller}/{id}", // URL with parameters                     createDefaults [ "controller" => "{controller}";                                       "id" => RouteParameter.Optional]                 ) |> ignore                      // Configure serialization                 config.Formatters.XmlFormatter.UseXmlSerializer <- true                 config.Formatters.JsonFormatter.SerializerSettings.ContractResolver                     <- Newtonsoft.Json.Serialization.CamelCasePropertyNamesContractResolver()                      // Additional Web API settings                     )              let RegisterRoutes(routes:RouteCollection) =                  routes.IgnoreRoute("{resource}.axd/{*pathInfo}")             routes.MapRoute(                 "Default", // Route name                 "{controller}/{action}/{id}", // URL with parameters                 createDefaults [ "controller" => "Home" ;                                   "action" => "Index";                                   "id" => UrlParameter.Optional; ]             ) |> ignore      I'm mainly wondering if type providers can do something like this at compile time instead of runtime.


title: How can I transition from database development to programming/software engineering?

text: I'm looking for some advice on the best path to take to shift careers from database development to software engineering. Some background: I have an undergrad in Mathematics from one of the better engineering/computer science schools in NA. I was lucky to have taken a few computer science courses given me a bit of a foundation in CS theory (java programming, elementary algorithms, data structures). Since graduating I've been working as a database developer (6 yrs now), specifically in data warehousing doing lots of PL/SQL coding for back-end ETL processing and occasionally front-end web/database applications. For a while now I've been finding that I'm far more interested in the work involving building database driven applications and now I want to extend and apply this passion to more traditional areas of software development. I've done research online to come up with some first action steps to catch up on theory and start to practice coding.   1. Study following texts.     * Code: The Hidden Language of Computer Hardware and Software     * The C Programming Language     * The Structure and Interpretation of Computer Programs   2. Simultaneously work through Python coding tutorials and look into solving as many online challenges, problems using Python.   3. Once reaching comfortable level of understanding of Python, start participating in open source projects, leveraging existing knowledge of HTML, CSS, JavaScript, AJAX, mySQL combined with Python.   4. A few months down the line begin serious study of algorithms via Introduction to Algorithms (Cormen) & MIT 6.006 opencourse. Need to brush up on some discrete math but I think prior exposure to advanced mathematics and basic algorithms from my undergrad will come in handy. So at moment I could use some direction on following:   1. Does the above learning plan look ok? Any other readings, concepts, practice to consider optimizing my time and opportunities?   2. I'm in a dilemma in that I want to leave my current job asap as I'm not gaining anything that will help move me towards software development (not to mention how boring, unchallenging it is), yet I don't have the practical experience on the resume to apply for programming positions. What to do? Ideally I would like to get a position which I can leverage my background in databases/data warehousing, like data services engineering (Amazon for example has several positions in this regard), and transition from there but even those need some work experience in java/c++. If I pick up minor open source work on the side in the following months, how far can that get me in being considered for development positions? Any other paths I should consider?


title: Are developers/programmers becoming a commodity in the IT world?

text: I work in the IT department as a web applications developer for a major company. Recently as I was at a coworker's desk (he's an architect), I saw this graph that was entitled "Likely Future Roles in IT in 2015". It basically was this chart outlining the roles in IT that would have more importance in the future and the roles that would diminish in importance. I'm not sure where it came from but it was a printout from our VP of IT. He got it from some magazine I think. Anyway, I was surprised to see that developers/programmers were on the diminished importance list. The roles on this list were projected to be less important and deemed liable for externalization which basically means offshoring. Also included on this list was roles like development managers and system administrators. In the group of increased importance were roles like Business Analysts, Project Managers, Cloud Solutions Engineer, and Technical Architects. I found this strange and surprising. I can tell you for one thing that there is no doubt in my mind that Architects are very important to an organization. Especially ones who still do coding. They are indispensable. But business analysts and project managers? In my company, I've always found the BAs and PMs to be middlemen and tend to "get in the way." The real work is actually done by the developers. The developers in my company aren't just a bunch of coders who have no people skills. We actually work directly with the stakeholders in the business and solve their issues and make the company run more efficiently. The BAs and PMs may scope out things in a bigger picture and more long-term fashion but the actual execution and solving of problems is done by the developers. So I was really surprised to find that our roles were on the diminished importance list. I'm also surprised that our VP doesn't recognize this as he has always seemed to be appreciative of the efforts of the developers and recognize the value we bring. Developers who can code but also have the organizational and communication skills to figure out the problems the business is facing are indispensable in my opinion. They are the ones who keep the wheels rolling. I realize there are certain kinds of development activities you can offshore. And in today's market, it's dirt cheap but there are certain things that you just can't hand off to someone who is in a different time zone and has a language/culture barrier. I know that because my company has tried it before and it just didn't work out. Nevertheless, this has basically raised a concern with me. Are programmers/developers becoming a commodity or will be a commodity? Lots of people can code these days. Of course the best programmers will always have jobs but what about the "good" programmers like the rest of us? Are future IT departments just going to consist of a bunch of top-heavy employees like PMs, BAs, VPs, product managers and so on and externalize all the people who actually do the work? It just doesn't make sense to me. I read this article on techrepublic that says we are entering the decade of the developer. http://www.techrepublic.com/blog/hiner/were-entering-the-decade-of-the- developer/6020 Yet there are other indications that developers are going to be in diminishing importance. I would appreciate some thoughts on this one.


title: Do the Project managers build a structure of an app (with empty methods) then give it to the others for completing the app in real world Project?

text: I have very little experience working in a big project. But I did work about 3 months in a small outsourcer (a company that do the coding for a bigger foreigner web development company). This is what I saw. The foreigner company did all the user analysis & all database designs. Then a group of the Project managers in that foreigner company start to build a structure of the Application. That means they build all the basic classes that are the framework of the app. For example, in the framework they got many **undone (empty)** methods like:               int calNoOfCustomer(...){        // do the calculation here     }      My small company then starts to fill in the details of empty methods but it did not build the whole structure. I think it likes an assignment in IT school. The teacher build a structure & empty methods & ask students to complete them. So, I want to ask you that "is that the way how web development company does in real world big project?" Do the Project managers build a structure of an application (with empty methods) then give it to the other programmers for completing the app in real world Big Project?


title: Do you write secondary languages in your CV?

text: Every programmer has a primary language that he works with most of the time and is therefore very familiar with. But there are also languages that you kinda know, in the sense that you used to know them really well in the past, but hasn't used in a while, or that you use them infrequently and therefore are not as immersed in them as you are in your primary language. You can definitely bring yourself to be productive with these languages, but you might need to re-familiarize yourself a little, look up a few syntax rules, and such. My question is- will you write these languages in your CV as languages you "know"?


title: What are the most common reasons for lack of forward compatibility

text: Some companies, like Blizzard, make software that continues to work well in future versions of Windows and with newer versions of their other software dependencies. Other companies (mostly ones that are not hardcore software companies) sometimes write software that breaks with a release of a new OS or other software dependency. What do the hardcore software companies know that the others don't? What are the major causes for forward compatibility problems?


title: What design pattern do you use to support graceful fallback on old platforms?

text: Let's say I need to add a drop shadow behind a box. Some old platforms do not support drop shadows, so I have to fake it by putting an image behind the box. Here's the pseudo code of how I'm currently handling this fallback:               if (dropShadowsAreSupported) {         box.addDropShadow("black");     } else {         box.putImageBehindIt("gaussianBlur.png");     }      Is this the right way to handle it? It seems too amateur to me. Is there a better design pattern? In my actual project, there are a ton of places where I need to style the user interface differently for different operating system versions. It's not only one if-else.


title: Do GUI programmers have an undue advantage over others?

text: It is easy for managers and customers to appreciate what they can see. I have seen many GUI developers who are average programmers with minimal knowledge of design principles or other programming idioms. However, these shortcomings often go unnoticed, specially by management and customers, if the programmer can create an impressive looking user interface. So much so that many GUI developers I know spend hours beautifying the GUI at the expense of writing bad, unmaintainable code. On the other hand, middle tier programmers who develop APIs or business functionality or database code (SQLs etc.) are at a disadvantage as there is nothing tangible to showcase. Perhaps a code reviewer or an architect may appreciate the elegance, good design, scalability etc. of code but it means nothing to the outside world. Your code may run for years without breaking, may be very easy to maintain and have good performance, yet it never elicits the 'wow' that a slick looking GUI does. In my opinion, a corollary to this is (and I am going to get heavily downvoted for this, I know) that there is less motivation for a GUI programmer to write good clean code. **EDIT** : I must explain here that by GUI programmer, I don't mean a full- fledged web/GUI designer but a front-end programmer e.g., a java-swing programmer. Does the rest of the community agree ?


title: sorting using a custom definition of ">" and "< " in python

text: suppose I have a custom function such as               def greater(a, b):         if (a % b) % 2 == 0:             return 1         return 0      It defines how to compare two numbers and determine which is greater. In this case, if the function returns 1 a > b else, a < b. Can I use inbuilt `<built- in function sorted> or`to create a sorted array of numbers with respect to this definition?


title: Desktop to Web - How to deal with user-interactive workflows

text: I start a new project this summer, consisting in developing a web version of a proprietary desktop ERP. The main goal of my company is to be able to propose a web version of its ERP, with all advantages it involves (mobility, possibility of selling SaaS versions, modern look and components ...), **without losing any business feature**. By this, I mean that us developers can't rework the business side of the app. The main goal is to be able to translate same processes into web application. Business layer of the older version is not directly reusable, since it's really GUI-dependent. Those business process were rewritten as UML diagrams, which will be used as support for us to develop the new app. The problem I meet is that I don't know how to deal with process that need user interactions. For example : On validation of a sale order, the validation process checks all products it contains, verifying if there is available stock, and then perform different operations. If there is no stock available, the user is asked if he wants to cancel the order, remove this product or select another one equivalent. It works like a Javascript `alert` or `confirm` : current "thread" (ie validation process) is on hold, waiting for user interaction. After user's choice, it finishes dealing with the current product, and then validates the next one, and so on. How to deal with this kind of processes with a web application ? Is there some framework, design pattern or something else that permits to write this kind of business processes, able to start and hold like that ? A solution could be to split those business processes into smaller ones. For my example, we would have 2 sub-processes : the first one checks all products and flags the problematic ones. Then the user has a screen to decide what to do on flagged products, and validates. At this moment we are sure all products are OK, we can start the second sub-process to perform the others operations. The problem with it is that even if it's pretty simple on this example, it can be really more complicated. Some process have a lot of users interactions like this one, and then could be splitted into 10 subparts. Like I earlier precised, we don't want to modify or rethink business process, to be sure that we lose nothing or introduce new business bugs. Does someone has an experience about it ? Do you know some way to deal with this kind of desktop-to-web developments ? * * * **EDIT 15/07/14** There was some misunderstanding about this post, surely related to my poor english expression and vocabulary. To summarize the problem : I got a bunch of business workflows described into UML diagrams. They comes from a huge 30-year-old CAMM (production management ERP). The project is to redevelop this application under **Java** web environment. The main point is that some of those workflows are user-dependent, since, in the middle of the processing, they need a user-interaction. Because web applications are based on a client-server architecture, I don't know how to port them. Reworking/rethinking these workflows is not an option, because it would be too much time-consuming. I need a way to simulate a desktop application on a web app, like Wt, but for Java (i'm not talking about UI but about how to develop workflows ), or to define rules to make those user-dependent workflows web- compatibles.


title: Are the default objects of VB a type of singleton?

text: Are the default objects supported by `My` keyword in VB.net is a kind of singleton? If not, what is the difference? Again is this "default object" feature is something useful? If yes, then why it is not implemented in other languages like C#?


title: Is NoSQL a better choice when working with OOP?

text: This might be a silly question, but I've reading a little bit about NoSQL databases on the past few days and I'm trying to understand when really they help us. One thing I've realized though is that it seems that NoSQL databases are closer to OOP than RDBMS. I say that because usually when we deal with OOAD we don't get a finished version of the model upfront. The model changes lots of times before getting to the real thing. I've even questioned about this here on Programmers.SE. With NoSQL, however, this seems the most natural thing, since the database can also change without much trouble. Also, for a first try with this kind of technology I've created one MongoDB database and the data was being saved like POJO, so that it seemed much more close to object oriented design. In that setting, NoSQL is really a good idea when working with OOP or it's just a good idea in cases where we need the database to scale, to be accessed by many users and all of that stuff?


title: python server to manage wervices

text: i'm looking for a framework to build a webserver. This server will be used to manage webservices. huge amount of client may be able to connect to principally set data which will populate a noSQL DB. we work with python and naturally we would like a python framework. i looked at bottle, gevent, twisted and tornado but it's hard to choose. Some feedbacks or propositions ?


title: Copy-and-Pasted Test Code: How Bad is This?

text: My current job is mostly writing GUI test code for various applications that we work on. However, I find that I tend to copy and paste a lot of code within tests. The reason for this is that the areas I'm testing tend to be similar enough to need repetition but _not quite similar enough_ to encapsulate code into methods or objects. I find that when I try to use classes or methods more extensively, tests become more cumbersome to maintain and sometimes outright difficult to write in the first place. Instead, I usually copy a big chunk of test code from one section and paste it to another, and make any minor changes I need. I don't use more structured ways of coding, such as using more OO-principles or functions. Do other coders feel this way when writing test code? Obviously I want to follow DRY and YAGNI principles, but I find that test code (automated test code for GUI testing anyway) can make these principles tough to follow. Or do I just need more coding practice and a better overall system of doing things? EDIT: The tool I'm using is SilkTest, which is in a proprietary language called 4Test. As well, these tests are mostly for Windows desktop applications, but I also have tested web apps using this setup as well.


title: Why Java does not support private/protected inheritance like C++?

text: While inheriting a class in C++, user can specify the access specifier like,               class Base     {         public int mem1;         protected in mem2;     };          class Derived1 : **private** Base     {         // mem1 will be private here.         // mem2 will be private here.     };          class Derived2 : **protected** Base     {         // mem1 will be protected here.         // mem2 will be protected here.     };          class Derived2 : **public** Base     {         // mem1 will be public here.         // mem2 will be protected here.     };      But the same is not possible in Java, i.e. extends in java is always like "public" inheritance in C++. Could someone explain the reason for this?


title: The way to describe the scale of software in the CV

text: I'm writing my CV, and having trouble explaining about the software for enterprise I developed in my previous job. Now I'm thinking of writing following 4 things for each software.   * Abstract explanation about what the software is used for   * How much was the software sold   * About how many data does the software usually handle   * About how many DB tables does the software have Are there any inappropriate ones in these? Or, anything I should add?


title: Can DVCSs enforce a specific workflow?

text: So, I have this little debate at work where some of my colleagues (which are actually in charge of administrating our Perforce instance) say that workflows are strictly a process thing, and that the tools that we use (in this case, the version control system) have no take on it. In otherwords, the point that they make is that workflows (and their execution) are tool-agnostic. My take on this is that DVCSs are better at encouraging people in more flexible and well-defined ways, because of the inherent branching occurring in the background (anonymous branches), and that you can enforce workflows through the deployment model you establish (e.g. pull requests through repository management, dictator/liutenant roles with their machines setup as servers, etc.) I think in CVCSs you have to enforce workflows through policies and policing, because there is only one way to share the code, while in DVCSs you just go with the flow based on the infrastructure/permissions that were setup for you. Even when I have provided the earlier arguments, I'm still unable to fully convince them. Am I saying something the wrong way?, if not, what other arguments or examples do you think would be useful to convince them? **Edit** : The main workflow we have been focusing on, because it makes sense to both sides is the Dictator/Lieutenants workflow: ![Dictator/Lieutenants workflow](http://i.stack.imgur.com/DFDWg.png) My argument for this particular workflow is that there is no pipeline in a CVCS (because there is just sharing work in a centralized way), whereas there is an actual pipeline in DVCSs depending on how you deploy read/write permissions. Their argument is that this workflow can be done through branching, and while they do this in some projects (due to policy/policing) in other projects they forbid developers from creating branches.


title: When is using stdio preferable to fstream?

text: I work on a well-established, embedded C++ code base. We have been using a proprietary API to our filesystem. For better integration with third-party C libraries, we are currently in the process of implementing most of `stdio.h` and `fcntl.h`. I made what I thought was a non-controversial proposal that we should also implement the fstream class and encourage new C++ code to use it instead of the new (to our code base) C-style API. We already have the `stdout` parts of `iostream` available, although it is not widely used. Given a choice between using `stdio` and `fstream`, what are good reasons to choose `stdio` for embedded software development in C++?


title: How can I organize personal git repositories?

text: I'm in the process of setting up a GitHub account with the plan of making a pair of libraries I developed as parts of some recent iOS projects freely available for other iOS devs to use. I don't currently have off-site backup for most of my code, so as part of this, I originally thought I would upload all of my personal projects, or at least all of my iOS projects, to a private GitHub-hosted repository. However, I have a _lot_ of projects sitting around, many of which are fairly low-value (i.e., adapted from books and written for the learning experience). Not only does GitHub charge by the private repository, it doesn't seem to have any way of organizing repositories hierarchically. Is there something I'm missing that would allow me to use a git repository with a hierarchy and check out pieces as I need them / work with them, the way I currently do with SVN? Does GitHub (or a competitor, like BitBucket) have some project organization features that I'm missing? Failing that, what's the generally accepted "git way" of handling this situation (discard projects not intended for release, store them offline, bundle them together somehow, etc., etc.)? As far as I can tell, my options are:   1. Put libraries on GitHub, continue hosting my own SVN for all other projects, use a non-VCS solution for off-site backup (blech),   2. Put libraries and software I plan to release on GitHub (as public and private, respectively), continue hosting my own SVN for projects I don't care about as much and am only likely to revisit to refresh my memory on how to implement XYZ, decide that I'm willing to write them off if my house implodes (double blech),   3. Put everything on [GitHub and/or BitBucket], deal with having some ridiculous number of repositories by searching for what I need / maintaining some offline set of pointers into my [GitHub and/or BitBucket] account (triple blech)


title: Limit number of users in a web app?

text: I've been asked to look at converting our traditional client-server software into a web-based version (using PHP).   One of the first questions from management was how we'd limit the number of concurrent users, currently handled by our licence manager that every client connects to when running our apps. My initials thoughts:   * Check the number of open sessions on the server (only with valid users that have logged in).   * Logging each login/logout to a DB table and counting them. Is there a standard/best practice way of limiting the number of concurrent users who can log into a web app?


title: Good Practices for development team in large projects

text: Since I started learning C a few years ago, I have never been a part of a team that worked on a project. I am very interested to know what are the best practices for writing large projects in C. One of the things I want to know, is when (not how) do I split my project into different source files? My previous experience is with writing a header-source duo (the functions defined in the header are written in the source). I want to know what are the best practices for splitting a project, and some pointers on important things when writing a project as part of a team?


title: How do you explain agile process tool (like Scrum or Kanban) to a (traditional) project manager?

text: I am sure many people involved in the software development projects came up with this question, but I could not actually come up with satisfying answer.   * How to explain to a manager used to having a huge gantt-chart, resource allocation, critical-paths (etc) benefits of using agile process tool such as Scrum or Kanban? A typical problem is explaining why testing sometimes takes longer than the actually coding...


title: How should we handle extra cosmetic features in Scrum sprints?

text: I was reading the Scrum documents and it says that the tasks in Sprint should be "potentially shippable". I am confused by what this means. Suppose in Sprint 1 the goal was, "user registration form". How much detail do I need to add for something to be ready to ship? For example:   1. I can show the simple form with fields without any fancy styling and mark them as done   2. I can just do client side validation as mark as done but server side is also the option or both   3. I can also add some jQuery fancy tool tips, hover overs, captcha, colors, labels for the form   4. Then there is whole lot of styling about how to show error messages on screen I can do endlessly on one topic. So how do we divide that and when I can think of that as shipping ready. Or do I need to write each smallest possible thing like showing errors, popup or light box text as subtasks and put them as sprint. This would lead to 1000s of tasks for whole project. I mean then again if some work for Internet Explorer and some for Firefox then again do I need to divide those as tasks as well. Time has to be spent on them and when manager asks me what you did in that time, I won't have any tasks to tell but in reality they all are part of User registration


title: Will .NET 4.5 Make the Reactive Extensions Obsolete?

text: Among other things, .NET's Reactive Extensions simplify concurrency management. From what I've heard, .NET 4.5 will simplify concurrency management with things like the `await` keyword. My Question:   * Will .NET 4.5 make the Reactive Extensions obsolete?   * Or is Microsoft expected to pitch the .NET 4.5 additions as an alternative way to approach asynchronous and concurrent programming?


title: How do you know when to split an object method into 2 or more other methods?

text: I know this is a very basic question, but I sometimes find myself struggling to figure out when to split a single object method into multiple methods. For example, I am trying to set up an ACL using Zend_Acl and Zend_Auth, as shown in this tutorial: http://devzone.zend.com/article/1665. However, I am wondering if the My_Plugin_Auth::preDispatch() method should invoke calls to a method called authenticate() and a method called authorize(), instead of having everything lumped in under preDispatch(). I was thinking that this would make the code more readable and encapsulate the logic into its smaller parts, but i'm not sure if this is reason enough.


title: How do I find test users for my Chrome extension with Google App Engine back end?

text: I am new to developing Chrome extensions and I used Stack Overflow to ask many questions and got great answers. I finally finished a beta version and uploaded it to Chrome store only for test users. Now I am not sure where to find test users so I decided to ask here. Is there a separate forum where people post their apps or extensions for review?


title: iPhone app store -- adding ads to free app

text: I have a free app in the store. I am considering an update. It would add some additional options, but also ads. I am curious if anyone else has done this, and if so what was the reaction. Did it piss off your users?


title: What is the best practice for saving TimeZones in the database?

text: We want to start collecting timezones for each of our addresses in the database. What is the best practice to store the timezones? How would you go about acquiring timezones for the existing address records? I'm using Microsoft SQL server, .net mvc, C#. Any suggestions would be greatly appreciated.


title: Checking out and compiling repository. What is the correct approach for starting the compilation process?

text: I am writing a Bash script that automatically updates a repository containing source code and then compiles it. I have been a bit stuck on the part about how to start the compilation itself, i.e. if I should `cat` all the files in the repository and look for the `main` (or equivalent) function and then compile that file. Or if I should let the user specify which file in the repository contains the `main` function (or possibly a `make`file) in the config file. This option requires more work and insight from the user, but I fear that the first option might cause long delays by unnecessary scanning all the files in the repository. What would be the best approach for solving this problem?


title: Identify Service Oriented Architecture

text: How can I tell if a system is built upon a service oriented architecture when reading its source code?


title: Using Full GPL Libraries in Software as a Service (SaaS) Models

text: I already searched the site, but I could only find answers relating to using GPL libraries in software that people were going to sell/distribute. In this case the answer is that they must also make the source code available. What about SaaS? That is, I'll be building an app that clients will pay a monthly fee to use over the Internet, and they won't download anything or get access to the code. Questions:   1. In this case am I allowed to use full GPL libraries without having to make my source code available?   2. Is there some other restriction/requirement of the GPL that I should be aware even if my model is SaaS?


title: Moving forward in the programming world

text: I have been placed in a recent position where my job title does not adequately represent what my current duties entail. I am worried that this classification will affect me later in my career as the job title does not specify 'programmer'. How important is the job title while maintaining a career when compared to the experience and knowledge I am receiving while working? Should this be something to fret over or will a simple explanation be sufficient when transitioning to another workplace in the future?


title: Can someone explain the concept behind Haskell's memoization?

text: (note I'm putting the question here because it's about the conceptual mechanics of it, rather than a coding problem) I was working on a small program, that was using a sequence of fibonacci numbers in its equasion, but I noticed that if I got over a certain number it got painfully slow, googling around a bit I stumbled upon a technique in Haskell known as `Memoization`, they showed code working like this:               -- Traditional implementation of fibonacci, hangs after about 30     slow_fib :: Int -> Integer     slow_fib 0 = 0     slow_fib 1 = 1     slow_fib n = slow_fib (n-2) + slow_fib (n-1)          -- Memorized variant is near instant even after 10000     memoized_fib :: Int -> Integer     memoized_fib = (map fib [0 ..] !!)        where fib 0 = 0              fib 1 = 1              fib n = memoized_fib (n-2) + memoized_fib (n-1)      So my question to you guys is, how or rather why does this work? Is it because it somehow manages to run through most of the list before the calculation catches up? But if haskell is lazy, there isn't really any calculation that needs to catch up... So how does it work?


title: What is a good rule of thumb to do technical writing that doesn't confuse people

text: Sometimes I'm such a nerd that not even nerds understand me, or rather, sometimes I cannot put stuff in understandable and simple-enough terms... and sometimes I can but cannot really tell until after. I like the details on technical stuff, I enjoy writing about them, but sometimes I cannot stop or tell when it is too technical or too abstract to understand. I often end up putting too much detail into stuff thinking that it will help the understanding of some concept, but it sometimes it backfires. These are all edge cases, I'm not that bad at writing (I hope), but, what would be a good rule of thumb to know when you are probably going to make people dizzy when reading your stuff?, how do you test your analogies?, I'm looking for one or more rules of thumb to know if I'm writing technical explanations right, knowing what to reference and what not, etc. **What is your golden rule for writing about technical stuff to technical people who are not necessarily familiar with what you are writing but are also not noobies in your area?, where is the line?**


title: best practice when unit testing for embedded development

text: I am looking for some best practice strategies for unit testing code written for embedded system. By embedded system, I mean code such as device drivers, ISR handlers etc., stuff that are pretty close to the metal. Most of the unit tests are not possible without testing it on the hardware with the aid of a ICE. Sometimes, the embedded unit also needs to be hooked up to other stimulus such as a mechanical switches, stepper motors and light bulbs. This usually occurs in a manual fashion, automation would be great but hard and expensive to achieve. **Update** I came across a C testing framework that seems to be quite successful in testing embedded projects. It uses the ideas of mocking hardware. Check out Unity, CMock, and possibly Ceedling.


title: Is it more efficient to query once for all settings, or query whenever a setting is needed?

text: For my blog script I have a usergroup and permission system set up. Each user is assigned to a usergroup and I have a long list of permission settings. Both are stored in a MySQL database. At the moment I perform around 10 permission queries for each page, for various content management functions. Coupled with another 20 or so queries for general blog use, the number of queries is building up. Would it be more efficient to instead perform one query at the start of the script to retrieve all permission settings into an array, and then have all functions compare values in the array instead of checking the database?


title: Test-driven development: To create test when issue is filed or when issue is picked up by somebody?

text: I've recently been working on a web development project on a team of less- than-five people. Things are going good but now we are decided to go with test-driven development. So far what I've learned is that one of the ultimate goal is that when you are testing your software, everything should be passed. However our current situation is that we have more open issues/stories than what we can handle within an iteration or two and we're a bit confused on how to actually handling test-driven development in this situation. One thing we can do is that when each of us pick a story, that person will write the test for it. Each of us will working within red-green-refactor cycle. Or another thing we can do is that we try to create test cases for all open issues. Then each of us can pick that up and working on eliminating the red for that issue. The first approach looks nice to me that we can ensure what we've done is green across the board. However the latter approach is what I've been thinking it looks more realistic as it reflects the imperfect status of your software. I am not really sure how it is managed in real world or what should be the best practice for this. Inputs from all are welcome.


title: Should deployment errors constitute a build failure?

text: Our software uses in-house written deployment software due to the complexity of the product. As part of our current QA (not dev) build process (using more in-house software) we compile the code, patch the databases, deploy the software and run a smoke test and, in some cases, automated UI tests, before the build is "passed". We are moving to TFS2010 and getting rid of the in- house build process and I would rather not have to add this process into TFS builds. What processes do you use to ensure that the deployment is successful and reporting errors back to the development team? Should a build be classed as a failure in the event of deployment errors / smoke screen or automated UI test failures? TFS ends it's build process when the files are placed in the drop folder it then marks that build as OK. If I am to use the same solution as we have now, either TFS build has to be extended to perform all these tasks before marking the build as a success or we have to have a mechanism to mark the build as failed after it has previously succeeded.


title: What kind of metrics should I collect for a website/web app

text: I have a website that allows users to register for accounts, login, and renew an annual membership fee. They can also update their personal profile, their personal profile, look at a list of their employees, make bulk payments for their employees, view receipts and invoices, etc. For non-members it's a regular website with a lot of pages, but for members, it has quite a few member only areas, with more to come (Such as forums). It also has a job listings page, course registrations, etc. **What are some useful "metrics" I can collect to give me meaningful information about the site, that I can share with my clients.** I really don't know a lot about collecting data about this kind of thing, and would like to learn. I already have a dashboard where the admins can view/export registrations this week and registrations by week for the past 30 weeks. I've been able to show them that registrations spiked after sending out an email about the new system. I'm think I'll also be adding stats about how often users update their profiles and how many users have updated their profile that day/week. Thanks


title: Who was the first software engineer?

text: It's fairly well known who the first programmer was but who was or were the first software engineer(s)? By software engineer I mean someone who uses formalized specifications and methods to deliver software not just a batch programming job. When was the term first used?


title: Package name best practice when porting a library

text: What is the suggested way (specifically in the open-source world) for the package name when porting a library. Say I am porting someone else's library where they have used a reverse domain name stucture for there package name, so there library package name was some thing like `com.therename.thelib`. What should I do if I decide to port it to a new language? Should I keep the domain name intact, even though they didn't have a hand in it? Or should I change it to something like `com.myname.thelib`?


title: Should I use the language I'm most comfortable in, or the company "standard"

text: I'm going to be developing an Intranet site for my specific plant, and our company standard for web-development is IIS \+ ASP.Net \+ VB.Net \+ Microsoft SQL Server (note that we have about 10+ plants). The Intranet site will only be used by my plant, and I'm the only one who will support it. I'm much more proficient with a LAMP setup, and I could do development and problem solving much more rapidly with PHP than I could ASP.Net. Even though the company "standard" is ASP.Net/VB.Net, most of what the company does as a whole is to purchase third party software (which is usually Java based), and very, and I do mean very few people in the company even know VB6, let alone ASP.Net/VB.Net. That being said, **is it better to violate the company standard and go with the setup that I can support better, or is it better to go with the setup that the company can support better if I ever were to leave, even though no one currently in the company can support their own standard anyway?** Some additional factors to consider in my personal case:   * Again, this is only for my plant, and I'm the only one who will ever be supporting it unless I leave the company, and then my replacement would be supporting it. Not someone else already in the company.   * The company does very little development with their standard anyway.   * Hardly any of the companies existing software uses their standard.   * If I choose the company standard, then I have to use the Express version of Microsoft SQL and a Windows 7 OS. From my readings, the Express version is okay for business use, but the database size is limited.


title: Can coding style cause or influence memory fragmentation?

text: As the title states, I'd like to know if coding style can cause or influence memory fragmentation in a native application, specifically one written using C++. If it does, I'd like to know how. An example of what I mean by coding style is using `std::string` to represent strings (even static strings) and perform operations on them instead of using the C Library (such as `strcmp`, `strlen`, and so on) which can work both on dynamic strings and static strings (the latter point is beneficial since it does not require an additional allocation to access string functions, which is not the case with `std::string`). A "forward-looking" attitude I have with C++ is to not use the CRT, since to do so would, in a way, be a step backwards. However, such a style results in more dynamic allocations, and especially for a long living application like a server, this causes some speculation that memory fragmentation might become a problem.


title: 12 factor app config and Java

text: I was reading the 12 factor app manifesto. The manifesto recommends storing the configuration data for the application in environment variables. Does this mean that properties like the DB username / password, resource URL should be stored as a part of Java Env variables rather than as property files?   Is this a secure way of storing the information? To me this seems to be a pretty clunky way of storing the information. One option that I can think of is to have a separate configuration service running in the landscape, and use env property to connect to the config service and then query the config service for further detailed configuration data.


title: How to approach a bad request from a client?

text: Say you coded up some new feature. Now the client comes to you and asks for a change that would make that new feature less user-friendly and just plain wrong. Should you just accept the change request or can you influence the client that their request is misguided?


title: What was the historical impact of Ariane 5's Flight 501?

text: The disintegration of the Ariane 5 rocket 37 seconds after launch on her maiden voyage (Flight 501) is commonly referred to as one of the most expensive software bugs in history1: > It took the European Space Agency 10 years and $7 billion to produce Ariane > 5, a giant rocket capable of hurling a pair of three-ton satellites into > orbit with each launch and intended to give Europe overwhelming supremacy in > the commercial space business. > > All it took to explode that rocket less than a minute into its maiden voyage > last June, scattering fiery rubble across the mangrove swamps of French > Guiana, was a small computer program trying to stuff a 64-bit number into a > 16-bit space. > > One bug, one crash. Of all the careless lines of code recorded in the annals > of computer science, this one may stand as the most devastatingly efficient. > From interviews with rocketry experts and an analysis prepared for the space > agency, a clear path from an arithmetic error to total destruction emerges. What major changes did Flight's 501 failure and the subsequent investigations inspire to the research of safety critical systems and software testing? I'm not looking for an explanation of the bug itself, but for an explanation of the historical impact of the bug, in terms of research that were inspired from or were directly related to the investigation(s) of the failure. For example this paper concludes: > We have used static analysis to: > >   * check the initialization of variables, >   * provide the exhaustive list of potential data access conflicts for > shared variables, >   * exhaustively list the potential run time errors from the Ada semantics. > > > **To our knowledge this is the first time boolean-based and non boolean- > based static analysis techniques are used to validate industrial programs.** Similarly, this paper(pdf) notes: > Abstract interpretation based static program analyses have been used for the > static analysis of the embedded ADA software of the Ariane 5 launcher and > the ARD. The static program analyser aims at the automatic detection of the > deﬁniteness , potentiality, impossibility or inaccessibility of run-time > errors such as scalar and ﬂoating-point overﬂows, array index errors, > divisions by zero and related arithmetic exceptions, uninitialized > variables, data races on shared data structures, etc. The analyzer was able > to automatically discover the Ariane 501 ﬂight error. **The static analysis > of embedded safety critical software (such as avionic software) is very > promising**. I would love a thorough explanation of the impact this single event had on software testing approaches and tools. 1 The $7 billion figure possibly refers to the total cost of the Ariane 5 project, Wikipedia reports that the failure resulted in a loss of more than $370 million. Still a quite expensive failure but nowhere near the $7 billion figure.


title: Testing that an attribute does not exist cannot fail when writing tests before code

text: I have been taught to follow the Red->Greeen->Refactor pattern when doing TDD. There have been situations where this pattern have not been applicable though. For instance, a test to make sure that a controller action method (ASP.NET MVC) does not have an Authorize attribute. Since the test is testing the absense of an attribute it will pass on the first go, unless an Authorize attribute is added only to have the test fail. What I have done so far when testing for absense of said Authorize attribute is to write a test for it, then add the Authorize attribute just to make sure that the test actually works, then immediately remove the Authorize attribute. Am I doing something wrong, or is this just the way it is; some tests will pass unless we intentionally add code to make the fail and then remove that particular code?


title: Algorithm to create an TicTacToe game AI

text: What are the algorithms I could use to create an AI for the game TicTacToe. I have already used Alpha–beta pruning and Predictive modelling. What the other good Algorithms I can use to create this AI. I want to practice a new language this would a great way to learn a new language. Thanks


title: Initiating processing in a RESTful manner

text: Let's say you have a resource that you can do normal PUT/POST/GET operations on. It represents a BLOB of data and the methods retrieve representations of the data, be they metadata about the BLOB or the BLOB itself. The resource is something that can be processed by the server on request. In this instance a file that can be parsed multiple times. How do I initiate that processing? It's a bit RPC like. Is there best practice around this? I've read this: RESTFul: state changing actions but it doesn't really answer the question. (First time on programmers. This is the right place for this sort of question, right?)


title: Loose typing not applied to objects

text:
I have very little experience working with classes and object. I work in a loosely typed language, PHP. I was working with a SimpleXML object and ran into a problem where I was trying to do math with an element of that object like `$results->ProductDetail->{'Net'.$i};` If I echoed that value, I'd get `0.53` but when I tried to do math with it, it was converted to `0` Is there a reason that a loosely typed language would not recognize that as a float and handle it as such? Why would "echo" handle it as a string but the math fail to convert it? Example:               $xml='<?xml version="1.0" encoding="UTF-8" ?>';     $xml.='<Test>       <Item>         <Price>0.53</Price>       </Item>     </Test>';          $result=simplexml_load_string($xml);          var_dump($result->Item->Price);     echo '
';     echo $result->Item->Price;     echo '
';     echo 1+$result->Item->Price;     echo '
';     echo 1+(float)$result->Item->Price;      Output:               object(SimpleXMLElement)#4 (1) { [0]=> string(4) "0.53" }      0.53     1     1.53      No object version:               $no='.53';     echo 1+$no;      Output:               1.53      ================================ Side note: PHP `strpos()` does not properly convert an integer needle `$i` into a string.               $x=101; $i=1; if(strpos($x,"$i")===FALSE){echo $i." missing";}      and               $x=101; $i=1; if(strpos($x,$i)===FALSE){echo $i." missing";}      give different results. I don't want to become a php hater, but I'm beginning to lose that loving feeling.


title: How to collaborate on features using github

text: github encourages 1 fork per user, so that that user can work independently on a feature and then request that feature to be accepted into the main repository via pull request. However, what if 2 developers need to collaborate on that feature? What is the ideal workflow for this? I could see a number of options:   1. Both developers fork the original repository. Each developer pulls/pushes changes between each other's repository. This seems like a lot of work (tiny micro operations) and also creates a delay between changes, so increases the window for conflicts.   2. Developer 1 forks from the main repository, developer 2 forks from developer 1. Same as #1 mainly but hopefully simplifies Developer 2's life a little?   3. Developer 1 gives Developer 2 permissions to his own fork, so they both work out of the same central repository. Not sure if this is ideal. I'm also curious where branches come into this. Obviously there would be a branch for the feature itself but that branch can't exist in a single place, it would have to exist on multiple forks and be synchronized. Basically just really confused about this workflow, would like an approach for how this can be best accomplished.


title: What are some of the benefits of a "Micro-ORM"?

text: I've been looking into the so-called "Micro ORMs" like Dapper and (to a lesser extent as it relies on .NET 4.0) Massive as these might be easier to implement at work than a full-blown ORM since our current system is highly reliant on stored procedures and would require significant refactoring to work with an ORM like NHibernate or EF. What is the benefit of using one of these over a full-featured ORM? It seems like just a thin layer around a database connection that still forces you to write raw SQL - perhaps I'm wrong but I was always told the reason for ORMs in the first place is so you didn't **have** to write SQL, it could be automatically generated; especially for multi-table joins and mapping relationships between tables which are a pain to do in pure SQL but trivial with an ORM. For instance, looking at an example of Dapper:               var connection = new SqlConnection(); // setup here...     var person = connection.Query<Person>("select * from people where PersonId = @personId", new { PersonId = 42 });      How is that any different than using a handrolled ADO.NET data layer, except that you don't have to write the command, set the parameters and I suppose map the entity back using a Builder. It looks like you could even use a stored procedure call as the SQL string. Are there other tangible benefits that I'm missing here where a Micro ORM makes sense to use? I'm not really seeing how it's saving anything over the "old" way of using ADO.NET except maybe a few lines of code - you still have to write to figure out what SQL you need to execute (which can get hairy) and you still have to map relationships between tables (the part that IMHO ORMs help the most with).


title: Calculator with 3+ values

text: I am new to c++ and have been making the good old Calculator. I have gone forward from a 2 value calculator to a 3 value calculator and wondered.. How is it possible to make a 10 digit calculator (purely using +,-,*,/) that doesn't forever to code.. I have a if statement which returns what happens if the operators are + and + or + and - etc.. and if i was to go to 4 value, i would be writing 64 ifs, and 5 value would be 256 if statements. Is there a way to change this such that it wouldn't require writing out so many if statements? Here is my the important parts of the code: Calculator.cpp:               #include "stdafx.h"     #include <iostream>     #include "headers.h"     using namespace std;          int main()     {     int nInput1 = GetUserInput();     char chOperation = GetMathematicalOperation();     {         if (chOperation == '=')         {             cout << "The answer is: " << nInput1 << endl;             return 0;         }     }     int nInput2 = GetUserInput();     char chOperation2 = GetMathematicalOperation();     {         if (chOperation2 == '=')         {             int nResult = CalculateResult(nInput1, chOperation, nInput2);             cout << "The answer is: " << nResult << endl;             return 0;         }     }          int nInput3 = GetUserInput();          int nResult = CalculateResult2(nInput1, chOperation, nInput2, chOperation2, nInput3);          PrintResult(nResult);     }      CalculateResult.cpp:               #include "stdafx.h"     #include <iostream>     #include <string>     using namespace std;               int CalculateResult(int nX, char chOperation, int nY)     {     if (chOperation == '+')         return nX + nY;     if (chOperation == '-')         return nX - nY;     if (chOperation == '*')         return nX * nY;     if (chOperation == '/')         return nX / nY;          return 0;     }      GetMathematicalOperation.cpp:               #include "stdafx.h"     #include <iostream>     #include <string>     using namespace std;          char GetMathematicalOperation()     {     cout << "Please enter an operator (+,-,*,/ or =): ";          char chOperation;     cin >> chOperation;     return chOperation;     }      CalculateResult2.cpp:               #include "stdafx.h"     #include <iostream>     #include <string>     using namespace std;               int CalculateResult2(int nX, char chOperation, int nY, char chOperation2, int nZ)     {     if (chOperation == '+' && chOperation2 == '+')         return nX + nY + nZ;     if (chOperation == '+' && chOperation2 == '-')         return nX + nY - nZ;     if (chOperation == '+' && chOperation2 == '*')         return nX + nY * nZ;     if (chOperation == '+' && chOperation2 == '/')         return nX + nY / nZ;          if (chOperation == '-' && chOperation2 == '+')         return nX - nY + nZ;     if (chOperation == '-' && chOperation2 == '-')         return nX - nY - nZ;     if (chOperation == '-' && chOperation2 == '*')         return nX - nY * nZ;     if (chOperation == '-' && chOperation2 == '/')         return nX - nY / nZ;          if (chOperation == '*' && chOperation2 == '+')         return nX * nY + nZ;     if (chOperation == '*' && chOperation2 == '-')         return nX * nY - nZ;     if (chOperation == '*' && chOperation2 == '*')         return nX * nY * nZ;     if (chOperation == '*' && chOperation2 == '/')         return nX * nY / nZ;          if (chOperation == '/' && chOperation2 == '+')         return nX / nY + nZ;     if (chOperation == '/' && chOperation2 == '-')         return nX / nY - nZ;     if (chOperation == '/' && chOperation2 == '*')         return nX / nY * nZ;     if (chOperation == '/' && chOperation2 == '/')         return nX / nY / nZ;     return 0;     }


title: CSS3 will be standardized by browsers?

text: I'm using CSS3 for the first time, but using specific styles with prefix for each browser looks strange. The need of using `-moz-`, `-o-`, `-webkit-` and another prefix turns the CSS bigger and harder to maintain. I want to know if the browsers are implementing some standardization to avoid the usage of prefix for styles.


title: Implementation of algorithm to generate chess positions

text: I am interested in developing a program that generates an endgame table-base for the chess. I have gone through the technical papers of the greats like Shannon and Ken Thompson. I have found that retrograde analysis is used for the generation. How can I generate all positions in a `KBBK` chess endgame which are mates in 0?


title: Is it a good idea to const-qualify the fields of structure in C?

text: Consider the following program:               #include <stdlib.h>     #include <stdio.h>          typedef struct S_s {         const int _a;     } S_t;          S_t *     create_S(void) {         return calloc(sizeof(S_t), 1);     }          void     destroy_S(S_t *s) {         free(s);     }          const int     get_S_a(const S_t *s) {         return s->_a;     }          void     set_S_a(S_t *s, const int a) {         int *a_p = (int *)&s->_a;         *a_p = a;     }          int     main(void) {         S_t s1;         // s1._a = 5; // Error         set_S_a(&s1, 5); // OK         S_t *s2 = create_S();         // s2->_a = 8; // Error         set_S_a(s2, 8); // OK              printf("s1.a == %d\n", get_S_a(&s1));         printf("s2->a == %d\n", get_S_a(s2));              destroy_S(s2);     }      I'm not aware of anything particularly bad with this kind of design, but there might be impact when compiler is heavily optimizing the code and some considerations I'm missing. Is it a good idea to use `const` in `C` as a mechanism of write access control in such a way?


title: Java vs COBOL programming examples

text: I am a COBOL programmer, desperately trying to learn and program Java. Although I understand the OO priciples and concepts, I am at a lost putting all together. I am trying to find some examples on how code will look in COBOL vs Java - something a bit more complicated than "hello world" [I am past that initial headache! :-)], that includes OO principles - basically, a decent 1000+ liner in COBOL, with the Java code to work through. After working through book after book, doing the examples, and even writing small java programs at work, I think working through an example I can compare will be the best way to getting my thinking cap converted, and being able to do in Java what I can do after 10 years with COBOL. Can anybody help?


title: Security aspects of an ASP.NET that can be pointed out to the client

text: I need to write several passages of text in an offer to the client about the security layer in ASP.NET MVC web solution. I am aware of security that comes along with MVC 3 and an improvements in MVC 4. But all of them are non conceptual, except for `AntiForgeryToken` (AntiXSS) and built-in SQL Injection immunity (with a little of encoding needed by hand). What would be the main point of ASP.NET security I can "show off" in an offer to the client?


title: Git bug branching convention

text: I've been following the successful Git branching model guide for most of my development. I still wonder if the way I handle bug tickets is correct. My current workflow: Once I accept a bug ticket I will do a `git checkout -b bug/{ticket_number}`, create a single commit as a fix and then checkout develop and do a `git merge --no-ff`. I'd love to hear from the experiences of others whether or not I am abusing the --no-ff option in this instance. If I am, could someone suggest a better approach?


title: Planning milestones and time

text: I was hired by a marketing company a year ago initially for link building / SEO stuff, but I'm actually a Web developer and took the job just in desperation to have one (I'm still quite young and just finished 2nd year of University). From the 3rd day my boss realised that I'm not into that stuff at all and since he had an idea of a web based app we started to plan it. I estimated that it shouldn't take me longer than two months to do it, but as I was making it we soon realised that we want to add more and more stuff to make it even better. So the development on my own lasted for about 4 months, but then it became an enterprise size app and we hired another programmer to work along me. The guy was awesome at what he did, but because I was assigned to be programmer/project manager I had to set up milestones with deadlines and we missed most of them, because most of the time it was too much work, and my lack of experience kept me setting really optimistic deadlines. We still kept adding features and had changed the architecture of the application twice. My boss is a great guy and he gets that when we add features it expands the time frame in which things should be done so he wasn't angry at me nor the other guy. But I was feeling bad (I still am) that I suck at planning. I gained loads of experience from the programming side, but I still lack the management/planning skills which make me go nuts. So over the last year I have dedicated probably about 8 months of work to this app (obviously my studies affected it) and we're launching as a closed beta this month. So my question is how do I get better at planning/managing a project, how do you estimate the times? What do you take into consideration when setting goals. I'm working alone again because the other guy moved from the city. But I'm sure we'll be hiring to help me maintain it so I need to get better at it. Any hints, points or anything on the topic are appreciated.


title: Finding the shortest path through a digraph that visits all nodes

text: I am trying to find the shortest possible path **that visits every node** through a graph (a node may be visited more than once, the solution may pick any node as the starting node.). The graph is directed, meaning that being able to travel from node A to node B does not mean one can travel from node B to node A. All distances between nodes are equal. I was able to code a brute force search that found a path of only 27 nodes when I had 27 nodes and each node had a connection to 2 or 1 other node. However, the actual problem that I am trying to solve consists of 256 nodes, with each node connecting to either 4 or 3 other nodes. The brute force algorithm that solved the 27 node graph can produce a 415 node solution (not optimal) within a few seconds, but using the processing power I have at my disposal takes about 6 hours to arrive at a 402 node solution. What approach should I use to arrive at a solution that **I can be certain** is the optimal one? For example, use an optimizer algorithm to shorten a non- optimal solution? Or somehow adopt a brute force search that discards paths that are not optimal? EDIT: (Copying a comment to an answer here to better clarify the question) To clarify, I am not saying that there is a Hamiltonian path and I need to find it, I am trying to find the shortest path in the 256 node graph that visits each node AT LEAST once. With the 27 node run, I was able to find a Hamiltonian path, which assured me that it was an optimal solution. I want to find a solution for the 256 node graph which is the shortest.


title: Would this be considered Single Tenant or Multi-Tenant?

text: As a company, we lease a managed server from a provider. In that sense, our server is a single tenant server. On this server, we have multiple customer databases. Each customer has its own database. We have been asked by a customer if we are a single tenant or a multi-tenant solution. From our perspective, we are the sole tenant of the server. But, what is the correct answer to the customer?


title: Is it possible to be agile without use cases and tests?

text: Rhetoric teaches us that the answer is probably yes. However I feel that we would no longer relate to the vast majority of Agile success stories. I think that my upper management read the benefits column of an Agile process but forgot to read about the requirements or how successful Agile businesses got there.


title: Is there a faster way to work out this logic?

text: The purpose of this assignment was the find the smallest and largest of the integer(User inputs 5 entries) I am a beginner Java programmer with no prior experience. Is there an easier way to do this without a ton of if/else statements? Forgive for the dirty code.                   //Scanner Object         Scanner input = new Scanner(System.in);              int num1, num2, num3, num4, num5;         int large;         int small;              System.out.print("Enter Num1: ");         num1 = input.nextInt();              System.out.print("Enter Num2: ");         num2 = input.nextInt();              System.out.print("Enter Num3: ");         num3 = input.nextInt();              System.out.print("Enter Num4: ");         num4 = input.nextInt();              System.out.print("Enter Num5: ");         num5 = input.nextInt();              //If/Else statements (SMALL)         if (num1<num2 && num1<num3 && num1<num4 && num1<num5) {             small = num1;                  }                   else if (num2<num1 && num2<num3 && num2<num4 && num2<num5) {                     small = num2;                                  }              else if (num3<num1 && num3<num2 && num3<num4 && num3<num5) {                     small = num3;                   }              else if (num4<num1 && num4<num2 && num4<num3 && num4<num5) {                     small = num4;                   }              else {             small = num5;              }              //Large              if (num1>num2 && num1>num3 && num1>num4 && num1>num5) {             large = num1;         }              else if (num2>num1 && num2>num3 && num2>num4 && num2>num5) {                                             large = num2;         }              else if (num3>num1 && num3>num2 && num3>num4 && num3>num5) {                     large = num3;         }              else if (num4>num1 && num4>num2 && num4>num3 && num4>num5) {                         large = num4;         }              else {                     large = num5;                      }                   //Display: Use printf when using a format limiter (%)              System.out.printf("The smallest integer: %d\n", small);         System.out.printf("The largest integer: %d\n", large);                             }// end of main          }


title: How to deal with exceptions to business rules?

text: I have been given a file with several records. I have also been given business rules that determine how to process those records and produce an output file. The business rules are relatively simple:   1. If record is of type A, use methodology A.   2. If record is of type B, use methodology B. However my client emailed me with a problem: There is one "special" record in the file. It's a type A record, but it needs to be processed with methodology B. How does one deal with these exceptions to business rules? Some options I have thought of so far:   1. Hard-code the exception into the software: `if record.id == "some_id" && record.value == 123.45 then methodology B`.   2. Manipulate the file by hand, run the program, and then correct the output by hand. My coworker is astonished that I would even consider option 1. It's messy, and next year (when I have to run this process again) the file could be different. It will turn out to a nice hidden "gotcha" that could cause problems long after I forgot about the exception. However option 1 is easier than option 2, and if the exception to the rule stays the same for next year, I won't have to even think about it. It's already been handled. Besides, it's easy to change if I need to change it later. How do I deal with random exceptions to business rules? EDIT: This is very targeted software - written to specifically do one job for one client.


title: MVC4 Service > Controller Models

text: I'm working on a MVC4 N-tier application and have a quick question about Service to Controller relation and using Domain/ViewModel.                  public ActionResult Details(int id = 0)         {             TenantDomainModel tenant = _tenantService.GetById(id);             TenantViewModel tenantViewModel = Mapper.Map<TenantViewModel>(tenant);             return View(tenantViewModel);         }      As you can see my service return a DomainModel that my controller use to create a ViewModel using Automapper. Is there a better way to do that ? Ideally I would like to have no domain model referenced in my Presentation/Web layer but i'm not what are the exact best practice on this specific point. Thanks


title: Dynamic programming proof

text: I have aquestion, lets say im trying to maximize: S=∑j=1nfj(xj) subject to ∑j=1nxj≤B, where B∈ℤ+ and fj:ℝ→ℝ. how would i do this using dynamic programming and what would be the states and recursive formulation. Also how would I go about finding the time complexity of this method? Any help would be much appreciated kind regards


title: How does VoiceDrop work?

text: I'm interested in building some functionality similar in nature to that provided by VoiceDrop (http://www.voicedrop.ws/). I'm thinking about using Twilio, offers some very powerful telephony features, but it's not immediately obvious how one would dial a user's voicemail directly. Anyone have any ideas? _edit:_ apologies for the poor tag, I wanted to put "voicedrop voice-mail twilio"


title: Programming for Digital frames

text: A project has recently come to my attention but i have no idea where to start or even if its possible. The idea revolves around programming a clock that is displayed inside a digital photo frame. The user would then be able to put different pictures corresponding to different times inside a usb pen for example, which would load as soon as you put the usb in. The project itself would be a really neat project - if it was just on a computer. I have no idea if what im talking about it even possible on a digital photo frame and if it is what language? Anyone who has any input at all would be great. My current idea is to maybe have a small device at the back, SSD, that runs the program through a screen, completely by passing standard digital photo frames, again though i dont know how to begin with this. And yes ive tried google (although it helps to know what to google).


title: Need Help in Pointing to focus on the Key elements in Code Review Phase?

text: Please share your views on the code review process. If someone gave a code snippet and asked you to review that code, then what are the major things you will focus on that code Review process? For instance, I will check if any dead code is available in that code, other than checking dead code, what are the key elements to be focused on in the code review process? **Update:** Please share any free code review e-book which helps me to understand more and more.


title: Why Oracle still loves command-line black dump screen?

text: I wanted to know about this since a long time. Other vendors are coming out with intuitive IDEs with even more flexibility to developers and DBAs, whereas we rely on Toad and other third-party IDEs to work with Oracle. Why they are sticking to command-line black dump screen?


title: Can a daily scrum meeting be replaced by a status email?

text: If an agile team has members like Developers, Testers, and Automation Testers from different geographical regions, how can the daily scrum meeting can happen? Obviously they have to work in different time zones. Can this be successfully managed? Do you think the daily scrum meeting can be replaced by sending status emails at the end of day, or by answering the three Scrum questions in an email?


title: Defining user operations on application/collection+json response?

text: I'm fairly new to Collection+JSON. I have a bunch of questions regarding Collection+JSON and user operations. # Use Case Having user permissions in a Collection+JSON response would be useful in telling the client what operations can be enacted on a particular object. As an example, it would allow the client to know which "buttons" to render on the user interface. ## Questions   1. Should the user's permissions be bundled into the Collection+JSON response?   2. Should the user's permissions be bundled into a separate call to the user object?   3. Is this beyond the scope of Collection+JSON? ## Thoughts My personal thought is that user permissions should be stored in a user object for a separation of duty, however, if this is the case then every request should then be paired with a request for a user object. This doesn't seem like a correct methodology. ## Examples In the following examples, "permissions" are represented by an integer value where 1 represents read, 2 represents create, 3 represents update, and 4 represents delete. The server will always validate the user's request, but this would make it easier for the client to know what operations can be done to the object. ### 1\. Bundled in the response "Permissions" could be added to the Collection+JSON specification, but this would be modifying the specification.               {       "collection" :         {           "rel" : {string},           "href" : {string},           ... links, queries, items, etc...            "permissions" : { integer value }         }     }      ### 2\. Bundled in the User object Permissions are stored in the user object and change based on the URL to provide the client with information on what this user can do at this particular state in the application.               {       "collection" : {         items: [{           ... name, username, etc...                "permissions" : { integer value }         }]       }     }      ### 3\. Beyond the scope According to the _draft_ specification: > The Collection+JSON hypermedia type is designed to support full read/write > capability for simple lists. I suspect that by providing a Collection+JSON response, it is assumed that all CRUD operations are available to the client and that the server will provide the appropriate response when a request is made.


title: Best way to assure uniqueness in filename with php

text: I was wondering, **without using any kind of user info** (id, nickname, age, etc), what would be the best way to assure filename uniqueness using php **in a large database with high traffic and most probably simultaneously** between many users? I am using `$file = time()` for example but I would like to know if this should suffice whenever two users might go over this code at the same time (at a large large large scale, 10000 users at the same time and the same function ran 200 at the same time).


title: Should dependency relationships always be shown on class diagrams

text: I recently started using the Object aid UML generator plugin for Eclipse and noticed that by default adding of dependency relationships is switched off. This made me wonder if in most cases they should not be shown or rather that most people don't want to show them, seeming as this is the default setting. How do I decide whether to show dependency relationships or not?


title: is it wrong for my parent object to make assumption about child objects?

text: I have a simple domain with about 6 objects in the model. For the most part they have a clear child/parent relationship with parent having multuple children. I'm going to have all of them be immutable. However, at some point I'll need to both fetch a set of all objects of a given type, and be able to fetch a specific object of a certain type by it's label. I was going to have a model with some generic maps, and an abstract class for objects in the model. Adding to the model sticks the object in my map, and asks for the parent objects and sticks those in the map etc. Likewise a delete can delete all classes that called themselves children. This way I can query for specific classes in a generic method without writing logic to hunt down each class. Once I thought of this my next thought was rather I can use a similar framework to save CPU by looking up children in the same manner. If I already have to store "these objects claimed x was a parent" to do the delete I can then say "give me children of X". However, this assumes that X knows something about the other objects (what classes are effectively children of it). I can put in type safty via reflection mostly; but is it brittle for one object to presume that certain other class is going to claim it as a parent and persumably be in the model as such? TO clarify, lets say I have a node and edge class. My edge would report a node as it's parent. My Node can then say "give me all Objects that claimed me as parent and are edges" and do logic on them; even though it never did anything to ensure that there were edges out there using it as a node. Is this wrong? Note, this is a small system. I know that there are great abstraction patterns for huge systems, that I mostly don't think are worth the implementation cost or less explicit code for such a simple system.


title: When to use shared libraries for a web framework?

text: **tl;dr:** I've found myself hosting a bunch of sites running on the same web framework (symfony 1.4). Would it be helpful if I moved all of the shared library code into the same directory and shared it across the sites? **more** I see some advantages to this:   * Each site takes up less disk space   * Library updates (an unlikely scenario) can take place across all sites I also see some disadvantages, mostly in terms of a single point of failure and the inability to have sites using different versions of the framework. My real concern, though, is performance. I hypothesize that I will see a performance increase, since the PHP code will already be cached for all sites when they call the framework. Is this a correct hypothesis?


title: Are there successful examples of development "shifts"?

text: There is some thinking going on around how to get more output from the current resources we have. The thought is that two teams working different shifts might produce more output. The first shift might work 8am - 5pm, and the second team works 4pm - 1am. There is an hour overlap for status meetings and any communication that needs to happen between the teams. You would obviously need two team leaders, one for each shift. So far, the benefits I can see from this are:   * Better ability to respond to customer issues (time zone affects things less)   * Utilize the same workstations, equipment, and office space (less cost per developer)   * Allows "night owls" to work at night, when they're more productive   * Might be able to complete certain less complex tasks in less days (not time, days)   * Less people in the (open-plan) office, meaning less distractions and higher productivity The drawbacks I see are:   * Developers don't have a space or equipment to call their own (am I the only one that cares about this?)   * Communication between the teams will suffer since they only see each other for an hour each day   * Much more documentation and specification writing will be necessary (you can't rely on on-the-fly decisions from decision-makers because they might not be available)   * Older developers tend to have families and night-time activities, and don't want to be at work Any other thoughts? Has anyone worked in this type of environment? I'd be curious to hear your thoughts on this development model, and your opinion on whether it was a good one or a bad one.


title: Is there a standard name for this search approach?

text: In order to create a (Lucene) query, an "incomplete" domain object is used. All properties with a value are used for the query, the rest is ignored. In the absence of a better name, we call it "search by example", but as with many other "original" approaches there is probably a (standard/agreed upon) name for this approach, but I could not find one. Thank you.


title: Are questions about the Singleton pattern a good way to evaluate a job applicant?

text: I have been recently assigned the task of taking interviews in my company. I have been taking interviews of developers and engineers with atleast 5-6 years of experience. One of my favorite question is to ask whether they have used any kind of patterns...and the default answer has always been "Singleton Pattern" Since it is the most simple pattern, I always end up asking them to write a code for it, and only 1-2 out of 5 end up getting it right, but get confused when I start asking about thread safety, double-checked locking issues and etc.. My questions are:   1. Is it fair on my part to expect a person with 5-6+ years of experience to know how to write a Singleton pattern?    2. Is it fair on my part to judge a person upon their ability to code a Singleton class? EDIT: Some clarifications. \- When I ask if they know anything about design patterns, I would like to know what kind of GoF patterns they have used, why they have used and how they have used them. And with 5-6 years of development experience, I would expect a person to know about GoF patterns...correct?   \- The first answer which everyone say when I ask about patterns is "I have used and written Singleton Classes". Singletons are at the cusp of being declared an anti-pattern...with asking them to write about it, I try to gauge 1. If they can code, 2. If they can code what they claim they could code, 3. Tell me the problems with Singleton... Do I sound more reasonable now? :)


title: Querystring Advanced Search where there are about 20 search fields

text: I am creating an advanced search page where there are about 20 search fields for a user to filter their search. My question deals with the query string, Is it standard web development practice to have say 20 parameters in a querystring? The search results display large tables of data. Is there an alternative that still uses HTTP GET(querystring), if it is not standard? I would like the users to be able to bookmark their searches.


title: Requiring Explicit Null Reference Handling

text: One of the problems I have with null references is that they may not be exceptional. In my current position, there are few requirements and you are lucky if conventions are followed. This means being unable to handle a request is a frequent occurrence and throwing an exception is too slow (think millions of requests). I am in charge of writing an api for handling these requests and I am trying to decide how to handle failures. Our code is written in C# and I am a huge fan of LINQ. I know that LINQ handles this problem by providing two methods "Function()" and "FunctionOrDefault()". By returning the default value (usually null), we make it very easy for the developer to shoot himself in the foot. On the other hand, throwing an exception is unacceptable for us. There is also the "TryParse" pattern, but that doesn't lend its self well to lambda expressions. I recently discovered the Option type in F# and how it requires explicit handling of both the Some and None cases or your assembly will not compile. This seems like a much better solution to the null value problem than leaving it up to the developer to remember to implement error handling. I could implement an option type that will not both compile **and** return the desired value unless both Some and None cases are handled. The contract for my implementation would look like this:               Option<SomeClass> option = new SomeClass { Value = 5 }.ToOption(); // Extension method     int value = option.Some(x => x.Value).None(x => x.Default(25)); // Other helper methods provided as well for None cases.      So my question is, if I have the ability to require explicit null reference handling, are there any downsides to this approach? Would it be better to stick with conventions rather than try to solve this problem upfront to prevent future hidden bugs?


title: 5 things before starting a project?

text: What are the first 5 things you do before starting a new project? Do you always spend a day researching new frameworks? Or, using similar or competing products?


title: Tips on Converting a C program to Pure Python

text: I'd like to convert an open source C application to pure python (not to Cython, IronPython etc). The documentation and presentations of the original creator of the C application has given me a good understanding of the architecture of the application. Since I want the first version of the python application to be as identical to the C based one, a manual conversion seems to be the best option. I'd appreciate some tips on how to best approach this code conversion (C to Python), based on your experience. (I am just looking for insights on how others have handled a similar task before.) * * * (Python version 2.7; The C application is the popular database SQLite. Please don't let that or C vs python distract you from the actual question. My C is rusty but good enough for the task, and my Python is above average.) * * * Clarifications:   * I was planning a manual rewrite. Appreciate advice on how to analyze the C source and header files and things to keep in mind vis-a-vis python.


title: GPL v 3 & Scripts

text: I'm not asking for legal advice; just some rough guidance. I have a host application in Java that uses the Rhino JS engine to execute JavaScript. That JavaScript can then make calls into other Java libraries, some of which might be licensed under the GPL. I distribute my hosting app, the JS files as source and the unmodified Java libs. I have released all of the JavaScript as open source. Am I also required to release my Java hosting apps source?


title: Name of this algorithm (Create binary image)

text: Some days ago I saw in this site the algorithm below to convert color images to binary images and I used it in my application (with some small changes). However, I need to know what is the name of the implemented algorithm and, if possible, some references about it. Thanks in advance!               public static boolean[][] createBinaryImage( Bitmap bm )     {         int[] pixels = new int[bm.getWidth()*bm.getHeight()];         bm.getPixels( pixels, 0, bm.getWidth(), 0, 0, bm.getWidth(), bm.getHeight() );         int w = bm.getWidth();              // Calculate overall lightness of image         long gLightness = 0;         int lLightness;         int c;         for ( int x = 0; x < bm.getWidth(); x++ )         {             for ( int y = 0; y < bm.getHeight(); y++ )             {                 c = pixels[x+y*w];                 lLightness = ((c&0x00FF0000 )>>16) + ((c & 0x0000FF00 )>>8) + (c&0x000000FF);                 pixels[x+y*w] = lLightness;                 gLightness += lLightness;             }         }         gLightness /= bm.getWidth() * bm.getHeight();         gLightness = gLightness * 5 / 6;              // Extract features         boolean[][] binaryImage = new boolean[bm.getWidth()][bm.getHeight()];              for ( int x = 0; x < bm.getWidth(); x++ )             for ( int y = 0; y < bm.getHeight(); y++ )                 binaryImage[x][y] = pixels[x+y*w] <= gLightness;              return binaryImage;     }


title: What is the best way to represent quantity in stock in domain model?

text: A `Transaction` contains one or more `LineItem`. One `LineItem` has a relation with an `Item`. Every `Item` has a number field that represent quantity in stock. Using this approach, every `Transaction` creation will need to decrease quantity in `Item`. If user update a `Transaction` then quantity in `Item` will need to be adjusted. If user delete a `Transaction` then quantity in `Item` will need to be increased. What is the best way to implement this rule or behaviour in domain model layer? `Transaction` operations (like create, update, or delete) are located in data access layer.


title: design strategy pattern with null checking

text: When the context class can accept a null strategy, is there another way to do it without check if its null? Is this considered a good strategy design implementation?               class MainApp{         static void Main(){             Context context = new Context();             while(true){                 Strategy strategy = createConcreteStrategy(Console.ReadLine());                 context.setStrategy(strategy);                 context.run();             }         }         static void createConcreteStrategy(string input){             if( input == "strategyA" ){                 return new StrategyA();             }             if( input == "strategyB" ){                 return new StrategyB();             }                    return null;         }     }     abstract class Strategy { public abstract void doSomething(); }     class Context{         Strategy strategy;         ClassX x;              public Context(){}         public void setStrategy(Strategy strategy){             this.strategy = strategy;         }         public void run(){             if( strategy != null ){                 data = strategy.doSomething();                 x.setData(data);             }         }     }


title: Why is the following naming guideline different between OO and non-OO languages?

text: I am working with a non-OO language and I'm trying to name my routines consistently. I came acrross the following guideline from Steve McConnell's Code Complete: > _To name a procedure, use a strong verb followed by an object_ McConnell gives the following good and bad examples:   * good, non-OO --> `PrintDocument(doc)`   * good, OO -->       `doc.Print()`   * bad, OO -->         `doc.PrintDocument()` For an OO language, `doc.PrintDocument()` is non-recommended on the basis that it is redundant. I'm having a hard time wrapping my head around this guideline. Why is `PrintDocument(doc)`recommended, and `doc.PrintDocument()` non-recommended? Also, what would be the problem with the simpler name `Print(doc)` in a non-OO language? Am I missing something very basic here?


title: How can I automate the process of code review

text: I have a team that works on multiple technologies. I want to know how can I automate the process of code review for .Net, .Net MVC, Python, PHP, Drupal and HTML5/CSS with JavaScript. I have read about and have used some tools like StyleCop/FxCop for .Net and PHP Code Sniffer and likes for PHP and pyLint for Python. I understand that automated code reviews do not fully replace the manual ones, but I want to setup a process to support manual code reviews. Any suggestions? Thanks