title: How to set up a multi-developer iOS environment?

text: Let me explain my need: I'm having a networked environment with 3 computers connected to a server which will be running full-time. The server also runs a FTP server. I would like to create an environment where 3 developers will be able to work on the same project. For example, if I'm creating a CRM app, I would like to split the project into modules so that each one will be working on each module like Developer A will be working on authentication, Developer B will be working on saving/retrieving data and Developer C will be working on User Interface programming. If I use Revision Control, can anyone please guide how to set it up ? Can the development of the entire app run **simultaneously** since each of the developers will be working on different areas ? How can I create such type of **multi-developer** iOS environment ?


title: Does the advent of the SSD have any implication for database optimization?

text: Today I was browsing through a book on SQL Server optimization and it seemed that a certain amount of the ideas were based on a linear model of storage. As SSDs have a completely different storage model, do they in any way change the game in regards to how one thinks about database tuning or optimization?


title: Are immutable/stateless singletons bad?

text: Lately there have been some kind of revolution against singletons, but is there something wrong with them if they are stateless? I know the overuse talk and all... this applies to everything not just singletons.


title: How would I go about having an editable file to transform an object on a webpage?

text: I have some code that creates objects on a webpage by using draw on HTML5 canvas. In my aspx file I have functions like:               function drawLine(x, y, w, h, width) {       var canvas = document.getElementById('cpMainContent_myCanvas');       var ctx = canvas.getContext('2d');       ctx.moveTo(x, y);       ctx.lineTo(x + w, y + h);       ctx.lineWidth = width;       ctx.stroke();     }     function drawShape(x, y, listOfPoints, fill, width, colour) {       var canvas = document.getElementById('cpMainContent_myCanvas');       var ctx = canvas.getContext('2d');       ctx.beginPath();       ctx.moveTo(x, y);       for (var i = 0; i < listOfPoints.length; i++) {         ctx.lineTo(listOfPoints[i][0], listOfPoints[i][1]);       };       ctx.fillStyle = fill;       ctx.fill();       ctx.closePath();       ctx.lineWidth = width;       ctx.strokeStyle = colour;       ctx.stroke();     }     etc...      On the server side I generate a string 's' which forms my script and then I call it by using:               ClientScript.RegisterStartupScript(GetType(), "Test", s.ToString(), true);      When the page is displayed it produces something like:               <script type="text/javascript">     //<![CDATA[     function Test(){drawLine(680,409.5,19,0,1);drawSemiCircle(699,409.5,8,0);drawRectangle(700,422.5,68,-26,'#000000',1,'#FFFFFF');drawText('K1D',703,415.5,'14pt Arial Narrow');}Test();//]]>     </script>      And I get a web page displaying line drawings depicting certain objects. My question is, is it possible to have an external file to describe how these objects are created? I have only had a brief look at XSLT and I can't seem to find if it can support bespoke line drawings. I would like the ability to have a file for each object type, then in the file define what it is made of. E.g. in the file I can declare: drawLine(x,y,19,0,1); drawSemiCircle(x + 19, y,8,0); Or something similar. I think I need to use SVG. The reason I used HTML5 canvas was because I thought this was the latest technology and would do pretty much what SVG does. But it seems to use XSL to create a line drawing on my web page, I would need to use SVG. Am I interpreting this correctly?


title: Un selectable content using CSS

text: I have found a website where the text is select protected. How can i make this without JavaScript. I think it is possible by using CSS. A set of paragraph is protected with non selectable contents. But i don't know how to do.


title: Document Storage Repository - Open Source / Design Pattern

text: I currently have several web applications that offer document upload and storage. I am now trying to create a central document management service that these application can leverage to store and retrieve these documents. Currently the documents are stored on disk. The file name is a Guid and its real file name and datatype are stored in a database. Am I following the right approach whereby I have a database table that stores the documents information (Name, ContentType, CreatedDate, CreatedBy, SystemId etc), and then store the document in a folder on the local file system of the server ? When I started storing documents, they were originally blobs in the database. This I found an unfavourable approach. My database was suddenly MASSIVE and impossible to backup and restore. Be separating the documents into the local file system the database is now far simpler and my backup strategy easier. (Backup database, File Diff backup from folder) Is there a more sensible way to do this I am missing? Is there some open source project that I can leverage to improve the design of my new service that I am now making from scratch ?


title: Additional class for objects construction when working with database

text: I have a class derived from `SQLiteOpenHelper` which is all about working with a database, i.e. tables creation, insertions, data selections. All methods which deal with data selection return a `Cursor`. What I really want is to get a list of objects rather than a `cursor`, at the same time I don't want my class to do a lot of things. Is it a good idea to add another class who get selections from a database and construct objects from the selection? Thank you.


title: Do commercial statistical calculators calculate with a high degree of arbitrary precision or just floating point precision?

text: Do commercial statistical calculators like Minitab or SAS (and open source like R) perform statistical analysis with very high precision? Or do they just use floating point (or double) precision? I want to write a statistical calculator that professional statisticians can use for any purpose. I've written a program that currently performs or calculates standardized z-score, hypothesis tests, confidence intervals, and descriptive statistics. Right now 90% of the calculations use an arbitrary precision library (C++) or Java's BigDecimal class. I'm almost certain now that this is a mistake because even if the statistic is for monetary values, a statistic is usually rounded and the individual values that form the composition of the statistic are also rounded by four decimal places (or temporary shifted to appear as integers). However, I suspect that there is a flaw in my logic and I can't really say why precision is important. I suspect that with double precision in a standard library, even the calculation of mean could be wildly inaccurate. Perhaps I want to know the mean of a set of very small number that has too many decimal places to be supported by floating point precision.


title: Does the MIT open source license implies work derivatives to be made public (under MIT license)?

text: I am looking for an open source license for a library I want to publish. Ideally, one should be allowed to use this library in free or commercial applications without paying me a fee, but if any derivative work from the library is created (any improvement of the library for example), it should be made available to everyone under that same license. In other words, I want to put the following ethics: "You benefit from this piece of work for free, and if you improve it, I can benefit from your improvement for free too". It's a type copyleft license I am looking for. The MIT license looks like a possible solution, but it is unclear to me whether derivative works of the code covered by this license MUST be made available PUBLICLY to everyone. Can anyone clarify/confirm this? If there is another more appropriate open source license covering my needs, I am interested too. Thanks.


title: ExtJs License for free application

text: I read much about GPL license. But it couldn't clear my doubt. I want to develop a small web application using ExtJs because of its features. I won't use much of it. But some features are very good. Now, as my understanding I think I can give this app to my friend for free for his business needs, right? Or should I take commercial license for ExtJs?


title: How much code should I be responsible for?

text: Through colleagues and exit interviews, I have heard that at my small company I am "responsible" for anywhere from 3-10 times more code than I would be at another job. I'm trying to look for some sort of fuzzy metric that I can use to compare my workload with others in my field. By "code responsibility", I don't mean "I'm the only one who knows area X of the code base" (though sadly, it's often true in a startup environment), but rather am referring to a number like "code_base_size/number_of_developers". Are there any resources I can use to help me more accurately measure my work load than just counting lines of code?


title: Using double dot notation in URL link

text: I've recently been working on a project and I've been seeing two different forms of url's being used.               src="../MyLinkUrl"      and               src="/MyLinkUrl"      We are using MVC .NET and the times I have seen the .. usages have been in Javascript code files and not when it's been generated by the MVC URL helpers. Typically the usages range from specifying a controller action to specifying images. Both seem to work but I'm wondering which is the better practice or if it depends on the context. Some questions I have are:   1. What benefits/pitfalls does one have over the other   2. Is one better practice than the other   3. Does it depend on context and if so what context?


title: TDD / one test representing the whole scenario ? or should I split it?

text: While practicing TDD, I came across this specification: _**A user should be created with its password hashed, be persisted and an activation token should be returned._** Should my first unit test, (aiming to begin to test this scenario) should encompass the whole needs? :               shouldPersistTheNewlyCreatedUserWithAHasedPasswordAndReturnACorrespondingActivationToken      Or rather, splitting its main parts into several smaller tests, and testing incrementally:               shouldCreateAUser     shouldReturnAUserActivationToken     shouldReturnAnActivationTokenBasedOnNewlyCreatedUserEmail     shouldPersistTheNewlyCreatedUser     shouldHashTheUserPersistBeforePersistingIt      To put in a nutshell, should I rework the same test until a whole scenario passes? Or should I proceed incrementally by specifying additional features in other small tests. IMHO, the benefit of the first solution is that the **spec** is defining in one place, no need to gather some chuncks of features to figure out the whole. On the other hand, the number of assertions and expectations might be huge, therefore the test **code** would be less readable.


Let's say we have some requirements   * **Req1** : User name will accept 6-10 character alpha value.   * **Req2** : On click of Submit button, application will show error message "Please enter value or character between 6 to 10 including" for invalid boundary value. In this case if we are designing test cases for invalid boundary values of 5 and 11, those would be positive test cases, since we are also verifying the error message, which is mentioned in requirement. What would be negative test case for this scenario?


title: GUI: Setting options in two different places and having them stay in sync?

text: Programming in Windows with Visual Studio 2010 C++ and MFC. My question is about how best to store, update, and pass around program settings or options. I have a simple main GUI window/frame/dialog. On that main window I have an options button. When I click the options button I create an Options Dialog. Inside the options dialog I get a reference to the "application" (an MFC concept, globally available) and grab a reference to my custom settings class (an instance is stored in the application class. From there, I can populate my options dialog and save my options back. Perhaps I should be using Dependency injection to inject the settings into my option dialog? Or perhaps I should not even be accessing the settings from within the dialog class? MaybeI should expose the settings via set/get on the dialog class? Also, now I want to show some options right there on the main window, while still keeping them settable on the original options dialog. So now I'm wondering what a good design is for this. If I set an option on my options dialog I want it to update the options displayed on the main window. I guess this is a good spot for the Observer pattern but I'm trying to figure out how to piece it altogether in a MFC context (which as best as I can tell is basically pretty much the same as any other GUI toolkit in any other language, so if you're not into MFC I still want your comments)   1. How should I be passing my settings around?    2. How do I keep the GUI display of the settings in sync with each other? Such that after clicking OK on the options dialog box, the options directly shown on the main window are updated?


title: Best way to handle delimited files

text: So typically a CSV file uses a comma and the return character as it's field and line delimiters. This runs into obvious problems with text which can contain both these characters. Obviously there are options there (escaping them) but how do people handle this? Use different characters - pipes or tildas? Escape them? Not use delimited files, after all it's 2010 and we have XML now? Looking at least effort for a decent chance of not seeing problems. (Just to be clear, this is a question out of curiosity rather than something more solid - it's something I've come up against time and time again playing with data, always got round it but it normally feels a bit, well, dirty, and wondered what other people's experience was).


title: If we could get a file's binary form, would this method of file compression work?

text: I'm not quite sure how easy it is to fetch the binary composition of a file, but suppose we have some file with this representation: 010011 We could make 2 arrays. One which stores the position of the 0s: ['x', '', 'x', 'x', '', ''] And another which stores the position of the 1s (which is simply the opposite of the previous array): ['', 'x', '', '', 'x', 'x'] Then we can persist these two arrays into a file, and voila? I don't know, is there something i'm not realizing? I'm not an expert in compression, was just wondering if this would work.


title: Unit testing methods that call suppliers webservices

text: I have a class with one public method `Send()` and a few private methods. It calls a couple of webservices and processes the reponse. The processing is done in private methods. I want to unit test the code. My understanding is that unit tests should test my code in isolation (ie mock up supplier responses). I also believe that private methods should not need to be unit tested But if I just test the Send() method my code isnt being tested in isolation and is dependent on the supplier resonse. Should I then make my private methods public so I can test them with mock responses? It seems bad practice since I only the class should need to call them. Apologies if its a basic question, im fairly new to unit testing. Im using c# and VS2010


title: Programming language with pattern matching in trees

text: I'd like to prototype a computer algebra system. An equation would be represented by a tree and rules would be defined - similarly to mathematical axioms - by specifying a pattern (in the tree) and a restructuring rule for the matched part of the tree. Can you suggest a programming language I could experiment with to test this approach (ideally not too experimental language)? Basically it should support high level data structures like lists (or actually trees) and make it easy to match the tree against a pattern and also replace part of a tree by a substitute. So it's about high level data structure pattern matching and easy modification of that. EDIT: Of course I could take any programming language to write the program in the end, but I'm looking specifically for something which makes it easy to do first idea prototyping. I don't mind learning a new language (for fun).


title: Recommended way to start with Javascript for client- and server-side

text: I'm thinking about to switch in middle term to node.js for server-side and mostly jQuery and scriptaculous for client-side web development. For the scripting I'm planning to use coffeescript.   * do you think it's okay to use coffeescript or should I learn "plain" Javascript?   * What resources e.g. books, e-books, mailinglist, papers etc. would you recommend?


title: How to decide maintenance cost/terms for freelance work?

text: I am a JavaScript programmer and am planning to take Freelance projects related to JavaScript effects for the web. Recently a potential client approached me to create a JavaScript effect for his website. The effect was quite complex and it was not generic. That is, every time the design of the website would change the JavaScript code would have to be modified. Due to this nature of the code, I told the client that I will not be able to provide maintenance for this project. I will be happy to modify the code in the future but I will be doing the cost estimation each time there is a modification. The client was not happy with this. I thought of calculating the probability of the modifications the client may ask per year and multiply the initial estimate by that so that the maintenance becomes free. For example, if the cost of the initial project is $100 and I assume that the client will ask me to modify the code 4 times a year I would charge him $ (100 + 4*100). But I think this would be way too much and the client would deny to pay such a high amount. I have just started freelancing and the cost estimation part related to maintenance confuses me a lot. What is a good way to estimate maintenance cost. Also suggestions on maintenance terms like what should be the scope would be useful.


title: Best way to share / "donate" a C# software - and what license?

text: Some years back I have developed a little C# class library, which is still frequently downloaded. Since I do not have the time to support the project any more, I would like to donate it. What is the best place to do so? Some remarks:   1. I will not be the owner of that project any more, I just "want to hand it over"   2. It has to be "free of charge", non commercial, ...   3. Best would be if others could make changes and also re-distribute them   4. It must not be a legal hazard for me, so no obligations etc. Have you done something before, what would you recommend...? Update: I got excellent feedback in virtually no time, **so I have to choose a license**. I am not so much in that legal stuff, also it is not my main interest. What do you recommend for this? In plain words, I only have little demands (clarifying my intentions):   1. People can use it for commercial and non commercial software   2. I do not want to be in any kind of liabilities   3. All improvements (fixes etc.) should be also available for me and the public under the same license as in 4.   4. I do not want force people to publish their whole source code when they deploy the library as part of a bigger project. But I want them to re-publish any direct improvements or bug fixes.  There are too many licenses to read them all....


title: Is there a way to publish IOS app from windows/Linux?

text: I have been using Linux (especially, Ubuntu) and Windows 7 for a long time. I want to publish iOS apps, but I don't have a Mac or an iPhone. I don't have anyone near me who will lend me a Mac, and I don't actually want to buy them either. So my question is: how do I publish my iOS app from Windows or Linux? I am not referring to publishing programs for jailbroken iPhones, I want to publish through the Apple Store. My search results indicate that there is no fool-proof way of publishing an iOS app from Windows or Linux. I also want to make it a paid app, and not give it away for free. Does anyone know of a way to publish iOS apps from Windows or Linux?


title: Should program behavior be modified using a config file or environmental variables?

text: I'm referring to *nix command line applications primarily, where you want to permanently modify the behavior from defaults. Environmental variables are easily understood and implemented, usually requiring the user to modify their `~/.bashrc` for a permanent change. However, namespace collision might be a problem (but unlikely if you're careful). On the other hand, a lot of programs use `~/.programrc` config files. Is it simply verbosity? If your program only has 2 configuration settings, then a simple `export APP_SETTING=1` works just fine. However if you're starting to offer 5+ options then it should be time to start looking into a config file?


title: Is "convention over configuration" not violating basic programming principles?

text: I was looking at the WPF MVVM framework Caliburn.Micro and read that a lot of standard things are based on naming conventions. For example, automatic binding of properties in the View to properties in the ViewModel. Although this seems to be convenient (removes some boilerplate code), my first instinct reaction is that it isn't completely obvious to a new programmer that will read this code. In other words, the functionality of the application is not completely explained by its own code, but also by the documentation of the framework. **EDIT:** So this approach is called convention over configuration. Since I could not find any questions concerning this, I altered my question: **My question is:** Is convention over configuration a correct way of simplifying things, or is it violating some programming principles (and if so, which ones)?


title: How to deal with static utility classes when designing for testability

text: We are trying to design our system to be testable and in most parts developed using TDD. Currently we are trying to solve the following problem: In various places it is necessary for us to use static helper methods like ImageIO and URLEncoder (both standard Java API) and various other libraries that consist mostly of static methods (like the Apache Commons libraries). But it is extremely difficult to test those methods that use such static helper classes. I have several ideas for solving this problem:   1. Use a mock framework that can mock static classes (like PowerMock). This may be the simplest solution but somehow feels like giving up.   2. Create instantiable wrapper classes around all those static utilities so they can be injected into the classes that use them. This sounds like a relatively clean solution but I fear we'll end up creating an awful lot of those wrapper classes.   3. Extract every call to these static helper classes into a function that can be overridden and test a subclass of the class I actually want to test. But I keep thinking that this just has to be a problem that many people have to face when doing TDD - so there must already be solutions for this problem. What is the best strategy to keep classes that use these static helpers testable?


title: Best practices for releasing an open source PHP application

text: I'm a PHP developer for a living but have never worked on or contributed to any open source projects before. I am developing a CMS for my own use. I have a working prototype and I think that once it's ready (probably a couple of months time) this could be something the PHP community would be interested in. I'm a fairly confident developer but there are areas where my knowledge is lacking, especially when it comes to open source issues:   * What's the best way to publicise the project and/or find others who might be interested in collaborating   * My CMS is powered by CakePHP and basically sits as a layer on top of it. I've forked the CakePHP project on GitHub: I've used version control systems (SVN) before but I'm fairly new to GIT so want to be sure I'm doing things in "the best way"   * How can I find out about licensing issues? Which open source license would be best for my app? Also, my project borrows from a lot of other open source projects, for example I have sections of code (which I have heavily modified) but which had copyright/licensing notices in place- I've no idea what my obligations are in terms of keeping these in These are just a couple of examples of the questions I have, but I feel like there must be some resources out there which would be useful to me. Where's the best place to get started, what are the best communities/sites out there which cover these issues? I've had a look around but haven't been able to come up with much...


title: How can large data handling be a special requirement for job?

text: I chanced to see some job requirements of Oracle SQL programmer or C# developer jobs, who want a person who can handle terabytes of data in ETL or data migration. I have worked on data migration to move data from one system to the other. As a C# developer or Oracle SQL programmer, I am not able to understand how things will be different if large data is involved. (Oracle documentation says that it can easily handle even 8000 terabytes, why do I have to worry about volume then?) Can someone please advice what is special about handling data migration of large volumes?


title: Programming in other writing systems such as those who write right-to-left

text: How do programmers in countries whose writing system is, say, right-to-left write their code? Say if they were using C# compiler, do they follow the left- to-right approach or do they have a different IDE that allows them write C# code right-to-left?


title: Best place for a factory interface

text: What's the best place for a factory interface to create an instance of another interface? **OptionA** : a separate class               public interface InterAFactory {         InterA createInterA();     }          public interface InterA {         void doStuff();     }      **OptionB** : a subclass               public interface InterA {         public interface Factory {             InterA createInterA();         }              void doStuff();     }      I notice that guava has tended to use B for the immutable collections, but that's for builders, which are slightly different to factories. I also tend towards optionB, as it reduces the number of top-level classes in the package, and it strongly associates the factory with the thing it creates. However, implementations will not be bound or affected by this, and it will make implementations of the factory slightly more verbose. Thoughts?


title: Procedural programming?

text: I'm about to set off on a journey to create a new report-generator for our in- house software. Our old generator is made in VB6, remotes Word, and pixelpushes images. And its slower than a sloth on a flypaper. The language I'm most fluent in is C#, so preferably I'll want to make it in C#. I'm open for other languages though, of which I probably know Javascript the best. My question really is how I should proceed in setting up my app. The data it's reporting on is survey data. It's separated into questions and questiongroups. Today this goes a bit like this:   * Create report score for complete report   * Create report score for each questiongroup   * Create report score for each question   * Create report score for each question group I addition there might be several extra steps to get scores by variable filter and such. My problem is that I can't really wrap my head around any other way to do it than this "procedural" way. How would you go about in solving this? Any suggestions? More data:   * Data is stored in MSSQL   * The environment is Windows


title: Why did Java make package access default?

text: I'm asking this question because I believe they did it for a very good reason and that most people do not use it properly, well from my experience in industry so far anyway. But if my theory is true then I'm not sure why they included the private access modifier...? I believe that if default access is properly used it provides enhanced testability whilst maintaining encapsulation. And it also renders the private access modifier redundant. The default access modifier can be used to provide the same affect by using a unique package for methods that need to be hidden from the rest of the world, and it does this without compromising testability, as packages in a test folder, with the same are able to access all the default methods declared in a source folder. I believe this is why Java uses package access as 'default'. But I'm not sure why they also included private access, I'm sure there is a valid use case...


title: Are there alternatives to stack+heap+static memory model?

text: All programs I have seen organize their data memory into one or more call stacks (usually fixed size, but sometimes not), the heap, and static memory. Lately thread-local static storage has been added to this as well. Have there been any attempts to organize data memory layout in a radically different way, e.g. without the call stack? Or organize memory in a different way that accomplishes the same thing?


title: Do we have any special design considerations for maintaining anonymity in an application?

text: This is an open-ended question which I am analysing while doing some fun projects in leisure. Websites like Google, Facebook do store user activities and perhaps sell them or use them for advertisements. But I believe anonymity is maintained. For instance, I need to expose that there are 5 people between age 45-50 who are drug-addicts in a given area... but I don't want to offer the names of the people. In fact I want to be sure that noone can access their names, otherwise resulting in privacy violation (Sorry for the weird example !) Is there some tool/standard which everyone(especially smaller organizations) follow to limit legal complications due to identity theft like this ? I am tagging MongoDB and Java, as I am using these technologies and answers specific to them would be easier to implement.


title: How a .NET dev team should be designing and delivering greenfield projects?

text: Some of the hottest topics in the software world atm are:   * Domain-Driven Design   * SOLID principles    * Agile methodologies    * ORM  Now assuming that you are not currently using all of these in your team, if you were to go and ask your team (individually, not as a group) what they knew about the topics they were not applying - how much do they know about those other topics - they've probably "heard about it/read it somewhere once". The problem is that, increasingly, tech is changing so fast that a lot of people (average Joe programmers) just can't keep up with the latest thinking. Now while those that are academically gifted can read 20+ books on the above subjects every year and combine it into some kind of order in their heads in order to apply it to a new software project, most of us will not be inclined to do all that studying. Personally, I sit at a desk all day programming, and so the last thing I want to do is go home and do the same. I want to go play sport, see friends, spend time with the gf, and generally have a life. So, given a nice shiny new greenfield project, many of us (make that most, if we are honest) are still pretty confused about how to tackle a new project with the latest, greatest thinking that is most commonly accepted by our more academically inclined piers. So my question - I was wondering if there was any book out there present or future, that combines the latest thinking into something more manageable for the average mortal to digest and apply? (preferably using .net and the most popular current related tech) From my experience in the market, it would look something like this to be relevant to most real developers:   1. Examples based on some kind of internet website, so all tiers can be involved.   2. Explain how to identify and map the real business objects, this would currently be done with domain-driven design as the latest commonly-accepted thinking, while obeying SOLID principles.   3. Explain how (2) goes from model to database schema, using latest ORM tech (this might be the biggest section).   4. Use MVC (or whatever tech that becomes) as a platform for the examples.   5. Very briefly explain TDD, then show you how to plug-in unit testing, probably visual studio testing/nunit or latest tech.   6. When to use IoC.   7. Show you how to write a couple of very simple integration tests using whatever the current tool of choice is (Fitnesse or whatever).   8. Show you (in no more than one chapter) how to set-up TFS for continuous integration. The book would then be revised every year to reflect the latest and most agreed concepts, so software teams always knew the best way to handle a new project, without wading through this year's mountain of new books themselves to try and identify the common themes for this year's hottest topics. It would be important that the revisions did not reflect the author's own opinion, but rather the general opinion of the majority of his piers, so it built an accepted, uniform approach to .net development projects. The real key to this book is that it would be a "How to" book, not a "Why you should" book. It could (and probably should) reference the "Why" books for those that wanted to be better programmers or just needed to know more, but it wouldn't have the space to explain it anything more than briefly, given the target of the book. Perhaps the book could more accurately be called "How to correctly and practically apply the current state of the art .NET software development design and technology to real world projects this year (for idiots)" but I guess the title needs work ;-) So, to fit into the sites "ask a question" directive - is there any book out there even vaguely similar to this? (although I doubt it gets revised regularly). Right, I'm off to read another dry, theoretical book, on my week off to try and keep up :( It's a shame that I'll probably have forgotten all the content by the time I come to use it, and for all I know it might be out of date already... Oh btw, where's the best place to kick this off as a discussion as opposed to a question? reading the FAQ only suggested the real-time chat, which I had a quick look at, but tbh it's pretty dead and seems to be mostly one-liners, not suitable for something long-winded (another website would be fine).


title: Why is the “app” folder now a (more) common pattern in web projects?

text: It might be related to the Yeoman project, or they might have adopted this from somewhere else, but it seems to be the default for all of their generators. Aside from Yeoman generators I've also noticed it in other projects that have nothing to do with Yeoman (this one for example). Where did this convention come from, and what are the reasons for using this over a `src` folder, for example (which used to be more common)? Or is it just random preference? * * * p.s.: As far as I can tell it doesn't seem to be strictly related to it being a web-app instead of a web-site (which is rather subjective anyway).


title: Writing robust code vs. overengineering

text: How do you guys know that you are writing the most robust code possible without overengineering? I find myself thinking too much about every possible path that my code can take, and it feels like a waste of time sometimes. I guess it depends on the kind of program you are writing, but I don't want to use too much of my time taking situations into account that will never happen.


title: Time tracking and payment registration architecture

text: Тitle might be a little bit incorrect. :) Anyway, I'm building a software where employees input time they worked per day (work hours) and employer "pays" for this time. "Payment" is done outside this system, so employer just "confirms" (checkbox or something like this) which work hours are paid. So the question is - what is the best way (both UI and data storage wise) to implement this? At the moment I have this idea:   * Employee selects week and manually (with some Javascript helpers, like "fill the same time for all days") inputs work hours in every day of the week. Employer confirms payment the same way employee inputs data (selects week, confirms each day). Data is saved in DB as unix timestamp (one day per table row).  Problem is 14 inputs (7 days * ("hours from" + "hours to" input), yet this approach seems kinda easy to implement. Maybe I'm overlooking something and this can be done differently and better? Maybe someone has any example of already working software?


title: How can I learn about typography, fonts, glyphs, etc.?

text: I know so little about this that I'm having trouble formulating the question. Apparently due to technical limitations, nastaleeq style of writing Urdu is very difficult, perhaps impossible, given current standards used on the web. I'd like to do a deep dive into why this is so (the technical aspects, at least). My, very rough, understanding is this: Unicode is the standard right now, but it doesn't define how characters look, it only define the names of characters and a numbering system to represent them. "Fonts," such as Halvetica or Times New Roman, actually define the look of characters. What is True Type then, and how is it different from Open Type or Postscript or LaTex? If a language requires that shapes of characters, _and how the connect to each other_ (think cursive), change, based on their location in text...how is that handled? If Unicode is only a representation system and fonts only concern themselves with single characters, where do these location based algorithms go? Is the current set of standards too limited to handle complex cursive style typography? If so, can HTML's canvas be used to create an alternative/experimental "font system?" If I do need to "roll my own" is Knuth's work on digital typography still relevant or are there more modern references?


title: Open-Source, Consensus-Based Development

text: **Question:**   Is there an open source license that requires that my name (or a name that I want to promote) will always be associated with a project and derivations of it? (Either within the copyright notice (©) or other.) **Motivation:**   \- My main motivation is reputation/career advancement. If it gained wide use, it could look very good on resume (I understand this is a long shot).   \- An additional benefit is that it would explicitly state to prospective employers that this code was used by myself before I started with the company and will continue to be used when I leave. **It is my understanding:**   I am aware that 99.9% of open-source projects never take off, and that I am taking a long shot in regard to advancing reputation/career. I understand that many don't read/respect licenses. I understand that open source projects take a lot of time to manage. I understand that 'Concensus-Based Development' is the best chance at motivating a community and that I may/will loose substantial control.


title: How can I register in the iOS developer program as a minor?

text: Recently, I started learning about iOS application development, and while the simulator is fine for starting out, I've gotten to the point that I really should be testing the Apps I write on an actual device. To do this, you must be a member of the $99/year iOS developer program, which also allows you to publish on the App Store. I'm more than happy to pay the fee, but my problem is that I'm still a minor, and to join the developer program you must be over 18 in the U.S. (I'm not sure how it works in other countries). I've talked to a few others that were in a similar position, but their responses have been varied. From what I've gathered, the best course of action is to register in the name of one of my parents. My problem with this is that if I were to ever publish an App on the store, it would be ideal to have my name as the seller instead of my dad's. It wouldn't be the end of the world if this happened, but as I said, this wouldn't be ideal. Have any of you been in this position or known somebody who has? How have others solved this problem? Any tips or suggestions would be greatly appreciated.


We use bugzilla to track bugs and feature requests, and we also require developers to write to a separate release notes should they finish coding a feature. Old fashion, I know. One problem we have with the above arrangement, is that while it works great for software that we are already selling, it is completely useless when comes to track the progress of a new software development project. The reason is that at the point of developing new software, we don't,or rather, we can't, use bugzilla to trace the features simply because bugzilla is not suitable to represent the complicated intricacy of feature dependency ( To complete a new software application, there are just too many features to code and we just don't feel like putting them in bugzilla, and even if we did, we had no way of knowing which features depend on which, and we won't be able to get an accurate prediction of the shipping date anyway). Then, our stakeholders will get concerned about our development progress ( or lack of) and start banging on the team lead ( yours truly)'s door on the estimates, which I can't answer because tragically, I also honestly don't quite know how far is the new application from completion. How would you present your software development progress to your stakeholders?


title: From where do financial firms obtain the stock data to analyze

text: I've been thinking about the subject and I've always wondered, from where do they obtain the data that is analized in applications, I've looked at Nasdaq's website and they do not seem to have any sort of APIs, do the firms parse yahoo's finance section, or are there special contracts, agreements in places with the different stock markets?


title: Should MVC/REST return a 403 or 404 for resources belonging to other users?

text: When working with a resource-based site (such as an MVC application or REST service), we have two main options when a client tries to `GET` a resource that they don't have access to:   * **403** , which says that the client is _unauthorized_ ; or   * **404** , which says that the resource _does not exist_ (or couldn't be located). Common wisdom and common practice seems to be to respond with the truth - that is, a 403. But I'm wondering if this is actually the right thing to do. Secure login systems never tell you the reason for a login failure. That is to say, as far as the client is concerned, there is no detectable difference between a non-existent user name and an incorrect password. The purpose is of this is to not make user IDs - or worse, e-mail addresses - discoverable. From a _privacy_ standpoint, it seems a lot safer to return a 404. I'm reminded of the incident wherein someone reportedly found out the winners of a reality show (Survivor, I think) by looking at which resources _didn't_ exist on the site vs. which ones did. I'm concerned about a 403 potentially giving away sensitive information like a serial number or account number. Are there compelling reasons _not_ to return a 404? Could a 404 policy have negative side effects elsewhere? If not, then why isn't the practice more common?


title: How is the correct way of writing TDD for a void API?

text: Ok so my scenario is this: I have a third party component that offers an API for communicating with an external system. The method calls for commanding the external system to do stuff, all return void. So what I have done is I have created a wrapper interface and have mocked out the external system. But since I have no real logic or checks in my code that calls stuff on the external API, the code is just procedural. I can't really test anything else than that the methods are being called.               _systemWrapper.DoStuff(a, b ,c , d);     _systemWrapper.DoStuff2(e, f);     _systemWrapper.DoStuff3(g);      I can't configure the external system from my tests, so integration tests are out of the question. So what I have done to test this, is that I have mocked out my "_systemWrapper" and am just verifying that the parameters I call on the mock contain the correct parameters. Is this a common way to solve this particular problem? To me it seems to be a bit exhaustive to have a test to make sure you have this and this line of code present. The problem is that this system is getting BIG and writing tests that assert that this and this line is present is getting out of hand, and refactoring is becoming real hard with all the tests failing if we change a call to the third party.


title: Is there a single book that covers the breadth of computer science fundamentals?

text: When I did my undergraduate studies in elecrical engineering, there was this book called "Basic Electricity" by Van Valkenburgh. If you read that book cover to cover, your fundamentals in electrical engineering would be bulletproof. I would recommend it all my juniors and I absolutely loved it. Is there such a book in the field of computer science? I am not so concerned about the algorithms. I am looking more into something that tells me how does everything work beneath the covers. TCPIP, memory management, DNS, routing, SSL, buffer, queuing etc.


title: Design for object with optional and modifiable attributtes?

text: I've been using the Builder pattern to create objects with a large number of attributes, where most of them are optional. But up until now, I've defined them as final, as recommended by Joshua Block and other authors, and haven't needed to change their values. I am wondering what should I do though if I need a class with a substantial number of optional but non-final (mutable) attributes? My Builder pattern code looks like this:               public class Example {         //All possible parameters (optional or not)         private final int param1;         private final int param2;              //Builder class         public static class Builder {             private final int param1; //Required parameters             private int param2 = 0;   //Optional parameters - initialized to default                  //Builder constructor             public Builder (int param1) {                 this.param1 = param1;             }                  //Setter-like methods for optional parameters             public Builder param2(int value)             { param2 = value; return this; }                  //build() method             public Example build() {                 return new Example(this);             }         }              //Private constructor         private Example(Builder builder) {             param1 = builder.param1;             param2 = builder.param2;         }     }      Can I just remove the `final` keyword from the declaration to be able to access the attributes externally (through normal setters, for example)? Or is there a creational pattern that allows optional but non-final attributes that would be better suited in this case?


title: Is goto to improve DRY-ness OK?

text: My code has many checks to detect errors in various cases (many conditions would result in the same error), inside a function returning an error struct. Instead of looking like this:               err_struct myfunc(...) {         err_struct error = { .error = false };              ...              if(something) {             error.error = true;             error.description = "invalid input";             return error;         }              ...                  case 1024:                 error.error = true;                 error.description = "invalid input";  // same error, but different detection scenario                 return error;                 break;  // don't comment on this break please (EDIT: pun unintended)                 ...      Is use of `goto` in the following context considered better than the previous example?               err_struct myfunc(...) {         err_struct error = { .error = false };              ...              if(something) goto invalid_input;              ...                  case 1024:                 goto invalid_input;                 break;              return error;              invalid_input:             error.error = true;             error.description = "invalid input";             return error;


title: Console App error An object reference is required for the non-static field, method, or property

text: Hey all I am trying to get the following code to work but currently I am getting this error: > An object reference is required for the non-static field, method, or > property 'fetchFeedData.Program.txtUsername' The code is:               class Program     {         private string appDataPath = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + "\\feedReader";         internal static extern IntPtr GetCurrentProcess();         private WebClient imageClient;         private String txtUsername = "xxxxxx@xxxxxx.com";         private String txtPassword = "xxxxxxx";         private Boolean chkDownVideo = false;         private Boolean chkIsHD = false;          [STAThread]     static void Main(string[] args)     {        bool isNew;        Mutex mtx = new Mutex(true, "FacebookNewsfeedReader", out isNew);             if (isNew) {          InitializeXul();          LoadSettings();        } else          MessageBox.Show("Already one instance is running.....", "Facebook Newsfeed Reader");     }          static void LoadSettings()     {        imageClient = new WebClient();        imageClient.Headers.Add("Accept", "image/webp,*/*;q=0.8");        imageClient.Headers.Add("User-Agent", "Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/36.0.1985.125 Safari/537.36");        imageClient.Headers.Add("Referer", "https://www.zzzzzzzz.com/");        imageClient.Headers.Add("Accept-Encoding", "gzip,deflate,sdch");        imageClient.Headers.Add("Accept-Language", "en-US,en;q=0.8");             string[] vals = data.Split('\n');        if (vals.Length < 3)           return;        txtUsername = vals[0];        txtPassword = vals[1];        txtBrowseFolder = vals[2];        chkDownVideo = bool.Parse(vals[3]);        chkIsHD = bool.Parse(vals[4]);     }      It shows that same error on the following lines:               imageClient = ...     imageClient.Headers.Add(...     imageClient.Headers.Add(...     imageClient.Headers.Add(...     imageClient.Headers.Add(...     imageClient.Headers.Add(...          appDataPath + ...     txtUsername = ...     txtPassword = ...     txtBrowseFolder = ...     chkDownVideo = ...     chkIsHD = ...      I searched a little and found continued suggestions to make sure both had the same function calls (static, void, etc) but that did not seem to fix the issue. Any help would be great!


title: Writing selenium tests, should I just get it done or get it right?

text: I'm attempting to drive my user interface (heavy on javascript) through selenium. I've already tested the rest of my ajax interaction with selenium successfully. However, this one particular method seems to be eluding me because I can't seem to fake the correct click event. I could solve this problem by simply waiting in the test for the user to click a point and then continuing with the test but this seems like a cop out. But I'm really running out of time on my deadline to have this done and working. Should I just get this done and move on or should I spend the extra (unknown) amount of time to fix this problem and be able to have my selenium tests 100% automated?


title: Recognizing text fields according to their label value

text: I have an application who has **text fields** (not select, not checkbox or other types) where an user can enter some value, like this: ![*ISBN* and *E-Mail* are the label of each input](http://i.stack.imgur.com/nKf2O.png) _ISBN_ and _E-Mail_ are the **label** of each input. Now I have to automatically test these inputs according to their label. The question is: how to recognize that, for example, the first input requires an ISBN code? I programmed something like this:   1. turn the label value to lowercase   2. check if the label value contains _isbn_   3. if so set the field value to a random _ISBN code_ (i.e.: 1234567890), else set it to a random value (default) For the email field:   1. turn the label value to lowercase   2. check if the label value contains _e-mail_ or _email_ or _mail_   3. if so set the field value to a random _email_ (i.e.: abcd@abcd.com), else set it to a random value (default) And so on for each text field I encounter. Is that reliable? How can I improve the "recognizing part"? I know only the _label value_ and the _field value_ (what is already written in the field by default) for each text input.


title: When is the right time to join open source project for programmer?

text: Most of the newcomers in programming start with basic projects to start with programming. Most of the C++ progammers spend some time with puzzles and contests but this is not always helpful. Sometimes you've to spend some time on real projects. Starting your own open source project could be a problem in self-learning for newbie cause of lack of mentors and peers who can't look at your code and give suggestions. Open source projects can solve this problem, some projects could be best suited for new programmers. Besides everybody is newbie at some point. So i'll try and make this question a bit from beginners perspective. I tried few questions on stack overflow before asking this like How do i join & Bare minimum you need and how to get involved with open source and what level of programming etc. But this is not helping me when it comes to self- evaluating with skills. How to find that out ? How can i check what it takes to join open source project and am i really that comfortable with huge source code etc. My question is _when to consider yourself comfortable joining open source programming ?_ I mean how will you test yourself that you're ready to take burden of big/small projects of open source ? how will you test yourself to see if you could work with version control/other programmers/tight schedule etc ?


title: Should I merge from the same branch or from a merge?

text: Kind of a _best practices_ question: is it better to merge directly from the source to other branches or is it OK to merge from a merge? Using Subversion for source control. **Scenario** :   * Branch A has changes made and committed.   * Branch B and the Trunk both need updates. **Case 1**   Merge from A to B and again from A to Trunk. or **Case 2**   Merge from A to B and then merge from B to Trunk. I may also be missing a Case 3 where you merge to B and Trunk Simultaneously (not sure if that is dependent on the source control being used?). Note that there could be any number of branches that need merging to, such that you could "cascade" the merge (A to B to C to D...).


title: Writing my own blog engine using PHP/JavaScript - am I doing it 'right'?

text: First, apologies in advance if this is in the wrong place - I wasn't sure if it should be here or in Code Review, but as I'm not actually asking for anyone to review my code . . . Here's my project: Mostly as a learning exercise I am writing my own blog engine. Here's how it works: Admin writes post - > post is saved to .html file, and details of post are written BOTH to a MySQL database and a JSON file using PHP - > posts are loaded onto site via iframes, determined by JavaScript using the details in the JSON file. Thus for loading posts onto the site, no PHP or access to the database is required. The only reason for the database at all is to have an editable record so that if the admin needs to delete a post, the entry can be removed from the database and the JSON file re-written from the database. What I want to know: 1) This seems a bit cumbersome. Would people recommend doing away with the JSON and making more use of the database? How do I integrate this with JavaScript stuff? 2) Is storing each post as a separate .html file and loading as an iframe a reasonable way of doing things? 3) Is there any way to cut out the PHP entirely? I am not keen on it really. I am starting to learn Python, but it seems an awful palaver for a small blog engine. As you can probably tell, I am VERY new to programming! I have looked into TaffyDB, which in theory could get rid of the database entirely - I load the JSON with Taffy, remove one record, and re-write the JSON . . . except I'd still need PHP to write to file I think? Also, I am worried that relying entirely on JSON files will make things very slow (I understand speed issues increase exponentially with JSON size?) Any advice/feedback would be welcome, and again I apologise if I'm posting in the wrong bit of StackExchange.


title: What are the best strategies for selling Android apps?

text: I'm a young developer hoping to sell my apps I made for Android soon. My applications are basically 99% finished so I'm investigating what would be the best marketing strategy to use to sell my apps. I'm sure the brilliant minds here can give me some great advice. I'm particularly interested in your thoughts on the following points (especially from experienced Android developers):   * Is it more profitable to sell an app for free with ads or to sell an app without ads for a price? Perhaps a combination of a free ad version and a paid ad-free version?   * If you give away an app for free with ads on it is it ethical to decline bending over backwards to support it?   * How much does piracy actually affect potential sales? Should any effort be put towards preventing it?   * Can you still make a profit off your application if you make it open source? Could you perhaps make more of a profit from the attention you would get by doing so?   * Is Google's Android Marketplace really the best place to release Android apps?   * It is worthwhile enough to maintain a developer blog or website to keep users updated on your development progress and software releases? Any other suggestions you could give me to maximize profit meanwhile keeping users happy and coming back for more would also be greatly appreciated. While I appreciate general tips and tricks, I'd like to ask that if possible you please go the extra step and show how they specifically apply to selling Android apps. Marketing statistics, developer retrospect, and any additional experience you can share from your time selling Android apps is what I would love to see most. Thank you very much in advance for your time. I truly appreciate all the responses I receive.


title: how to create java zip archives with a max file size limit

text: I need to write an algorithm in java (for an android app) to read a folder containing more folders and each of those containing images and audio files so the structure is this: `mainDir/subfolders/myFile1.jpg`   * It must be in java, something like perl script is not an option. It would preferably be for the compressed archive in order to squeeze as many files as possible before mailing the zip. Just a normal zip (no jar). My problem is that I need to limit the size of the archive to 16mb and at runtime, create as many archives as needed to contain all my files from my main `mainDir` folder. I tried several examples from the net, I read the java documentation, but I can't manage to understand and put it all together the way I need it. Has someone done this before or has a link or an example for me? I resolved the reading of the files with a recursive method but I can't figure the logic for the zip creation. **EDIT:** FileNotFoundException (no such file or directory) this was my initial post at Stack Overflow. I've got an answer to it, but I can't set the size of the ZipEntry and the logic doesn't work and also when extracting the my files from the zip I get the `compression method not supported` error.


title: Application deployment with Puppet

text: I've been researching puppet lately, and I think it could be useful to integrate into my deployment pipeline. Currently, I deploy my apps by manually adding users, creating vhosts, setting directories, and then git cloning my repo from GitHub. I deploy changes with a simple Git pull (Git hooks take care of database migrations, clearing the cache, etc). With puppet, I could setup a manifest to do the directory creation, permissions and virtual host management for me. To deploy an app to a dev/prod environment, I'd pull the manifest from GitHub and run it locally. I was also thinking about adding the puppet manifest process to the Git hook so every pull, Puppet could ensure directory permissions are OK. Are there issues with this approach? Things I could do better?


title: Design Pattern For Util Classes and General Static Variables

text: I am developing a Mojo(think it as just a usual class) for my custom Maven Plugin. There is an Abstract Mojo at top. I have some other custom Mojos in example which makes server side includes. I have some static variables and some util methods in example get operating system name, fix file separator in order to used operating system etc. I have created an abstract Base Mojo that extends Abstract Mojo and put every common things inside it. When I create a Mojo (i.e. server side includer) I extend it from my Base Mojo. However should I think that I should separate variables and util methods or not and what kind of pattern I should follow. To make it clear there is:   * **AbstractMojo** at top by default (I can not change it)   * **BaseMojo** an abstract class that extends **AbstractMojo** that has util methods and static system variables   * **CustomMojo** extends **BaseMojo** and does its responsibility. Any ideas how to implement a design for my needs?


title: Stuff you should have learned in school but didn't pay attention to at the time

text: This question made me think that there was a better question to ask. What did you learn in school that you didn't care about at the time, but turned out to be useful or you had to relearn in the workplace because you had it in school, but didn't retain the information and you needed it? (I mean for software related jobs.) I think this might help college students identify some of what they really should be paying attention to while they are in school.


title: Could taking design lightly be a pitfall of agile methodologies causing constant rework or is it a misunderstanding of the methodology?

text: I've been working for a year now in an agile project to redesign an insurance application. I really like working in an agile environment, although management and analysts I work with still have waterfall thinking ingrained and makes it a little complicated to embrace the new paradigm shift to agile. From a developer standpoint sometimes I feel like since we're doing "agile" we don't over-think or think enough our designs and just go with the flow and refactor later. Many times that ends up in rework because we never put enough though to certain pieces of the application. As far as I understand, agile is like having small waterfalls and deliver small pieces at a time (iterations), but sometimes we lose the big picture and end up paying for it later with rework. Are agile methodologies encouraging or tolerating procrastination more than traditional waterfall? Is this constant rework for pieces of software with defined requirements acceptable? Is anyone else experiencing something similar in their projects?


title: Resource for common ballparks in development projects?

text: Does anyone know of any resource which gives some man-hour ballparks for common types of development projects? I realize it's going to vary wildly by framework/language/the skill levels of the developers, but I'm just looking for something that comes within 50% of the mark. Facing a classic build vs buy vs use open source and I don't want to pick the wrong path. Thanks!


title: Best way to parse optional grammar rules?

text: I started to write a hand written parser just for fun. For simple rules it is working, but I have problem with the optional grammar rules. I marked the optional rules with a question mark. Here is a simple rule:               rule1:  "AA"? "AB"? "AC"? "AD"      So AA, AB and AC string is optional, but AD is required. ex.: "AAABAD" is matching, "AAAD" is matching, "AAAB" is not matching, "AD" is matching, ... I need an algorithm and not a regex tool or something like that. I can solve this with brute force method (so trying every possible combination of the rules) but I think there is a better way to do this.


title: Filtering a List

text: I will try to simplify my problem. Let say I have a collection (more specifically a List) with different types of elements, for explanation purpose let say we have objects "Person" with different age of birth and an ID. I will represent a person like this: `{<id>,<year>}` At some point, I want to get a sub list of all the persons born on 1988 and 1989, and **if** there is **no** persons born on that years, I want all the persons born in 1990:               [{1,1988},{2,1988},{3,1982},{4,1995},{5,1989},{6,1989},{7,1990}] ==>      [{1,1988},{2,1988},{5,1989},{6,1989}]               [{1,1990},{2,1981},{3,1983},{4,1993},{5,1981},{6,1989},{7,1990}] ==>     [{6,1989}]          [{1,1990},{2,1981},{3,1983},{4,1993},{5,1981},{6,1985},{7,1990}] ==>     [{1,1990},{7,1990}]      ## Option 0 At first I though about using the filter method on the apache commons library, but this wouldn't work as I would need to know about all the element on the list to decide if a particular element goes on the sub list or not, so I ruled this option out. ## Option 1 Then, the simplest way I can see to do this is loop through the list looking for elements that match the first condition (1988 or 1989), and then, if I can't find any, loop again to look for elements that match the second condition (1900). But I don't like this because you have to loop through the list more than once. ## Option 2 The other option I can think about is to loop through the list only once, and to have two different sub list, one with the elements that match the first condition and another with the elements that match the second condition. At the end, if the first sub list is empty, we return the second sub list. Which one of these two is better (more efficient)?   Which would you use and why?   Do you think there is a better solution than these?


title: Good practice for returns in Python

text: I was recently working on some prototype code in Python. The code worked great, then I realized that I needed a little more feedback from one of my functions so I changed the return statement from               return x      to               return (x,y)      Then going back to refactor existing code I realized that unless I search for invocation of this function across entire of the code base I won't know of any problems until run-time (and if this is some marginal case) barely ever and risking the program crashing due to uncaught exception resulting in operations on mismatched types. I contrast this with statically typed languages, where at compile time I get told about all places where the return doesn't mismatches expected type. So I was wondering whether there is some conventional wisdom associated with the return types in Python to avoid this grepping through code nonsense. P.S> Obviously better design patterns would solve this problem or not using duck typed language, but sometimes one comes across a case when you got to change the return type.


title: Preferred method for handling Failed CRUD operations in Entity Framework (6)?

text: I am using EF 6 as my ORM. I am trying to decide how to handle CRUD failures. ### Option 1: Use exceptions (custom or built-in) to inform the web layer that an item didn't correctly save. Handle the exceptions at the Web Layer as either error messages to the user or to trigger an AJAX post to try again depending on the reason for the failure. ### Option 2: Use some sort of object as a wrapper for CRUD operations. Return an enum and a message. Writer an object parser at the Web Layer as either error messages to the user or to trigger an AJAX post to try again depending on the reason for the failure. I am also open to other ideas. These are the two that I have come up with. I am using DB first on a legacy database. This database structure is poor at the very best. The current way issues are handled, is by returning an object that holds an enum and message. The majority of the applications hitting the database is used in winform apps. I just happen to be writing the web applications that hit them.


title: Will the Facebook apps I build still be available if I deactivate my account?

text: I have no desire to have a personal Facebook account, I do have one but it has been deactivated for awhile. A client of mine would like me to port over a few web apps to Facebook that are hosted on his domain, and it looks like I am unable to with my business account which makes absolutely no sense to me seeing as it is for a software development company that I own and operate. If I were to temporarily activate my personal Facebook account to create a few apps, will they still be available in the marketplace, I believe it's called "App Central", if I then later deactivate the account used to create them?


title: Objective-C class cluster pattern

text: I have many sublcasses of one class. I choose concrete class based on type (simple enum). I like idea of class cluster. Should i use it or just create factory class (but each class in objective-c is actually a factory)? What is the difference between factory pattern and class cluster pattern. When to use it in your code and why?


title: RESTful API design. What should I return if there are no rows?

text: I'm currently coding an API for a social network with the Slim Framework. My question is: What are the best practices when there are no rows to return in the json structure? Lets say that this call **/v1/get/movies** returns 2 rows from the table movie names:               [         {"name": "Ghostbusters"},         {"name": "Indiana Jones"}     ]      But, then I call **/v1/get/books** and there are no rows in that table. Should I just return an empty structure?               [     ]      ...or would it be better a message and an error code?               [         "errors": {             "message": "no matches found",             "code": 134         }     ]      Which is a better practice? (the API will be used in iOS and Android apps) Thanks!


title: Is it worthwhile to create a knowledge map for software?

text: Basically, the objective is to create a visual representation of the software specification document. This visual representation would capture various scenarios involved in the software. Benefits:   * Picture speaks louder than words   * Catch scenarios so that they need to be handled by the developer   * Becomes a knowledge map for others   * Can be used as a reference   * Can be used for knowledge transfer as well. Ideas:   * If possible, we can dynamically modify the visual representation to add scenarios when site issues are found and they were not identified initially. I do not know how to do this. But I would like to invest time to find out how to do this. But is it worth the effort?


title: Software failure due to maintenance oversights example/case study

text: I'm doing some investigation into the role of maintenance in software development and the use of metrics within the development cycle. What I am asking is for a point in the right direction or possibly a direct example in which there has been software failures due to the oversight of maintenance costs. More specifically I am looking for a case in which an implemented system has failed as the costs/effort for maintenance has been far too great as there has been poor or no projections from metrics. I understand this is a very specific question, but I've been racking my brains thinking of all the software failures I know of and none of them fit the criteria.


title: False friends? Keyword "static" in C compared to C++, C# and Java

text: To me, the use of the keyword `static` in C and languages like C# and Java are "false friends" like "to become" in English and "bekommen" in German (= "to get" in English), because they mean different things. In C `static` means, that the function or variable is only accessible via functions inside the same source file, comparable to `private` functions and members in C++, Java and C#. In C++, Java and C# `static` means, that the methods are not members of a class instance, but effectively are more or less like C functions plus namespace. IMHO these two concepts are quite different, so why did the designers of C++ and later Java and C# choose the `static` keyword for that behaviour? Is there a logical connection that I miss? **EDIT** I know, that `static` in C does not govern accessability in a way similar to `private` in C++, but can be used in that way, see http://stackoverflow.com/a/1479639/124983


title: How to keep .Net assemblies relevant through high-flux period

text: How much do you, as .Net developers, consider the changes between Windows XP, 7, & 8 when choosing your development environment and libraries? We are nearing the end of Windows XP; Windows 7 is noticeably and aggressively making it's mark; Windows 8 (Win R/T) is on the horizon. Granted, **flexibility** is completely expected from the customer's perspective. But we are faced with developing to the current OS, Windows 7 ( _understandably, some may argue the current OS is still XP_ ) ...and maintain legacy code for the outgoing OS, WinXP. So, Windows 8 and all the Win R/T goodness flares the imagination and you can't help but ask yourself, " _what will still be relevant in 5 years?_ " Well, at least I can't help but ask the question. During periods of rapid evolution of an OS, what considerations do you plan for in application design, libraries, frameworks, and choosing development environments; and, in doing so, how do you determine the length of relevance a particular design will have?


title: What makes a large and complex software product slow?

text: For a reason that is largely irrelevant, I installed Delphi 7 once again in such a long time. I have to say, I was completely blown away - in a way I haven't been for rather a while. This is not how I remember things at all. The installation took around 30 seconds. Launching it took 2 seconds, and it was immediately usable. I can press "Run" the second after it started, and less than a second later the blank program is already visible and running. Hurray for computers getting so much faster! But the reason I've been blown away like this is because usually I use Visual Studio 2010, that doesn't feel snappy like this at all. Granted, Delphi 7 is a much smaller system than Visual Studio 2010, but it does have the _appearance_ of having all the really necessary things there: a control palette, a form designer, a code editor with code completion. I realise that the language might be simpler, and the code completion might be a lot less powerful, and the IDE might not be nearly as extensible and feature-rich, but still: I do not understand how (i.e. through what mechanism) does having a lot of extra features (that I might not have even triggered yet) cause a system like Visual Studio to always feel sluggish in comparison. I would like to ask people experienced in working with systems the scale of Visual Studio: what is it that makes them slow? Is it the layers upon layers of abstractions required to keep the codebase within the human comprehension capabilities? Is it the sheer amount of code that needs to be run through? Is it the modern tendency towards programmer-time-saving approaches at the (mindbogglingly huge) expense in the clock cycles / memory usage department?


title: What is the best pattern for adding an existing item to a collection in REST API?

text: I'm designing a pragmatic REST API and I'm a little stuck on how best to add existing entities to a collection. My domain model includes a Project that has a collection of Sites. This is a strict many-to-many relationship and I have no need to create an entity that explicitly models the relationship (i.e. ProjectSite). My API will allow consumers to add an existing Site to a Project. Where I'm getting hung up is that the only data I really need are ProjectId and SiteId. My initial idea was:               1. POST myapi/projects/{projectId}/sites/{siteId}      But I also thought about               2. POST myapi/projects/{projectId}/sites      with a Site entity sent as JSON content. Option 1 is simple and works but doesn't feel quite right, and I have other relationships that cannot follow this pattern so it adds inconsistency to my API. Option 2 feels better but leads to two concerns:   * Should I create a Site or throw an exception if a new Site is posted (SiteId = 0)?   * Because I only need ProjectId and SiteId to create the relationship, the Site could be posted with wrong or missing data for other properties. A 3rd option is to provide a simple endpoint solely for creating and deleting the relationship. This endpoint would expect a JSON payload containing just ProjectId and SiteId. Please help me break out of this analysis paralysis!


title: What can we learn from esoteric languages?

text: Esoteric languages are intriguing and can make you go 'Hmmm...', but what can we really learn from them? Is there a benefit to spending more than 5 minutes trying to write an application in an esoteric language? Have you tried one, and if so, what did you learn?


title: Global constant values throughout MVC site

text: My MVC (.NET) has some constant values through out the site, such as the phone number, physical address, email address etc. I'd like to store this value once, so future updates are easier for when they change their details. To make my question simpler, I've only focused on phone number. My question is where and how to store this number and a problem I'm facing with my decision. At the moment, I've chosen to store it in the Global.asax file as a static method, eg               public class MvcApplication : System.Web.HttpApplication     {         protected void Application_Start()         {            //logic         }              public static string GetPhoneNumber()         {             return "012345 678 910";         }     }      This works very well, in my controller I can add references to this method and assign it to a ViewBag                 public ActionResult Contact()       {             ViewBag.Phone = MvcApplication.GetPhoneNumber();       }      As per many sites, the phone number will be visible at the top of every page and as such, placing it in the `_Layout.cshtml` is logical. The problem I have is there is no controller (not that I know) for the _Layout.cshtml and the only way I can pass the value is to have a ViewBag.Phone set up for every view, EG               public class HomeController : Controller     {         //         // GET: /Home/              public ActionResult Index()         {             ViewBag.Phone = MvcApplication.GetPhoneNumber();             return View();         }              public ActionResult About()         {             ViewBag.Phone = MvcApplication.GetPhoneNumber();             return View();         }              public ActionResult Contact()         {             ViewBag.Phone = MvcApplication.GetPhoneNumber();             return View();         }      This is messy and smelly but I have no idea how I can improve this. Should I be storing my global variables in a different place or is there a better approach for this as I'm sure this is a common problem.


title: Is is acceptable to create mediocre code now in preparation for new language features?

text: I'll be specific: Java 8 is promised to bring lambda expressions as well as method and constructor references among other things. As a Java developer I'm super psyched about that. In my day to day programming I see more and more opportunities where using these features would greatly simplify code that would otherwise be very verbose and tedious. In lieu of method and constructor references I started using more and more reflection and plan to migrate those code paths to Java 8 as soon as possible. I use special comments (like the well known TODO comments: JAVA8) that can be used by the IDE or grepped easily in order to find the relevant places. I also test all those cases extensively to make sure they work. But still I have to wonder whether it's good to do it like that. Is it acceptable to produce a little more brittle code now that will eventually become robust again? GA for Java 8 is September 2013 so it's not too far in the future (provided the release date doesn't slip). A kinda general example would be something like this: I want to create some container objects and fill them with data from a database. If I were to use the standard Java approach, it could look like this:               class ContainerService {       private Database database;       private final Map, ContainerInitializer> INITIALIZERS = new HashMap();            {         INITIALIZERS.put(Foo.class, new FooInitializer());       }            public Container getContainer(Class cls) {         return INITIALIZERS.get(cls).create();       }            interface ContainerInitializer {         Container create();       }            class FooInitializer implements ContainerInitializer {         Container create() {           return new Container(database.getFoo());         }       }     }      The reflective code is               class ContainerService {       private Database database;       private final Map, String> INITIALIZERS = new HashMap();            {         INITIALIZERS.put(Foo.class, "getFoo");       }            public Container getContainer(Class cls) {         Method m = Database.class.getMethod(INITIALIZERS.get(cls));         return new Container(m.invoke(database));       }     }      Note how all the intermediate interfaces and classes fall away. The Java 8 variant is something along the following lines:               class ContainerService {       private Database database;       private final Map, ContainerInitializer> INITIALIZERS = new HashMap();            {         INITIALIZERS.put(Foo.class, database::getFoo);       }            public Container getContainer(Class cls) {         return new Container(INITIALIZER.get(cls).create());       }            private interface ContainerInitializer {         Container create();       }     }      This is slightly longer again but has type safety. Also it's trivial to get from the prepared code to the final code using method references. Of course the example is a bit simple. Imagine having a lot of types the container could contain. In the first method, there would be an extra class for each of them. In the other two methods, only data has to be added. It keeps everything so much simpler.


title: My university doesn't provide php courses because it is an "easy" programming language?

text: I've met a student from the computer science department and I discovered that they only teach java and aspx. I asked him why they didn't teach php since it is the top one programming language on the net. He says that it was a "easy" (or hobbyist's) programming language. I'm not sure what that means. What's your opinion?


title: Which programming methodology would be a good fit for us?

text: Unfortunately, somebody has taught our upper management the word "Agile" and now they want us to move towards it. I have a peripheral understanding of agile (in principle) but have never used it in practice. From what I know, it will not be a good fit for our organization. Right now, things are pretty grungey. Here's how it is; We're a very small team - two developers, one DBA, one designer. The company I work for makes a disproportionately large amount of money relative to its size, and nearly 95% of that is pure online sales. From a development perspective, we are subjected to many desk invasions during a typical day (we're tech support as well as dev), work can regularly just fall out of the sky at a moments notice if a sales team member promises something to someone. We do undertake larger projects too, and they're a nightmare with the constant interruptions. Some of us are starting to tear our hair out! Project plans are drawn up by non technical managers in excel spreadsheets, where they try and break the task down into bite-sized sentences that they can understand and put a date beside each one. These dates are always hideously unrealistic and often missed, and our meetings (which we have around weekly) are regularly filled with awkward moments with people asking "why hasn't this been done yet". I am pretty sure Agile isn't the one for us. Now, given that (and i have tried) this company _will not change its ways_ , and only the dev team is willing to change, is there a development methodology that we could adopt which is a good fit for just saving us some sanity?


title: Violating SQL principles

text: I have to write a decent size database, 1GB more or less. I have only taken an introductory semester regarding SQL databases. During the course we learned that the relational model under SQL has no implied order and that therefore when querying we should always have a variable that sets the correspondant order in the table. However, when doing practical work I find 'convenient' to make already ordered small, infinite number of tables. For example, lets say that you have 5 clients and that their info will never join their data together. Is it admissible to have a potentially infinite number of tables with a table per client? For example, I append new rows already ordered to the database. The database is already ordered. Is it admissible to make an unordered query and just assume that is implicitly ordered? All this violates the principles that I know. My boss, who does not know about databases says that if it works it works and that speed is important. What shall answer to him?


title: Using partially implemented interfaces

text: Consider the following hierarchy in C++ notation:               class A         {         public:             virtual void doStuff()=0;             virtual void doOtherStuff()=0;         };          class B:public A         {         public:             void doStuff();             void doOtherStuff();         };          class C:public A         {         public:             void doStuff();             void doOtherStuff();         };      Now, assume that the code for doStuff is identical in B and C. What is the best practice of   * implementing doStuff in a class D:public A and let B and C derive from A   * Let the real task be performed in a function that is called from doStuff in both B and C Somehow the latter seems more clean, is it? It should be noted that there are other methods in B and C with common implementations as well, and that in the underlaying model, the concept of D does not exist.


title: What does it mean to be a game developer?

text: I'm a .NET developer and mostly builds GUI's but of course also pure C# due to architecture and database level needs. To me, developers of games in discussions often being simply referred to as "gaming developers". I find that a little too shallow and I'm curious what a "gaming developer" really stands for. What would we, in turn, be to a gaming developer? Are there ever conversions from one direction to another and what are the main differences in a regular development process?


title: Thinking of simultaneously coding the same project in two languages. Good Idea?

text: Is this a good way to learn a new language? Or to develop a preference of one language? I was thinking of coding a project in both Python and Java. The only foreseeable problem is trying to transfer solutions that should be rethought for each language. Or is this unnecessary? (My intentions aren't to benchmark.)


title: Best strategy to discover a web service in a local network?

text: I am currently doing some research for a project. The setup is simple, I have a computer running a service in my home network and any device connected to that same network should be able to discover the service automatically and use it. I have no specific technology requirement whether it is on the server or client side. The client knows about the service definition. Other than that I have no idea what strategy to use, what technology to look at or whether I should go for a SOAP or a HTTP based service. I think going HTTP with REST API is the best for targeting all devices but I am opened to any suggestions. Thanks.


title: SLF4J vs LOG4J Which one to prefer?

text: I have seen this question but does not answer me. It have a brand new project. I have almost always used Log4J but now I am seeing SLF4J making some waves. What is it that Log4J could not do and we needed SLF4J? Is it really an upgrade. Should I use it in a project which will also have an API for other to extend upon?


title: How can I find the root of confusing problems?

text: Several times after posting over at Stack Overflow, I have found that the problem I have is somewhat specific, and may have issues rooted elsewhere in my code. These are very difficult to solve with a question, and I often end up getting poor or irrelevant answers. When a problem is just too localized or to complex for Stack Overflow to be any use, what should I be doing to break down the problem so it can be solved? How can I approach peers or user groups about problems like these?


title: New PHP project, how to best architect it

text: I have already done a PHP project, and I did a number of things pretty wrong :) I just had all pages as scripts with php mixed in with html. I also wasn't using a framework like cakephp. And I didn't really use objects, nor had any sort of test suite. :) This time around I want to get it right. What should I do in terms of good practice approaches? And what am I ok not using? Any suggestions? Tips?


title: What should I study to be able to join a C++ open source project?

text: I am learning C/C++/Oracle/Unix. I am thinking of developing some application on my own, but I have no Idea what else is required. If you take an example of C++. I have very basic knowledge of it (data types, OOP concepts, vectors, file handling, exception handling, etc). I am not an expert though. I have just read one book about C++ and don't know much about graphics in C++. I went to codeplex.com (an open source website for programming and development) they had some projects in C++ that are looking for developers. Now this looks way beyond my knowledge but I want to buld something. If not, I want to learn more to do it but I have no clue where to begin and what material topics, books to read. There so many things involved with an application: .exe files, .dll files and many more 1) Am I thinking in the right direction? 2) Is it possible to do it alone or be a part of such big open source projects online? What are the things that I need to collect online and study? Please help, if possible please provide the topics, books, websites that might help me to study and proceed to achieve my goal.


title: Does "Property" in C# cost much?

text: I have a class created in some namespace, like `SomeNameSpace.SubNameSpace.StaticClassName` Here is a code snippet from other code file where I want to use this class many more times, so I created a property in the code file like this               //Just to provide an Alias for long name "SomeNameSpace.SubNameSpace.StaticClassName.PropertyName"     public StaticClassName ServerProxyAlias     {         get         {             return SomeNameSpace.SubNameSpace.Instance.PropertyName;         }         set         {             SomeNameSpace.SubNameSpace.Instance.PropertyName = value;         }     }      **Is there any problem in doing like this ?**


title: What good reasons are there to capitalise SQL keywords?

text: There seem to be a lot of developers who write their SQL by capitalising the keywords:               SELECT column     FROM table          INNER JOIN table          ON condition     WHERE condition     GROUP BY clause     HAVING condition      I'm wondering why people stick to this approach? Clearly, it's a long established convention - but I've never run into a RDBMS that _requires_ capitalisation. Personally, I find KEYWORDS THAT SHOUT to be calling attention to exactly the wrong part of the query, which is why I write the keywords in lowercase. Still, enough people use this convention that I figure I might be missing something, hence this question.


title: How do you cope with "brain farts"?

text: From the Jargon File: _brain fart: n.   The actual result of a braino, as opposed to the mental glitch that is the braino itself. E.g., typing dir on a Unix box after a session with DOS._ I've been working with JavaScript and Python lately and have made errors like typing, in Python,               function foo(argument1, argument2):      This isn't pure JavaScript, but it also doesn't work in Python. One of my recent posts, http://serverfault.com/questions/506403/why-is-my- root-url-serving-up-a-404-under-apache/506452?iemail=1&noredirect=1#506452, was about why a pure, simple, working, and rather small DocumentRoot contents were not showing. The answer was that I made a mistake that I do not remember making in years of dealing with Apache: I had included commas betweek ServerAlias entries, and that was why the (perfectly appropriate) DocumentRoot was giving a ServerError. (And did I mention that I've been spending a lot of time coding where separating by ", " was the appropriate way of separation?) Is this sort of thing just non-negotiable? Or are there ways to mitigate and compensate for them?


title: What will generate an adjacency matrix file with a specified topology for me?

text: I am writing an application that takes some file specifying an adjacency matrix and uses this to construct a graph (in this case, a directed social network). What I would like to do is specify the size of the matrix and then have it generate an adjacency matrix with one of these topologies: ring, hierarchical, fully-connected, random and smallworld (every node x degrees of separation from each other). Ideally a text file would be the output. I can't create these files manually because the size is in the thousands^2... Fully-connected and random aren't 100% required but they would be nice, I can just implement them in code. I read a dissertation which specified it used an application located at http://ww2.cs.mu.oz.au/~tmill/graphtastic.tgz ...but it does not seem to exist anymore so I am not sure what to do. I thought there would be loads of applications such as this out there, but I can't see any. So, is there an program out there that could generate an adjacency matrix with a configurable topology into a text file ?


title: Agile User Stories and acceptance criteria

text: I am writing some agile user stories and acceptance stories for the first time, and was hoping for some feedback from an experienced product manager or developer. I only need to capture the main points in the acceptance criteria. ## User Story AS A registered jobseeker, I WANT TO create and edit my CV on the user interface on my mobile device SO THAT employers and recruiters can view my career summary and contact details ## Acceptance Criteria   1. The user must sign into a registered account to create a CV   2. The user cannot save a CV unless all the mandatory fields on the form are complete    3. The user should be able to edit and delete the form at any time   4. Data from the saved form is stored in the CV database   5. Only registered Recruiters and Employers can view the users CV and contact details    6. The jobseekers user account is linked and synchronised on both mobile and desktop versions Does this acceptance criteria sounds suitable for the given user story? Is there any way they can be more focused, and if so how?


For definitions and examples of "state", see: http://en.wikipedia.org/wiki/Program_state , http://en.wikipedia.org/wiki/Finite_state_machine , http://en.wikipedia.org/wiki/State_diagram A diagram showing a very easy example, notice how the current state changes how the turnstile operates when the same input (inserting a coin, pushing on the turnstile) is given twice in a row: http://en.wikipedia.org/wiki/File:Turnstile_state_machine_colored.svg I thought about this question for a bit and came up with nothing other than:   1. Reduce the scope/features of the project/software.   2. Push the burden of making intelligent decisions to the user and/or supply the program with a "cheat sheet" that makes decisions easier (for example: instead of trying to write a program that drives a car using only two webcams, you could embed waypoint markers in the road every 100 ft, place special reflective markers in between lanes, and use a database of terrain maps to help the program make decisions; one would require the work of a Tesla/Newton -level genius [assuming the program can do things like (1) dodge animals, the remnants of exploded tires, etc. while taking less drastic measures for things like cardboard and plastic bottles, (2) deal with the occlusion of landmarks and indicators caused by other vehicles, (3) adjust to weather, etc. conditions, and so on] vs. someone who can write a "connect the dots" algorithm) PS: I would classify these two methods as "cheating" because you are significantly changing the input/output of the program. In the first case, you are whittling away your program to nothing, and in the second, you are shifting much of the burden of decision-making onto whoever maintains the database and transit system. Are there any valid ways of eliminating/reducing state?


title: Using "Context-based" CSS Class Names

text: This morning I found a note on my desk with some tips from a higher up developer who had been looking over some HTML/CSS I had put together. One of his suggestions was for me to "stay away from context-based class and ID names like 'left' or 'right.' Never use colors as names. Stick to semantic names based on the content." Is this valid advice? Why?