title: Is a Unique ID column needed in a many-to-many (junction) table?

text: Getting a few projects started with EF, but I had some questions about join tables and keys etc. Lets say I have a table of applications and a table of permissions. Applications have many permissions and each permission can belong to many applications (many-to-many). Now, the Application and Permission tables are easy:               Applications     --------------     PK  ApplicationID         Name          Permissions     --------------     PK  PermissionID         Name      But what's the BEST way to do the join table? I have these two options:               ApplicationPermissions     -----------------------     PK  ApplicationPermissionID     CU  ApplicationID     CU  PermissionID      OR               ApplicationPermissions     -----------------------     CPK ApplicationID     CPK PermissionID          PK = Primary Key     CPK = Composite Primary Key     CU = Composite Unique Index      Have you ever been burned doing it one way over the other? is it strictly preference? It has occurred to me that a lot of the "differences" will be abstracted away by my repository pattern (for example, i would almost never create an entire permission object and add it to an application, but do it by ID or unique name or something), but I guess I'm looking for horror stories, one way or the other.


title: Getting started with object detection - Image segmentation algorithm

text: Just getting started on a hobby object-detection project. My aim is to understand the underlying algorithms and to this end the overall accuracy of the results is (currently) more important than actual run-time. I'm starting with trying to find a good image segmentation algorithm that provide a good jump-off point for the object detection phase. The target images would be "real-world" scenes. I found two techniques which mirrored my thoughts on how to go about this:   1. Graph-based Image Segmentation: http://www.cs.cornell.edu/~dph/papers/seg-ijcv.pdf   2. Contour and Texture Analysis for Image Segmentation: http://www.eng.utah.edu/~bresee/compvision/files/MalikBLS.pdf The first one was really intuitive to understand and seems simple enough to implement, while the second was closer to my initial thoughts on how to go about this (combine color/intensity and texture information to find regions). But it's an order of magnitude more complex (at least for me). My question is - are there any other algorithms I should be looking at, that provide the kind of results that these two, specific papers have arrived at? Are there updated versions of these techniques already floating around? Like I mentioned earlier, the goal is relative accuracy of image segmentation (with an eventual aim to achieve a degree of accuracy of object detection) over runtime, with the algorithm being able to segment an image into "naturally" or perceptually important components, as these two algorithms do (each to varying extents). I found these two papers after a couple of days of refining my search terms and learning new ones relevant to the exact kind of techniques I was looking for. I have just about reached the end of my personal Google creativity, which is why I am finally here! I do not know if this is a better fit for cstheory.stackexchange (or even cs.stackexchange). I looked, but cstheory seems more appropriate for intricate algorithmic discussions than a broad question like this. Also, I couldn't find any relevant tags there either! But please do move if appropriate.


title: What do you believe is a better of method of learning languages: using books or jumping straight into a project?

text: Do you find that it is better to learn through reading books or to just jump straight into a project and pick up what you need to know using the web, or some combination of both?


title: Object Oriented "normalization"

text: In database programming there's a technique called "normalization" that you do to data you want to store. Has anyone tried to apply this concept to object design? How did you? How did it work out? Edit: To expand/clarify, database normalization is more than a set of principles to reduce redundancy. There's actually steps and stages you go through and at least moderately objective measures that tell you which stage you are in. Object design has its own principles, and there's the concept of smell, but is there any way to do something similar that would tell you that you're in XX-form0,1,2...etc...and methods to move to the next most "normalized" level?


title: Use Case Diagrams - should I create a diagram just for a view business rule?

text: I'm modeling a UCD where I have two actors ( a content producer and a developer).. the content producer is going to create and specify details of a storyboard functionality, and the other actor (developer) will only be able to view this storyboard ( he'll log in the application and read the storyboard to start developing what it says, outside the application..) I'm working on the specification of this storyboard functionality and I'd like to know it would be like a best-practice if I describe something like " > actor- developer", "UCD - read scenes of storyboard" . This is the specification of an application I developed for my thesis and they asked me to add some specification...


title: Why don't databases have good full text indexes

text: Why don't any of the major RDBMS systems like MySQL, SQL Server, Oracle, etc. have good full text indexing support? I realize that most databases support full text indexes to some degree, but that they are usually slower, and with a smaller feature set. It seems that every time you want a really good full text index, you have to go outside the database and use something like Lucene/Solr or Sphinx. Why isn't the technology in these full text search engines completely integrated into the database engine? There's lot of problems with keeping the data in another system such as Lucence, including keeping the data up to date, and the inability to join the results with other tables. Is there a specific technological reason why these two technologies can't be integrated?


title: Why do some opensouce libraries lack comments?

text: I don't know if this happens to most Opensource libraries, but many of I know and use (for example OpenSSL, Webkit, ...) they all lack comments, or contain very few comments. Not to mention their very few documents, it is hard to read their source code. We can hardly understand what a member variable means, or what this function does. This seems to be against coding standard practice Why is that? How can people collaborate to these opensource with very few comments?


title: Do you think managed OSes are a good idea?

text: Managed OSes like Microsoft Singularity and JNode are quite an interesting concept. Essentially, the OS is bootstrapped with code written in a low-level language (C/C++/Assembly), which essentially implements a virtual machine. The rest of the OS (and all userland apps) run on the virtual machine. There are some great things about this. For example, you suddenly make arbitrary pointers obsolete. And if well written, you get rid of a ton of legacy crud that most modern OSes currently have. However, as a disadvantage, you're that much farther away from the hardware, and as a developer, you lose the ability to drop down to a lower level of abstraction and get your hands dirty. What are your opinions on this?


title: Is programming an art or a desk job?

text: Developing software needs a clear mind, full of creative ideas (art) & good knowledge in computing, software domain and logic (science). Still many companies consider programming as a desk jobs, where you have tasks you have to finish. But it's not just paper filing, developers are more creative on few days than others, more keen to solve the software issues and problems one day and the other day they don't feel like even if they try hard to do so. How should IT department management concider this issue? Should developers be considered as artists and given full time to do what they like to do (many will not deliver software on time like that) or should developer be treated as assembly workers who have to finish their specific tasks no matter how they feels about it (will not get quality results)? I think it should be somewhere in the middle, but where exactly?


title: Users creating instances from a template - is there a software pattern that corresponds to this use case?

text: I am looking into designing a system where users build a template item and then create many instances based on this template.They then need to be able customise each instance but I also need for them to be able to make changes to the template and have all instances updated. These items are fairly complex, each consisting of many components that will be stored in numerous database tables. I see two implementation paths.   1. Store complete copies of the templates to create the instances and migrate updates to the instances.   2. Store records only for the changes and build each instance from a combination of the template and instance changes. I believe the first option would create a lot of unneeded extra data however the 2nd way introduces complexities in querying the data. This seems like it has probably been implemented many times before but I am having trouble finding much reading material. Are there common names for data models or pattern options used in implementations of such systems? Any advice on benefits or pitfalls of each option, other options, or implementation guidance would be useful too. **edit:** Sorry I may not have been clear. I was looking more for a name for the general architecture not a design pattern. It is the end users who create instances not developers. For example the system might allow users to define templates to model manufacturing processes of many items. Then at different sites where facilities or requirements are different, the end user would would use one of these templates to define a process specific for that site. Things will be added, removed and modified for each site. I believe I will go with option two mentioned above - storing only delta changes, not complete copies.


title: script engine with no global environment (java)

text: I am curious about how global variables are handled by script engines. I am looking for a script engine that does not preserve the state of global variables upon invocation. Are there such engines out there? We are looking for a scripting language we can use under the script engine API for Java. When making multiple invocations of a script engine, top-level calls to eval() or evaluate() method preserves the state of global variables, meaning that consequent calls to eval() will use the global variables as they were left by the last invocation. Is there a script engine that does not preserve the state, or provides the ability to reset the state, so that global variables are at their initial state every time the script engine is invoked?


title: How do you visually represent programming skills?

text: I had a discussion with a recruiter recently that made me wish I could visually represent programming skills. In trying to explain how skills relate, **what are the important properties of those skills?** Would a tagging model work (i.e. "Design Pattern," "Programming Language," "IDE," or "VCS")? Are they really hierarchical? Clarification: The real problem I see is communicating the level of granularity among skill sets. For instance saying someone "knows Java" is a uselessly broad term in describing what someone can DO. However saying they know how to write web services with the Java Programming language is a bit better. To go even further, saying they know Spring as a tool under all that is probably specific enough. What should we call those levels of granularity? What are the relationships between the terms we use? i.e. Framework to Language, Tool to Language, Framework to Solution(like web services), etc.


title: Should I use title case in URLs?

text: We are currently deciding on a consistent naming convention across a site with multiple web applications. Historically, I've been an advocate of the 'lowercase all the letters!' when creating URLs:               http://example.com/mysystem/account/view/1551      However, within the last year or two, specifically since I began using ASP.NET MVC & had more dealings with REST based URLs, I've become a fan of capitalizing the first letter of each section/word within the URL as it makes it easier to read (imho).               http://example.com/MySystem/Account/View/1551      We're not in a situation where people _need_ to read or be able to understand the URLs, so that's not a driver per se. The main thing we are after is a consistent approach that is rational and makes sense. Are there any standards that declare it good to do one way or another, or issues that we may run into on (at least realistically modern) setups that would choose a preference over another? What is the general consensus for this debate currently?


title: What is a dedicated Linux box used for?

text: So this is probably a very basic and obvious question for most people, but my google-fu is failing me and it just seems something is going over my head. I've heard numerous people refer to having a 'dedicated linux box' as a central part of a developer's setup. I have been doing web-dev programming for about a year and understand the benefits of programming on a Unix/Linux system. But I seem to be missing what role a 'dedicated linux box' plays in the development process. I would assume that it is used as a server of some sort, but I am yet to run across any needs to have a computer dedicated to running a linux server. Am I just being nieve and mistaking the commonality of programmers preferring to work in linux for a tool used by developers? What do most developers use their 'dedicated linux box' for?


title: how to write a scalable/flexible php system?

text: I am trying to write a joomla type system in PHP to improve my coding/programming skills i need guidelines/rules of thumb to do that. what i basically want to do is create a index.php file which will act as a front controller and will redirect to the request transparently to "extensions/plugins" (no need for them to follow MVC and hence it will be more flexible) what are your recommendations on that? **EDIT** i meant i am trying to create it using CORE PHP (no frameworks), but existing libraries are acceptable


title: GUI, BLL, DAL Organization In A Project

text: I'm reading about application layers, and want to use this design in my next project (c#, .Net). Some questions:   1. Is the separation of layers done through namespaces? Project.BLL.Whatever, Project.DAL.Whatever   2. Is it more appropriate to separate by layers, then components (Project.BLL.Component1), or by components, then layers (Project.Component1.BLL)   3. For my DAL, is this layer further organized using different classes? If all database calls are put into a single class, there is no organization. Would it be better to split these up with different classes or namespaces?   4. Are DAL classes typically static? It seems cumbersome to instantiate a DAL object before calling one of its methods each time.  Any other tips for doing things the correct way with these layers would be appreciated.


Why do people say that VB gives you bad programming habits? What do they mean by this?


title: Are asserts or unit tests more important?

text: Both asserts and unit tests serve as documentation for a codebase, and a means of discovering bugs. The main differences are that asserts function as sanity checks and see real inputs, whereas unit tests run on specific simulated inputs and are tests against a single well-defined "right answer". What are the relative merits of using asserts vs. unit tests as the main means of verifying correctness? Which do you believe should be emphasized more heavily?


title: How to explain my 5 burnt-out years off to a new employer?

text: Five years ago, I lost my ability to concentrate long-term, and therefore ability to code with professional efficiency. I know why it happened, I understood how it happened, and on top of being able to re-create my calm and thus relaxed focus, I overcame the original (rooted in childhood) reason why my mind tilted on the overall situation back then; My understanding isn't rooted in words that a psychologist told me, I actually grokked them first-hand. I'm pretty much confident to be able to churn out productivity, possibly even more so than pre-burnout. I also never lost my interest in code nor did I stray from trying to get my abilities back; I kept my knowledge up to date (I could always relatively painlessly learn things coding-related, just not apply them) and thus can say that I'm a better developer than before, even if my average LOC-count over those years is abysmally low. On the other hand, now I have a biography that includes more time on the dole than in a job. What would convince you, as an employer, to give my application a chance? I don't believe I should just keep the whole topic out of it. **EDIT:** I think I should add that I didn't start searching my childhood for causes, it was the solution that pointed me to the cause. Alas, not doing my best to fix the company (which was disintegrating as I left, and completely disbanded a year later) is deeply rooted in the fact that in my childhood I, at one point, gave up on fixing my parent's relationship, misattributing it to my own failure at empathy instead of them being an utterly hopeless case, and I don't really see a way to explain that without referring to childhood. I'm perfectly able to say that without breaking out into tears, though. That said, yes, I'm aware that I'm writing to you guys as friends, not employers, right now, that's the reason why I show my distrust in you by using a one-time account .oO( ... ) Yes, I'm planning to release some OSS code before I apply anywhere. **EDIT 2:** I'm German and going to apply at a German company, so "creative truth" is definitely not an option. **As to the chosen answer:** I chose Renesis over Pierre because, while the latter did an awesome job at motivating, getting across that I shouldn't give up and giving me points to beef up my social skills section with, Renesis actually answered my question by summing up the involved key factors.


title: Is an atomic action supposed to be deterministic?

text: I was reading about the _at most once_ property that defines what an atomic action is and I've been curios about this example:               x = 0, y = 0     x = y + 1 || y = y + 1      If we use the 'at most once' definition, we can say that, indeed, `x = y + 1` is atomic because   * `y` is only referenced in an another thread and   * `x` is not being read by any thread But the result of this action is not deterministic, it could be 1 or 2 depending on which operation is being computed first. I might be wrong from the start, isn't atomicity suppose to grant some kind of determinism?


title: Making server logic independent of client interaction

text: I'm trying to make a realtime multiplayer web-game in node.js with express framework and socket.io library. But I can't seem to make my server-side logic independent of client interactions. I want client to interact only when I (server side logic) want but I can't seem to be able to do that. For example: I want 2 users to start playing a game. I have to first initialize the game, like set up environment, variables and stuff.. all in a separate, call it: The Game Logic. Only then can I "allow" the clients to interact. But how am I supposed to carry on with my Game logic when my `socket.on` event is "calling the shots"? With socket.io you have to define triggers like               io.sockets.on('connection', function(socket) {         socket.on('event', function(data) {             //supposed this is fired when client hits an "interact with X" button         });      }      All my logic seem to be dependent on these triggers. I only wanted client to be able to fire that event when _I want_ (after I've set up the game env etc), but defining it like so, separated from my game logic, it creates problems like **how am I supposed to transfer the execution control from socket into my game logic**? And even if I managed to, there's that whole client "calling the shots" problem. I then have no control when client could want to interact. Any advice what should I do?


title: Writing High Quality Software Proposals

text: I've been reading over some proposals for software projects recently and I'm a little concerned by what I've seen. Often I feel that proposals have been rushed and/or poorly thought out. It's very possible that proposals don't need to look like a basket of fruit, but if your pitching for work or seeking approval for funding, there has to be some guidelines available for what constitutes a "decent" proposal. I was wondering if anyone was aware of good guidelines for writing software proposals or could possibly point me at books/websites etc?


title: Bluetooth push application

text: I am considering the technical viability of software that I want to write. Is there a way that I can push data to a phone (iPhone or Andriod) via Bluetooth without pairing with it? I want to be able to walk into a room and have a computer push data to my phone when I get a certain distance from it, or push data to any phone automatically when it comes within a certain distance to a Bluetooth-ready device?


title: Developing a DVR software using a hardware KIT

text: I'm currently thinking about a project for my masters degree graduation. I start researching for options to make my own video streaming software based on a premade hardware kit having not much knowledge about what I'll exactly need that will match my needs. My search led me to the `DVR` `(Digital Video Recorder)` cards which seems to be the closest to what I need, but still I can't find out a few basic things so I decide to ask for them here. Currently I haven't find a lot of manufacturers that offers such kits so where I can look and have some options to choose from? There are a lot of `DVR` products on the market but they already have a software written for them and even if I buy one they just don't give any documentation or sdk's so buying such is not an option I need a DVR card made exactly for software programers and not end users. Are there a preferred manufacturers that provide such kind of devices with good and developer-friendly documentation? Also - I prefer to do all this with Java, is this an option (I think I will make it with .NET too but really prefer Java as a language of choice)


title: How can I design an anti-spam algorithm based on a web usage profile?

text: I've looked at other anti-spam algorithms, notably Reddit's, but they seem to be inadequate and naive: for example, only banning specific words (like "spam") that appear in the title of a post. How can one approach this problem? Are there any tools that would help in this case, and for high-activity online community websites in general?


title: Web-app DAO and server architecture design for service outside LAN

text: i just need a suggestion what path should i take to educate myself further. Situation:   We've got in our company internal (LAN only) application that, among other things, serves something like ordering app. Main functionality is - people can schedule some service(eg. technical consultation, fixing electronics etc.) for a particular date. Today outside customers have to personally come to the employee who will create their ticket. Boss said that we can no longer live in caves so we have to develop web app for scheduling orders.      Background:   \- our internal system is based on Java(swing) + DB(postgres)   \- DB server is on dedicated machine   \- data in DB is fragile (in sense of security)   \- because this is a little legacy code, most of logic is in stored procedures on DB   \- we would like to use Vaadin to develop web-app   \- host web-app on other machine         Main tasks:   \- separate internal server (DB) from outside world   \- serve only portions of data from DB required to create a ticket from web- app   \- find and secure or eliminate weakest link between internet web-app and internal DB system in chosen solution   \- web-app has to be synchronized with internal ordering app (no condition race for scheduling for particular date)         So how to make it right?:   \- host web-app on local machine (other than DB, and in DMZ) or use external commercial hosting   \- create Web-Service which will proxy web-app requests with customers orders to DB and then process them?   \- use maybe JMS for user requests and then poll from JMS to DB (using maybe Apache Camel to process and store to DB)?   \- create second database instance just for web-app, and then synchronize master-DB and web-app-DB in some sophisticated way?   \- in web-app data access layer we would like to develop high abstraction just in case we will have to switch from one of above to another         What are your suggestion, which of these, or maybe something completely different should we consider in this project?


title: Why does storm not supply a mechanism for supplying topology necessary dependent jars other than the fat jar?

text: Following is a question that I had posted at the incubator-storm-user mailing list (verbatim). I had decided to open up the question here as well, because it also contains a conceptual side to it, which might be answered by non-storm users. > I am no python expert and am also a newbie to storm. > > I have gone over the storm source code in order to see how to add jars to > the classpath. Obviously, the preferred mechanism is the fat jar (as > specified in Micheal Noll's tutorial and another post on the storm-user > mailing list). The second seemingly available mechanism is via the > `USER_CONF_DIR` which amounts to `os.path.expanduser("~/.storm")` but this > does not allow for topology independent versioning of the same jars (e.g. > `apache-commons-aaa` version x and version y). There does not seem to be a > third way. Many other Java based technologies do give a way to amend the > classpath. Why doesn't storm? To generify the question a bit, why would a (clustered) java software framework/container not supply a mechanism for adding app specific dependent jars, but force you to use fat jars?


title: How do you manage feature requests and software changes?

text: I am a Software Engineer and over the past few years I have become the de- facto software project manager simply because there isn't one. So to keep our sanity in the R&D/Engineering department, customers have become accustomed to coming to me with their requests. I have no experience in this realm so it is my first time acting as a project manager for software projects. I have managed other things but not software. So, how do you manage software projects and mark priorities? Requests come in at infrequent intervals so we very well could be working on something for someone else and then another person comes in with a "rush" job that needs working on. Is it easier to just say First Come, First Serve or is it the person with the most money?


title: How does one handle an incorrect resource file?

text: I'm starting the parser that will handle one of the key features of my app and realizing exactly who easy it would be for me to screw up a resource file that is provided to the application. For example, a simple resource that I provide to my app is a JSON file that contains an entity layout (name, fascia, location etc...). It would be easy for me to leave out the name of the entity or misspell the JSON key. Obviously catastrophic failures during parsing are to be handled in a try/catch, but how would subtle failures (such as a dyslexic spelling of name) be handled?


title: TDD for batch processing: How to do it?

text: I like "red/green/refactor" for RoR, etc. just fine. My day job involves batch processing very large files from third-parties in python and other custom tools. Churn on the attributes of these files is high, so there are a lot of fixes/enhancements applied pretty frequently. Regression testing via a known body of test data with expected results does not exist. Closest thing is running against the last batch with new test cases hand coded in, make sure it does not blow up, then apply spot-checking and statistical tests to see if data still looks OK. Q>> How to bring TDD principles into this kind of environment?


title: Is ASP.NET MVC too much overhead for smaller projects?

text: I will be honest I don't really know much about MVC other than the stuff you can read online in 5 minutes. Unfortunately this doesn't really tell me whether its suited to smaller projects or not. I also read this related question and its chosen answer, but the business perspective is not a concern in this case for me as I am the only one making it. The next answer proceeds to say why it is more flexible. Sure, that's great. But my question is again, if its an ideal choice for a small project. For example I would rather use winforms to make a simple mockup of a small desktop program than do it on WPF because of the overhead of custom styling. So I have a project that will essentially have about 6-8 pages that read excel files and user input use that to pull a bit of data from databases and output resulting excel files. I will be the only one working on this project. If I used webforms I would expect it to take no more than 2-3 weeks. Now I am 100% comfortable with webforms. And I know its easy to do a small project in webforms. But I have only heard good things about MVC so I am seriously considering it.


title: Web development advice for a distributed development team

text: I am a web developer. Worked in many projects. Now I have changed my work place. It is big organisation. I and my group are thinking about new project. There is no difficulty to write project but our organisation is big and it's has little offices in many places (within the country). There is no any problem about internet in center. But there is problem with internet in remote areas sometimes. My question is: is there any solution to solve problem as it? If anybody has create project such this please tell little about what technologies you have used. Thanks


title: Divisional/Sectional comments, good or bad?

text: I know the general trend against comments explaining how something works, and how it's a good idea to use them only to explain why you're doing what you're doing, but what about using comments as a means of dividing up the code? Assume you have a script that does a preamble, searches through a bunch of records, prints the records, then closes everything:               // Preamble     ... preamble code, say about 10-15 lines ...          // Find records     ... sql query ...     ... put records into array ...     ... some other stuff ...          // Print records     ... printing records, 20-30 lines a record ...          // Close everything     ...      More of a way to visually divide the code, make it easier to find a certain section. Like if in a month you need to fix the printing code, rather than reading through a couple hundred lines to try and find the right spot, just look at the comments to see where it is. What actually happens in each section being fairly straightforward and easy to tell what's going on, **would this approach to comments be considered good or bad**? **Edit:** I'm working mostly with PHP scripts, where you either can't put code into functions, or it's impractical to do so. However, the same sort of thing would apply to large class files, with several methods that do related things, like getters/setters, database updates, etc.


title: Testing BI (Business Intelligence) systems on the MS stack

text: I'm placing my first steps in the Business Intelligence sector and **I'm looking for good ways to test BI systems.** I'm going to try to explain what my system consists of so that people unfamiliar with BI systems could also pitch in some advice. **For those of you who are rather unfamiliar with BI systems, here's how a BI system typically looks like on the MS stack:**   1. Data is in MS SQL DBs, text files, XML files, etc    2. The data is put into a single MS SQL DB ( **the data warehouse** ) using (an) **Sql Server Integration Services (SSIS)** package(s). (ETL, Extract - Transform - Load)    3. A 'Cube' containing Measurements, KPIs etc is processed on the data warehouse, using **Sql Server Analysis Services (SSAS)**   4. Reporting can be built on the cube using excel, Reporting services, etc. **There are multiple things you can/should test:**   * Is the data put into the data warehouse correctly   * Are the measurements and calculations done correctly I think a test environment could be made in .NET using empty databases with the same structure as the production databases and data warehouse. **Tests could be written like this:**   1. Insert dummy data in the production databases of which you know that they should produce certain measurements, KPI values. For example: Insert a car with cost 100 and profit 110 sold in 2008. another car with cost 100 and profit 120 sold in 2009. markup in 2008 should be 10% and in 2009 20%.   2. Run the SSIS package(s). I looked this up and its possible in .net   3. Run the SSAS calculations. Still have to look up how to do it, but should be possible.   4. Retrieve the KPI data from the Analysis Services database and test if it matches the expected results. **Some downsides I expect to this approach:**   1. Setting up test databases, security for the test script, ... will take quite some time.   2. Changes to production databases and the data warehouse will have to be copied to the test environment.   3. Creating the insert statements for the test data could be difficult. In my car example it is simple but for more complex calculations this could be quite time consuming   4. Tests will most likely run quite slow   5. The tests are error prone, either in the INSERT statements or in the part where you retrieve the KPI data. Figuring out what went wrong could be difficult. So summarized, writing **and** maintaining these tests could be quite consuming. On the other hand, you would have a nice **test-driven approach** where you write the test first, plus your business logic is explained and documented in the tests. Since I have not much practical experience with BI development I'm unsure if this is the way to go and what alternatives there are. Perhaps someone more experienced could explain how BI systems are usually tested and documented?


title: Check-list to avoid vendor lock-in?

text: Is there a set of industry approved rules to avoid vendor lock-in? I mean something one can show to a manager or other decision maker that is easy to understand and easily verifiable.   * Are there any universally accepted set of rules, checklist or conditions that help detect and prevent vendor lock-in in an objective, measurable way?   * Have any of you warned a manager about the risk of vendor lock-in during the initial stages of a project?


title: Why does Cem Kaner consider a test not revealing a bug a waste of time?

text: What about confirming the functionality in positive tests, proving it is working - should I say it is a waste of time? What kind of concept is behind this quote? > Unsuccessful tests, i.e. tests that do not find errors are a waste of time. Web Engineering: The Discipline of Systematic Development of Web Applications quoting Cem Kaner.


title: How do people make money by writing programming languages?

text: Why will anyone even attempt to write a programming language? It seems to be a tedious task and the alternative (simply using an existing language) seems to make much more economical sense. Microsoft may hire people to write .NET because they have too much spare money to burn. But why will anyone else write a language if they aren't paid for it?


title: How to delete .tmp file in fileupload struts2

text: I have used `file-upload` (common fileuplod) in `strtus-2.3.15.3` . There is one Form in my `.jsp` with multiple field with many diff type(textfield,textarea,hidden,file) including `FILE` and obvious `SUBMIT`. When i submit form by selecting one file and enter some text in all other field its generated `.tmp` file in mention temp folder . Only `.tmp` file related to file field is going to delete after uploading my file to myfolder but rest of `.tmp`(with 1kb size) file is remaing as its .               List items = upload.parseRequest(servletRequest);       This line in below code generate `.tmp` file for all field which have some value (if you do not enter any text in text field it not generated) . `MonitoredMultiPartRequest.java` **:**               public void parse(HttpServletRequest servletRequest, String saveDir)                 throws IOException         {                  System.setProperty("java.io.tmpdir", "D:\\ankit");                  UploadListener listener = new UploadListener(servletRequest);             // Create a factory for disk-based file items             FileItemFactory factory = new MonitoredDiskFileItemFactory(listener);             // Create a new file upload handler             ServletFileUpload upload = new ServletFileUpload(factory);              }      `MonitoredDiskFileItemFactory` :               public class MonitoredDiskFileItemFactory extends DiskFileItemFactory     {         HttpServletRequest request;              public MonitoredDiskFileItemFactory(OutputStreamListener listener, HttpServletRequest request)         {             this.listener = null;             this.listener = listener;             this.request = request;             setTrackers();         }              public void setTrackers()         {             FileCleaningTracker fileCleaningTracker = FileCleanerCleanup.getFileCleaningTracker(request.getServletContext());             File repository = new File(System.getProperty("java.io.tmpdir"));             DiskFileItemFactory factory = new DiskFileItemFactory(DiskFileItemFactory.DEFAULT_SIZE_THRESHOLD, repository);             factory.setFileCleaningTracker(fileCleaningTracker);             super.setFileCleaningTracker(fileCleaningTracker);             super.setRepository(repository);         }              public MonitoredDiskFileItemFactory(int sizeThreshold, File repository, OutputStreamListener listener)         {             super(sizeThreshold, repository);             this.listener = null;             this.listener = listener;         }              public FileItem createItem(String fieldName, String contentType, boolean isFormField, String fileName)         {             MonitoredDiskFileItem result = new MonitoredDiskFileItem(fieldName, contentType, isFormField, fileName, getSizeThreshold(), getRepository(), listener);             FileCleaningTracker tracker = getFileCleaningTracker();             if (tracker != null)             {                 tracker.track(result.getTempFileOfDistFileItem(), result);             }                  return result;         }              private OutputStreamListener listener;     }      `MonitoredDiskFileItem` :               public class MonitoredDiskFileItem extends DiskFileItem     {              public MonitoredDiskFileItem(String fieldName, String contentType, boolean isFormField, String fileName, int sizeThreshold, File repository, OutputStreamListener listener)         {             super(fieldName, contentType, isFormField, fileName, sizeThreshold, repository);             mos = null;             this.listener = listener;         }              public OutputStream getOutputStream()                 throws IOException         {             if (mos == null)                 mos = new MonitoredOutputStream(super.getOutputStream(), listener);             return mos;         }              public File getTempFileOfDistFileItem()         {             return super.getTempFile();         }              private MonitoredOutputStream mos;         private OutputStreamListener listener;     }      `UploadListener` :               public class UploadListener implements OutputStreamListener, Serializable     {         private static final long serialVersionUID = 1L;         private int totalToRead = 0;         private int totalBytesRead = 0;         private int percentDone = 0;         private int previou_percentDone = 0;         private long uploadspeed = 0;         private long starttime;         private long stTime, EndTime;         HttpSession session;         private int count = 0;              public UploadListener(HttpServletRequest request)         {             totalToRead = request.getContentLength();             session = request.getSession();         }              public void start()         {             session.setAttribute("percentageDone", 0);             session.setAttribute("speed", 0);             starttime = System.currentTimeMillis();             stTime = starttime;              }              public String getMessage()         {             return "" + totalBytesRead + " bytes have been read (" + percentDone + "% done)  ";         }              public void bytesRead(int bytesRead)         {             totalBytesRead = totalBytesRead + bytesRead;                  if (100.00 * totalBytesRead > totalToRead)             {                 previou_percentDone = percentDone;                 percentDone = (int) Math.round(100.00 * totalBytesRead / totalToRead);                 if (previou_percentDone < percentDone)                 {                     long speed = 0;                     try                     {                         double TimediffInSecond = (System.currentTimeMillis() - starttime) / 1000;                         if (TimediffInSecond > 0)                             speed = Math.round(((totalBytesRead) / TimediffInSecond) / 1048576);                         else                             speed = totalBytesRead / 1048576;                          }                     catch (Exception e)                     {                         System.err.println(e.getMessage());                     }                 }             }                   }              public void done()         {             EndTime = System.currentTimeMillis();             session.setAttribute("percentageDone", 100);             session.setAttribute("speed", 100);         }              @Override         public void error(String message)         {             // System.out.println(message);         }              public long getUploadspeed()         {             return uploadspeed;         }              public void setUploadspeed(long uploadspeed)         {             this.uploadspeed = uploadspeed;         }          }      `EDIT` **:** 1> Why this `.tmp` file is generated for fields (textarea ,hidden,textfield) . How can we prevent this ? 2> i want to stop generating `.tmp` file for all field except where `type='file'`(file field) . 3> Otherwise, how can i delete this all `.tmp` file ?


title: Proper response for a REST insert - full new record, or just the record id value?

text: I'm building a REST API which allows inserts (POST, not idempotent) and updates (PUT, idempotent) requests to add/update database to our application. I'm wondering if there are any standards or best practices regarding what data we send back to the client in the response for a POST (insert) operation. We need to send back at least a record ID value (e.g. your new record is record #1234). Should we respond with the full object? (e.g. essentially the same response they'd get back from a "GET /object_type/1234" request) Should we respond with only the new ID value? (e.g. "{ id: 1234 }", which means that if they want to fetch the whole record they need to do an additional HTTP GET request to grab the full record) A redirect header pointing them to the URL for the full object? Something else entirely?


title: What's the meaning of "the Sun defect" and how does it differ from the more generic "NIH syndrome"?

text: I hear people talking about the "Sun defect", often giving the whole mess around logging as an example. How is it different from the not-invented-here syndrome, which means uselessly duplicating existing work?


title: Is Python suitable for a statistical modeling application looking over thousands of past events?

text: I'm currently working on a project with a partner where we analyze large datasets of past sporting events. There are approximately 30,000 events per year and we have historical data for five years. Thus, we're looking at analyzing 150,000 events. I wrote our first version in Python with a heavy reliance on Pandas (great tool, by the way). However, each time I add a "factor" or calculation to the process it slows down by quite a bit. Simply put, it can read all the various data files and data queries we need at a rate of 25-events-per-second. The problem is once I start working with the data, it drops fast. If I add a simple calculation, it drops to 24... and each calculation after that it drops again. With just 10-12 "factors" calculated from the data (we're not talking complex loops or anything crazy), it's now down to 6-events-per-second. ... and we're barely scratching the surface. At this rate, it'll take this thing days to work through all 150k events! I've optimized our data queries, flat file reads etc. Those really aren't the issue. I can live with doing 15-20 events per second. However, I can't live with such drastic slowdowns each time a new factor calculation is added. I've read a lot where Python as an interpreted language is slow etc., but my question to the experts out there - what language should this project be done in? **EXAMPLE...** One of the key "DataFrames" I am using through Pandas is fairly large. 350 rows x 70 columns, as an example. Even when trying to simply multiply one column's value by another...                data['value'] = data['col1'] * data['col2']      ...I see what I could consider significant drop in performance. It's very puzzling, and very frustrating. I understand this is a large set of data, but I can't believe this is anything so crazy that Python would be slowing to a crawl. If I just read the data files and do no calculations on them at all, it reads 67 events in 2.807 seconds. If I add one simple calculation where I execute code like the example above, it slows to 2.877 seconds. Based on our research, we're needed to add upwards of 100 calculations on the data.... so 7 seconds worth of slowdown? Seems too hard to believe.


title: I am developing an app for iPhone - does it matter which iPhone I buy?

text: It's a basic application - nothing majorly fancy (i.e. not a game) I have the option to buy iPhone 5 iPhone 5c iPhone 5s Just wondering if it matters which iPhone I buy to test out my App or should I just go for the most common? I guess the real question is do people see any bugs based on the phone type (less so the OS type).


title: Is IoC feasible in winforms?

text: I'm coming back into the winform world after being in the web world for a while. Is it common or otherwise feasible for developers to use IoC in winform? My concern is mainly with performance. I envision that I will need to "bootstrap" or initialize all my inverted items that are required by a given form instance on form initialization. If this initialization becomes expensive, I can push the task off to a thread, but that requires that I get the created objects back to the main thread where they will be used at some point.


title: How to fit requirements into MVC

text: Let's say we have a website requirement to allow User functionality. Simple! We create the UserModel, UserController and UserView. Works perfectly. However, let's assume that User has a `many-to-one` relational table connected to it titled `Child` which also has its own MVC components: ChildModel, ChildController, ChildView. Now if we had a requirement to create a CSV file for download containing a few details from the `User` and a few details from its `Child`, how would we go about designing this requirement? "DownloadCSV" could essentially have its own CRUD methods, it's own Controller, it's own View but its Model is based on the details from other tables, so should it have its own Controller, View, Model(/DB View) or should it just be another method besides CRUD in `User` or `Child` controller?


title: What are the benefits of using database abstraction by ORM?

text: I'm starting to use the ORM recommended by the framework I choose, and though I like the idea of the added layer of abstraction the ORM provides, I'm starting to realize what this really means. It means I'm no longer working with my database (mysql) and any mysql-specific features are gone, out the window, like they don't exist. The idea the ORM has is that it's trying to help me by making everything database agnostic. This sounds great, but often there is a reason why I choose a specific database system. But by going the database agnostic route, the ORM takes the lowest common denominator, which means I end up with the smallest set of features (the ones supported by all databases). What if I know that for the long term I won't be switching the underlying database? Why not access the database-specific features, too?


title: The design of a generic data synchronizer, or, an [object] that does [actions] with the aid of [helpers]

text: I'd like to create a generic data-source "synchronizer," where data-source "types" may include MySQL databases, Google Spreadsheets documents, CSV files, among others. I've been trying to figure out how to structure this in terms of classes and interfaces, keeping in mind (what I've read about) composition vs. inheritance and is-a vs. has-a, but each route I go down seems to violate some principle. _For simplicity, assume that all data-sources have a header-row-plus-data-rows format. For example, assume that the first rows of Google Spreadsheets documents and CSV files will have column headers, a.k.a. "fields" (to parallel database fields)._ _Also, eventually, I would like to implement this in PHP, but avoiding language-specific discussion would probably be more productive._ Here's an overview of what I've tried. * * * # Part 1/4: ISyncable               class CMySQL implements ISyncable         GetFields()     // sql query, pdo statement, whatever         AddFields()         RemFields()         ...         _dbh                    class CGoogleSpreadsheets implements ISyncable         GetFields()     // zend gdata api         AddFields()         RemFields()         ...         _spreadsheetKey         _worksheetId                    class CCsvFile implements ISyncable         GetFields()     // read from buffer         AddFields()         RemFields()         ...         _buffer                    interface ISyncable         GetFields()         AddFields($field1, $field2, ...)         RemFields($field1, $field2, ...)         ...         CanAddFields()  // maybe the spreadsheet is locked for write, or         CanRemFields()  // maybe no permission to alter a database table         ...         AddRow()         ModRow()         RemRow()         ...         Open()         Close()         ...      **First Question:** Does it make sense to use an interface, as above? * * * # Part 2/4: CSyncer Next, the _thing that does the syncing_.               class CSyncer         __construct(ISyncable $A, ISyncable $B)         Push()          // sync A to B         Pull()          // sync B to A         Sync()          // Push() and Pull() only differ in direction; factor.                         // Sync()'s job is to make sure that the fields on each side                         // match, to add fields where appropriate and possible, to                         // account for different column-orderings, etc., and of                         // course, to add and remove rows as necessary to sync.         ...         _A         _B      **Second Question:** Does it make sense to define such a class, or am I treading dangerously close to the "Kingdom of Nouns"? * * * # Part 3/4: CTranslator? ITranslator? Now, here's where I actually get lost, assuming the above is passable. Sometimes, two `ISyncable`s speak different "dialects." For example, believe it or not, Google Spreadsheets (accessed through the Google Data API "list feed") returns column headers _lower-cased and stripped of all spaces and symbols_! That is, `sys_TIMESTAMP` is `systimestamp`, as far as my code can tell. (Yes, I am aware that the "cell feed" does not strip the name so; however cell-by-cell manipulation is too slow for what I'm doing.) One can imagine other hypothetical examples. Perhaps even the data itself can be in different "dialects." But let's take it as given for now, and not argue this if possible. **Third Question:** How would _you_ implement "translation"? Note: Taking all this as an exercise, I'm more interested in the "idealized" design, rather than the practical one. (God knows _that_ shipped sailed when I began this project.) * * * # Part 4/4: Further Thought Here's my train of thought to demonstrate I've thunk, albeit unfruitfully:   1. First, I thought, primitively, "I'll just modify `CMySQL::GetFields()` to lower-case and strip field names so they're compatible with Google Spreadsheets." But of course, then my class should really be called, `CMySQLForGoogleSpreadsheets`, and that can't be right.   2. So, the _thing which translates_ must exist outside of an `ISyncable` implementor.   3. And surely it can't be right to make each translation a method in `CSyncer`.   4. If it exists outside of both `ISyncable` and `CSyncer`, then what is it? (Is it even an _"it"_?)   5. Is it an abstract class, i.e. `abstract CTranslator`?   6. Is it an interface, since a translator only _does_ , not _has_ , i.e. `interface ITranslator`?   7. Does it even require instantiation? e.g. If it's an `ITranslator`, then should its translation methods be `static`? (I learned what "late static binding" meant, today.) And, dear God, whatever it is, how should a `CSyncer` _use_ it? Does it "have" it? Is _it_ , _"it"_? Who am I? ...am I, "I"? * * * I've attempted to break up the question into sub-questions, but essentially my question is singular: **How does one implement an object`A` that conceptually "links" ( _has_ ) two objects `b1` and `b2` that share a common interface `B`, but where certain pairs of `b1` and `b2` require a helper, e.g. a translator, to be handled by `A`?** Something tells me that I've overcomplicated this design, or violated a principle much higher up. Thank you all very much for your time and any advice you can provide.


title: Should you write down a list of issues, or fix issues as they arise?

text: I have observed a strange trend in the company I work at. There are people who insist that there should be a list of tasks. They estimate those tasks, implement them, and try to meet their commitments. However, while they are coding, the requirements are likely to change. The priorities shift, the tasks increase or decrease, and the scope may just down right change, causing the whole work to get discarded. And then, there is another team, who meet issues and fix them as they arise. There are no estimates, there are no priorities, there are no set deadlines, and mission statements for sprints go something like, “Fix the bugs in the [insert subsystem name here]”. Now, which is the right way to go about being agile when you have technical sprints that focus only on stabilizing the system? Should you try and gather a list of issues, only to have them change, or should you try and fix-as-you-go, without saying when you’ll be done?


title: A* search for Sudoku

text: I have a homework problem for an Artificial Intelligence course that I am having trouble answering. > Consider solving the Sudoku problem using A* search. The start state has > some number of cells filled in, and the successors of each state are all > legal ways an additional cell can be filled in. At any time we know exactly > the number of cells that remain to filled. > > Therefore, if K cells remain to be filled at node n, we know that h(n) = K. > Thus if we set our heuristic function h(n) to be h(n)=K, we will have > perfect heuristic knowledge in A. > > Explain the mistake in the above statement. I understand that this heuristic is entirely pointless since if there was some function that could find legal successors you might as well run a depth first search but what exactly is wrong with the above statement.


title: Pre-screening coding test - How long is reasonable?

text: **EDIT** After a good amount of thinking and self-reflection on the topic, I realised that most of the issues I raised in this question was coming only from a personal, rather than a professional perspective. Hence the moderators put this question on hold because of the highly personal, subjective nature of the problem I tried to talk about. I was thinking about rephrasing the question but I could not really find a possible way to manifest the question in more objective way so it can be the subject of a discussion where answers can be back up with some sort of evidence or references. For the sake of those who are still interested, I am trying to give a summary of the discussion emerged from this question:   * a 4 hours pre-interview, offsite programming test is not usual but   * many people pointed it out that for some companies you would interview for much-much longer than that all together   * it is our personal decision if we take a test or not, and we can evaluate this based on our circumstances and the perceived benefits of getting hired for the company   * all companies are different, as people are, and it can be perfectly reasonable for a company to employ a longer pre-interview offsite test, if that is what fits their needs or circumstances I wanted my original question to be about how _reasonable_ to expect 4 hours from me, and how _ethical_ to give out a problem so the solution (not the code, but the design) can be possibly used for the company. As I can now see both of these questions can only (at best) be explored in a forum discussion, rather than using a question-answer type community tool like stackexchange. However, I found all your answers valuable and thanks for sharing. **ORIGINAL POST** I am interviewing for several positions, and most of them include a pre- screening phase where I have to submit a coding test before the telephone interview or the onsite interview would take place. I have pretty much got used to this idea, and find it quite reasonable that companies expect me to do this so they can check what type of work I can produce on my own. Generally, my experience is that these type of coding exercises are mostly small programming tasks. Do some logic, maybe implement a small algorithm, open a file and read/write data, stuff like that. Even the most simple task can be implemented with nice separation of logic, testable components, etc, to see how the candidate is coding, generally how well he is prepared for the type of job a company want to fill in. Recently I came across a company who sent me a coding test with a whole page long description of their exercise, asking me to solve a real life problem of their business (I don't want to say specifics to protect the company, but the test was pretty much about what they do). They described a pretty complex system to implement, included real data, and in the end they concluded that the coding test should not take more than **4 hours**. Is it reasonable from a company to expect me to spend 4 hours working on their dummy assignment in my free time, even before they would say hi to me? (the recruiter sent me the coding test) Don't get me wrong, I am motivated to find a new job and new challenges, but most companies expect me to spend maximum 1-2 hours on a task like that, and such tasks has always been far less complicated. What I came up as a conclusion with this company is that either: 1) My motivation is not good and probably they are looking for someone else 2) They do not respect their future employees to expect such a long coding tests to do even without saying hi to them 3) They just want to give out one of the problems they work on and see if there is an enthusiastic young fella who would solve it for them for free (again, don't get me wrong I am not a conspiracy theorist but I have heard such stories ...) How much do you think is reasonable for a company to expect candidates spend time on their dummy coding tests without talking to them? What is your experience generally?


title: What is the relationship between data structures and algorithms?

text: I have been searching for a good online course in data structures but have found that Google also returns results for algorithms courses, which say stuff like: > In this course you will learn several fundamental principles of algorithm > design: divide-and-conquer methods, graph algorithms, **practical data > structures (heaps, hash tables, search trees)** , randomized algorithms, and > more. [source] and > By the end of this class you will understand key concepts needed to devise > new algorithms for graphs **and other important data structures** and to > evaluate the efficiency of these algorithms. [source] and > This course provides an introduction to mathematical modeling of > computational problems. It covers the common algorithms, algorithmic > paradigms, **and data structures used to solve these problems**. [source] My question is: are algorithms and data structures intimately linked, meaning that they must be understood together or is one topic more foundational than the other? _EDIT: For those voting to close this question, can you please tell me why and maybe how to improve this one? Learning to ask the right questions is part of the educational process._


title: Release management with Azure and Visual Studio Online (Cloud TFS)

text: What strategy would you use to manage the releasing of versioned software to Azure cloud services (web and worker roles)? We are not looking for continuous integration. We are using Visual Studio 2013 and Visual Studio Online (Cloud TFS). At one point, we were releasing straight from Visual Studio using the Azure Cloud Project Publish tool. This is really bad practice in my opinion as you can never be sure what you are really releasing. Additionally, there is no automated control on the labeling or branching of code, or the running of unit tests and code analysis checks. Next, we employed Release builds on Visual Studio Online. Before deployment, one would edit the appropriate Build Definition (whether it be for Test or Production by and filling in the code label (under the "Get Version" build property) that is to be released. This would then get the appropriate code (by the label specified), build it, and release it to whatever cloud service is specified in the targeted Cloud Project profile (this is using the AzureContinuousDeployment.11.xaml template). There is still a degree of manual intervention involved. Also, the fact that a version of code is built every time before it is released is not ideal (as far as I understand it would be better if it was packaged once). Microsoft Release Management tools look ideal for the job, but are not supported with Visual Studio Online. Is there a better way of handling our releases?


title: The Written Roles of Chief Technology Officer

text: A follow up to this question: The Written Roles of Software Development Manager What is the role and what are the responsibilities of a CTO when it's done well, with particular reference to how it might pertain to a programmer with aspirations towards this sort of position? (Reason for asking - it's one potential career destination for programmers looking to move away from a purely hands-on role and for those with this sort of ambition it's worth knowing what it actually entails).


title: Converting event-based asynchrony to C#5 async

text: We currently have an interface for an asynchronous video decoder that runs on its own thread. Basically you feed it some data and it'll eventually call you back on its thread through some events, like so (not real code):               interface IDecoder {         void Decode(parameters);         event FrameReady;         event FrameDropped;         // lots of other possibilities     }      It's a bit messy and I'd like to convert it to a C#5, async-based version, something like:               interface IDecoder {         async Task<DecodeResult> DecodeAsync(parameters);     }      Where DecodeResult will have all the information that would have otherwise been transmitted via events, and the client code can be written cleanly with async/await rather than a mess of event handlers and thread dispatching. It is my understanding that Tasks are scheduled on the ThreadPool by default. We want all Decode operations to happen sequentially on a single, decoder- specific thread. Can this be achieved using Tasks, if so, how? Are Tasks even appropriate for this use or is there a more obvious pattern I'm missing?


title: Using dot to Access Object Attribute and Proper abstraction

text: I have been programming in python and Java for quite a number of years and one thing I find myself doing is using the setters and getters from Java in Python but a number of blogs seem to think using the dot notation for access is the pythonic way. What I would like to know is if using dot to access methods does not violate abstraction principle? If for example I implement an attribute as a single object and use dot notation to access, if I wanted to change the code later so that the attribute is represented by a list of objects, that would require quite some heavy lifting which violates abstraction principle.


title: Designing exceptions for conversion failures

text: Suppose there are some methods to convert from "X" to "Y" and vice versa; the conversion may fail in some cases, and exceptions are used to signal conversion errors in those cases. Which would be the best option for defining exception classes in this context?   1. A single `XYConversionException` class, with an _attribute_ (e.g. an `enum`) specifying the _direction of the conversion_ (e.g. `ConversionFromXToY`, `ConversionFromYToX`).   2. A `XYConversionException` class, with two _derived classes_ `ConversionFromXToYException` and `ConversionFromYToXException`.   3. `ConversionFromXToYException` and `ConversionFromYToXException` classes _without_ a _common_ base class.


title: Are C static libraries frowned upon?

text: There are 2 arguments for having shared libraries:   1. It helps reduce disk space.   2. When a shared library is updated, all the binaries depending on it get the update. There is mainly one drawback for shared libraries:   * They (can) introduce dependency hell. * * * On desktop computers, the 1st advantage doesn't really hold anymore. Wasting disk space isn't much of an issue these days. Having static binaries would allow us to get way better package managers -- I mean, the dependency hell would be a thing of the past. Adding a program would be just adding a binary; eventually a folder to let it handle its files. Deleting a program would be simply deleting this file. Dependencies? Gone. The 2nd advantage still stands, but I think the advantage of static binaries on desktop computers outweighs it. I mean, even new languages like Go compile all their binaries in spite of the shared libraries advantages, because of the convenience. * * * Since one of the main advantages of shared libraries is not a big deal anymore, are C static libraries are still frowned upon? If so, why?


title: Ruby on Rails Development Process

text: We are a small team that is about to start developing a localized version of a successful US web app in Korea, using RoR. Our question is: What process would you recommend we use to go about developing the app? Should we start with the data models? The views in HTML and then code them? Take a single feature, develop it and then add additional features as necessary? A few more details about the project:   1. it is a web app for small business owners   2. it includes the usual crm-reporting-dashboard-user admin-document mgmtfeatures that most small biz apps tend to have   3. team size is initially 2 people: a programmer and a designer/CSS guru (just one coder)   4. experience level is medium. good knowledge of Git, Ruby, Rails and XHTML/CSS, less experienced with deployment issues. this is the first project of its kind that we are doing together as a team


title: "Don't do programming after a few years of starting career". Is this a fair advice?

text: I am a little experienced developer having approximately 5 years experience in PHP and somewhat less in Java, C# and trying to learn some Python nowadays. Since the start of my career as a programmer I have been told every now and then by fellow programmers that programming is suitable for a few early years of a career (most of them take it as 5 years) and that one must change the direction after it. The reason they present include headaches and pressures associated with programming. They also say that programmers are less social and don't usually like to give time to their families, etc. and especially "Oh come on, you can not do programming your entire life!" I am somewhat confused here and need to ask others about it. If I leave programming then what do I do?! I guess teaching may be a good option in this case, but it will require to first earn a PhD degree perhaps. It may also be noteworthy that in my country (Pakistan) the life of a programmer is not very good in that normally they must give 2-3 extra hours in the office to accomplish urgent programming tasks. I have a sense that situation is somewhat similar in other countries and regions as well. Do you think it is fair advice to change career from programming to something else after spending 5 years in this field? UPDATE * * * Oh wow... I never knew people can have 40+ years of experience in this field. I am both excited and amazed seeing that people are doing it since 1971... That means 15 years before my birth! It is nice to be able to talk to such experienced people, we don't get such a chance here in Pakistan. * * * Thanks again for all the help and sharing. It has been a nice experience getting your thoughts on this.


title: Javascript simple code to understand prototype-based OOP basics

text: I know Javascript for some time, although I am not a heavy user, I know it the first from the time when Netscape was my browser. I pretty much understand the main things, but since JavaScript approach to OOP is prototypical I have some problem grasping it. One problem to add to this it seems that things can be done in more than one way, and here is where books don't help much because they put all the examples on the table making it hard to keep the pace. What I need for start is only one way of doing it, if someone can help me with the simplest code possible an example where I can see how the prototypal OOP model works? To be helpful the code should have an inherited object, to access a parent's property and its inherited properties and a parent's function, to overwrite a parent's function and and have an instance of a multiple inheritance where an object inherits two other objects.


title: Best practices for cloning bugs

text: I'm trying to think of a nice and easy way to do this, but I thought I'd run it past some people for a second opinion: Say you've got 8 clients (one project for each customer) and each project derives from a core project. If a bug is raised that has to be fixed in core, our current approach is to create a bug and clone it for each customer (using Bugzilla). A lot of developers are finding it time consuming to manually clone the bugs across all clients and ensure that they are placed on each release tracker per customer. I suppose this is a workflow problem, so does anyone have suggestions on the best way to handle cloning bugs for multiple customers? Perhaps Bugzilla isn't the best tool for this. Most of us believe that it can not be fully automated and will require some manual intervention regardless of what tool we use. One idea I did have was to create a single bug issue. If it is a core bug and when assigning it for one release, we don't mark it as completely resolved as it has not been tested for all client projects that stem from the core project. The problem with this is that I would need a way to link the single bug to all customers and have it know when to automatically set it to resolved once the last customer has had a release. I don't believe Bugzilla has such a feature. Any thoughts or ideas would be welcome.


title: Is JavaScript "write once run everywhere"?

text: I have a business requirement for a javascript "write once run everywhere" App. I did research and discovered that there are a few options between: FireFox OS, ChromeOS, NodeOS, Tizen, and Dart. What I do not know - is if 1) this software is truly capable of allowing a single website to be written once and exported to Hosted or Packaged Native Apps. 2) Can a single JavaScript Website really traverse device-platform as a Native App via this breed of JavaScript Operating System or not? 3) Is it simple, or is it painful? Has anyone seen a full implementation first hand in at least a test environment or production? Also - are the upsides expected or unexpected - and what are the downsides? Overall: is JavaScript write once run everywhere - or not? To the point it isn't 'Native' - I found these. Apple iOS7 JS first-class citizenship. Last month. http://fluentconf.com/fluent2014/public/schedule/detail/32624 It is called JavaScriptCore framework. I installed a FireFox OS Open WebApp with emulator. https://developer.mozilla.org/en-US/Apps/Quickstart/Build/Your_first_app I don't know what these are, but it was easy and it looks cool. Like a website packaged into a Native App. Has any one reviewed this class of JavaScript Architecture?


title: N-Tier MVC4 Web Application with console application

text: I've built an MVC web application and I need to run several tasks at different time intervals. So I've also made a console application to schedule these tasks through task manager in windows. For example, the application needs to send out an email every week summarizing the program's data. I've chosen to use the Nuget RazorEngine package to format the emails because I already have to show the same data on a webpage too, so by using the RazorEngine package, I can re-use my viewmodel for both the email and the UI of the web project (just use it in a template formatted for email instead of web). But therein lies the problem, the ViewModel is in the UI project. I don't think the right thing to do here is for my console application to take a dependency on my UI layer. The logical decision to me at first was "just make another layer, App.ViewModelBuilders (maybe also help me with a better name?), and take a dependency in both App.UI and App.ConTasks" But I've never seen that done before, so I'm not sure if that is a wise choice or not... Here's my current layers (projects) for the solution:   * App.DAL (No Dependencies - Unit of Work and Repository pattern)   * App.Service (Depends on DAL - uses DAL for business operations, such as getDataWithCondition() which returns the relevant objects (it's actually an IQueryable)   * App.UI (Depends on Service - gets the data back from service and runs it thru a ViewModelBuilder to map the business objects to the appropriate view model, and then renders a view using that view model)   * App.ConTasks (SHOULD depend only on service, but still needs ViewModels - uses data returned from service to render view formatted for email and send the email) What Layer should my View Models and View Model Builders go in?


title: How do I architect zip code & distance calculation functionality?

text: I am building an app using MVC 4/Razor and EF 4/ .NET 4 in which it is possible to search items by zip code and thus retrieving items only a certain distance from your current zip code. I have a class that calculates distance using census gazetteer files (zip, lat, and lon) and the Haversine formula. My specific problem deals with the SQL portion of my code. I have a view that uses a pager (20 results per page) and has hyper links that order the columns in asc and desc order. I also have 3 drop down lists that can further filter the results down: Manufacturer, Category, Distance. When I am filtering by say 50 miles my class retrieves an IEnumerable of zipcodes that are within the requested distance. At times this can be in the 10,000 - 30,000 area. Each `Item` object contains an `int ZipCode` ![Relationships](http://i.stack.imgur.com/OQRfd.jpg) The problem EF generates when I try to grab item objects from the database using a list of acceptable zip codes is _One of your queries is too deeply nested. Try breaking them up_. I am assuming that it is because you can not have a where clause with thousands of conditions. This makes sense. I had found a link a few days ago that basically dealt with creating a temporary table to use as the list in the where condition but can not find the link anymore. It also applied to raw ADO.NET as opposed to EF. **My question is basically, how can I implement the functionality that I want without having make huge changes?**                using (var context = new JDMExchangeEntities())             {                      var results = context.Items.Include(P => P.Manufacturer).Include(P => P.Category)                     .Include(P => P.VehicleMake).Include(P => P.VehicleModel).Include(P => P.VehicleYear);                               //Category logic                 if (!string.IsNullOrEmpty(Categories))                 {                     results = results.Where(P => P.Category.Name == Categories);                 }                      //Manufacturers logic                 if (!string.IsNullOrEmpty(Manufacturers))                 {                     results = results.Where(P => P.Manufacturer.Name == Manufacturers);                 }                      //Vehicle logic                 if (Vehicle > 0)                 {                     results = results.Where(P => P.YearId == Vehicle);                 }                      if (acceptableCodes.Count > 0)                 {                     List<int> codes = acceptableCodes.Keys.ToList();                     results = results.Where(P => codes.Contains((int)P.ZipCode));                              //return _UoW.tblcoursebookingRepo.All        //.Where(cb => AttendanceIDs.Contains(cb.Attended))        //.ToList();                 }                 ////Take out items that are not in the ManualQueryResults Dictionary                 //if (!String.IsNullOrEmpty(ManualQuery))                 //{                 //    var all = listB.Where(b => listA.Any(a => a.code == b.code));                 //    results = results.Where(r => ManualQueryResults.Any(a => a == r.id));                 //}                      ////Take out zips not in the closeCodes variable                 //if (!string.IsNullOrEmpty(DistanceLimit))                 //{                 //    results = results.Where(P => closeCodes.Any(z => z.ZipCode.Code == P.ZipCode));                 //}                      switch (sortOrder)                 {                     case "Price_desc":                         results = results.OrderByDescending(P => P.Price);                         break;                     case "Price":                         results = results.OrderBy(P => P.Price);                         break;                     case "Date_asc":                         results = results.OrderBy(P => P.PostDate);                         break;                     default:                         results = results.OrderByDescending(P => P.PostDate);                         break;                      }                 int pageSize = 20;                 int pageNumber = (page ?? 1);                           IPagedList<Item> cc = results.ToPagedList(pageNumber, pageSize);      I could call `.ToList()` somewhere before I hit the `.ToPagedList()` but then I will be returning back thousands of entries and thus lagging the response time by a few seconds. After that I could easily make a paged list from the IEnumerable list. I want to try and minimize response time and so I think the area I need to fix is in the SQL code so as to not pull unnecessary data and then filter it out.


title: Balance between "right tool for the job" and familiarity

text: So when choosing what language to use for a project, in an ideal world the language is chosen because it's the right tool for the job. However, I often prefer to use a language that I am _fluent_ in rather than one I would have to learn or that I am only conversational in. Of course language fluency also entails knowledge of the applicable libraries in the language. Just because I really like a fairly general-purpose language like Java doesn't mean I should always use it, but at the same time it doesn't mean I should break out something like Perl every time there's some text processing to be done. How does one find the balance here?


title: What is the best way to approach visualization projects?

text: I work on several areas related to information visualization, linked data, computer vision and other stuff, so mainly front-end. I am not really happy with the fact that visualizations take lots of iterations and lots of time from first prototype to production ready code. So here is the question: what can I do to improve that? Sometimes we do a prototype in few hours, add something, do another prototype, rewrite it to use jQuery instead of Prototype because it's a better fit and so on and so forth, but almost all visualizations go trough 15-20 iterations (sometimes taking up to few months of development time - the code will also go from the 300 lines of the initial prototype to 2000 or 3000 lines due to evolving requirements and iterations). Since I am working at multiple projects, from my point of view the fact that sometimes it can take months is not a problem, just that I am not really happy, as I could do 40 visualizations per year instead of 15 for example, if I would only be able to improve this process by reducing the number of iterations or by any other means. If somebody with a higher score wants to add information visualization to tags and edit my question after, I would not mind. Best regards!


title: Software development life cycle in the industry

text: I am taking a module called "Requirements Analysis & Design" in a local university. Common module, I'd say (on software development life cycle (SDLC) and UML). But there is a lot of things I wonder if they are actually (strictly) practiced in the industry. For example, will a domain class diagram, an not anything extra (from design class), be strictly the output from Analysis or Discovery phase? I'm sure many times you will think a bit about the technical implementation too? Else you might end up with a design class diagram later that is very different from the original domain class diagram? I also find it hard to remember what diagrams are from Initiation, Discovery, Design etc etc. Plus these phases vary from SDLC to SDLC, I believe? So I usually will create a diagram when I think will be useful. Is it the wrong way?


title: What are the benefits of using geospatial datatypes?

text: We currently store points as three floats (lat,lon,alt) and support only one type of query (points within a given radius) but look forward to support more queries. We are using PHP and MySQL. What are the benefits of using geospatial types?


title: Is it reasonable to concentrate on one topic of CS for one semester at university?

text: As usual, I need to do courses from several different areas of Computer Science for my Master's degree. I'll focus on Algorithms, Theoretical Computer Science (Computability and Complexity, the foundations,...) and Parallel/High Performance computing plus maybe a bit of Programming Languages at the side. To finish in time, I have to do 5-8 courses per semester. Is it reasonable to focus on one topic per semester? E.g., I'll do about 5 courses on Algorithms. My assumption is that if I do all of these in one semester, I'll get a deeper understanding of the topic. Or would it be more beneficial for me to do 1-2 courses form each area per semester?


title: Breaking 1NF to model subset constraints. Does this sound sane?

text: My first question here. Appologize if it is in the wrong forum but this seems pretty conceptual. I am looking at doing something that goes against conventional wisdom and want to get some feedback as to whether this is totally insane or will result in problems, so critique away! I am on PostgreSQL 9.1 but may be moving to 9.2 for this part of this project. To re-iterate: Does it seem sane to break 1NF in this way? I am not looking for debugging code so much as where people see problems that this might lead. # The Problem In double entry accounting, financial transactions are journal entries with an arbitrary number of lines. Each line has either a left value (debit) or a right value (credit) which can be modelled as a single value with negatives as debits and positives as credits or vice versa. The sum of all debits and credits must equal zero (so if we go with a single amount field, sum(amount) must equal zero for each financial journal entry). SQL-based databases, pretty much required for this sort of work, have no way to express this sort of constraint natively and so any approach to enforcing it in the database seems rather complex. # The Write Model The journal entries are append only. There is a possibility we will add a delete model but it will be subject to a different set of restrictions and so is not applicable here. If and when we allow deletes, we will probably do them using a simple ON DELETE CASCADE designation on the foreign key, and require that deletes go through a dedicated stored procedure which can enforce the other constraints. So inserts and selects have to be accommodated but updates and deletes do not for this task. # My Proposed Solution My proposed solution is to break first normal form and model constraints on arrays of tuples, with a trigger that breaks the rows out into another table.               CREATE TABLE journal_line (         entry_id bigserial primary key,         account_id int not null references account(id),         journal_entry_id bigint not null, -- adding references later         amount numeric not null     );      I would then add "table methods" to extract debits and credits for reporting purposes:               CREATE OR REPLACE FUNCTION debits(journal_line) RETURNS numeric     LANGUAGE sql IMMUTABLE AS $$     SELECT CASE WHEN $1.amount < 0 THEN $1.amount * -1 ELSE NULL END; $$;          CREATE OR REPLACE FUNCTION credits(journal_line) RETURNS numeric     LANGUAGE sql IMMUTABLE AS $$     SELECT CASE WHEN $1.amount > 0 THEN $1.amount ELSE NULL END; $$;      Then the journal entry table (simplified for this example):               CREATE TABLE journal_entry (         entry_id bigserial primary key, -- no natural keys :-(         journal_id int not null references journal(id),         date_posted date not null,         reference text not null,         description text not null,         journal_lines journal_line[] not null     );      Then a table method and and check constraints:               CREATE OR REPLACE FUNCTION running_total(journal_entry) returns numeric     language sql immutable as $$     SELECT sum(amount) FROM unnest($1.journal_lines); $$;          ALTER TABLE journal_entry      ADD CONSTRAINT CHECK (((journal_entry.running_total) = 0));          ALTER TABLE journal_line     ADD FOREIGN KEY journal_entry_id REFERENCES journal_entry(entry_id);      And finally we'd have a breakout trigger:               CREATE OR REPLACE FUNCTION je_breakout() RETURNS TRIGGER     LANGUAGE PLPGSQL AS $$      BEGIN        IF TG_OP = 'INSERT' THEN           INSERT INTO journal_line (journal_entry_id, account_id, amount)           SELECT NEW.id, account_id, amount             FROM unnest(NEW.journal_lines);           RETURN NEW;        ELSE           RAISE EXCEPTION 'Operation Not Allowed';        END IF;      END;     $$;       And finally               CREATE TRIGGER AFTER INSERT OR UPDATE OR DELETE ON journal_entry      FOR EACH ROW EXECUTE_PROCEDURE je_breaout();      Of course the example above is simplified. There will be a status table that will track approval status allowing for separation of duties, etc. However the goal here is to prevent unbalanced transactions. Any feedback? Does this sound entirely insane? # Standard Solutions? In getting to this point I have to say I have looked at four different current ERP solutions to this problems:   1. Represent every line item as a debit and a credit against different accounts.   2. Use of foreign keys against the line item table to enforce an eventual running total of 0   3. Use of constraint triggers in PostgreSQL   4. Forcing all validation here solely through the app logic. My concerns are that #1 is pretty limiting and very hard to audit internally. It's not programmer transparent and so it strikes me as being difficult to work with in the future. The second strikes me as being very complex and required a series of contraints and foreign keys against self to make work, and therefore it strikes me as complex, hard to sort out at least in my mind, and thus hard to work with. The fourth could be done as we force all access through stored procedures anyway and this is the most common solution (have the app total things up and throw an error otherwise). However, I think proof that a constraint is followed is superior to test cases, and so the question becomes whether this in fact generates insert anomilies rather than solving them. If this is a solved problem it isn't the case that everyone agrees on the solution....


title: Looking for tips on managing complexity with SCM repositories

text: I am a solo developer in my department and I have a lot of individual projects, all created and managed by me. I started using SVN at ProjectLocker via Versions on the Mac a couple years ago when the variety of projects started getting unwieldy. _Scenario 1_ : Now I have a process that is of reasonable complexity it can be broken up into multiple smaller applications and they all share files. In one phase, there is a single shared file—a constants file—that is shared between a Cocoa app and an iPhone app framework. In the second phase, the iPhone app framework will be used to create individual apps of the same ilk—controller classes and what not will all be the same—but with different content in each. The problem that I am running across is that the file in the first phase is in one repository with the application that started it, and the app framework is in a second, separate repository. _Scenario 2_ : I have another application framework that partially relies on code from an open source project. This is all internal, non-commerical work, but again, the application framework is going to be used to create a variety of unique products and processes. So, now I have an internally managed repository and an externally managed one out of my control. I make little changes to the open source code to meet the needs of my framework when there is an update I download, but I never commit back into the external repository (though, now that I think about it, I don't think I'm committing it to mine either. Oops). **The Problem** I have all of this set up on my production Mac quite nicely, but duplicating and subsequently maintaining that environment on my laptop has been challenging. For Scenario 1, I've thought of merging these two projects together into the same repository because they are, for all intents and purposes inextricably linked. But, Scenario 2, I think I'm stuck just managing files as best I can. **The Question** I'm wondering if anyone has any tips on how to manage either of these situations, as well as other complex SCM scenarios when it comes to linking various files from various repositories together. My familiarity with SVN only comes from my work with Versions. It's been great, but I'm a little out of my depth here.


title: Number of lines of code in a piece of software

text: Our manager has asked for a report on on the number of lines of code in our software. What should we do?


title: What are some good Object Oriented Design (OOD) interview questions?

text: I'm looking to prepare for a job interview and I wanted to go over some good Object Oriented Design (OOD) questions. Here are some of the OOD concepts that should give a good starting point:   1. inheritance    2. multiple inheritance    3. encapsulation    4. abstraction   5. composition    6. polymorphism    7. overriding polymorphism Would you please suggest any other OOD question(s)/topics that should be reviewed?


title: Benefits of porting C library to C++

text: Say we take any C library such as libpng or libvorbis and convert it so that it compiles as C++ (only the minimum changes to make it compile as C++ code). Can the compiler do extra optimizations when its C++ code? Is there **any sort** of benefit to be gained by porting the code to C++? What are the downsides that might cancel out these benefits?


title: Confused about implementing Single Responsibility Principle

text: Please bear with me if the question looks not well structured. To put you in the context of my issue: I am building an application that invoices vehicles stay duration in a parking. In addition to the stay service there are some other services. Each service has its own calculation logic. Here is an illustration (please correct me if the design is wrong):               public abstract class Service     {        public int Id { get; set; }        public bool IsActivated { get; set; }        public string Name { get; set }        public decimal Price { get; set; }     }          public class VehicleService : Service     {           //MTM : many to many        public virtual ICollection<MTMVehicleService> Vehicles { get; set; }     }          public class StayService : VehicleService     {          }          public class Vehicle     {        public int Id { get; set; }        public string ChassisNumber { get; set; }        public DateTime? EntryDate { get; set; }        public DateTime? DeliveryDate { get; set; }        //...        public virtual ICollection<MTMVehicleService> Services{ get; set; }     }      Now, I am focusing on the stay service as an example:   I would like to know at invoicing time which class(es) would be responsible for generating the invoice item for the service and for each vehicle? This should calculate the duration cost knowing that the duration could be invoiced partially so the rule is as follows: not yet invoiced stay days * stay price per day. At this moment I have InvoiceItemsGenerator do everything but I am aware that there is a better design.


title: Search Substring in String collection

text: I have a big collection of strings _a[1], …, a[N]_ where _N_ is about several millions. I am provided a string _m_ and I need to iterate over all the strings _a[i]_ that contain _m_. In other words, I need to find all the strings _a[i]_ having _m_ as substring. What would be the most efficient data structure for that problem? I need to be very careful with memory as I am working with a big number of strings.


title: What do these cocoonJS terms of use mean

text: I was looking at the terms of use for CocoonJS and noticed this section > License Grant. By uploading User Content via the Services, you expressly > grant, and you represent and warrant that you have a right to grant, and do > so grant, to Ludei, a royalty-free, non-exclusive, worldwide license to use, > reproduce, modify, publish, list information regarding, edit, translate, and > make derivative works of all such User Content and your name, voice, and/or > likeness as contained in your User Content, if applicable, in whole or in > part, and in any form, media or technology, whether now known or hereafter > developed, solely for use in connection with the Services. I am not too clear on the legal jargon, but to me this sounds like I'm basically giving someone unrestricted access to any intellectual property that I have submitted to their servers, and the ability to use my identity in any form as they wish. Can someone clarify what the excerpt means?


title: long lines in git or svn

text: I am coding a program which has persistent data (the MELT monitor, related to GCC MELT). The data is persistent because it is expected to be read and overwritten by most executions. (That data is in particular made of abstract syntax trees) Currently, this persistent data is an Sqlite database. Of course, I am backing up it in textual format, obtained by sqlite dump, and I want to manage this textual dump with a version control system (probably git, but perhaps also subversion ....). Unless I take special precautions, these SQL dumps will probably have quite long lines (e.g. several dozens of kilobytes). Wide SQL columns would probably contain JSON text of many kilobytes. Would `git` (and `svn`) be more happy with shorter lines (in particular would they perform slower with long lines, or have repositories using much more disk space)? I'm probably not mostly interested in the `diff` commands (e.g. `git diff` or `svn diff`), because I expect that using them for such textual dump is not very interesting for the human developers. I am coding the persistency routines, so I am able to change slightly the format (e.g. to add newlines in some JSON text, which `sqlite3 dump` is dumping verbatim). If you are curious, my current code snapshot is on http://starynkevitch.net/Basile/monimelt-bgc-21apr2014.tar.bz2 and contains a `state-monimelt.sql` dump file (which will of course become much larger, perhaps near or above a megabyte)


title: Extreme Programming for a single developer

text: I've been working with some basic extreme programming concepts for the last two weeks, for a small scale, for-profit, multiplayer, arcade game. I've spent a week developing user stories and determining requirements to create a release plan. I've also spent a week coding and applying the first iteration plan I came up with. I've identified a few of the obviously useful concepts for a single developer.   * Continuous Integration   * Never Add Functionality Early   * Test Driven Development   * Choose a System Metaphor   * Use a single Integration Point   * Test out all bugs   * Constantly refactor   * Set a sustainable pace   * Simplicity   * Frequent Releases I'm curious if I'm missing anything in particular that might be suited to working with a single developer project? Also, in this light given the idea of simplicity and test driven development, is it better to use established, feature-rich, ready made platforms? Or should I work from the ground up, when feasible, to avoid running into the issues presented with rules such as constantly refactoring and never adding functionality early?