title: Javascript and SQL Lite (multi browser offline SQL/database query)

text: I'm in the elections division of my county and am trying to simplify a voter lookup method for our poll judges during election time. Currently we are using a clunky heavy application that the judges must install, and we only support Windows. My goal is to have an offline (client-side) browser based solution that will work on any browser for any operating system. I think, based on research that I've done through google searches and w3 forums, that I should be using JavaScript + SQL Lite. I have read that HTML5 has a good solution, but please keep in mind that election judges are typically elderly and don't upkeep their updates, or deviate from the preinstalled browser (typically IE), so HTML5 is not a plausible solution for our needs. I've done a days worth of research on the subject and just come up empty handed, because honestly I'm NOT certain what I should be looking for. But as I said, the JS/SQLlite combo seems to be the solution. Unfortunately I can't find any tutorials that will help me reconcile these two systems. Do you have any suggestions? Anything is helpful at this point. Thanks!!!!


title: Mission critical embedded language

text: Maybe the question sounds a bit strange, so I'll explain a the background a little bit. Currently I'm working on a project at y university, which will be a complete on-board software for an satellite. The system is programmed in C++ on top of a real-time operating system. However, some subsystems like the attitude control system and the fault detection and a space simulation are currently only implemented in Matlab/Simulink, to prototype the algorithms efficiently. After their verification, they will be translated into c++. The complete on-board software grew very complex, and only a handful people know the whole system. Furthermore, many of the students haven't program in C++ yet and the manual memory management of C++ makes it even more difficult to write mission critical software. Of course the main system has to be implemented in C++, but I asked myself if it's maybe possible to use an embedded language to implement the subsystem which are currently written in Matlab. This embedded language should feature:   * static/strong typing and compiler checks to minimize runtime errors   * small memory usage, and relative fast runtime   * attitude control algorithms are mainly numerical computations, so a good numeric support would be nice   * maybe some sort of functional programming feature, matlab/simulink encourage you to use it too I googled a bit, but only found Lua. It looks nice, but I would not use it in mission critical software. Have you ever encountered a situation like this, or do you know any language, which could satisfies the conditions? EDIT: To clarify some things: embedded means it should be able to embed the language into the existing C++ environment. So no compiled languages like Ada or Haskell


title: Decrease probability of picking a list's item based on its index

text: I have a list of sounds that are to be played when the user presses a button.   For now I just generate a random number within the range of the list and just pick the sound with that index. (I also prevent that sound from being played the next time the button is clicked. Since that is easy, I would like to concentrate _only_ on the selection algorithm and leave the exclusion behind.)   Since that makes it possible for a few sounds to be played repeatedly in a pattern, I would like to adjust my algorithm: Once a file is played it gets moved to the end of the list. Sounds from the beginning have a greater chance of being played than those at the end - therefore minimizing repetition.   Instead of assigning a weight to each index, I want to have one factor determining the probability falloff. For example, I would set this factor to be 1.2 which means that each index is 1.2 times as probable to be played as the following one. This hopefully produces a nice falloff in probability. The fastest solution seems to be a mathematical function that maps the random number to the range of indices. That way I do not have to set up intervals, but can directly calculate the result based on the random number. I just cannot figure out the math and implementiation behind this idea, so I need you to lay it out for me. The algorithm will be used in an Android app, so the programming language I am using is Java.


title: Javascript and web application data

text: I am pretty new to Web Application programming and so to **OOP** Javascript and the new **Client-Server** interactions. I am encountering some trouble wondering about how much **AJAX** I should use or how much data I have to save "locally" . Explainig it better: at the moment , to manage the data that I obtain from AJAX request , I push them in **Data Structure** like **Array's** and then I handle them helping myself rendering html through template. Now, was I wondering : is all this necessary? Do I really need to store all this data in Data Structures or I can make AJAX call for every action users do on my application? I apologize for the explanation but it's a difficult concept for me to explain in English. Thanks in advance


title: Do todays web pages use Web Semantics

text: Do todays web pages use Web Semantics? what is the potential in web semantics (i mean potential to enhance web)? web semantics is all about SEO?


title: Role based access to resources for a RESTful service

text: I'm still wrapping my head around REST, but I wonder if someone can help with any suggestions or approaches to role based access control for a RESTful service, particularly from the point of view of securing the data and how the URLs might look. It's probably best to consider an example: Say I have a REST service for Customers, and want to split the users of this REST service into Admin, Editor and Reader roles:   * Admins can change all attributes of a Customer resource    * Editors can change only some    * Readers can only view them. Access control rights are assigned to the Customers entities individually. So for example a user of the service might have admin rights to Customers 1,2 and 3 but Editor access to 4,5 and Reader access to 7,8,9. Now consider the user calling the service. What is a good way to seperate the list of Customers for the current User? **GET /Customer** \- this might get a list of all customers that the current user has Admin\Editor\Reader access to. But then on each Customer the consumer would need an indication of what role they have. Or would it be "better" having something like **GET /Customer/Admin** \- return all customers the current user has Admin access to. Just looking for some high level pointers or reading on a decent way to secure\filter the resources based on roles of the current user.


title: REST API Library Conventions

text: Most API libraries define one method for each endpoint. If there is an endpoint for getting user information, you might have a method like:               getUserInfo(userId);      That simple method is often a wrapper around another function that actually does the api call:               apiCall('/user/info', {userId: userId});      Another option I see less frequently is for the library to only contain the method that makes the API call. The first method only has the advantages of code discoverability, but it isn't that big of an issue for dynamic languages. Some say it also removes the need for the developer to read documentation for the APIs, but why would you ever want somebody using APIs without reading the documentation? The second method has three advantages that I see:   * The library is dramatically smaller   * Methods don't need to be updated if the API ever changes   * There is no need to maintain documentation for the library; the API documentation fulfills that purpose But I don't see the second method used very often, so perhaps I'm missing something. When is it appropriate or inappropriate to use either method of writing API libraries?


title: Difference between Singleton pattern and auto_ptr<> resp. unique_ptr<>

text: I'm maintaining some legacy code of a physical simulation. The calculation object is build as a singleton, to ensure there is only one instance. A co- worker told me, that singleton are completely out-of-date and I should instantiate it through a smartpointer. But I think it is not the same, because the initialization by a smartpointer doesn't garanties me, that there is only one instance of this object, right? If I wanna have one single instance of an object in my code, which way is preferable: To use the singleton pattern or the initialize the object through one of this smartpointers (`auto_ptr<>` or `unique_ptr<>`).


title: Sanity of design for my in-memory object representations of database rows

text: I've been trying to revise the structural design of the C#.NET-based system I'm currently working on. The new design involves a rather light-weight object-relational mapping framework (we're trying to stay away from ADO or linq2sql). Sorry, this came rather lengthy, but I cannot describe it shorter - it's a bit complex. The system has two primary functions:   1. Retrieve rows from an SQL relational disk-based database, then serve them up using `[DataContract]`-marked objects via ASP to a web-based client, as well as receive UPDATEs to those and reroute them to the database.   2. Read off and serve the same kinds of objects to server-side / distributed modules which work with these, generate some result, and push it back to the database.  The results (some might ask: "why're you storing generated data?") of module computation _do_ have to be stored in the database due to both size and length of computation required to obtain them, only to be retrieved in parts by the web-client through the (1) function. Currently, all row-representing objects are defined as separate C# classes with a common trend but little to no inheritance, and no common base class. I want to completely break this pattern, and instigate more extensive inheritance based on a tree of abstract classes and possibly interfaces. I've whipped up a "due-for-test" implementation in the past few days, but I'm concerned about the sanity of this design. Obviously, there is the object- relational impedance mismatch, which I deal with by only initializing the database-column-backed fields unless the other encapsulated objects are provided to the constructor. I'm not so concerned about that, and it's an issue for the old system design as well. Here's what I have so far: A `DatabaseColumnAttribute` class, which targets fields, and defines   * name of the column where the data for the field resides.    * database type (enum-backed locally) for this column. There's a fixed set of database types this system is designed to support, so be it.    * whether or not the column is nullable.   * read phrase(i.e. how do we represent this column in a SELECT query within an sql statement): this is generated automatically based on column type. There's a fixed number of types the data can be accessed in, so if there's a conversion involved when reading data from a column this will include it. Otherwise, just the column name.   * write wrapper (i.e. database function that converts the data sent into the column from C# to the appropriate representation) - also generated based on column type. All this is used within a `DatabaseFieldColumnWrapper` object, which contains all the methods required to transfer the data from the column to the field or vice-verse. The `DatabaseFieldColumnWrapper` is constructed for each location in the code where a `DatabaseColumnAttribute` is used, meaning it's not quite "static", but rather class-based, since it modifies fields of derived classes. The fields can back properties, there's a `BackedByFieldAttribute` class as well, I'll skip it for brevity. All of these are used within an abstract `DataElement` class, root of hierarchy. It defines the following abstract members: function that provides the backing-table's name for this class of objects, a read-only public Id property, a private function to set the Id (which corresponds to the primary key of the row in the table). It also provides a protected static helper function to retrieve the `DatabaseFieldColumnWrapper` objects for specific fields based on Linq Expressions (to avoid "magic strings"). This can be used in derived types to easily synch the database representation for specific fields/columns. It provides a `Delete()` method, which is (not a destructor, but a function) responsible for only deleting the database representation. The whole system is designed to allow asynchrony and multiple memory representations unless otherwise specified. Here is the "less sane" part: There is a `DataElementAttribute` class, which is designed to modify non- abstract derived types. It is _not_ fully constructed completely right away where it's defined, instead filled-in in a thread-safe manner upon the construction of the first object of a derived type. It not inherited, and contains only data specific to the _derived class_ required to speed up construction (i.e. construct all the necessary `DatabaseFieldColumnWrapper` objects before-hand and associate them with the fields). This basically _violates_ the C# OO model, since it's "static only with respect to current class in the hierarchy", not static to the whole chain. Basically, it makes the `DataElmentAttribute` object associate with a particular Type object. It's like a convenience structure, which is generated according to the rules specified in the base class _only_ , but initializes its members based on the fields marked as columns for each derived type. Each instance of that particular type has a reference to it. I don't know how to circumvent this issue, it seems to be best in terms of "code reuse", but it also seems like I'm violating a lot of things I shouldn't be when I do it. Any ideas, suggestions? In a more "question"-form: do you know of any better way to associate things with Types (without inheritance) and have these accessible from each instance of that Type, which conforms to the OO model? P.S. I'm not looking for a "you shouldn't" kind of answer, since that wouldn't allow us to reuse more code.


title: Modules already committed, client doesn't pay, what should I do?

text: So the story is simple, early stage EU portal hired me to do some extra modules. I got all the source code for local testing, did my job, committed new code. Now I am out of this project but client still haven't paid me yet and he is not even thinking about that. It has been couple of months and no contract was signed so I can't take any legal actions. What should I do with all the source code? Sell it? Run exact copy of that portal? Make all portal publicly available?


title: Why is WCF is called Windows

text: I'm wondering why it isn't called Microsoft Communication Foundation. Does it rely on Windows and will it rely on Windows in the foreseeable future?


title: Are there any good resources to learn how to write tech specs/design documents

text: > **Possible Duplicate:**   >  Writing a Software Requirement Specification   >  How to make a great functional specification I am starting to write more tech specs and design documents. However, I don't have a lot of time in school writing these, and don't have a lot of access to other people's examples. I have found a few good examples of how to structure these documents for example: Define the project goals Define the system architecture/infrastructure Define the user dialogs and the control flow Define the background tasks Define the database model Define the interfaces to other systems Define the non functional requirements (response times, security, ...) But I am looking for maybe a little more on best practices of actually writing the contents of these types of sections. I am not sure this is a dumb question or not since it is just documenting what is there but I get kind of a block with a blank canvas and start to just over think things


title: How to make a great functional specification

text: I am going to start a little side project very soon, but this time i want to do not just the little UML domain model and case diagrams i often do before programming, i thought about making a full functional specification. Is there anybody that has experience writing functional specifications that could recommend me what i need to add to it? How would be the best way to start preparing it? Here i will write down the topics that i think are more relevant:   * Purpose   * Functional Overview   * Context Diagram   * Critical Project Success Factors   * Scope (In & Out)   * Assumptions   * Actors (Data Sources, System Actors)   * Use Case Diagram   * Process Flow Diagram   * Activity Diagram   * Security Requirements   * Performance Requirements   * Special Requirements   * Business Rules   * Domain Model (Data model)   * Flow Scenarios (Success, alternate…)   * Time Schedule (Task Management)   * Goals   * System Requirements   * Expected Expenses ## What do you think about those topics? Shall i add something else? or maybe remove something? I rode every single answer, and i would like to thank all of you for the useful information. I am doing this side project for a company, and they spect from me a constant flow of communication and i will need to explain why i do every single thing, because i will have to administer the resources they will give to me. This will be my first func spec and as i said i want it to be useful, not just big and useless. I think this is something that has to be done, but i want to do it in the way that will be more useful for me and my team. Its bad that i we dont have a manager, so thats why i also need to take care about some administrative tasks... Regarding to the agile programming, i think this is 100% compatible with the agile aproach. I am an Agile programmer my self and i honestly fell more confident when someone already did the thinking for me. I still Junnior, but i worked before as a Tapestry web developer in other projects, were the organization was a total chaos. I dont agree i am doing a waterfall aproach, i think i am just trying to define some boundaries that will make the project being easier when the development starts.


title: Why do I have to keep my open source software license in the root?

text: Nearly all open source software licenses require (or at least lawyers generally suggest they require) users to include the full license in the root of the project that they are protecting. One lawyer I spoke to suggests this is a legacy of the CD age, when it was necessary that a full license be included in a jewel case. But today, we're living in the cloud age. Why can't I, for instance, simply host the full license at my website, and include the title + URL of that license in the header of my source files? **Bonus:** If it's generally agreed that established licenses must be kept intact in the root, why hasn't the OSI of FSF approved a license that you _can_ refer to by URL, and what is keeping someone from creating that license?


title: What are the memory-management capabilities of MySQL + JDBC (in light of autonomic computing)?

text: I'm interested in implementing some kind of autonomic-computing functionality using MySQL. By autonomic-computing I mean roughly some failsafe abilities, whereby the application appears to be at least slightly "intelligent" For reference, the main parts of autonomic computing we'd like are the "self- configuring" and "self-healing" features (the other two - "self-optimizing" and "self-protecting", are too abstract/futuristic for us, at this time). Sofor example, if we have a sample Java application that utilizes a MySQL database, we might want to automatically restart the MySQL database if we take up too much memory. Or maybe we want to have the ability to dynamiccally adjust the database memory as needed. So for example, when we start the application the database begins with a 56 Megabyte buffer; but then as we insert so many rows we want to have it automatically jump up to 512 MB, then to 1024, until a max of 4096 MB. Does all of the above suggest that MySQL is too "weak" for the task? Do you suggest using Oracle database? My professor believes that by using Java we can basically make up for any memory-management deficiencies that MySQL has in relation to Oracle DB. I'm new to MySQL , but have experience with Oracle. If all of the above sounds wishy-washy, it is because I'm still fleshing it out. thanks


title: Is my work on a developer test being taken advantage of?

text: I am looking for a job and have applied to a number of positions. One of them responded, I had a pretty lengthy phone interview (perhaps an hour +) and they then set me up with a developer test. I was told that this test is estimated to take between 6 and 8 hours and that, provided it met with their approval, I could be paid for my work on it. That gave me some pause, but I endeavored. The developer test took place on a VM accessed via RDP. The task was to implement a search page in a web project that requests data from the server, displays it on the screen in a table, has a pretty complicated search filtering scheme (there are about 15 statuses and when sending the search to the server you can search by these statuses) in addition to the string/field search. They want some SVG icons to change color on certain data values, they want some data to be represented differently than how it is in the database, etc. Loooong story short, this took one heck of a lot longer than 6-8 hours. Much of it was due to the very poor VM that I was running on (Visual Studio 2013 took 10 minutes to load, and another 15 minutes to open the 3 GB ginormous solution). After completing, I was told to commit my changes to source control... Hmm, OK. I get an email back that they thought that the SVGs could have their color changed differently, they found a bug in this edge-case, there was an occasional problem with this other thing that I never experienced, etc. So I am 13-14 hours into this thing now, and I have to do bug fixes. I do them, and they come back with some more. This is all apparently going into a production application. I noticed some anomalies in the code that was already in there where it looked like other people had coded all of one functionality and not anything else that I could find. Am I just being used for cheap labor? Even if they pay me the promised 50 dollars and hour for 6 hours, I have committed like 18 hours to this thing now. If I bug fix all of the stuff they keep coming up with, I will have worked at least 16 hours for free. I have taken a number of developer tests. I have never taken one where I worked on code that was destined for production. I have never taken one where I implemented a feature that was in the pipeline for development (it was planned for, and I implemented it through the course of the test). And I have never taken one that took 4 rounds and a total of 20+ hours. I get the impression that they are using their developer test to field some of the functionality, that they don't have time for in their normal team, on the cheap.


title: Should I use both WCF and ASP.NET Web API

text: We already have a WCF API with basichttpbinding. Some of the calls have complex objects in both the response and request. We need to add RESTful abilities to the API. at first I tried adding a webHttp endpoint, but I got               At most one body parameter can be serialized without wrapper elements      If I made it Wrapped it wasn't pure as I need it to be. I got to read this, and this (which states "ASP.NET Web API is the new way to build RESTful service on .NET"). So my question is, should I make 2 APIs(2 different projects)? one for SOAP with WCF and one RESTful with ASP.NET Web API? is there anything wrong architecturally speaking with this approach?


title: Virus source code

text: Recently I read an article on the bbc about encrypted viruses. I have no idea about how one would even start programming something like that. I would love to see the source code for that or something similar. Does anyone have any relevent material? (Disclaimer: I dont want to create a virus of my own. My interest is purely acedemic)


title: Modular Web App Network Architecture

text: Assuming that I am dealing with dedicated physical servers or VPSs, is it conceivable and does it make sense to have distinct servers setup with the following roles to host a web application?   1. Reverse Proxy   2. Web server   3. Application server   4. Database server ![cloud diagram](http://i.stack.imgur.com/ycKgq.png) Specific points of interest:   1. I am confused how to even separate the web and application servers. My understanding was that such 3-tier architectures were feasible.   2. It is unclear to me if the app server would reside directly between the web and database server, or if the web server could directly interact with the database as well. The app server could either do the computational heavy-lifting on behalf of the app server or it could do heavy-lifting _plus control all of the business logic_ (as implied in the diagram above, thus denying the web server of direct database access).   3. I am also unsure what role the reverse proxy (ex. nginx) could and should fulfill as a web server, given the above mentioned setup. I know that nginx has web server features. But I do not know if it makes sense to have the reverse proxy be its own VPS, given that the web server–in theory–would be separate from the app server.


title: How unique should a UUID identified object be?

text: I am working on a fairly large open source project (Drupal) and the next major version will begin to use UUIDs for a lot of things, including configuration objects. If we put UUIDs into the configuration we ship with and then various sites change their configuration then there will be many, many objects in the wild with the same UUID but different properties. Is this... OK? Or is it better practice to ship without UUIDs and generate them on install?


title: Construct your solution logic in syntax or in a faster and more efficient mental model?

text: I am a newbie, studying programming and I came across this question today: How can I make sure that I'm actually learning how to program rather than simply learning the details of a language? A commenter, ChaosPandion, had asked the question **if the programmer thinks in syntax or in a faster mental model**. I, while writing a solution will always think about the number of loops or condition to be used (for example). Am I doing it wrong? If so, how can I correct myself and what should I learn?


title: What is needed to implement a usable functional language

text: I've done some programming in a more-or-less functional style, but I've never really studied pure functional programming. What is the bare minimum needed to implement a functional language? As far as I can tell, you need:   * The ability to define a function   * The ability to call a function   * parameter substitution   * Some kind of "if" operation that can prevent recursion like "?:".   * Testing operators or functions like "Less than" or "Equals"   * A core library of fundamental functions and operators (+ -...) This implies that you do NOT need:   * Looping   * variables (except for parameters)   * sequential statements This is for a very simple mathematical usage--I probably won't even implement string manipulation. Would implementing a language like this significantly limit you in some way I'm not considering? Mostly I'm concerned about the lack of sequential statements and ability to define variables, can you really do without these "Normal" programming features?


title: How much technical detail is too much when talking to non-technical managers?

text: I have a boss that is not very technical. He can write some basic SQL, speak some dev lingo, but all in all not a pro dev. I get into trouble often, by giving him a lot of detail and asking him to make a decision as to which direction he wants to go. For example, recently he asked for a bunch of changes to go into a product. Then took 80% of the changes away saying he is not ready to release these yet. But then, I speak to our lead developer and he tells me to just push it all. This way we avoid having to manually merge code that we do want pushed vs code we do not want pushed (by push I mean move from dev to QA, forward merge). So, the lesson is...do what's easy. Don't tell the boss that you are pushing up all the stuff. This doesn't seem ethical to me, but this is what the solution turned out to be. So, where do I draw the line? Do you feel that hiding details is unethical or just a normal job function of a developer? I ask only highly experienced developers answer this question (10+ years). I know there's skilled guys with less experience, but I want experience to speak in this case, not just skills.


title: Can the DDD repository modify entity in the DB without an entity object?

text: Say I have an aggregate root `Entity` with some flags which are represented by an encapsulated object `EntityFlags`:               class Entity     {         /** @var EntityFlags */         private $flags;         ...     }      I have a repository for this entity. My goal is to modify flags in the DB. There are two ways I see:   1. Get entity from the repository, modify flags like `$entity->getFlags()->set($name, true)` and save it: `$repository->save($entity)`.   2. Create an additional method in the repository, e.g. `modifyFlags(EntityId $id, EntityFlags $flags)` I think the first way is redundant. But it also seems wrong to use repository for partial entity updates like in the 2nd way. Which way is the correct one? Maybe I missed something?


title: Are languages just syntax or do they include the framework too?

text: In building a language history for Pascal I noticed that at some point languages changed from a strong line between the language and its common libraries to more of a blurry one. In the first few versions of Turbo Pascal there was no capability for reusable modules until version 4 introduced units. Later versions of Pascal had a very powerful collection of common libraries. With the introduction of Delphi it came with the **RTL** and **VCL**. Especially for the RTL, it is often considered part of the language. For example, Exceptions are part of the language, but you need to use the `SysUtils` unit to get proper handling. Additionally there is the built in `System` unit that always gets used in all Delphi projects. Then with Java you have the Java language with the Java run-time and the Java platform. You can't use the Java language outside of the Java platform. Now with .NET we have VB.NET and C# which are languages that don't exist without their framework either, while Phyton, Ruby and others exist both within .NET and without. So my question is, is a Language just the syntax and compiler, or is the platform and framework part of the language too? Where is the line? Why or why not?


title: Should you charge clients hours spent on the wrong track?

text: I took up a small CSS challenge to solve for a client and I'm going to be paid on a hourly rate. I eventually solved it, it took 5 hours but I spent roughly 25% of the time in the wrong track, trying a CSS3 solution that only worked in recent browsers and finally discovering that no fallback is possible via JS (like I originally thought). Should I charge the client that 25%? More details: I didn't provide an estimate, I liked the challenge per se, so I started working on it before giving an estimate (but I have worked with him before, so I know he's not one of those people that have unrealistic expectations). At the very worst I will have spent 5 unpaid hours on an intriguing CSS challenge. And I will give the fairest possible estimate for both of us, since I will have already done the work. :) Edit: Thank you all, I wish I could accept more than one answer! I ended up not billing him for the extra hours (I billed him for 3 and a half), but I mentioned them, so that he knows I worked more on it than I billed him for. Maybe that's why he immediately accepted the "estimate" (which in that case wasn't an estimate, hence the quotes).


title: What is the general definition of something that can be included or excluded?

text: When an application presents a user with a list of items, it's pretty common that it permits the user to filter the items. Often a 'filter' feature is implemented as a set of _include_ or _exclude_ rules. For example:   * _include_ all emails from bob@example.com, and   * _exclude_ those emails without attachments I've seen this include/exclude pattern often; for example Maven and Google Analytics filter things this way. But now that I'm implementing something like this myself, I don't know what to call something that could be either _included_ or _excluded_. In specific terms:   1. If I have a database table of filter rules, each of which either _includes_ or _excludes_ matching items, what is an appropriate name of the field that stores `include` or `exclude`?   2. When displaying a list of filters to a user, what is a good way to label the `include` or `exclude` value? (as a bonus, can anyone recommend a good implementation of this kind of filtering for inspiration?) * * * ### Edit: My solution Thanks for your answers. I decided that to use **operation** to described an include or exclude. So the database fields and program variables are called operation. I like the name because it roughly aligns with the meaning of operation in set theory. As for how it's displayed to users, I fudged it by never labelling 'include' or 'exclude'. Instead it is always presented as part of a full sentence: ![Mockup](http://img824.imageshack.us/img824/3695/examplerestrictionslist.png) The only label used is 'Restrictions' which I think is more specific than 'Filters'. Our users are ususlly not very technically savvy, so — much as I like the word operation — I decided that displaying a label called 'operation' would be unclear for most of our users. Using full sentences might be a little slower to read, but avoids confusion.


title: Screen out software engineers with poor communication skills?

text: Personally, I try to speak and write impeccable English. I try to capitalize proper nouns, get punctuation correct, use parallel form, and employ precise verbiage. (I'm also a fan of the Oxford comma, can you tell?) As a programmer, I put an equivalent amount of effort in the code I write, as code is read many more times than it is written. I pay close attention to style guides, use direct clear idioms, and try to follow recognized best practices. If I were looking for others to work with, I'd be looking for the same. My question is: is careful usage of human language a trait that correlates with better code? If so, could human resource personnel use this to good effect to screen out applicants, or would they be reducing their qualified applicant pool arbitrarily?


title: Advantages of paid Java Application Servers?

text: What are the advantages of Weblogic or Websphere over Glassfish or JBoss, since they may reach costs of millions of dollars? Edit: Is there additional functionality? The all are Java EE Full Certified. **The question is about technology, not business or marketing. From the technological POV how are the servers different?**


title: How do I deal with classes that are only used once, say in only a single function?

text: I have a class that basically builds up a memory-efficient version of a structure to be used in a performance-critical section of code. The resulting structure is ugly but extremely fast, so not using it isn't really an option, but I also can't use it as the only representation of my structure because it has parts not relevant to the analysis stripped. Did I mention it's also very ugly? Let's call this class `Fast`. I also have the original, pretty representation, let's call it `Pretty`. I have a function called `Process()` which is supposed to take in an instance of `Pretty`, convert it to `Fast` and then do a few million calculations on it and spit out a result:               Pretty pretty;     // do stuff with pretty          // in another hpp:     double Process(const Pretty& pretty)     {       Fast fast(pretty); // create my fast object            // do some processing on fast            return result; // at this point fast dies     }      The instance of `Fast` is created and dies within `Process`, but unfortunately I can't declare a class within a function, so I have to declare it elsewhere. What I would _like_ to do is make the entire class accessible only to `Process`, and not even have it _seen_ by anyone else (just like I would conversely declare a function `private` if the class were the only object that should have access to it). But I can't declare a class private! Here's my current attempt:               class Process     {     public:       static double DoProcess(Pretty pretty); // this is the process function          private:       class Fast       {         // construct fast here (only Process can see this class!)       };     };      And then I just call `Process::DoProcess()`. This isn't really a critical issue so I didn't post it on SO, but it's a style question and I would really like to have a neat solution! I've never come across this issue before and was wondering how others have dealt with it, and if they came up with a nicer solution.


title: when to use a scaled/enterprise agile software development framework and when to let agile processes 'emerge'?

text: There are quite a few enterprise agile software development frameworks available:   * Scott Ambler: Disciplined Agile Delivery   * Dean Leffingwell: Scaled Agile Framework   * Alan Shalloway: Enterprise Agile Book   * Craig Larman: Scaling Lean and Agile   * Barry Boehm: Balancing Agility and Discipline   * Brian Wernham: Agile Project Management for Government - DSDM, Scrum and others I've also spoken with people that state that your enterprise agile processes should just 'emerge' and that you shouldn't need or use a framework because they constrain you. **Question 1:** When should one choose an enterprise agile software development framework, and when should one just let their agile processes 'emerge'. **Question 2:** If choosing an enterprise agile software development framework, how does one select the appropriate framework to use for their organisation? Please provide evidence of your experience or research when answering questions rather than just presenting opinions.


title: How do languages with Maybe types instead of nulls handle edge conditions?

text: Eric Lippert made a very interesting point in his discussion of why C# uses a `null` rather than a `Maybe<T>` type: > Consistency of the type system is important; can we always know that a non- > nullable reference is never under any circumstances observed to be invalid? > What about in the constructor of an object with a non-nullable field of > reference type? What about in the finalizer of such an object, where the > object is finalized because the code that was supposed to fill in the > reference threw an exception? A type system that lies to you about its > guarantees is dangerous. That was a bit of an eye-opener. The concepts involved interest me, and I've done some playing around with compilers and type systems, but I never thought about that scenario. How do languages that have a Maybe type instead of a null handle edge cases such as initialization and error recovery, in which a supposedly guaranteed non-null reference is not, in fact, in a valid state?


title: How do I quote a job with PHPUnit?

text: I've been doing website programming for 15 years and PHP for the last 5 years or so. I've always written solid code. HOWEVER, I have a client that is insisting on 80% of the code being unit tested. Since the client is ALWAYS RIGHT, I am planning on using PHP_CodeSniffer to make sure my code looks right and PHPUnit to do my unit testing. I'm hoping to learn something through this experience. Are these the right tools to use? How much time is involved in setting up PHPUnit and writing the additional code? It should take me around 8 weeks to write the webpages and self-test as I have done in the past. If I add 4 days additional (10%) for unit testing (PHPUnit), is that enough? Thoughts? Suggestions? Thanks.


title: How should a developer reject impossible requirements?

text: Here's the problem I'm facing: * * * **Quote From Project Manager:** Hey Spark, I'm assigning you the task of developing a framework that could be used for many different iOS applications. Here are the requirements:   * It should be able to detect the thickness of the thumb or fingers being used to manipulate the UI.   * With this information, all elements of the UI should be arranged & sized _automatically_.   * For a larger thumb, elements should be arranged nearer the center of the screen.   * For a smaller thumb, elements should be arranged nearer the corners of the screen.   * For a larger thumb, all fonts should be smaller. (We're assuming an adult in this case.)   * For a smaller thumb, all fonts should be larger. (We're assuming a younger person in this case.) **Summary:** This framework is required for creating user-friendly user interfaces programmatically. The framework should be developed in such a way that we can use for as many projects as needed, so it must also be very developer- friendly. * * * I am the developer given this task, so my questions are as follows:   * How can I explain that these requirements are a little ridiculous?   * How can I explain that it would be better to concentrate on developing actual projects?   * How can I explain that even if this were possible, I wouldn't recommended developing such a thing?   * How do I say NO to this project politely, gently, and respectfully?   * How can I explain that even for a developer with 3 years of experience, this might not be possible?


title: Do you need to know Java before trying Scala

text: I'm interested in learning Scala. I've been reading a lot about it, but a lot of people value it because it has an actor model which is better for concurrency, it handles xml in a much better way, solves the problem of first class functions. My question is do you need to know Java to understand/appreciate the way things work in Scala? Is it better to first take a stab at Java and then try Scala or you can start Scala with absolutely no java backround?


title: Anonymous function vs. separate named function for initialization in jquery

text: We just had some controversial discussion and I would like to see your opinions on the issue: Let's say we have some code that is used to initialize things when a page is loaded and it looks like this:               function initStuff() { ...}     ...     $(document).ready(initStuff);      The initStuff function is only called from the third line of the snippet. Never again. Now I would say: Usually people put this into an anonymous callback like that:               $(document).ready(function() {          //Body of initStuff     });      because having the function in a dedicated location in the code is not really helping with readability, because with the call on ready() makes it obvious, that this code is initialization stuff. Would you agree or disagree with that decision? And why? Thank you very much for your opinion!


title: How to manage a developer who has poor communication skills

text: I manage a small team of developers on an application which is in the mid- point of its lifecycle, within a big firm. This unfortunately means there is commonly a 30/70 split of Programming tasks to "other technical work". This work includes:   * Working with DBA / Unix / Network / Loadbalancer teams on various tasks   * Placing and managing orders for hardware or infrastructure in different regions   * Running tests that have not yet been migrated to CI   * Analysis   * Support / Investigation Its fair to say that the Developers would all prefer to be coding, rather than doing these more mundane tasks, so I try to hand out the fun programming jobs evenly amongst the team. Most of the team was hired because, though they may not have the elite programming skills to write their own compiler / game engine / high-frequency trading system etc., they are good communicators who "can get stuff done", work with other teams, and somewhat navigate the complex bureaucracy here. They are good developers, but they are also good all-round technical staff. However, one member of the team probably has above-average coding skills, but below-average communication skills. Traditionally, the previous Development Manager tended to give him the Programming tasks and not the more mundane tasks listed above. However, I don't feel that this is fair to the rest of the team, who have shown an aptitude for developing a well-rounded skillset that is commonly required in a big-business IT department. What should I do in this situation? If I continue to give him more programming work, I know that it will be done faster (and conversely, I would expect him to complete the other work slower). But it goes against my principles, and promotes the idea that you can carve out a "comfortable niche" for yourself simply by being bad at the tasks you don't like. **Update**   I've been impressed by the quality and insight of the answers I've received. Though most agree I should work to the individual team members strengths, there's been good debate back and forth. I want to clarify that I'm not trying to address this issue due to a grudge, or that I have a "chip on my shoulder" as was mentioned. I'm looking for advice on how to keep a well-rounded team, which is happy and motivated. By observing the variety of answers to this question, it seems like there are a lot of different opinions on how to achieve this.


title: What is the purpose of including header files in the solution in Visual Studio?

text: So I have including the files to my projects by simply : `#include "myheader.hpp"` and adding the headers into the solution explorer. But recently I have realized that I may omit the step of adding the headers to the solution explorer because it does not change anything. The only important fact is to define proper include directories in project properties. Am I missing something here ? Can someone clever explain this to me ?


title: Programming language with native concurrency support for large graphs?

text: I'm currently looking for a new programming language to learn (currently working through some C++, know some C and Python), specifically one that has built-in concurrency support? I want to try to build a large graph library that can do processing across clusters or multiple cores.. I know C++'s Boost library has support for concurrency, but I also want to learn a new language and I'm guessing a language that was designed with concurrency in mind would also be more pleasant to do concurrent programming in. Overall I see this as a chance to learn a new language, learn about concurrent programming, and tackle a big project. From looking around, Clojure and Scala seem to be the two popular candidates when looking for concurrent programming support.. though I'm not sure how these two compare in terms of   1. Speed (specifically for concurrent large graph processing)   2. Community (thinking about pushing this project onto somewhere like GitHub)   3. Ease of programming concurrently Or are there other languages I should consider aside from Clojure or Scala? I have never programmed in a functional language before, but I'm open to learning it.. I've seen one of my friends program in Haskell and Clojure and it looks daunting but I've heard good things about functional programming, esp. for data processing. Thanks!


title: Could someone break this nasty habit of mine please?

text: I recently graduated in cs and was mostly unsatisfied since I realized that I received only a basic theoretical approach in a wide range of subjects (which is what college is supposed to do but still...) . Anyway I took the habit of spending a lot of time looking for implementations of concepts and upon finding those I will used them as guides to writing my own implementation of those concepts just for fun. But now I feel like the only way I can fully understand a new concept is by trying to implement from scratch no matter how unoptimized the result may be. Anyway this behavior lead me to choose by default the hard way, that is time consuming instead of using a nicely written library until I hit my head again a huge wall and then try to find a library that works for my purpose.... Does anyone else do that and why? It seems so weird why would anyone (including me) do that ? Is it a bad practice ? and if so how can i stop doing that ?


title: Is copyrights notice of a BSD licensed library considered as endorsement?

text: As I am reviewing a BSD license for an open source library to use it in my commercial product, I found this paragraph: > Redistribution and use in source and binary forms are permitted provided > that the above copyright notice and this paragraph are duplicated in all > such forms and that any documentation, advertising materials, and other > materials related to such distribution and use acknowledge that the software > was developed by the organization. Its clear that I have to mention the copyright notice, but as for the next paragraph: > The name of the organization may not be used to endorse or promote products > derived from this software without specific prior written permission. If I just put the copyright notice of the used library, is that considered as I am promoting my product by mentioning the library copyrights notice? Shall I seek a written permission? or I just need to add the copyright notice only?


title: Should back end processes be included in use cases in requirements document?

text: We're writing a requirements document for our client and need to include the use cases of the system. We're following this template:               ID     Description     Actors     Precondition     Basic Steps     Alternate Steps     Exceptions     Business validations/Rules     Postconditions      In the Basic Steps section, should we include steps that the system performs in the back end or should we only include steps that the user directly interacts with? Example: Basic Steps for Search 1:               User goes to search page     User enters term     User presses search     System matches search term with database entries     System displays results      vs Basic Steps for Search 2:               User goes to search page     User enters term     User presses search     System displays results


title: Functional Programming vs. OOP

text: I've heard a lot of talk about using functional languages such as Haskell as of late. What are some of the big differences, pros and cons of functional programming vs. object-oriented programming?


title: How to write manageable code with functional programming?

text: I just started with functional programming (with JavaScript and Node.js) and from the look of things it looks as if the code I am writing would grow to be one hell of a code base to manage, when compared to programming languages that have a sort of object oriented paradigm. With OOP I am familiar with practices that would ensure your code is easily managed and extensible. But am nore sure of similar convention with functional programming.


title: When You Have Both Options, When Functional and When OOP?

text: Like (I suspect) a lot of JS devs, I tend to start with intuition first and then come to sound principles/practice with experience informing study of the comp. sci stuff I never really had any form training in that I like to look into in my spare time. Note: I tagged JS by way of identifying where I'm coming but I'm open to answers from any language where you might have the same dilemma. So, as I've come to understand more purely functional-oriented languages I've started to realize that I've occasionally been following that approach by accident. Essentially I'll have some data that doesn't change and a function or set of functions using those "constants" (yeah, yeah...) in conjunction with variable params to hand off a return value that won't necessarily be different on method firings. I tend to reach for whatever tool strikes me as likely to simplify the problem or reduce work the most but is there maybe something a little less ambiguous in terms of what are more formally considered the advantages of one vs. the other to come up with some heuristics to consider? So far the split is typically more with OOP at higher-level architectural concerns with occasional functional typically coming into play within or between objects.


title: Are Nested Static Library dependencies possible?

text: I am working in QT .   1. Can a static library depend on another static library?(Static Lib is made by linking another static lib)   2. If yes, is it possible that after linking to lib2, the generated lib(lib1) would not contain all the codes of lib2? In my Qt Project I am using a static library, which depends on multiple libraries. I had to add all the libraries (with all their headers in my project), although I need only one lib (and one .h of that class) in my code. Please explain the scenario.


title: Are there any benefits in not having referential integrity keys in database?

text: So Referential integrity is good, but are there scenarios where not having constraints is better? For example when all the logic of relationships is kept in code? or when the database upgrade is simplified? PS: I am not asking it is good not to have referential integrity, just that what scenarios would justify it


title: Why does a contenteditable div not behave like an input element?

text: The motivation for the content editable div would be to allow user input inside a normal div element. Why does it then behave so differently to input element? Mainly I am referring to the addition of a `div` or a `br` on line break. Additionally it does not have a placeholder item. So my question is what is the point of content-editable div? Why would I want to use it at all?


title: Entirely separate business logic layer from MVC

text: We are currently refactoring our controller methods in ASP.NET MVC application. At the beginning we've separated data access layer (our goal was to remove LINQ from controllers entirely). Now we are thinking about another step - how to create a business logic layer to reduce number of lines and logic in controller. Currently we have something like this:               public ActionResult CustomerProjects(some parameters)     {         var collectionOfSomeType = this.CustomerRepository.GetSomeData();         var anothercollection = this.ProjectsRepository.GetAnotherData(collectionOfSomeType);              var viewModel = CreateSomeViewModel(anotherCollection);              return View("Index", viewModel);     }      Of course it's just an example with four lines of code. We have some methods which are bigger (but still IMO not so bad). We injected our helper classes through IoC container, more complex logic sits there. But now we'd like to remove even that parts. Is it worth our time to create another layer which would be our 'last gate' before controllers? The final result would be:               public ActionResult CustomerProjects(some parameters)     {         var viewModel = someSource.PrepareCustomerProjectsViewModel(params);              return View("Index", viewModel);     }      What do you think?


title: How do you pronounce eval()?

text: I'm not a native speaker so please excuse me if you think the question is silly, but how should I pronounce eval()?


title: How does dependecy injection increase coupling?

text: On the Wikipedia page on dependency injection, the disadvantages section tells us this: > Dependency injection increases coupling by requiring the user of a subsystem > to provide for the needs of that subsystem. with a link to an article against dependency injection. Dependency injection makes a class use the interface instead of the concrete implementation. That should result in decreased coupling, no? What am I missing? How is dependency injection increasing coupling between classes?


title: Copyright registration against future patents

text: **Short question:** Could registering a work containing probable patentable ideas at one or more copyright registraion services (such as CRS) be used to effectively prove _prior art_ in case someone tries to patent the idea? **Details:** The particular work is software and some related stuff which show some novelties, maybe patentable, maybe not in the US. I live in Europe, and even if I lived in the US, I wouldn't want to care (and leave tons of $$$ in patent offices) about patents: the thing is to be released under GPL when the time comes. I want to protect it in such a way that it could stay free, which, as I see, involves protecting it against probable patent ventures (trying to capture those novelties the project has). Reading about the subject I see that copyright registration services (such as CRS) exist which for an affordable price would archive the state of the work reliably with their registration date. So in case someone tries to "attack" the GPL'ed work in the aforementioned way, how useful could these proofs be in proving _prior art_? (Could you think of any other effective methods for someone who has no reliable connections to release a true _printed publication_ , neither much funds, and neither lives in the US?) My goals are _solely protecting the published GPL'ed work from legal takedown_. That is as I understand patenting it might be possible that someone patents an already existing technology (in this case my published GPL'ed work), and then sues the original author (inventor) for patent infringement. I only seek for protection against this type of abuse building up some robust enough proof of _prior art_ so the work may remain free.


title: How to handle mutiple API calls using javascript/jquery

text: I need to build a service that will call multiple API's at the same time and then output the results on the page (Think of how a price comparison site works for example). The idea being that as each API call completes the results are sent to the browser immediately and the page would get progressively bigger until all process are complete. Because these API calls may take several seconds each to return I would like to do this via javascript/jquery in order to create a better user experience. I have never done anything like this before using javascript/jquery so I was wondering if there was any frameworks/advice that anyone would be willing to share.


title: Lua & Javascript documentation generation

text: I am in the beginning phase of create a mobile MMO with my team. The server software will be written in JavaScript using NodeJS, and the client software in Lua using Corona. We need a tool to auto-generate documentation for both the server-side and client-side code. Are there any tools which can generate documentation for both Lua and Javascript? And as a bonus: we are hosting our project on Bitbucket and the Bitbucket Wiki uses the Creole markup language. So if it's possible I want the tool to export to Creole. Edit: I know about tools for generating documentation for one of both languages. However, I don't want 2 different styles for documentation in one project. Therefore one tool which can generate documentation for both languages would be great.


title: What to choose API based server or Socket based server for data driven application

text: I am working on a project which has a Desktop Application for MAC/COCOA, a native application for iPhone another native application in iPad. All the application do almost same thing. The applications are data driven applications. Every communication to server is made via a restful API developed in PHP. When a user logs in a lot of data is fetched from server. And to remain in sync with server polling is done. As there are lot of data to poll it makes application slower and un-reliable. A possible solution that comes into my mind is to use Socket based server. My question is that will it reasonably improve the performance? And which technology (of sockets) will be good as a server side solution for data driven application? I have heard a lot about Node.js. Please give your suggestions.


title: I seem to be missing a few important concepts with PhoneGap

text: I'm planning on developing an app on multiple platforms and I'm thinking that PhoneGap might be perfect for me. I had been reading that it's one codebase for all platforms but looking at the PhoneGap guide it seems there are separate instructions for each platform. So if i want to develop for iOS, Android, BB and WP7 I need to write 4 different sets of code? I'm sure i'm missing something fundamental here. Aside from that, how do people usually approach a PhoneGap build? You obviously / probably want the finished app to look like a native app - is it more common than not to use jQuery Mobile together with PhoneGap? Is there a preferred IDE? I see, in the guide, for iOS they seem to suggest Xcode. I'm fine using Xcode but it seems a bit overkill for HTML & CSS. Do I need to develop in Xcode and if not how do i approach it? Use a different IDE / Text Editor and then copy paste into Xcode for building and testing? I know this question is long-winded and fundamental but it something which i don't think is properly addressed in the guides. Thanks.


title: How to organize back-end database design and front-end application in software repository?

text: I have an application that has a back-end database (tables, procedures, database specific dlls) and front-end (application logic and UI) that separate people are working on. I was wondering what's the best way to organize it in my repository (I'm using GIT). The options I see are:   * all-in-one repository   * submodules of main repository   * two separate repositories   * other? Any suggestions are welcome.


title: Preventing crawler from interfering with user tracking

text: I'm scraping text from various webshops (no images/videos or other data). I'm no expert on user tracking, so I'd like to know if there's a way for me to write my crawler so it won't interfere with the webshop owners tracking. Perhaps this is already the case since the crawler isn't storing any cookies, requesting images or anything else but the actual pages, but I'd like to be sure. What would I do when requesting the pages to ensure that nothing is tracked in Google Analytics for instance? Should I send an e-mail to the owners telling them to filter a specific user-agent or...? I've seen How to be a good citizen when crawling web sites? where the last answer states that one should add "crawler" or "spider" in the user-agent. I'm not sure what to make of that as I can't find anything to back it up. (The crawler is written in node.js and uses the request-module to download websites) EDIT: For anyone interested, here's the infinitely simple crawler I've made. It doesn't obey robots.txt because I'm specifying what kind of links I want to follow myself (and I'm too lazy right now to write something that obeys robots.txt):               var request = require("request")     , cheerio = require("cheerio")     ;          exports.crawl = function(options) {         var links = [].concat(options.url) // Takes either an array of url's or just a string.         , ongoingRequests = 0         , index = 0         , done = false         ;         process.nextTick(ticker);         function ticker() {             if(ongoingRequests < options.maxRequests && index < links.length && !done) {                 var url = links[index++];                 ongoingRequests++;                 if(options.debug) console.log("Downloading " + url);                 request({ url: url, encoding: options.encoding || "utf-8" }, function(err, response) {                     ongoingRequests--;                     if(err) {                         return;                     }                     if(!done) {                         var $ = cheerio.load(response.body)                         , shouldContinue = options.data($, response, url)                         ;                         if(shouldContinue === false) {                             console.log("Crawler interrupted.");                             options.done();                             done = true;                         }                         var  newLinks = options.extractLinks($).filter(function(url, i) { return links.indexOf(url, i + 1) === -1; });                         if(options.debug && newLinks.length) console.log(newLinks);                         links = links.concat(newLinks);                         if((index - 1) % 5 === 0) console.log("Current index: " + (index - 1) + ", links found so far: " + links.length);                     }                 });             } else if(!ongoingRequests) {                 if(!done) {                     options.done();                     done = true;                 }                 return;             }             process.nextTick(ticker);         }     };      Use it like this:               var crawler = require("../crawler");          crawler.crawl({         url: "http://website.com"         , debug: true         , maxRequests: 5         , data: function($, response, url) {             if(url.indexOf("/product/") === -1) {                 return;             }             console.log("extract stuff from $ using CSS-selectors and a nice jQuery-like API");         }         , done: function() {             console.log("DONE!!");         }         , extractLinks: function($) {             return $("a").map(function() {                 return $(this).attr("href");             }).filter(function(url, i, a) {                 if(!url || url[0] !== "/") {                     return false;                 }                 return i === a.indexOf(url) // Remove duplicates                 && url.indexOf("/cart") === -1                         && url.indexOf(".htm") > -1                 ;             }).map(function(url) {                 return "http://website.com" + url;             });         }     });


title: Is DDD not appropriate for my website or should I introduce a Query Layer?

text: I have inherited an ASP.NET website application and the previous developer has used what I believe are some DDD concepts. I am new to DDD and I have to admit I am struggling with the practical side of it having come from an N-Tier Transaction Script background. One of the problems with the site is that it is slow. There is no paging on huge grids and also the business logic layer pulls down way more data than is needed for 90% of operations 70% of which are reads to bind data to grids. The general design is that the business logic layer has a Service class per aggregate root, with various "GetByX()", 'FindBestMatching()" and "Update()" type methods on it. These Service classes are the points from which trees of domain objects are created such as "Organisation" and "User." Back in my comfortable transaction script days, my service layer was similar: there would be some logic possibly, a call into a repository (or since EF 6 direct use of EF as it can be mocked for testing) and then the call would return. The objects that were returned would be DTO type objects containing return data relevant, including possibly some POCO entity objects. These DTOs would travel to clients via webservices, be bound to ASP.NET or Silverlight grids...all was good. My operations on my service layer could be very specific, allowing for queries like:               "GetUsersWithSurnameIncludeChildren(string surname, int skip, int take)"      allowing for nice narrow DB queries that supported paging and eager loading of related data. It was fast and loaded only the data that was actually needed. Now with this site I have inherited there is an actual OO model of the business domain. These classes are POCOs, not generated from EF, but EF is used database first as a repository (there is a lot of mapping between the domain objects and the EF objects). An example domain object is below (without any logic).               public class Organisation     {         public int OrganisationID { get; set; }         public string Name { get; set; }              public IList<Organisation> AssociatedOrganisations { get; set; }         public IList<User> Staff { get; set; }         public IList<User> Managers { get; set; }              // Business logic method implemented below here     }      Many of the classes are essentially copies of the underlying entity framework objects, others have a significant amount of logic encapsulated within them. The way the site works currently is that every time the OrganisationService service class creates a new Organisation domain object (and it may create a collection in one hit) it also populates ALL of the fields and collections in that object...and all of the fields and collections in those objects! A huge deep tree is created in memory and a stack of joins and unions (generated by EF) is needed to get all of the data. This is totally inappropriate for a website that mainly displays loads of flat grids. My questions are: 1) Is an application that is 70% pulling data out of a DB for display and 30% business logic actually a bad candidate for DDD? 2) If DDD is appropriate how are scenarios like this generally designed? Should I implement a separate "Query Service" that is designed just to pull out loads of flat data for binding to pages and grids (these could just be the EF POCOS themselves) and reserve the Domain objects just for parts of the application where logic must actually be performed? 3) Should I only load data into my Domain Object reference types and collections when it is actually accessed (like EF lazy loading...)? Previous posts I have read have suggested lazy loading in a Domain Object is a code smell: DDD Lazy Loading Code Smell I am about to buy a DDD book tonight :)


title: What Algorithm can be use for task allocation based on location?

text: What algorithm can be use for task scheduling based on location? For example there are 100 students and 5 lecturers available. Each lecturer must get same amount of student using location allocation which is allocation of students depends on the nearest place to lecturer. The system must assign automatically students to lecturer depends on shortest distance between student and lecturer.               Student A      Lecturer A      Student B      lecturer B     Student c      Lecturer C      EXAMPLE : Lecturer A can get student c because when compare 3 students address student C is near to lecturer A. I have done some research on algorithms such as ant colony, bee colony, location allocation but what I can learn from that is it doesn't meet my requirement. So looking for some new algo. What type of algorithm can be use to solve this problem?


title: What is the purpose of the "non-endorsement clause" in the New BSD license?

text: _**Note:** This question is not about the "obnoxious BSD advertising clause". The New BSD license does not contain that clause, and is compatible with the GPL._ I'm trying to pick between the New BSD license and the MIT license for my own projects. They are essentially identical, except the BSD license contains the following clause: >   * Neither the name of the <organization> nor the names of its contributors > may be used to endorse or promote products derived from this software > without specific prior written permission. > Why would anyone want to use this clause? What's wrong with gaining some notoriety if someone makes a well-known piece of software using your code? Also, wouldn't dictating what users can and cannot do with your given name fall outside the domain of intellectual property?


title: RefactorException: Good idea or bad idea?

text: When I'm doing large scale refactors I'm often commenting out the contents of methods and using NotImplementedExceptions for stuff that I still need to refactor. Problem is that this is interfering with 'valid' NotImplementedExceptions. I'm thinking about introducing a custom RefactorException, that I quite easily find back by reference to see what I still need to do. Good idea or bad idea? What are other common ways to do large scale refactors in stages? (of course the idea is that all these exceptions are removed before the I commit the whole refactoring)


title: Is it legaly allowed to state this in a software EULA?

text: Just read through the whole EULA from the game ("Minecraft") owned by ("Mojang AB"). And in there it was one sentence that got my attention:               We have the final say on what constitutes a tool / mod / plugin and what is not.      My questions are:   1. Is is legaly allowed to write this in a EULA?   2. Will this really hold up in court?      **EDIT:** As people apperently want more detail: I was initially thinking just generally but as more detail is required lets's take Sweden(Where's mojang is from) and USA(Just becase)..


title: What should a GetSelectedIndex method return when no rows are selected

text: I'm creating a UI table component that returns an array of selected indices. Some typical return values would be               var myRetVal1 = [0];//one value selected      var myRetVal2 = [0,1,2,3,8,11];//multiple value selected      as you can see I'm always returning an array. I had an idea to return `-1` when nothing is selected, but then I thought that might be confusing when in every other condition an array is returned. So checking for an empty set of values would be either               //returns -1     var selectedItems = tbl.GetSelectedIndex();     if(selectedItems !== -1){        //we have data to process     }      OR               //returns []     var selectedItems = tbl.GetSelectedIndex();     if(selectedItems.length > 0){        //we have data to process     }      OR               //returns null     var selectedItems = tbl.GetSelectedIndex();     if(selectedItems){        //we have data to process     }      Maybe I'm making too big a deal over this, but is there a standard expectation for this type of control? As I build other controls should they conform to a standard empty return value or should they always return a "empty" version of their expected return type?


title: Query regarding VBA as career option

text: I am a dot net developer, with over 7 years experience in VB, Vb.net, C# and Asp.net. Would it be worthwhile to learn VBA/VSTO? Would it be adding value to my career? Would there be any companies hiring a person who knows both VBA and Dot net? I heard that VBA would be used mostly used in finance industry and it won't pay much. Is it true?


title: best way to do the compile and check cycle

text: I am trying to learn lua and am experimenting on my linux machine. I am not a programmer, so I am looking for your help to give me some suggestions. What I want to accomplish is making my compile-rewrite-recompile cycle as efficient as possible. Here is what I do. I am using vim in one window to program. I have a shell open in another window. When I want to check my progress, I save the code in vim, switch to my shell, then execute the code. However, this is still kind of tedious, I was there was a faster, more elegant way. Any ideas? How do you go about this problem?


title: How can we protect the namespace of an object in Javascript?

text: Continuing from my previous question: Javascript simple code to understand prototype-based OOP basics Let's say we run into console this two separate objects(even if they are called child and parent there is no inheritance between them):               var parent = {         name: "parent",         print: function(){            console.log("Hello, "+this.name);         }     };          var child = {         name: "child",         print: function(){            console.log("Hi, "+this.name);         }     };          parent.print()     // This will print: Hello, parent     child.print()     // This will print: Hi, child          temp =parent;     parent = child;     child = temp;               parent.print()     // This will now print: Hi, child     child.print()      // This will now print: Hello, parent      Now suppose that parent is a library, as a HTML5 application in a browser this cannot do much harm because is practically running sandboxed, but now with the advent of the ChromeOS, FirefoxOS and other [Browser] OS they will also be linked to a native API, that would be a head out of the „sandbox”. Now if someone changes the namespace it would be harder for a code reviewer (either automated or not ) to spot an incorrect use if the namespaces changes. My question would be: Are there many ways in which the above situation can be done and what can be done to protect this namespaces? (Either in the javascript itself or by some static code analysis tool)


title: Generic code or code easy to understand?

text: at work now I had an argument with co-worker, because I made a page that he feels is **too generic**. The page has **3 modes** (simple, adv and special) - it has to work like this, because we don't choose how the specification is written. in each mode **the page looks different** (the changes are not big - **it shows/hides 5 text fields** in different combinations based on the mode). My co-worker think it should be **3 pages** and when you change something you should just **merge** the changes to other two modes. The fields now has code like `rendered="#{mode!=2}"`, etc. P.S. Now the difference is 5 fields, but **in the future no1 know how much it will be changed**. **EDIT:** We use Seam(JSF/Facelets), here is pseudo facelet code(to make it easier to understand). I did not put it in panelGroups to better present the problem.               <h:output rendered="mode=2" value="Name: " />     <h:input rendered="mode=2" value="bean.name" />     <h:output rendered="mode=2" value="Surename: " />     <h:input rendered="mode=2" value="bean.surname"  />          <h:output rendered="mode!=2" value="Surename: " />     <h:input rendered="mode!=2" value="bean.surname"  />     <h:output rendered="mode!=2" value="#{mode==1?'My Name':'My friends name'}" />     <h:input rendered="mode!=2" value="bean.name" />      **EDIT:** I duplicated version it would look like this(pseudo code)               <c:if test=mode=1>             <ui:include view=modeSimple.xhtml>     </c:if>     <c:if test=mode=2>             <ui:include view=modeAdv.xhtml>     </c:if>     <c:if test=mode=3>             <ui:include view=modeSpec.xhtml>     </c:if>               modeSimple.xhtml         <h:output value="Surename: " />         <h:input value="bean.surname"  />         <h:output value="My Name" />         <h:input value="bean.name" />     modeAdv.xhtml         <h:output value="Name: " />         <h:input value="bean.name" />         <h:output value="Surename: " />         <h:input value="bean.surname"  />     modeSpec.xhtml         <h:output value="Surename: " />         <h:input value="bean.surname"  />         <h:output value="My friends name" />         <h:input value="bean.name" />


title: Can my company give IP rights away for an application I wrote off hours to another startup?

text: I am an intern for a health company (unpaid), let's call it _Company A_ and I noticed that they are using a lot of paper form for things that can be done on the computer. Excel files for things that shouldn't be in Excel. So I wanted to improve on my programming and figured that it was the best opportunity to do. I developed a couple of apps for their use. All these applications were outside company time. One application I did and they love and one of the director has a brother who has a health start up company. He wants me to give over my source code so his brother's company can further develop it and maybe sell it (I am out of the equation). I have no intention of handing over my code as I put a lot of time outside doing it but I also don't want to burn bridges with anyone in the company. I can't go to the director and tell him "I don't think so". I am fine with demoing to the brother how it works but the line is giving up my code. If they want to build something like it then they can go right ahead I have no problem with it. What is the correct way of approaching this and do they have the right to do this to me? Edit: there is no contract I never signed anything


title: How is the DOM language independent?

text: Quoting from Wikipedia > The Document Object Model (DOM) is a cross-platform and language-independent > convention for representing and interacting with objects in HTML, XHTML and > XML documents. and from wc3 > In order to provide a precise, language-independent specification of the DOM > interfaces, we have chosen to define the specifications in OMG IDL Now I have been programming in Java, C# and PHP and in all these languages the keyword `interface` is provided, but how do you implement a language- independent interface? How come you can write an interface without a programming language? Moreover how can you interact with the DOM using any programming language? If someone invented a new programming language, what are the steps he needs to do to be able to interact with the DOM?


title: Cloud availability of short-term "virgin" Windows instances?

text: I have a situation where we on a regular basis need a freshly installed "virgin" Windows installation to do various work in isolation on, and building one from scratch every time in a vmware instance is getting tedious. Perhaps there are cloud offerings providing a service allowing to request one or more Windows instances and after a very short while they were available for logging in through Remote Desktop? After usage they were just recycled without having to pay for a full Windows license every time. Do this exist for a reasonable price? What is your personal experiences with this?


title: Why should I use MSBuild instead of Visual Studio Solution files?

text: We're using TeamCity for continuous integration and it's building our releases via the solution file (.sln). I've used Makefiles in the past for various systems but never msbuild (which I've heard is sorta like Makefiles + XML mashup). I've seen many posts on how to use msbuild directly instead of the solution files but I don't see a very clear answer on _why_ to do it. So, why should we bother migrating from solution files to an MSBuild 'makefile'? We do have a a couple of releases that differ by a #define (featurized builds) but for the most part everything works. The bigger concern is that now we'd have to maintain _two_ systems when adding projects/source code. _**UPDATE:_** Can folks shed light on the lifecycle and interplay of the following three components?   1. The Visual Studio .sln file   2. The many project level .csproj files (which I understand an "sub" msbuild scripts)   3. The custom msbuild script Is it safe to say that the .sln and .csproj are consumed/maintained as usual from within the Visual Studio IDE GUI while the custom msbuild script is hand- written and usually consumes the already existing individual .csproj "as-is"? That's one way I can see reduce overlap/duplicate in maintenance... Would appreciate some light on this from other folks' operational experience


title: A good way to learn a language and fully understand its features and classes is to try all methods in the API

text: I have an idea that to learn a language (i.e. Java)I need to try all methods from language's API; i want to try to use methods from its API. is this a good idea? there are 10 000 methods in Java API. is this a good way to learn all language capabilities?


title: Basic use of Business Rules

text: I have a query on whether the following requirements would need to be designed via Business Rules - this is for a JEE based application where currently this is coded as part of the Business logic. > System will create a tax account for every city, county and district > combination that imposes tax for only certain cities, counties or districts > depending on the taxpayer's business. > > When the user establishes an account which exists in all subdivisions (i.e. > at city or county level), the application must use his tax code and > automatically populate all the locations without requiring the user to data > enter every location. I assume this would mean a data lookup table from a master table (of tax accounts) and fetch and display all locations. Is there some way in which a Rules Engine can be used to manage these combinations?


title: Can I use my company name instead of using ofbiz logo and name

text: Sorry this is not a programming questions. My company is looking to do some work on ofbiz. I read the license of apache and I am not sure if its legal to change the logo to our company logo. http://www.apache.org/foundation/license-faq.html#WhatDoesItMEAN


title: How do I store an object in a way that I can use it even in a second execution of the program?

text: I am making program in Java in which I am making `Dialog box`, `button`, `checkbox`, etc. SWT widgets. Now my problem is, I want like if in one execution `button` is made and in second execution `checkbox` is made then they both should display in one box. So I need to store that box object. How can I do that?


title: How should I create a mutable, varied jtree with arbitrary/generic category nodes?

text: _Please note: I don't want coding help here, I'm on`Programmers` for a reason. I want to improve my program planning/writing skills not (just) my understanding of Java_. I'm trying to figure out how to make a tree which has an arbitrary category system, based on the skills listed for this LARP game here. My previous attempt had a bool for whether a skill was also a category. Trying to code around that was messy. Drawing out my tree I noticed that only my 'leaves' were skills and I'd labeled the others as categories. ### What I'm after is a way to make a tree which attempts to separate Model and View, and allow adding an arbitary type of child node (with a separate way of being edited/rendered) to an arbitrary parent. ![A tree listing various skill from the above link](http://i.stack.imgur.com/vmcFs.png) _N.B Everything here is bought as a skill, even where it seems like a property. The End-Users will see this as buying skills (which they do on paper atm) so should be presented as such, all on the same page._ **Explanation of tree:** The Tree is 'born' with a set of hard coded highest level categories ( _Weapons, Physical and Mental, Medical_ and more etc.). From this the user needs to be able to add a skill. Ultimately they want to add the 'One-handed Sword Specialisation' _skill_ ( **not** item) for instance. To do so you'd ideally click 'add' with `Weapons` selected and then select `One-handed` from a combobox node that appears on that child, then click add again and enter a name in a text field on _that_ child node that appears. Then click add again to add/specify a 'level' or 'tier' for that leaf; first proficiency, then specialisation (for example). Of course if you want to buy a different skill it's a completely different route to the leaf. You might not need a combo box at the same level down the tree as you did with the weapon example, and need some other logic behind it too. This is what I'm having trouble getting my head around let alone programming in; how to make a set of classes and **not** specify what order to attach them together in, but still have them all fit. What is a good system for describing this sort of tree in code? All the other JTree examples I've seen have some _predictable_ pattern, and mine _doesn't_. I don't want to have to code this all in 'literals', with long lists of what _type_ (combo-box, text field etc) of children node should be allowed on what parent. Should I be using abstract classes? Interfaces? How can I make this sort of cluster of objects extensible when I add in other skills not listed above that behave differently? If there is _not_ a good system to use, is there a good process for working out how to do this sort of thing? ### The gears in my head are turning: I always need to:   * Check the parent   * Provide options based on the parent I'm begining to think becasue of this commonality I need some sort of abstract/interface `skill` class that defines/outlines common methods for skill and category. I can (hopefully) put rules and options in a database and read to-from there. The question is I think now, between an abstract or interface method and how to bes implement that.


title: How to check if 4 points form a square?

text: Assume I have 4 points (they are 2-dimension), which are different from each other, and I want to know whether they form a square. How to do it? (let the process be as simple as possible.)


title: Advantages and disadvantages of structuring all code via classes and compiling to classes (like Java)

text: _Edit: my language allows for multiple inheritance, unlike Java._ I've started designing and developing my own programming language for educational, recreational, and potentially useful purposes. At first, I've decided to base it off Java. This implied that all the code would be written in form of classes, and that code compiles into classes, which are loaded by the VM. However, I've excluded features such as interfaces and abstract classes, because I found no need for them. They seemed to be enforcing a paradigm, and I'd like my language not to do that. I wanted to keep the classes as the compilation unit though, because it seemed convenient to implement, familiar, and I just liked the idea. Then I noticed that I'm basically left with a module system, where classes could be used either as "namespaces", providing constants and functions using the `static` directive, or as templates for objects that need to be instantiated ("actual" purpose of classes in other languages). Now I'm left wondering: **what are the upsides and the downsides of having classes as compilation units?** Also, any general commentary on my design would be much appreciated. An informative post on my language can be found here: http://www.yannbane.com/2012/12/kava.html.


title: Would using AJAX extensively improve server performance?

text: Clearly AJAX improves the user interface but does this also decrease server load? You would think it does because the entire page will not have to be served up each time, but maybe there are other variables I'm not considering.


title: Is OOP hard because it is not natural?

text: One can often hear that OOP naturally corresponds to the way people think about the world. But I would strongly disagree with this statement: We (or at least I) conceptualize the world in terms of _relationships_ between things we encounter, but the focus of OOP is designing individual classes and their hierarchies. Note that, in everyday life, relationships and actions exist mostly between objects that would have been instances of unrelated classes in OOP. Examples of such relationships are: "my screen is on top of the table"; "I (a human being) am sitting on a chair"; "a car is on the road"; "I am typing on the keyboard"; "the coffee machine boils water", "the text is shown in the terminal window." We think in terms of bivalent (sometimes trivalent, as, for example in, "I gave you flowers") verbs where the verb is the action (relation) that operates on two objects to produce some result/action. The _focus_ is on action, and the two (or three) [grammatical] objects have equal importance. Contrast that with OOP where you first have to find one object (noun) and tell it to perform some action on another object. The way of thinking is shifted from actions/verbs operating on nouns to nouns operating on nouns -- it is as if everything is being said in passive or reflexive voice, e.g., "the text is being shown by the terminal window". Or maybe "the text draws itself on the terminal window". Not only is the focus shifted to nouns, but one of the nouns (let's call it grammatical subject) is given higher "importance" than the other (grammatical object). Thus one must decide whether one will say terminalWindow.show(someText) or someText.show(terminalWindow). But why burden people with such trivial decisions with no operational consequences when one really means show(terminalWindow, someText)? [Consequences are _operationally_ insignificant -- in both cases the text is shown on the terminal window -- but can be very serious in the design of class hierarchies and a "wrong" choice can lead to convoluted and hard to maintain code.] I would therefore argue that the mainstream way of doing OOP (class-based, single-dispatch) is hard because it IS UNNATURAL and does not correspond to how humans think about the world. Generic methods from CLOS are closer to my way of thinking, but, alas, this is not widespread approach. Given these problems, how/why did it happen that the currently mainstream way of doing OOP became so popular? And what, if anything, can be done to dethrone it?


title: Does teaching programming make you a better programmer

text: I consider myself an intermediate Python programmer and have been offered an opportunity to be a trainer for a beginner Python programming class. I was wondering if this would really widen my programming repertoire. Has somebody had an enlightening experience after they successfully trained a group of people? Does it also depend on those people -- whether they're programmers or noob students? (In my case they are intermediate .NET and Java programmers) What should I expect from them? One of my fears is -- what if I choked when one of them asked a tangled question. Is this normal?


title: Should I break contract early?

text: About 7 months ago I made the switch from a 5 year permie role (as a support developer in C#) to a contract role. I did this because I was stagnating in my old role. The extra cash contracting is really helping too. Unfortunately my team leader has taken a dislike to me from day 1. He regularly tells me I went out contracting too early, and frequently remarks that people in their 20's have no idea what they are talking about (I am 29). I was recently given the task of configuring our reports via our in house reporting library. It works off of a database driven criteria base, with controls being loaded as needed. The configs can get fairly complex, with controls having various levels of dependency on each other. I had a short time frame to get 50 reports working, and I was told to just get the basic configuration done, after which they will be handed over to the reporting team for fine tuning, then the test team. Our updated system was deployed 2 weeks ago, and it turned out that about 15 reports had issues causing incorrect data to be returned. Upon investigation I discovered that the reporting team hadn't even looked at them, and the test team hadn't bothered to test the reports. In spite of this, my team leader has told me that it is 100% my fault. As a result, our help desk got hit hard. I worked back until 2am that night to fix the highest priority issues (on my wedding anniversary!). The next day I arrive at work at 7:45 am to continue with the fixes. I got no thanks, but keep getting repeatedly told by my manager that "I fucked up" and "this is all my fault". I told my team leader I would spend part of my weekend working to fix the remaining issues. His response was "so you fucking should! you fucked it all up!" in front of the rest of the team. I responded "No worries." and left. I spent a decent chunk of my weekend working on it. Within 2 business days of finding out about the issues, I had all the medium and high priority issues fixed. The only comments my team leader has made to me in the last 2 weeks is to tell me how I have caused a big mess, and to tell me it was all my fault. I get this multiple times a day. If I make any jokes to anyone else in the team, I get told not to be a smartass... even though the rest of the team jokes throughout the day. Apart from that, all I get is angry looks any time I am anywhere near the guy. I don't give any response other than "alright" or silence when he starts giving me a hard time. Today we found out that the pilot release for the next stage has been pushed back. My team leader has said this was caused by me (but the higher ups said no such thing). He also said I have "no understanding of the ramifications of my actions". My question is, should I break contract (I am contracted until June 30) and find another role? No one else in my team will speak up in my favour, as they are contractors too and have no interest in rocking the boat. I could complain to my team leaders boss, but I can't see that helping, as I will still be stuck in the same team. As this is my first contract, I imagine getting the next one will be hard without a reference. I can't figure out if this guy is trying to get me fired up to provoke a confrontation (the guy loves conflict), or if he is just venting anger, or what. Copping this blame day after day is really wearing me down and making me depressed... especially since I have a wife and kid to support).


title: Simulating double-click, how long should I wait between clicks?

text: I'm simulating a double click programmatically and I want to have a slight pause between both clicks in order to better simulate a real user. I know the interval should be less than `GetDoubleClickTime` but am not sure what would be a good time to choose. Does anyone know of any data on how fast a typical person performs a double-click? I was thinking in the direction `GetDoubleClickTime()/3` but of course the magic number seems a bit iffy.