title: What are the pros and cons of Node.js?

text: I'm designing a web application that is locally focused on JSON objects to do all the data stuff (and after that I would pass it to a server to cloud synchronize). However, somebody in an answer from another question suggested me to use Node.js to up/download data directly formatted as JSON. I read some stuff at the developer's website, and they claim it's as a web server. However, I'm not sure if it's just a data server (which makes sense to me) or it could be a replacement to Apache (I would go for no). I'm aware that your answers depend on the needs of my application, so, to sum up: _it should be able to dispatch data from a database ([No]SQL, whichever) and synchronize it back when I choose (either in the background or by direct action). The client-side should store the data as a mid-step (before syncing and after downloading the stuff) in JSON. Eventually in the future, it should need to synchronize across a bunch of accounts at the same time (you know, team modifications, just like Google Docs and so)._ And now, back to the question: **Which are the pros and cons of Node.js?** I'm pretty sure that the direct use of JSON objects from the server to the client and the _pushing_ calls are pretty good reasons to choose Node.js. However, I'm not sure if security (either my code or the data itself) or concurrent connections are mature enough, or I should go for a typical Apache with PHP files querying a MySQL, and in the early future poll instead of push (or find a pushing server). I know the question may sound easy to answer if you're already on one side (just node, node+Apache, just Apache), but these days I'm from nowhere. Thanks for your answers, mates.


title: Case studies for successful service (project) based software development businesses without constant overtime from its employees

text: I work for an IT company that is primarily services (project) based rather than product based. All software engineers are salaried. The company has set new expectations that everyone should work 48 hours per week instead of 40. Note, this isn't occasional overtime due to crunches. This is the new 40. The reasoning is that this enables the company to provide benefits to its employees such as monetary incentives and training because the company is more profitable. more hours worked = more billable hours = larger profit I understand the need for profitability and the occasional crunch time and have put in the extra hours when it was needed and beneficial to the project. However, I am also very sensitive to work life balance and have raised my concerns about the the new expectation. My employer is open to other methods to increase profitability so I hold hope that we can turn things around before it becomes a horrible place to work. How does a services based company become more profitable without increasing the number of hours expected from it's salaried employees? Are there any case studies showing the pros and cons of consistent overtime? Are there any case studies for a successful service based business model (for software development companies) that does not require consistent overtime from its employees?


title: Duck checker in Python: does one exist?

text: Python uses duck-typing, rather than static type checking. But many of the same concerns ultimately apply: does an object have the desired methods and attributes? Do those attributes have valid, in-range values? Whether you're writing constraints in code, or writing test cases, or validating user input, or just debugging, inevitably _somewhere_ you'll need to verify that an object is still in a proper state--that it still "looks like a duck" and "quacks like a duck." In statically typed languages you can simply declare "`int x`", and anytime you create or mutate `x`, it will always be a valid `int`. **It seems feasible to decorate a Python object to ensure that it is valid under certain constraints, and that every time that object is mutated it is _still_ valid under those constraints.** Ideally there would be a simple declarative syntax to express "hasattr length and length is non-negative" (not in those words. Not unlike Rails validators, but less human-language and more programming- language). You could think of this as ad-hoc interface/type system, or you could think of it as an ever-present object-level unit test. **Does such a library exist to declare and validate constraint/duck-checking on Python-objects?** Is this an unreasonable tool to want? :) (Thanks!) * * * Contrived example:               rectangle = {'length': 5, 'width': 10}          # We live in a fictional universe where multiplication is super expensive.       # Therefore any time we multiply, we need to cache the results.          def area(rect):         if 'area' in rect:             return rect['area']         rect['area'] = rect['length'] * rect['width']         return rect['area']          print area(rectangle)     rectangle['length'] = 15     print area(rectangle) # compare expected vs. actual output!          # imagine the same thing with object attributes rather than dictionary keys.


title: Verification naming confusion

text: According to Martin Fowler classical article, there are two types of verification: state and behaviour verification. At the same time I often see people telling about implementation vs. behaviour verification. So I guess we speak about pretty same stuff here and "state" in the first classification is "behaviour" in the second; "behaviour" in the first equals to "implementation" in the second. What I don't like is that "behaviour" word appears in both namings but on contrary sides which causes a lot of confusion. Which naming do you prefer?


title: JavaScript Phone Screen

text: For a simple phone screen question we generally always ask about scoping rules. It's clearly one of the biggest gotchas of JavaScript. Out of everyone we ask almost everyone insists that in an if or for loop a variable is scoped to that block as opposed to the function. Is this an unreasonable question?


title: source code file system layout for 2 very similar projects (with git)

text: we're working on "two" android apps that are very similar; in fact, they're the same apps with different graphics and color schemes, slightly different configuration and one or two unique activities that are not in the other project - but the functionality is 95% the same. the plan was to work on one app until it is as complete as possible and then change the images and the other /res(ource) files. of course it's not that easy; we're still working on the shared code, and patching the same code in different projects (or repositories) is - in my opinion - out of the question. we're all using git and eclipse. is there the "definitive guide" about handling such a situation? my thoughts about it: ### three repositories rep1 for the unique files of application1, rep2 for the unique files of application2, and rep3 for the shared files. if there is a way to push files in one folder (the project folder) to different repositories ... i mean, cloning rep1 automatically pulls the files from rep1 AND rep3, and pushing automatically pushes files back into to the right rep? my teammates are suspicious; no one of us knows git very well and we're afraid of spending too much time repairing our dcvs mistakes. ### 2 repositories if the first option isn't possible, our plan was to have 2 repositories. rep1 for the complete app1 and rep2 only for the rep2-specific files. a build script would replace the files from app1 with those of app2. imo this is an "accidental overwrite" minefield, and i don't like it. but as long as we don't have a better solution, this is the way to go. ### eclipse maybe there is some kind of eclipse-specific hack that would make this painless? ### (edit) branching!? i don't have any experience with branching. but this be a possible solution? note: these are android projects; android demands a specific file layout. e.g. the name and structure of the "res" folder is pretty much fixed. this means that there are directories which contain files both app-dependent and shared files. i don't know if git can handle this.


title: Storing stop/start points in a database

text: Let's say I am storing start and stop points per user into a database table. For example... let's say in a chat system, a user only needs to see lines 24-293, and 500-512. (Let's say he logged off for the night, and was not present between lines 294-499). Saving each start and stop point as a discrete row would lead to a huge ballooning table, which isn't exactly ideal. I wouldn't be searching on these points, so indexing is not necessary. How would I save this kind of information in the database? I was thinking of saving it in JSON:               accountID   |   lines             1   |   [24,293,500,512]      Where each odd value denotes a start, and each even value denotes an end. My only worry is that highly active users will be joining and leaving a chat, and would quickly fill up the row if `lines` was of type VARCHAR. So perhaps `TEXT`, or even `LONGTEXT`. Am I heading down a path of hurt, or is this a viable method? Thanks in advance!


title: How to reach to the advanced level in SQL?

text: I think I have a good grasp of SQL and the most features it has, but sometimes when I've done some more advanced Reporting Services a fellow developer has helped me with some stuff and when I open some existing procedures in T-SQL I understand that I have some learning to do. I think I have focused more in later years at application code (C# and javascript mostly) and somehow my SQL skills aren't there where It should be. Because at work the most stuff is very database centric with procedures, so I think I need to get better at SQL. But when I google around about features and look in books about SQL I know the most stuff, but somehow getting better at SQL ain't so easy any more. Does anybody have any advice how to become an advanced SQL programmer? What books to pick up? By the way I work exclusively with SQL Server. I've done tons of basic procedures with inserts, updates, selects with joins and group by and so on. But doing bigger problems I've always done a more application-centric approach with arrays and collections, but sometimes (Reporting) there's no choice than do it in SQL and work with temporary tables and so on. I'm tempted to do cursors because then I can loop through everything but that kills database performance (how about looping through a half million rows with a cursor?).


title: Silent Crash of WPF/VB.net 2010 based application

text: I have an application built in WPF and VB.net. It works on several Windows XP computers that I've tested it on, however, my animator's computer doesn't seem to like it. At first, the program would work up to a certain point, where the program would play a video. However, as she was missing the codec to play the video, it threw an exception. We installed the codec, and now the program silently fails all together, without so much as an error message or crash notification. These are the prerequisites that are required. All of these are installed on her computer. Assume prereqs for these items are also installed.   * .NET 4 Framework    * SQL Server Compact Edition 2006   * Windows Media Player v. 11   * Theora DirectShow codec Her computer is running Windows XP Home Edition SP3. What is going on? How can we get this program working on her system?


title: Are today's general purpose languages at the right level of abstraction?

text: Today Uncle Bob Martin, a genuine hero, showed this video In this video Bob Martin claims that our programming languages are at the right level for our problems at this time. One of the reasons I get from this video as that Bob Martin sees us as detail managers and our problems are at the detail level. This is the first time I have to disagree with Bob Martin and was wondering what the people at programmers think about this. First there is a difference between MDA and MDE MDA in itself hasn't worked and I blame way to much formalisation at a level you can't formalize these kind of problems. MDE and MDD are still trying to prove themselves and in my mind show great promise. e.g. look at MetaEdit The detail still needs to be management in my mind, but you do so in one place (framework or generators) instead of at multiple places. Right for our kind of problems ? I think depends on what problems you look at. Do the current programming languages keep up with the current demands on time to market ? Are they good at bridging the business IT communication gap ? So what do you think ?


title: After an outsourced/offshored application is "completed", who will do the maintenance?

text: What is the typical arrangement for the maintenance of applications that are not developed in-house? Note: by maintenance, I mean bug fixes, optimizations, small modifications and future extensions.


title: Parameterless & Empty-Paren methods in Scala

text: I'm learning Scala at the moment via Odersky's Programming Scala (2nd). I'm upto chapter 10 where he starts introducing parameterless and empty-paren methods. I just can't get my head around it. So far, all I understand is that I should use empty-parens if a method has side-effects and parameterless methods otherwise. I can't figure out what is the advantage of this convention. I read the posts on Stack Exchange, but to be honest, when the posts start discussing this topic in some depth I was lost. I'm looking for a simple explanation of what are typical use cases for this language feature and what are the advantages to help me understand it better.


title: What's your view on using other people's code?

text: As per this question: I decided to implement the BitTorrent spec to make my own client/tracker. Now, I was going through the spec, I was about 70% done implementing the BEncoding when I found a link to an implementation of BEncoding in C# written by someone else. Normally, if I were working on production code, I'd use it as a reference to check my own work against, and a baseline to write some tests to run my code against, but I found myself thinking "I'm making this, it's a for-fun project with no deadlines; I should really implement it myself - I could learn a lot" but some voice in my head was saying "Why bother re-inventing the wheel? Take the code, work it so that it's you're style/naming convention and you're done." So I'm a bit conflicted. I ended up doing the latter, and some parts of it I found better than what I had written, but I almost feel like I 'cheated'. What's your take? Is it cheating myself? Perfectly normal? A missed opportunity to learn on my own? A good opportunity to have learned from someone else's example?


title: Are projects using frameworks not as good as projects using pure programming?

text: I've been a Rails developer for a year now (originally self taught), and am at the point where I want to improve. I've been reading books on how to improve the quality of my Ruby code (I read Design Patterns and Practical Object Oriented Design in Ruby). I'm trying to improve the quality of my code and to add to my portfolio, but I'm having trouble thinking of anything motivating to do with just Ruby since in my head it feels cooler or more usable to have a Sinatra app (I'm thinking about learning Sinatra) and a browser to interact with the app than having to run a pure ruby app through the console with `$ ruby my_app.rb` and have it spit out some info. I know the results are really similar, but still. My question is, do employers think lesser of projects that use frameworks than projects (Rails, Sinatra, etc) that are built from complete scratch (just the programming language itself)?


title: Is it bad to reuse other programmer's code libraries that can perform generic tasks?

text: Reusing large amount of helpful codes made by other programmers is very tempting for me. I specifically refer to codes that can perform generic tasks, such as Data Access Layer (DAL) codes. I am just beginning a project using a newly familiar language, and I don't think programming from scratch is feasible. I can understand the semantics and many other concepts of that language, it is just the case that maybe I'm too lazy to start over and wanted to dive in to the task of coding a specific business logic. So given that using a code library of others is perfectly legal, is it bad to acquire a large portion of somebody's work and use it as a foundation of mine?


title: Incorporating libs into module pattern

text: I have recently started using require.js (along with Backbone.js, jQuery, and a handful of other JavaScript libs) and I love the module pattern (here's a nice synopsis if you're unfamiliar: http://www.adequatelygood.com/2010/3/JavaScript-Module-Pattern-In-Depth). Something I'm running up against is best practices on incorporating libs that don't (out of the box) support the module pattern. For example, jQuery without modification is going to load into a global jQuery variable and that's that. Require.js recognizes this and provides an example project for download with a (slightly) modified version of jQuery to incorporate with a require.js project. This goes against everything I've ever learned about using external libs - never modify the source. I can list a ton of reasons. Regardless, this is not an approach I'm comfortable with. I have been using a mixed approach - wherein I build/load the "traditional" JS libraries in a "traditional" way (available in the global namespace) and then using the module pattern for all of my application code. This seems okay to me, but it bugs me because one of the real beauties of the module pattern (no globals) is getting perverted. Anyone else got a better solution to this problem?


title: Clearcase: Find out files checked in with the current snapshot view

text: If you have used clearcase before, then this question is for you. How do you determine all the files and their corresponding checkins?, given a snapshot view.


title: Which architecture should I choose for this project?

text: I have a project. The server which based on a phone PCI-board is responsible for received phone calls from the customer and then redirect the phone calls to the operators. ![enter image description here](http://i.stack.imgur.com/bQEMN.png) I have decided to code the server using c++ programming language and qt framework because the PCI-board SDK's interface is c/c++ originated and for the sake of portability. The server need to send the information of the the customer to the operator while ringing the operator and the ui interface of the operator client should be browser-based. Now the key problem is how could the server notify the operator that there is a phone call for he/she. One architecture I have considered is like this, ![enter image description here](http://i.stack.imgur.com/9PdY5.png) The operator browser client use ajax pooling the web server to check whether there is call to the client; the web server pooling the database server to check whether there is call; the desktop server(c++) wait for the phone calls and set the information in the database. The other operations such as hang up the phone call from the client, retransfer the phone call to the other operator also use this architecture. Then, is there any way other than pooling the server(js code `setInterval('getDail', 1000)`) to decide whether there is a call to the operator? Is this architecture feasible or should I use some terrific techniques that I do know such as web services,xml-rpc, soap??? * * * The Caller center is for 8~300 operators and the operators do not seperate geographically. Moreover, I have figured out that we need provide interface for customer programmer, so this thing is so called middleware? Then some new questions, how could we expose interface to customer, COM? Thanks in advance.


title: Performance analysis of C++ programs

text: How can I measure the performance of my C++ programs using C++? Specific metrics I want to measure are:   * Memory used ( **space** )   * Duration taken ( **time** )


title: What workflow do you use with asp.net web forms development and your design department

text: I work at a place that has a clear separation between designers and developers. We're a fairly new start-up and we're trying to figure out what would be the best workflow for our team. We're a small company with a total of about 11 employees, three of which are designers (they deal with the HTML, CSS, some jQuery), and three developers primarily working with ASP.NET Web Forms. I am one of the developers and don't have a knack for design, but I am comfortable enough with CSS and jquery/Javascript to understand the mechanics and whatnot. So, currently we wait for the designers to provide us with HTML structure clobbered together with server-side includes, js, jquery, css, etc. Typically we try to work around their stuff and begrudgingly try to keep their structure roughly the same with the consequence of forcing us to have a lot of hacks in place to work with it. Yes, this means using their Server-Side Includes mixed in with our .aspx pages, amongst other things that seem to go against the general asp.net web forms flow. There have been times when I have changed the includes into a user control and had their common HTML out in master pages, etc. All of which was consequently followed by a lot of barking from the design team. Their main complaint being that master pages and user controls make their maintenance of the site more difficult. I can see their point of view, and I wouldn't like it either if people messed with my workflow either, which I guess I am doing so with them. I have tried several times to approach them about moving site structure that complements the asp.net web forms environment we programmers are working with, but every time the subject of working with master pages comes up, the design team throws a near tantrum. Our current approach is simply forcing us to put together a lot of hacks and work-arounds so that it gels with their design and frankly it's getting frustrating and just adding more unnecessary technical dept to our projects. My question is simply this: what workflow works best for you and your design team? Do your designers know how to use master pages, etc. Is it unreasonable to have designers understand the mechanics of how master pages and user controls work, and in general how ASP.NET puts a page together? (I don't feel this is an unreasonable expectation of them...) So, what do you guys think?


title: Example of a javascript app using immutable data structures?

text: JavaScript is functional but not in a strict sense. It does not rely on immutable data and side-effect free functions. There are a few libs that provide immutable data structures, so I believe it should be possible to write a more strictly functional program using JavaScript. I know ClojureScript exists but I am not interested in transcompilation. Are there any open source projects that use JavaScript in a more strictly functional sense with nothing but immutable data? I am interested in whether this is practical in a language not built with this in mind.


title: How applicable would an Automata class be to professional development?

text: Would it be worth taking Automata over Databases or Networking assuming no immediate plans on a Masters degree in Computer Science? I'd assume I'd learn things in there that would somehow be real work applicable like complexity theory but is it more useful immediately out of school or better to do a course somewhere post baccalaureate and take something more obviously applicable in its place? I've limited slots left or I'd take all of them.


title: How should I plan and start a project?

text: Every time I start a project, I decide at crucial moments to completely change the core classes and get caught up in obscure errors. I try planning in advanced and usually start off on a good foot but then I go to it another day and decide I would like to do it 'another way'. Is there a standard, of sorts, when starting a project such as mapping out classes and starting with unit tests? What is a good convention when planning and starting a medium project. The last project and started was a projectile motion simulator - I know, predictable.


title: Is code pruning related to obfuscation?

text: From my research, many obfuscation/optimization packages include a feature called **pruning** where the software will remove dead code during processing. The following packages include both obfuscation and code pruning as a feature (to name a few):   * RedGate SmartAssembly (.NET)   * Preemtive Dotfuscator (.NET)   * Inquartos Obfuscator (.NET)   * ProGuard (Java) I see the common thread that both operations require scanning and analyzing an assembly, but I'm curious if the two features are or even could be fundamentally related. The reason I am asking is that we are considering disabling code pruning in our environment (unrelated issue), but our concern is that it could potentially decrease the effectiveness of the obfuscation process and thus protect our Intellectual Property less. Does or could code pruning influence obfuscation, and how?


title: Why is SQL known as a relation-based / functional language?

text: We're learning that most languages are classified as either of the two, "relation based" or "high level". I've never used SQL before, but from reading its syntax it seems more like the imperative/high-level syntax than functional/relation-based (Lisp, Haskell)?? Or it could just be that my interpretation of my professor's lecture notes is wrong... but it definitely lists SQL as one of the relation-based languages (as opposed to high level), and it equates relation-based with functional... or perhaps it's that I don't understand **why the fact that SQL deals with relational databases makes a functional language the way it should be implemented? (and why 'relation-based' equates with 'functional' when categorizing programming languages?)** Thanks :)


title: The C++ web stack, is there one?

text: Java would be jsps and servlets (or a framework such as Spring) running on the JVM and tomcat (or glassfish etc). C# would be asp and C# running on dot.net framework and IIS ? (I have no experience with this please correct and improve my terminology) Is there an equivalent for C++ ? I could happily call some C++ from a java servlet/controller but was wondering if there are existing frameworks and libraries out there specifically for creating business logic in C++ with a web front end.


title: Are there any good python libraries for programming GUI's on MAC and Windows?

text: Need a a toolset / framework that I can use to build GUI apps on both Mac and Windows, without too much stuffing around. Any obvious candidates?


title: How to learn & introduce scrum in small startup?

text: In a few months, a friend will establish his startup software company, and I will be the software architect with one additional developer. Though we have no real day-to-day experience with agile methods, I have read much "overview" type of material on them, and I firmly believe they are a good - if not the only - way to build software. So with this company, I want to go for iterative, agile development from day 1, preferably something light-weight. I was thinking of Scrum, but the question is: what is the best way for me and my colleagues to learn about it, to introduce it (which techniques when etc) and to evaluate whether we should keep it? Background which might be relevant: we're all experienced developers around the same age with similar professional mindset. We have worked together in the past and afterwards at several different companies, mostly with a Java/.NET focus. Some are a bit familiar with general ideas from the agile movement. In this startup, I have great power over tools, methods and process. The startup's product will be developed from scratch and could be classified as middleware. We have some "customer" contacts in the industry who could provide input as soon as we get to an alpha stage.


title: Am I permitted to use an LGPL library without releasing the source to the rest of my application, if I dynamically reference the library?

text: I am a bit confused as to what I am/am not allowed to do with a LGPL Library that I intend on using in a small scale commercial C++ Application that I am developing. My current understanding, although I don't know if I am correct, is that I am permitted use the library without releasing the source to the rest of my application if I dynamically reference the library. Does anyone know if this is correct? Are there any restrictions as to how I reference the library? Thank You! I am not a native English speaker and don't understand the licence entirely.


title: Non-english programming languages

text: Is there a definitive listing of programming languages which don't use English for the keywords and statements in the language code? For example, I know that Russians back in the Cold War were developing their own computers on their architecture. I'm interested if there is a listing of programming languages that are not English based?


title: Why are methods considered the class attributes in Python?

text: I read in a book that both _methods_ and _fields_ are considered the _attributes_ of a class in Python. However, recently I was told by a friend of mine that methods may **not** be considered the _attributes_ of a class. Then I decided to check this out again, and found this question mentioned on Wikipedia saying that this is a Python "tradition" to refer to methods as attributes, in contrast to other object-oriented programming languages. So my question is: why are methods considered the class atributes along with the fields in Python in contrast to other languages? Thank you!


title: Dynamically generating HTML and CSS

text: I find writing CSS by hand to be extremely tedious. Coming across a concept such as _fluid_ , makes me want to write all my websites so that the CSS resizes nicely and looks the same in different browsers. My question to you is: **Can my design be generated programmically?** e.g.:               #include <css>     #include <html>     #include <vector>     #include <string>          int main(void) {         HTML::HTML page;         page.title("my title");         page.heading.font(15);         std::vector<std::string> para = <vector of paragraphs>;              CSS::CSS layout;         layout.grid(2,2);         layout.fill(xcoords_as_percentage, ycoords_as_percentage);              page.use_css(layout);         for(int i=0; i<para.size() && y!=grid.y.size()+1; i++, x++) {             if(x==grid.x.size()) x=0, y++;             page.grid[x][y]=para[i];         }         page.header1("I am header1");         page.footer("I am page footer");         layout.order(page.header1[0], page.grid.all(), page.footer());              generate_html("index.html");         generate_css("layout.css");     }      This will allow me to concentrate on the actual contents, abstracting away from "Oh, IE7 doesn't support this option, so do this hack..." FYI: I am coding the actual site in Django (Python), so the HTML/CSS generator doesn't have to be in C++. I am aware of work being done in this direction in the C++ Wt framework


title: Claim to get my source code used GPL code

text: I'm running public web site based on Drupal. Drupal is GPL 2 or 3 licence. Of course I wrote custom code which interacts with Drupal code (modules). Can anybody write me an e-mail and ask for the source code of that my custom code? In other words, have I to publish that my code somewhere?


title: Processing csv files (alternative to business logic in DB)

text: We are working on a fulfillment system for an online book store. Everyday we receive tens of CSV files (about 90 files) with data about purchased orders.   **Example:**               OrderId    |    BookTitle    |    Quantity    |    Price    |    BuyerName    |    ...     1          |The hunger games |        1       |     10      |    John Doe     |    ...     1          | The Exorcist    |        2       |     25      |    John Doe     |    ...     2          |   Superman      |        1       |     5.5     |    Jane Nose    |    ...      **What we currently do:**   The data need to be translated to our domain to `Order` entity, `OrderItem` entity,...etc. We load the file into dummy tables then use very complex queries to populate the `Orders` table and `OrderItems` table. **Problem:**   All the business logic is in the database (in the queries) so unit testing them is a nightmare. In addition we were requested to change the database we are using (not exactly, but something terrifyingly similar) **What we tried:**   We are moving to a DDD approach where the domain model is the core of the application that holds all the logic and validation. We tried to parse the file line by line and create the respective entities and validate them accordingly then save them to the database.   This resulted in thousands of calls to the database and sometimes the server runs out of memory coz of the thousands of records (around 90 thousand record/file) in a single file. I know this domain is dead old and someone must have found a better way to handle such task. How do you process such huge files in your domain without suffering from performance? UPDATE   * We are using a MySql database with PHP and Apache.   * The CSV file is loaded into a dummy table using something similar to this:               load data local infile 'orders.csv' into table dummyOrders fields terminated by ','       enclosed by '"'       lines terminated by '\n'         (orderId, bookkTitle,Quantity, Price, BuyerName,...)


title: How to handle static-ish content from a CDN with authentication?

text: I have a website that allows user uploads of content. Part of the design, to date, involves storing the user content on a NAS that has been configured with a separate app pool in IIS that has scripting disabled, shorter lifespans, no cookies, etc for CDN-type behavior as a subdomain (static.domain.com vs. www.domain.com). I have complete control over this process and all the instances. The design decision behind this was to allow for cheaper storage of uploaded documents (instead of wwwroot or a DB) and help mitigate some security concerns by disallowing scripting. The concern I have now is that CDNs, and this setup, are by nature very permissive and do next to no checking or validation. Are there any _reasonably effective_ measures to discourage idle sharing of this user content? I know nothing will stop determined or malicious people, but I want to at least prevent this user content from being available at large to the general populous. All of the links to the content will be behind a paywall at the 'www' subdomain, but the content itself will be behind the 'static' subdomain. Ideas I had so far:   1. HTTP Referer checking    2. Obfuscated filenames (I know, I know...)    3. Cookie testing with URL rewrite? (IIS8)    4. ...    5. Ask stackexchange


title: xml serialization and deserialization complex situation

text: I'm considering passing xml back and forth for error messages but each error has different scenarios. one situation at hand is passing diffed text comparison while others are as simple as passing a text message. What kind of serialization/deserialization strategy could I use for such a scenario? The main issue with a scenario like this is that the object is different from case to case and there needs to be a mechanism for identifying what type it is. Serializing xml is pretty straight forward:   * http://stackoverflow.com/questions/11283040/deserialize-xml-string-to-complex-type   * http://stackoverflow.com/questions/1212742/xml-serialize-generic-list-of-serializable-objects Three sloppy ideas pop into my mind from the start:   1. Make some super class that contains every possibility of contained types.    2. Make some mechanism for reading the xml first to identify what's in it.    3. Use option 2 and convert the inner body xml to an object. A more elegant approach would be to implement some kind of Action pattern, where, once the object was identified you could create the proper action to take with it. Some ideas consist of the Action/Executor pattern or IoC:   * http://msdn.microsoft.com/en-us/library/cc984279.aspx   * http://msdn.microsoft.com/en-us/library/aa973811.aspx Here is an example pattern idea that runs parrallel to what I'm thinking:   * http://stackoverflow.com/questions/298976/is-there-a-better-alternative-than-this-to-switch-on-type Not for data persistence but for error handling by the client: The client decides how to handle the error once received based on the Action from a base library that takes place after deserialization. my considered xml format would be something like this: diff error:               <errorMessage>     The header is not correct               <diffErrorArray>     <diffItem message="NoChange">     <customMessage>Correct</customMessage>     <source>HeaderColumn1</source>     <destination>HeaderColumn1</destination>     </diffItem>          <diffItem message="Replace">     <customMessage>Changed</customMessage>     <source>HeaderColumn1</source>     <destination>Header_Column_1</destination>     </diffItem>          <diffItem message="AddDestination">     <customMessage>Unknown</customMessage>     <source></source>     <destination>Header_Column_1</destination>     </diffItem>          <diffItem message="DeleteSource">     <customMessage>Missing</customMessage>     <source>HeaderColumn2</source>     <destination></destination>     </diffItem>          </diffErrorArray>               </errorMessage>      string error:               <errorMessage>     Bad news          <stringErrorMessage>Something really bad happened.</stringErrorMessage>          </errorMessage>


title: Is it anti-pattern to mix unit test and web test?

text: It is a language agnostic question, e.g. I have a unit test like               # Unit test     User user = User.create('john');     assertEquals("User name is john", "john", user.getName());          # Web test start from here     goTo("/user/john");     assertTitleEquals("john");      Do you think it is an anti-pattern? Although I can write a full selenium test suites to do the same thing, but using the above code save much of my time (e.g. no more click('Login'); waitUntil etc, and I don't need to worry if my UI is changed at all, sound like it is a quick and more stable approach to test?


title: when to mock in unit testing

text: I am trying to write unit tests in javascript for an application made in nodejs. What I want to know is - Say there is a class Vehicles which is dependent on another class Roads.   1. Should I mock the Roads class and send it as a parameter to Vehicles for unit testing? OR Should I just create a new object and send it as a parameter to Vehicles?   2. If I change the Roads class I will have to change the mocking every where?   3. Should I use a factory to create mocked objects?


title: (Why) is it important that a unit test not test dependencies?

text: I understand the value of automated testing and use it wherever the problem is well-specified enough that I can come up with good test cases. I've noticed, though, that some people here and on StackOverflow emphasize testing **only** a unit, not its dependencies. Here I fail to see the benefit. Mocking/stubbing to avoid testing dependencies adds complexity to the tests. It adds artificial flexibility/decoupling requirements to your production code to support mocking. (I disagree with anyone who says this promotes good design. Writing extra code, introducing things like dependency injection frameworks, or otherwise adding complexity to your codebase to make things more flexible/pluggable/extensible/decoupled without a real use case is overengineering, not good design.) Secondly, testing dependencies means that critical low-level code that's used everywhere gets tested with inputs other than those that whoever wrote its tests explicitly thought of. I've found plenty of bugs in low-level functionality by running unit tests on high level functionality without mocking out the low-level functionality it depended on. Ideally these would have been found by the unit tests for the low-level functionality, but missed cases always happen. What's the other side to this? Is it really important that a unit test doesn't also test its dependencies? If so, why? Edit: I can understand the value of mocking _external dependencies_ like databases, networks, web services, etc. (Thanks to Anna Lear for motivating me to clarify this.) I was referring to _internal dependencies_ , i.e. other classes, static functions, etc. that don't have any direct external dependencies.


title: Does every ASP.NET Web Application has a Single Application Domain?

text: I am bit confused. Is there only one application domain for every single ASP.NET Web Application or there can be anywhere between 1 to 100 application domains present in a single application pool of a web application


title: How do you learn a language's standard framework/API/functionality?

text: I understand how to code. I know how to get around the basics of the languages I use regularly. I know how to write slightly-above-basic regular expressions, I can talk to databases, I can accept input, print output, handle files, etc. I'm more or less assured of my basic ability to spit out the source code for moderately complex program. My problem is that I never feel like it's enough. I feel like I only know a small portion of the standard library of my language, and that until I understand it all, at least in passing, I have no right to even try to get a job using it. I'm just out of (community/junior/whathaveyou) college, and my friends are getting jobs in the industry, but I still feel like a fake or a poser and that I'm just not good enough. Is there a decent marker for "I know enough" that I could use to assure myself that I can code? Should I take the fact that I'm at least capable of coding up a FizzBuzz as an indicator that it's alright to apply for things? How can I learn more of these standard libraries, frameworks, and/or APIs relatively easily? I code on a regular basis, I read books, but my knowledge still feels so shallow. HELP!


title: _variable - why that underscore at the beginning?

text: Sometimes I see people writing variable names like this: > int _variable; IMO That's really ugly. What's that about?


title: Most efficient way to store this collection of moduli and remainders?

text: I have a huge collection of different moduli and associated with each modulus a fairly large list of remainders. I want to store these values so that I can efficiently determine whether an integer is equivalent to any one of the remainders with respect to any of the moduli (it doesn't matter which, I just want a true/false return). I thought about storing these values as a linked-list of balanced binary trees, but I was wondering if there is a better way? **EDIT** Perhaps a little more detail would be helpful. As for the size of this structure, it will be holding about 10s of thousands of (prime-1) moduli and associated to each modulus will be a variable amount of remainders. Most moduli will only have one or two remainders associated to it, but a very rare few will have a couple hundred associated to it. This is part of a larger program which handles numbers with a couple thousand (decimal) digits. This program will benefit more from this table being as large as possible and being able to be searched quickly. Here's a small part of the dataset where the moduli are in parentheses and the remainders are comma separated:               (46) k = 20     (58) k = 15, 44         (70) k = 57             (102) k = 36, 87         (106) k = 66             (156) k = 20, 59, 98, 137          (190) k = 11, 30, 68, 87, 125, 144, 182      (430) k = 234     (520) k = 152, 282     (576) k = 2, 11, 20, 29, 38, 47, 56, 65, 74, ...(add 9 each time), 569      I had said that the moduli were prime, but I was wrong they are each one below a prime.


title: Track time spent on site

text: We are going to track user engagement (i.e. time spent on site, most viewed part/page of the system, etc). I don't see Google Analytics / MixPanel being able to do this, since we have to analyze based on factors only present in OUR backend (such as users who go to specific school, users who are a specific type, etc) - not the general stuff like Country, Gender, etc. I can think of a REALLY simple solution, but I am not sure if it is, serverwise, bad. You have a table that looks something like this:               CREATE TABLE `log` (       `id` int(11) unsigned NOT NULL AUTO_INCREMENT,       `uri` int(11) DEFAULT NULL,       `date` timestamp NULL DEFAULT CURRENT_TIMESTAMP,       `user` int(11) NOT NULL,       PRIMARY KEY (`id`)     ) ENGINE=InnoDB DEFAULT CHARSET=utf8;      And then whenever a page is loaded, a row is added to the "log" table, with current timestamp, the user id and the uri. Now I got the data I want, which is great. I can figure out when the user was last online and how many minutes people spend in average. BUT. Is this bad for the server? It is going to add a row each page load, which is a lot of rows, if you have 500 or 1000 active users. But will it matter? What are your thoughts?


title: Benefits of caching the count of items in a data structure versus on-demand calculation?

text: Given a data structure, I want to provide an API method `Size` which returns the number of items. I am vacillating between 2 approaches:   1. Maintain a count and increment/decrement it in response to Add/Delete calls respectively   2. Perform a traversal to calculate the count when `Size` is called. Approach #2 will take O(n) vs O(1) for approach #1. Other than performance, any other benefits of #1 over #2 ?


title: Generating PDF files using individual template components

text: **EDIT: Updated flow diagram to better explain the (likely unnecessary) complexity of what I'm doing.** * * * We at the company I work for are attempting to **create complex PDF files using Java iText** (the free version 2.1 line). The documents are **built piece-by-piece from individual "template" files** , which are added to the final document one after another using the `PdfStamper` class, as well as filled using AcroForms. ![Visual Example](http://i.stack.imgur.com/9pyck.png) The current design performs a loop which runs for each template that needs to be added in order (as well as the custom logic needed to fill each). In each iteration of the loop, it does the following:   1. Creates a `PdfReader` to open the template file   2. Creates a `PdfStamper` that reads from the `PdfReader` and writes to a "template buffer"   3. Fills AcroForm fields, as well as measures the height of the template by getting the location of an "end" `AcroField`.   4. Closes the `PdfReader` and `PdfStamper`   5. Creates a `PdfReader` to read a "working buffer" that stores the current final document in progress   6. Creates a `PdfStamper` that reads from the `PdfReader` and writes to a "storage buffer"   7. Closes the `PdfReader`, opens a new `PdfReader` to the "template buffer"   8. Imports the page from the "template buffer," adds it to the `ContentByte` of the `PdfStamper`   9. Closes the `PdfReader` and `PdfStamper`   10. Swaps the "storage buffer" with the "working buffer" in order to be ready to repeat. Here is a diagram visually explaining the above process, which is performed for each iteration of the "loop" that performs each template: ![Flow diagram](http://i.stack.imgur.com/FUSSn.png) However, as discovered through this Stack Overflow question (where example code can also be viewed) and the response by iText author Bruno Lowagie, this methodology of using the `PdfStamper` can cause significant issues. "Abusing" the `PdfStamper` by creating and closing the stamper too many times can cause corruptions in the resulting file that only effect some programs, generating a seemingly good document that may fail in certain contexts. **What is the alternative?** Mr. Lowagie's response suggests that there is a simpler or more direct way to use `PdfStamper`s, though I do not quite understand it myself yet. Could this be done using only a single stamper? Could it be done without using a rotating series of buffers?


title: Best practices / reasons for String constants in JavaScript

text: In static languages like Java/C#, I commonly make use of constants for strings or numbers, rather than insert them into the code alone. However, I tend to avoid this practice in JavaScript. More recently, as some other coders around me have taken this approach in JS, I decided I should probably solidify either my, or their, reasoning. There is no actual "const" declaration syntax in JavaScript. We usually just settle for an informal policy of not changing uppercase properties. But my opinion is usually to avoid them altogether, because most of their benefits are lost in JavaScript. In Java, a misspelt string will cause the program to fail when you try to run it, at which point you correct it and move on. Having a static checker where both instances are pointing to the same constant eliminates that problem, as it can be found at compile-time. But JavaScript will simply have that problem all over the place, as you're ALWAYS going to discover your spelling's correctness _at run-time_ :               Library = { doThing: function() }     setTimeout(function()       Liberry.doThing()       // No such object: Liberry     }, 0);      The best safeguard against this, usually, is "use strict". For developers that prefer it, I'm fine with them using that to find issues with undeclared variables more quickly. But my opinion has been that providing string constants for REST APIs, etc., doesn't actually safeguard you against anything. Another example:               CompanyAPI.constants.ENROLL_URL = "/rest/enroll";     CompanyAPI.constants.FIRST_NAME = "firstName";          ajax({url: CompanyAPI.constants.ENROLL_URL,     data: CompanyAPI.constants.FIRST_NAME     });     // vs.     ajax({url: "/rest/enroll",     data: "firstName"     });      ...You meant to write the above, but then made typos. Whoops.               ajax({url: CompanyAPI.constants.ENROL_URL,       data: CompanyAPI.constants.FIRS_NAME     });     // vs.     ajax({url: "/rest/enrol",       data: "firsName"     });      The constant-based one will still provide _undefined_ , while "firsName" is no better. To that end, I tend to just see this as a benefit of static languages, and not bother having a system to fix it (besides maybe starting to use "use strict" for debugging). Can some other people tell me what their preferred practice for string/integer constancy is? EDIT: To clarify, my preference is usually to put strings like "firstName" directly inline with no top-level constant declaration - the penalties for misspelling it are the same either way. Strings that might get long, like a REST URL, I'll tend to define at the top of the file.


title: Why should a builder be an inner class instead in it's own class file?

text: Many `Builder Pattern` examples make the `Builder` an inner class of the object it builds. This makes some sense since it indicates what the `Builder` builds. However, in static a static type language we know what the `Builder` builds. On the other hand if the `Builder` is an inner class, you _should_ know what class the `Builder` builds without looking inside of the `Builder`. Also, having the builder as an inner class reduces the number of imports since it can be referenced by the outer class--if you care about that. And then there are practical examples where the `Builder` is in the same package, but not an inner class, like `StringBuilder`. You know that the `Builder` _should_ build a `String` because it is named so. That being said, the only good reason I can think of for making a `Builder` an inner class is that you know what the class' `Builder` is without knowing it's name or relying on naming conventions. For example, if `StringBuilder` was an inner class of String I probably would have known it existed sooner than I did (speculative). Are there any other reasons to make the `Builder` an inner class or does it just come down to preference and ritual?


title: Simple avenues for dynamically building Windows executables

text: I'm trying to build a Firefox add-on which lets you create executable files which can be associated with a default program or added to the "Open With" list and possess its own icon. I was hoping to avoid having the add-on compile files into exes, but...   1. It does not seem batch files can have their own icons.   2. Although one can pass batch instructions to cmd.exe via shortcut (and shortcuts can have their own icons) and a shortcut can even accept arguments (as in dropping files onto it), one apparently cannot add shortcuts to the "Open with" menu (the Open With dialog treats the shortcut as equivalent to the referenced executable, in this case, .exe, and without the extra parameters). So, I'd like to know what other approaches might be available to me for building executables (or something that really functions like an executable) in a simple and transparent manner? I am leaning toward packaging an open- source batch-to-exe converter like http://sourceforge.net/projects/bat2exe/ (though I'd really hope to find one which itself can be controlled via command line) so I can build a batch file programmatically and then turn it into a full-blown executable with icon. **UPDATE** The primary reason I want to do this is for the sake of https://github.com/brettz9/webappfind . WebAppFind lets you open desktop files (while you are on your desktop) into web applications and currently comes with pre-built executables which can be associated with a given file extension (to work with Open With or as a default handler). These executables will be used to call Firefox (and my add-on, WebAppFind) with certain flags that allow WebAppFind to open the file in a web app (as determined by other factors like a filetypes.json file in the same directory as the file or a previously registered protocol handler correlated to the file extension, as explained at the repo). However, what I cannot pre-build into the executable are all possible configuration directive combinations a user might wish to supply to the add-on or, more importantly, the specific Firefox profile in which they wish the app (with desktop file) to load. The ability to open a web app in any profile can allow for web apps to work more like executables--they get their own icon in the task bar, they don't have to force the user to load a bunch of tabs or add-ons if, e.g., they just want to have open in a separate process their local HTML file in a JavaScript-based WYSIWYG HTML editor or their SVG file in an SVG-edit web app (And I also don't want users to have to go through the trouble of associating an icon with the exe manually.)


title: What is the difference between requirements Elicitation and Requirements Analysis in the real world?

text: My question aim to draw a fine line between Requirements Elicitation and Requirements Analysis. What is the difference between these two?


title: How to reconcile my support of open-source software and need to feed and house myself?

text: I have a bit of a dilemma and wanted to get some other developers' opinions on it and maybe some guidance. So I have created a 2D game for Android from the ground up, learning and re factoring as I went along. I did it for the experience, and have been proud of the results. I released it for free as ad supported with AdMob not really expecting much out of it, but curious to see what would happen. Its been a few of months now since release, and it has become very popular (>250k downloads!). Additionally, the ad revenue is great and is driving me to make more good games and even allowing me to work less so that I can focus on my own works. When I originally began working on the game, I was pretty new to concurrency and completely new to Android (had Java experience though). The standard advice I got for starting an Android game was to look at the sample games from Google (Snake, Lunar Lander, ...) so I did. In my opinion, these Android sample games from Google are decent to see in general what your code should look like, but not actually all that great to follow. This is because some of their features don't work (saving game state), the concurrency is both unexplained and cumbersome (there is no real separation between the game thread and the UI thread since they sync lock each other out all the time and the UI thread runs game thread code). This made it difficult for me as a newbie to concurrency to understand how it was organized and what was really running what code. **Here is my dilemma:** After spending this past few months slowly improving my code, I feel that it could be very beneficial to developers who are in the same position that I was in when I started. (Since it is not a complex game, but clearly coded in my opinion.) I want to open up the source so that others can learn from it but don't want to lose my ad revenue stream, which, if I did open the source, I fear I would when people released versions with the ad stripped, or minor tweaks that would fragment my audience, etc. I am a CS undergrad major in college and this money is giving me the freedom to work less at summer job, thus giving me the time and will to work on more of my own projects and improving my own skills while still paying the bills. So what do I do? Open the source at personal sacrifice for the greater good, or keep it closed and be a sort of hypocritical supporter of open source?


title: Which Provides a better Foundation Java or .Net (C#, ASP.NET)?

text: I am not asking this question to start arguments (people often consider Java and .Net as religions) but which provides a better foundation and helps to gain real programming skills (of Computer Science and Web Development), I have worked with ASP.NET and C# but most of my time spends on Dragging and Dropping i am a C++ programmer and Drag and Drop irritates me.I haven't tried Java so i want to ask is Java also like .Net family (Drag and Drop)?


title: What alternative is better to diagram this scenario?

text: I was creating and discussing a class diagram with a partner of mine. To simplify things, I've modify the real domain we're working on and made up the following diagram: ![one](http://i.stack.imgur.com/8Q7WX.png) Basically, a company works on constructions that are quite different one from each other but are still constructions. Note I've added one field for each class but there should be many more. Now, I thought this was the way to go but my partner told me that if in the future new construction classes appear we would have to modify the Company class, which is correct. So the new proposed class diagram would be this: ![two](http://i.stack.imgur.com/C2cCj.png) Now I've been wondering:   1. Should the fact that in no place of the application will there be mixed lists of planes and bridges affect the design in any way?   2. When we have to list only planes for a company, how are we supposed to distinguish them from the other elements in the list without checking for their class names?   3. Related to the previous question, is it correct to assume that this type of diagram should be high-level and this is something it shouldn't matter at this stage but rather be thought and decided at implementation time? Any comment will be appreciated.


title: Are "conditional" caching policies ever actually useful?

text: I'm designing an abstraction over ASP.Net's built in caching to make it not so horrible to use. One design decision I'm having to look at is if I should restrict people to using just one cache policy on each item. For example, say you're caching the HTML generated by your blog post or some such. Would you ever want to cache it sometimes for 30 minutes and sometimes for 2 hours? Note: this isn't cache invalidation. These are the policies available:   * Priority   * Absolute expiration   * Sliding expiration (where each access bumps the expiration by this much) Are there any use cases where someone would want to add an item to the cache with one set of policies and in another portion of the web application use a different set of policies when it gets added(but of course, if it already exists keep with the old policy)? Are there any real world uses to allowing this?


title: Why might I switch from ASP MVC to Node/Express?

text: So I've been wanting to try Node and Express. Not to mention Jade and Stylus. Webstorm has in my opinion an amazing user experience and I want to use it and these technologies. Here is where I get hung up though. ASP has some nice built in features that don't seem to exist in this other world. I will pick on authentication. Authentication can be a pretty complex in depth thing. Frankly it is nice to have something built in, tested, and robust for something so critical to some applications. Or if Authentication is too petty. How about compiled code? Why would I WANT to use JavaScript on the server side if I know c#. Isn't type safety a nice to have? What am I missing? these technologies are popular for a reason but I just don't see the draw? I would like to though.


title: Is refactoring for the purpose of unit testing a code smell?

text: Let me preface this question by saying that I get the need for unit testing. I painfully get it. You have to do it to ensure that future modifications don't adversely affect the application in ways you did not expect. It's also good practice to utilize a test driven methodology to ensure your current modifications work as expected while providing a solid testing base for adding edge cases (bugs) later. I also understand that testing is a requirement for any company that will, or plans to be, subject to an IT audit. And finally, I get that if your code is testable, it is probably written using solid design principles. The quandary that I have is that coding to an interface for the purpose of supporting unit testing alone, seems like a contrived complexity. Take the case where you have a database application that does not have the requirement to be database agnostic. You've already coded a DAL that communicates with that database and BL that uses that DAL for persistence. Integration tests are in place with the current architecture that utilize a development database for test data. To support 100% code coverage on unit tests you would now need to introduce interfaces for both the DAL and the BL, have concrete implementations of those interfaces, and use dependency or constructor injection to utilize those interfaces based on the context of the runtime. Does that not introduce a contrived complexity? A side question I guess is where is the line drawn between unit and integration testing in these cases? It's certainly feasible that the data model can change and you'd want integration testing in addition to unit testing because it's clear that unit testing will succeed where integration testing can fail in that case.


title: Visitor pattern

text: I was recently given the following task, and failed, the reason given that I misunderstood the question               Create a 'LibraryItem' interface.     Create 3 concrete implementations of LibraryItem: 'Book', 'CD', 'DVD'.     Apply the visitor pattern to your data model.     Write a MaximumBorrowTimeVisitor that computes the maximum time you can borrow a LibraryItem.     Create an arbitrary instance of a data model and apply the MaximumBorrowTimeVisitor.      I thought this was simple, and yet I failed the task. How would you solve this task?


title: Is it a good practice to have a remote branch for each developer?

text: Is it considered a good practice to have a remote branch for each individual developer in the project? We're using Git with the following branches:   * master   * release   * develop If each developer had their own branch, they could push code into their branches and others could merge these changes into their own branches.


title: Do any LOP languages exist?

text: I have read a few of the articles related to the **Language Oriented Programming** paradigm. Therefore, I concluded that LOP paradigm can let programmers be more productive because of it's extensibility. Are there any programming languages that are already implemented LOP or in development status?


title: Approach to coding algorithms to minimize rework

text: I find myself reworking my code quite a bit, especially when learning to write algorithms that involve keeping track of multiple attributes and labels. I feel that having the pseudo-code written up, having a small numerical example worked out, and a few test cases is usually a good approach. Yet, I find myself making mistakes and reworking code constantly. Is there a better approach or a structured methodology that I should follow? Greatly appreciate the advice.


title: Is it possible to write software that doesn't need to be continually modified?

text: I have written a lot of software in many different languages, and I've also "written" hardware for use with FPGAs using Verilog and VHDL. I tend to enjoy writing hardware more than software, and I think one of the primary reasons is that it is possible to write hardware that is "done" and never needs to be modified: you define the interfaces and the functionality, write a test bench, implement the hardware module, then test the heck out of it using a simulator. Then you can rely on that hardware module as a building block to create something bigger and better: if you need to add a feature to that module, you create a second module and add the functionality there. You never throw away the original module since it is working just fine and can still be useful. One of my main frustrations with software is that it is never "done". There is always another feature to add. Often when adding a feature it introduces a bug somewhere else that was working just fine before. This doesn't happen in hardware as long as the interfaces are not violated. To be clear, I'm not advocating building one version of something with a list of features and that's it forever: I'm in favor of iterations and multiple releases over time to add new features. I just don't want to poke the code on the left and find a bug on the right, and this seems to happen after adding a new feature. Is it possible to write software in a similar way in which hardware is "written"? Is there a good software development methodology that allows forward progress to always be made and allows new functionality to be added without needing to rewrite existing code and introduce new bugs?


title: What are some possible accreditations I could get over 4 months toward being a software developer?

text: We have a family business and I need to be in India, Delhi for 4 months as a part of a business trip. I won't be doing much all day. I already have a degree in economics, but I also love software. Over the years I have taken different courses. I even took a degree in software engineering, completed the first 2 years but then I left for family reasons. It did not affect me as I already had a degree and also the family business. Now I am thinking what are some of the things I can do in the 4 months that I will be there. Programming lessons is one of them, in some of the languages that I am not familiar with, but what else? Are there any certifications I can get?


title: When writing a library, how much should the end user do?

text: First off, this question goes beyond my example (don't want this to be too localized or migrated to Stack Overflow) but I've come across this when thinking about something I wanted to try in C so I thought I'd use that as an example. So my idea is to create a generic linked list in C and started it last night and it is coming along pretty well for being new in C. The issue I ran into is type casting and it leads me to this question: how much work should a library designer expect the end user to do when using the library? If you take my example, right now, I don't perform any casts and return an Object (which is a typedef of void*). Is it reasonable to make sure that the end user keeps track of their types or should the library designer make sure that the list is type safe (I think I have a general idea on how to implement that for at least the built in data types)? Is it reasonable, when designing a library to expect a certain amount of work on the end users part to use the library or should it be dumbed down as much as possible? Are there factors that would affect this decision, such as language?


title: What are the features required for Object Orientation?

text: I am just wondering, what exactly are the features a language or a library must provide in order for it to be defined as 'Object Oriented'. Is Object Orientation something that can, more or less, be achieved in **any** general- purpose programming language with decent features? Or is it something that can only be achieved in languages that specifically advertise that they support Object Oriented Programming? For example, look at the following C code:               SDL_Surface* screen = SDL_SetVideoMode( 640, 480, 16, SDL_HWSURFACE);     SDL_FreeSurface( screen );      or the code discussed here. Now the above code does not use inheritance , runtime-polymorphism ( ? ) , virtual functions etc. But it seems pretty much OOP to me. Is Object-Orientation simply writing code which is based on creatable and destructable data structures such as objects, classes, structs etc. which does not require on any special pattern or features provided by the Programming Language or a library ?


title: What is an efficient way to retrieve product counts at multiple levels of a hierarchy?

text: I'm working on an e-business website to sell books and also want to display the number of available books in the category list. The category list contains the genre and the format (pocket, ebook, audiobook etc). In each element in genre and format I would like to display the number of available products from the stock list. Of course, when you go deeper into the hierarchy, you retrieve more specific information of available books at that level. For instance there are 2000 available books in the "medicine" genre and if I select the "pocket" format then there are 200 available books left. In other words, you have combined "pocket" and "medicine" and you know now that there are 200 available pocket books in total in the "medicine" genre. My question is: How do you create that functionality without making lots of effort to ask the database about the amount of available products in each element? Do you need to buy a special application or plugin? Please remember that there are millions of books in the database. ![enter image description here](http://i.stack.imgur.com/MJ4eh.png)


title: How to determine number of resources to be allocated in a software project?

text: Last day I have been interviewed and the interviewer asked me as given the outline of a project, how can we determine the number of resources to be needed for the same? I don't know to do so. Is there any standard way of doing so? or is it based on the experience? Or how? I am pretty new in this activity and my knowledge is zero at present .... so any clear explanation with some example(simple) will help me(and people like me) to understand this.


title: Cloud differential backup

text: I am responsible for the design and development of a cloud backup application. Currently we are using xDelta to do differential backup so that only the changed parts of the files gets uploaded. This cuts cost for both us the company and the user. One issue we are having with this approach is that in order to do a differential backup the modified file needs to be compared to the original file. To solve this we opted for a quick solution and that is to cache the original files on the users' computer for a quick reference. Now this solution works brilliantly for desktop/home users where the file sizes are relatively small. The problem arise when say a server administrator tries to backup an sql database for example that is 100GB in size. Though currently we cache the file on disk, this is definitely not appreciated by server administrators since we are filling their drives with cached files. I am wondering if there is any other approach to do differential backups without the need of having the original files on disk permanently.


title: Top bad practices in MySQL

text: There was another post allowing people to post their top bad practices in PHP, I had a gripe about MySQL practices and thought it'd be an interesting topic to hear the top bad practices in MySQL. Up vote the ones you agree with


title: What are the standard directory layouts for source code?

text: I'm in the process of proposing a new standard directory layout that will be used across all the projects in our organization. Projects can have compiled source code, setup scripts, build scripts, third-party libraries, database scripts, resources, web services, web sites, etc. This is partly inspired by discovering Maven's standard layout. Are there any other standard layouts that are generally accepted in the industry?


title: What (free) on-line conferences or video sites about tech stuff do you know?

text: Instead of TV, I prefer to watch (free) on-line conferences or videos. As a software developer, my favorites are:   * InfoQ   * MSDN Channel 9   * Google TechTalks   * LinkedIn TechTalks   * TED   * Business Of Software blog (I like entrepreneurship too) Maybe I'm losing other valuable sources (about software and startups) of these kind of content. So, can you suggest other specialized sites like these?


title: Does it make sense to use a personal Amazon Cloud Drive to host an SVN repository?

text: I have 5GB of free storage on Amazon's Cloud Drive service that I'm not using, so I'm wondering: is it possible to create an SVN repository and be able to commit/update through TortoiseSVN? I have an account at Assembla.com and use it for all my personal/school projects and love it, but Assembla has a 2GB limit.


title: Hibernate set up for beginner

text: I am learning Hibernate (OR Mapping). I am using Maven for project management. However, I am currently reading a Hibernate book by O'Reilly, and they use ANT for their example. So my question is are there any difference between setting up hibernate with ANT and Maven? Thanks in advance!


title: typedefs and #defines

text: We all have definitely used `typedef`s and `#define`s one time or the other. Today while working with them, I started pondering on a thing. Consider the below 2 situations to use `int` data type with another name:               typedef int MYINTEGER      and               #define MYINTEGER int      Like above situation, we can, in many situations, very well accomplish a thing using #define, and also do the same using typedef, although the ways in which we do the same may be quite different. #define can also perform MACRO actions which a typedef cannot. Although the basic reason for using them is the different, how different is their working? When should one be preferred over the other when both can be used? Also, is one guaranteed to be faster than the other in which situations? (e.g. #define is preprocessor directive, so everything is done way earlier than at compiling or runtime).


title: How should repetitive calendar tasks be stored in the database?

text: This is for a small personal project for micro-management. Basically, I store tasks in a SQLite3 database that looks like this:                   id INTEGER PRIMARY KEY AUTOINCREMENT         label TEXT         deadline INTEGER      So each task has a due date (deadline) that is stored as a Unix Time Stamp. So far so good, I can do entries such as "tomorrow: visit grandma" and a new row gets created with "visit grandma" as the label and _tomorrow_ transformed as Unix time for deadline. Now I would like to enter new type of tasks: routines - tasks repeated on a time pattern, like "everyday: clean kitchen". How can such tasks be stored or modeled? For the moment, I am thinking that, in the case of a task that needs to be done everyday, to generate new rows in my table that would have the same label, and the deadline field incremented by one day. In this case, I need to fix a limit in the future. For example, if I create a routine for every day, it creates a new row for everyday of the remaining year. Is there a simpler way to do this? Am I missing some obvious database design principles?


title: What techniques should I keep in mind in order to design efficient algorithms in PHP?

text: I am trying to solve programming challenges on www.interviewstreet.com using PHP. Are there certain techniques I should keep in mind that will optimize the efficiency of the algorithm? For example, I read that using PHP's language constructs versus function calls are faster. Is this true? Any other tips?


title: Delegates and events

text: What is the difference between               public delegate void SecondChangedHandler(Object clock, TimeInfoEventArgs ti);     public event SecondChangedHandler OnSecondChanged;      and               public event EventHandler<TimeInfoEventArgs> OnSecondChanged;      When should you use which and is there any best practice?


title: Calculating 3d rotation around random axis

text: This is actually a solved problem, but I want to understand why my original method didn't work (hoping someone with more knowledge can explain). (Keep in mind, I've not very experienced in 3d programming, having only played with the very basic for a little bit...nor do I have a lot of mathematical experience in this area). I wanted to animate a point rotating around another point at a random axis, say a 45 degrees along the y axis (think of an electron around a nucleus). I know how to rotate using the transform matrix along the X, Y and Z axis, but not an arbitrary (45 degree) axis. Eventually after some research I found a suggestion: Rotate the point by -45 degrees around the Z so that it is aligned. Then rotate by some increment along the Y axis, then rotate it back +45 degrees for every frame tick. While this certainly worked, I felt that it seemed to be more work then needed (too many method calls, math, etc) and would probably be pretty slow at runtime with many points to deal with. I thought maybe it was possible to combine all the rotation matrixes involve into 1 rotation matrix and use that as a single operation. Something like:                [ cos(-45)    -sin(-45)         0]      [ sin(-45)     cos(-45)         0]      rotate by -45 along Z       [    0            0             1]      multiply by                [ cos(2)          0       -sin(2)]      [    0            1            0 ]      rotate by 2 degrees (my increment) along Y      [ sin(2)          0        cos(2)]      then multiply that result by (in that order)                [ cos(45)      -sin(45)         0]      [ sin(45)       cos(45)         0]      rotate by 45 along Z       [    0            0             1]      I get 1 mess of a matrix of numbers (since I was working with unknowns and 2 angles), but I felt like it should work. It did not and I found a solution on wiki using a different matirx, but that is something else. I'm not sure if maybe I made an error in multiplying, but my question is: this is actually a viable way to solve the problem, to take all the separate transformations, combine them via multiplying, then use that or not?


title: Can I use a project code which has New BSD license but uses a GPL license library?

text: I want to use the ICSOpenVpn project source code in my commercial application. If we see the ICSOpenVpn project, it states that its license is New BSD but the libopenvpn.so library it uses is under GNU GPLv2 license. As per FAQ for version 2 of GNU GPL "If a library is released under the GPL (not the LGPL), does that mean that any program which uses it has to be under the GPL?" The answer says: "Yes, because the program as it is actually run includes the library." Also, how could ICSOpenVpn change the license to New BSD?


title: Open source licensing of derived works

text: I derived an open-sourced work, Service-Nucleus, based on Netflix's Karyon (Apache License) and Google's AngularJS (MIT License). I want to make sure proper licensing and copyrights are in place, and I am not sure how to honor those projects and move forward legitimately at the same time. I've researched this to some length and it's a soupy mess out there. Any advice would be greatly appreciated. I currently provide the Apache License from NetFlix at the root.


title: Overwhelmed at Internship

text: My best friend just started his internship a month ago. The problem is he is discouraged. He was a good A+ student at school, and he is feeling that he doesn't know anything at all. The issues he is working on, although they are on languages he feels comfortable in, seem so alien to him, he said. He's getting really discouraged, like he does not know the code base at all. I keep trying to tell him that it will just take time and that he is expected to have lots of questions. What should I tell him?


title: Run a function when a function in a list is executed?

text: **Goal** : I'm currently doing an MVC project and I have this method to update the ViewBag (based on previous actions of the user). I would like to call this function whenever a certain list of MVC Actions are called (most of them). **Questions** :   1. Would an observer pattern fit my problem? (I'm reading about them at the moment, starting to sound like it would).   2. If so, would it be overkill for something so simple or would it be in good practice?   3. Am I looking in the right direction or is their a better way to reach my goal? The user has an "ActiveEntity" in the session once they select one and I need to display the entity's name, date, etc. when most pages are loaded (as part of the header information). The catch is that I'm using other data for the model as I have a large hierarchy of data to display (parts/levels at a time) and the ViewBag is an acceptable location to store the data that acts similar to header-information(I think?). Is my approach correct? Might someone be able to point me in a good direction?


title: When using "Github Flow", what if my next feature depends on code from a pending Pull Request?

text: We are experimenting with "Github Flow", as defined here. In short, every change starts off as a well-named branch off of master. When it's done, you open a PR for that branch, it gets reviewed, and then gets merged into master. It's a very simple workflow. However, we have run into this a couple of times: I develop feature X, and open a PR for it. While I'm waiting for the PR for X to be reviewed, I want to start work on another feature Y, but I need the code from PR X. Should I just start a branch from the feature X branch, or if I've already started feature Y, just merge feature X into the feature Y branch? It seems so, but I wanted to check with other teams that are following this model to see how they handled multiple PRs and features that are dependent upon each other.


title: SVN - Is it OK to use any flavor of SVN amongst the team?

text: Is it OK if, within a team, developers use different flavors of SVN? Say one using Tortoise SVN and other using Versionsapp.com SVN?


title: Windows Azure vs GAE vs AWS - for process based application

text: I am writing an application that will crawl web pages and analyze data, and I'm wondering if I can host this as a cloud-based service. The main reason I'm looking at cloud hosting is that users may process thousands of pages at once, and I need to return data as quickly as possible. The user will have software installed on their computer that will communicate with this application. If, for example, each page takes 10 seconds to process, is it possible to set up auto scaling so that a user can process 1, 10 or 10,000 pages in the same amount of time (ie: 10 seconds) by simply adding and removing instances as needed? Note: Each process requires little RAM/CPU resources, so it will be possible to process multiple pages in a single instance but for this example, I'll simplified it to 1 instance per process. If so, which cloud-based service is best suited for this task?


title: Does not documenting code result in job security?

text: > **Possible Duplicate:**   >  Should you write good documentation and clean code to increase the "Bus > Factor"? I often ask young programmers why they are not documenting their code. Their responses, perhaps jokingly, frequently include "job security." I hear this from experienced professionals, too. And not just in programming; network engineers and system administrators widely subscribe to this belief. Can you really ensure job security by holding the details of your work in your head rather than on paper (or in files)? What's your experience?


title: Initialization of objects in a system using dependency injection

text: This is a follow up question to the following post: Injecting dependencies (DI) in c++ applications In a system that uses DI, someone, somewhere should be responsible to create the various objects and "wire" them. I find it difficult to figure out who should do this. I read about one option that it should be the "root class". However, in that case it seems that the root class might be responsible for creating a very large number of objects. I though of an option to use smaller builder classes that will be used the root class - is that a good way to do it? Note: I tagged 'C++' in this question because I am developing in C++. I am not sure if it makes any difference to the answer.


title: Pattern to safely establish a one to one bidirectional relationship

text: Let suppose we have 2 classes, `Pilot` and `Plane`, being in an optional one- to-one relationship. So a `Plane` might have a pilot when it's flying, but when it's standing in its hangar, it has none. Similar for the `Pilot`. It would be just logical to hold a pointer to the `Plane` in the `Pilot` and a pointer to the `Pilot` in the `Plane`, accessible via getters and setters. Constructing the setters so that a call on any of them establishes the bidirectional relationship is surprisingly hard. I was even more surprised that I couldn't find a suitable solution on the web as this construct seems to be common to me. Does anyone know of concepts that would encapsulate such a relationship inside a class? Or an idiom to stick with normal getters/setters and still establish the relationship with one setPilot/setPlane call?


title: Which past version of Netbeans IDE that has lightness almost equal or better than Eclipse Indigo?

text: Currently, I'm a long Eclipse user because my past and current companies always deal with eclipse. Recently I met some example java codes created using netbeans. I downloaded and tried Netbeans 7.x and 6.9.x, but they're more heavier and eating memory resources than Eclipse Indigo. So anyone know which past version of Netbeans IDE that has lightness almost equal to or better than Eclipse Indigo (3.7) but can support Java SDK v1.6?


title: Restrict access to backend

text: This might be one of those "not answerable" or "just opinions"-questions but I thought I'd give it a shot. I'm developing an app with health care information with a friend who's a doctor. The basics of app are done and the information in the database is shaping up so now I've come to the question of wether, and if so how, I should restrict access to that information to just my app. The question of if is one I can answer, but any opinions are welcome. The question of how is where I need your help. The app is written in Java on Android and the backend in Django, what ways do you see for restricting access to the backend so that other scripts/apps can't access it? One idea I had was for the phone to request an api key on first start and bind it to the IMIE number which I think is unique for each phone, then keep track of those tuples on the server. We(as in I) will likely port this to iOS at some stage, so it needs to be fairly cross-platform, I thought about binding to google accounts instead of IMIE number before.


title: Is Linq having a mind-numbing effect on .NET programmers?

text: A lot of us started seeing this phenomenon with jQuery about a year ago when people started asking how to do absolutely insane things like retrieve the query string with jQuery. The difference between the _library_ (jQuery) and the _language_ (JavaScript) is apparently lost on many programmers, and results in a lot of inappropriate, convoluted code being written where it is not necessary. Maybe it's just my imagination, but I swear I'm starting to see an uptick in the number of questions where people are asking to do similarly insane things with Linq, like find ranges in a sorted array. I can't get over how thoroughly inappropriate the Linq extensions are for solving that problem, but more importantly the fact that the author just _assumed that the ideal solution would involve Linq_ without actually _thinking_ about it (as far as I can tell). It seems that we are repeating history, breeding a new generation of .NET programmers who can't tell the difference between the language (C#/VB.NET) and the library (Linq). What is responsible for this phenomenon? Is it just hype? Magpie tendencies? Has Linq picked up a reputation as a form of magic, where instead of actually writing code you just have to utter the right incantation? I'm hardly satisfied with those explanations but I can't really think of anything else. More importantly, is it really a problem, and if so, what's the best way to help enlighten these people?


title: Can I remove a company's logo from a software licensed under Mozilla Public License Version 1.1?

text: I have tried looking for an answer to this question, but I couldn't find anything related. To put it in a nutshell, I want to fork the existing Komodo Edit project, which is licensed under MPL Version 1.1, and create a new derived project/software. I would like to remove certain features from the current project, including ActiveState's logo, but I do not understand the technical jargon on the license. Also, I plan to keep the derived project completely free and open-source. I'd be really grateful, if someone could explain it to me. Here is the link to the license : https://github.com/Komodo/KomodoEdit/blob/trunk/LICENSE.txt


title: Handling Indirection and keeping layers of method calls, objects, and even xml files straight

text: How do you keep everything straight as you trace deeply into a piece of software through multiple method calls, object constructors, object factories, and even spring wiring. I find that 4 or 5 method calls are easy to keep in my head, but once you are going to 8 or 9 calls deep it gets hard to keep track of everything. Are there strategies for keeping everything straight? In particular, I might be looking for how to do task x, but then as I trace down (or up) I lose track of that goal, or I find multiple layers need changes, but then I lose track of which changes as I trace all the way down. Or I have tentative plans that I find out are not valid but then during the tracing I forget that the plan is invalid and try to consider the same plan all over again killing time.... Is there software that might be able to help out? grep and even eclipse can help me to do the actual tracing from a call to the definition but I'm more worried about keeping track of everything including the de-facto plan for what has to change (which might vary as you go down/up and realize the prior plan was poor). In the past I have dealt with a few big methods that you trace and pretty much can figure out what is going on within a few calls. But now there are dozens of really tiny methods, many just a single call to another method/constructor and it is hard to keep track of them all.


title: What should I learn after Python?

text: I am 12 years old and have mastered the basics of Python with Learn Python The Hard Way by Zed Shaw (I think) and it has done me well. What should I do next? Do you have any recommended books or good website tutorials? What do you need to know before learning C?


title: Benefits of using object document mapping (ODM)

text: I am creating a web app on Flask and was planning to use mongodb. Most of the examples using this stack that I've come across have used an ODM of some kind and was wanting to figure out whether or not I should as well. I have worked with ORM for a Java web app before and found its utility to be limited and apart from preferring just using JDBC and writing the sql myself, we came across a few instances where our own hand written queries increased performance noticeably. I realize that the NoSQL db is a different beast, so I was just wondering if there are many parallels between ORM and ODM and the issues I observed with ORM. Might there be performance hits in some instances using an ODM with mongodb? Is the only benefit ease of use/natural translation between code and db objects? I have no quarms about Essentially, I am wanting to know if I am missing out on too much by just using plain old `pymongo` in the flask application rather than an ODM? PS. If it is important, I expect my application to be high volume but balanced read/right in nature.


title: MIT and copyright

text: I am contributing to a library that is licensed under the MIT license. In the license and in each class file it has a comment at the top saying: > Copyright (c) 2011 Joe Bloggs <joe.bloggs@example.com> I assume that he owns the copyright to the file, and can change the license of that file as he sees fit. If I contribute to the library with a new class entirely write by me, can I claim copyright of that file. And put: > Copyright (c) 2011 Petah Piper <petah.piper@example.com> at the top?


title: Splitting and hiding headers in a static library

text: I am writing a static library for C/C++ (personal project). As my headers became rather large, I thought that splitting my headers would be a good idea. Right now a header looks like this:   * **MainClass.hpp** :     * namespace impl: implementation details enclosed in a namespace `impl`     * forward declarations of classes declared below (when needed)          * `MainClass` declaration     * `MainClass` free functions declarations     * `MainClass` specialization declaration     * `MainClass` specialization free function declarations     * `AuxiliaryClass1` declaration     * `AuxiliaryClass1` free functions declarations     * …     * `AuxiliaryClassN` declaration     * `AuxiliaryClassN` free functions declarations          * `MainClass` definition     * `MainClass` free functions definitions     * `MainClass` specialization definition     * `MainClass` specialization free function definition     * `AuxiliaryClass1` definition     * `AuxiliaryClass1` free functions definitions     * …     * `AuxiliaryClassN` definition     * `AuxiliaryClassN` free functions definitions Where:   * `AuxiliaryClassK` is a class logically or structurally related to `MainClass` (e.g. an iterator for `MainClass`, a nested class within `MainClass`, a derived class of `MainClass` etc.)   * `ClassX` free functions as recommended in How Non-Member Functions Improve Encapsulation and Monoliths "Unstrung"   * definitions are in header because they are templates. This is becoming very crowded and difficult for me to navigate so I thought that splitting across multiple headers would help. However I do not know how to do it right. Here is how I think the structure could look like:   * **MainClass.hpp** :     * forward declarations (when needed)     * small classes/structs definitions & declarations     * `#include` the other headers   * **_Class.hpp** :     * `_Class` declaration     * `_Class` free functions declarations   * **_Class.inl** :      * `_Class` definition     * `_Class` free functions definitions With a `_Class` for each: `MainClass`, `MainClass` specialization, `AuxiliaryClassK`. My questions are:   * Is it reasonable to want to split a header (all are functionalities of `MainClass`) (I have headers over 1000 lines long and I foresee even longer ones) or should I leave it as it is?   * Is the above split scheme ok? Should I further split a class and the free functions related to that class? Are there other solutions to make the code more maintainable?   * How to hide the other headers (not in a sense of obfuscating / making the code unavailable, but avoid exposing the headers the users see (e.g. in a GUI with autocomplete)? They should include and be aware only of `MainClass.hpp`. Seeing other headers without being clear that they are behind–the–scenes headers will produce unnecessary confusion. One idea is to add a prefix like an `_` (underscore) or to put them in a `impl` folder. (Again, this is not about hiding classes (I do that with a namespace), but to hide the split behind a header they should use).


title: Java Singleton fields implementation

text: I have singleton in Java and I have realized, that I could make its fields static and it would work same way as regular instance fields. Would there be a performance / optimization difference? If so, what would turned out better? Is there a preferred way to implement singleton fields? (again, I am talking fields, not methods)


title: Resources for understanding a programming language and its specifications and grammar deeply

text: I'm a computer engineer and all the courses we have had about programming and computer languages were an introduction to C/Java and OOP. Now I feel like reading Java language specification to learn a deep understanding on Java language but I understand that there are something like grammar description in the specifications which I have no idea about. What should I study to be able to understand a programming language deeply(Especially specification elements such as grammar)? Have I missed some computer science courses? or I should understand all intuitively? I was pondering about reading some books about compilers but I thought it'd be better asking it from the experts!


title: How to name arrays or list when the nouns are both singular and plural?

text: Generally variables are named in the singular `Car car;` and arrays and list with the pluras: `List<Car> cars;` or `Car[] cars;` But what about nouns like `fish` or `media`* that are already plural? *already lost the battle to have the class called `Medium`.