title: Why do Git users say that Subversion does not have all the source code locally?

text: I'm only going on what I've read on SO, so forgive me, but all I read says that one major advantage of Git over Subversion is that Git gives all the source code to the developer locally, not having to do anything on the server. With my limited using of SVN and TortoiseSVN, I had all the source code, or at least I thought I did. For example, I have a website. I upload it to SVN. I am still running my website locally, aren't I? If someone submits a change and I'm not connected, it wouldn't matter if I had Git or not, until I reconnect to the server. I do not understand. I'm not asking for a rehash of one vs. the other except this one point.


title: "Sensitive Data" clause in Bitbucket's Customer Agreement

text: I'm using Bitbucket for a few projects, but as of April 28, 2014 they will replace their End User Agreement with a new Customer Agreement. The new agreement mentions in 7.7.2: " _You will not submit to the Hosted Services ... any personally identifiable information_ " One of my projects clearly contains such information, and I'm now trying to figure out what to do. These are the three possible options I could come up with:   1. I may keep all existing projects and continue to work with them, as long as no new patch involves sensitive data. This is under the assumption that what I have done so far has been in accordance with the current agreement, and that the new agreement only concerns information submitted after April 28.   2. I have to remove that particular project, but may keep the others. This seems likely if 7.4 in the new agreement means that any data that have been submitted to the "Hosted Services" will be treated equally, regardless of under which agreement it was submitted: _" **Your Data** " means any data, content, code, video, images or other materials of any type that you upload, submit or otherwise transmit to or through Hosted Services._   3. I have to terminate the agreement, and thus remove my account and all of my projects. This is a possible interpretation if the continuation of 7.4, about the company's right to _"collect, use, copy, store, transmit, modify and create derivative works of Your Data"_ , means that they can still do whatever they want, even with data that were submitted under the terms of an older agreement and have since then been removed.


title: Who has right over the code that comes from contributions in an open source project?

text: If somebody starts an open source project (for example with a GPL license) where people will make contributions, than who will own these contributions in the level of the whole project? Will the new code become the property of the original author or the contributors will be authors too? Who has the right over the ongoing project? For example who has the power to release the code in a second license? The original author only? Can the contributors separately do that as well, or do they have to make a joint decision with the original author and all of the contributors?


title: Copyright Laws for Apps

text: For my app that I'm about to release, I have used a bunch of 3rd party classes found for free online. I checked all the liscenses before using the code and each one said I could use the code commercially So now what I'm concerned about is do I have to give credit somewhere in my app to the creater of that class? Also, I plan on having my app be free, but if in the future I charge for it, does that change things? The most common license I see in an MIT License: > Permission is hereby granted, free of charge, to any person obtaining a copy > of this software and associated documentation files (the "Software"), to > deal in the Software without restriction, including without limitation the > rights to use, copy, modify, merge, publish, distribute, sublicense, and/or > sell copies of the Software, and to permit persons to whom the Software is > furnished to do so, subject to the following conditions: The above copyright > notice and this permission notice shall be included in all copies or > substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", > WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED > TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND > NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE > LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF > CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE > SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. The part I'm unsure about is: > The above copyright notice and this permission notice shall be included in > all copies or substantial portions of the Software. Is it enough for this license to be at the top of the class file embedded in the binary, or do I have to make it literally accessible to the user? Of course I'm not asking for expert legal advice, but any help would be appreciated.


title: ASP vs javascript vs jQuery vs User Controls vs AJAX

text: Increasingly when developing sites I find myself utilising more client side technologies such as Javascript, jQuery and AJAX. For three different pages I measured the size of the HTML sent to the browser (excluding images and CSS). What I found was:   * A page that has normal ASP.NET controls + a little bit of jQuery: approx. size = 30kb    * A page using some user controls that have AJAX and client side support: approx size = 50kb   * A page that uses more complex user controls from a library with heavy client side support: approx. size = 110kb  As you can see the size of data transferred seems to increase as client side support and AJAX features are added. This adds to the bandwidth requirements of the site and presumably the servers I/O load which may reduce the number of concurrent users that can be served. Should I worry about balancing rich client side features and interactivity with server's load and bandwidth use? What are the priorities, if any?


title: Should HTTP Verbs Be Used Semantically?

text: If I'm making a web application which integrates with a server-side backend, would it be considered best practice to use HTTP methods semantically? That is, for example, if I'm fetching data (e.g., to populate a menu, etc.), I would use GET, but to update data (e.g., save a record), I would use POST. (I realise there are other methods that may be even more appropriate, but we need to consider browser support.) I can see the benefits of this in the sense that it's effectively a RESTful API, but at a slightly increased development cost. In my previous projects, I've POST'd everything: Is it worth switching to a RESTful mindset simply for the sake of best practice?


title: Why additional code and complexity when data model and interaction are simple is considered a disadvantage in MVC model

text: According to the slides given by my lecturer, one of the disadvantages of MVC model is > additional code and complexity when data model and interaction are simple Why is this so, I would assume it would make no difference since data model and interaction are on two different components of the MVC model?


title: Frameworks/methodologies for documenting functional/use case scenarios and mapping them to code base

text: Is there an established framework or methodology for documenting functional or use cases and mapping them to units of code? E.g. assume you are a new developer hire assigned to work on an application. What better way to get up to speed would there be than going through a list of that application's features or functional case scenarios, i.e. what all you can do with the application? For example, let's take Evernote (my favorite SaaS) as an example:   1. Successfully log in (duuhh, but still technically a use case)   2. Fail to log in (what happens next)   3. Create some notebooks   4. Create a basic, text only note   5. Move the note from one notebook to another   6. Create a note with media attached   7. Delete a note   8. Share a note publicly through a fixed URL etc. Now, that is simple. But what I would like to be able to do is have a way to map each one of those items to the pieces of code that utilize it. That way, when inspecting or learning or reverse engineering the code base, you could (provided that the documentation is up to date) easily trace a function, method, script, HTML document, REST service, servlet etc. to all the functional cases that utilize it and are affected by it.


title: Will we go back(?) to fixed-point arithmetic in the near future?

text: As far as I recall, this has been the ongoing trend of the past, I'm just a student, so I might be wrong:   * Long ago: Integer numbers and calculations. Very precise, however cannot present a big range.   * At a later point: Added single-precision floating point numbers (`floats`), and also added FPU's which are incredibly fast at calculating with them.   * Quite recently(?): Double-precision floating point numbers (`doubles`) are starting to become more common. For example in OpenGL Shader Language they are steadily introducing more and more methods that work with doubles natively. I think they are also working on FPU's for doubles? But also there has been a change to 64-bit processing a few years ago, so I've got a few questions:   * Are there more options now to calculate with fixed-point numbers (maybe two int64 registers?)?   * Why are there, as far as I know, no specific units for fast integer calculation with respect to fixed-point numbers? Maybe most of what I'm saying does not make much sense, but I think the question remains valid. Is there a switch we switch to fixed-point arithmetic in the near future?


title: New Silverlight app. MVVM. RIA Services vs CSLA

text: Another 2 days of reading and watching demos and here we go. For my enterprise LoB Silverlight app I'm going to use:   1. Prism for UI aspects and modularity.   2. MVVM pattern (using Prism)   3. ??? to bring data over and validations...   4. Entity Framework for Data access   5. SQL Server for data Ok, main dilemma is #3. If I won't use any framework then I will have to figure out how to do all CRUD stuff myself. I can do RESTful WCF, I can do SOAP. All that == MANUAL coding. I can do RIA Services. I kind of see what it does and it is nice for direct match with my data layer BUT it is not that great if there will be lot of business logic. Where would I put it? In my ViewModel? Another question is how those services maintained. Once I generated it - I should maintain them by hand if data changes? I also found CSLA which seems to be nice on one hand but receives lot's of critique.. CSLA will allow me to write business logic and shape object as I needed and than I can pass it "through" ViewModel and all is well. Something tells me that RIA Services will be much quicker to write. Also, I like the fact that I don't have to include extra dependencies. There is no blogs or mentioning of RIA Services since 2010. Is it going under table? Not widely accepted? Not scaling well for big apps? I'm trying to decide which one I need to bet on. CSLA or RIA Services. OR?


title: Price Comparison Database Scema

text: I have a bunch of data from multiple retailers. Each product that each retailer sells may or may not be sold by another retailer in the database. If multiple retailers sell the same product, then the product can be identified by a SKU. I currently have 1 database for each retailer. I'm having a problem trying to conceptualize an appropriate database schema to identify how many retailers are selling the same product. Should I have 1 table with all retailers?


title: Crucial programming-for-hire contract points?

text: **What are some important and easily-overlooked points that should be in a programming-for-hire contract?** We recently had a learning experience as a client hiring a programming company: in the contract we signed, there was no mention of billing practices such as   * Minimum billable unit. A 5 minute phone call was billed as 1 hour.   * Division of work. If two contractors at the company worked on something in the same day they had their hours billed _and rounded up_ separately.   * What kinds of things were billable. We were billed for them to "install Visio" even though we'd asked them to use it on our VPN-accessible terminal server). We prefer learning from _other_ people's experiences rather than our own, thus hope to get the community's ideas about other important points we might be missing. I am interested in both sides of the coin as I have been and will again be a contract programmer myself, even though at this time I'm thinking of it more for my company's hiring needs. So points important for both the client and the contractor are welcome.


title: Self taught programmer seeking advice

text: I need some general advice on how to continue my programming studies. I'm a self taught programmer and I picked up programming somewhere in the fall of 2011. I began with C++ and Java books and I learned everything up to OOP (except memory handling in c++). I later decided that I wanted to work with web-development so I learned the PHP syntax and started my first project in the summer that resulted in http://doostr.com (obviously work in progress) The main reason why I started the project was that I would be forced to solve different kind of problems that I knew I would face along the way. I learned about relational databases and designed my own tables in MySQL (third normalization form), learned SQL logic and functions, became more fluent in programming by extensively utilizing basic programming tools (variables, loops, arrays, functions, classes), PHP native functions, MVC, Javascript (jQuery library) and the basics of CSS/HTML. I've used twitter-bootstrap as a base for design since I wanted to speed up the design and focus on programming. Now I feel like I'm just iterating through things that I've learned before. I feel like I need to come in contact with more experienced programmers in a professional developing environment that I can learn more from so I'm preparing myself for applying for a backend programmer trainee job (unpaid) and use my project as a resumé (I dont have a computer science degree). I need some general advice from working professionals on how I not only should prepare myself considering what I want to work with, but also how I should continue my programming/developer path generally. I've asked a friend that works with java and he said that I should find a good design patterns books. You guys have any good suggestions? Any other language that would be good to combine with PHP/MySQL? I know Java/C++ syntax. I'll take any advice you might have. You can go to my site, create an account and test the functionality and it might give you a hint of what I'm capable of. Thanks for reading.


title: Expensive AOT Optimizations

text: I've seen it stated several times that AOT can run some more expensive optimizations that take too long to be used by a JIT. But I've never seen it stated what exactly these optimizations are. So I'm wondering, what are these optimizations?


title: Fastest Haskell library sort implementation

text: I am implementing an application in Haskell and, for sorting, I use the library function `Data.List.sort`. However, I was wondering whether this is the fastest sort implementation in the Haskell standard library (perhaps lists are not the best choice for efficient sorting). I have found different alternatives, e.g. heap sort on arrays, sort on sequences (but the documentation does not say what kind of algorithm is used). My question is: what is the fastest sorting implementation (container type + sort function) provided by the Haskell standard library? Is there some documentation page listing all library sort functions and comparing them wrt performance? **EDIT** To provide some more context, I am running a benchmark. I have written a simple program in C, Java, Python and Haskell that   1. Reads 1000000 strings (lines) from a text file.   2. Sorts the strings using a built-in (library) sorting algorithm.   3. Writes the sorted list of strings to a file. For each implementation, I only measure the sorting time (leaving out the time needed for disk IO). Running the benchmark on Ubuntu 12.04, I get   * C (gcc 4.6.3, `qsort` on `char **`): 0.890 s   * Java (OpenJDK 64-Bit 1.7.0_09, `Collections.sort()` on `java.util.LinkedList<String>`): 1.307 s   * Python (Python 2.7.3, `list.sort()`): 1.072 s   * Haskell (GHC 7.4.1, `Data.List.sort` on `[Data.ByteString.UTF8.ByteString]`): 11.864 s So I wonder if there is another data type / library function in Haskell that can give better performance.


title: Using MVC in a Java app

text: I need to write a cross-platform GUI application to process (in multiple threads) and visualize fairly large quantities of data. Ideally the application should be relatively fast and look good. The app's interface will consist of a table widget, a tree widget, and a custom figure-drawing widget. The user will be able to modify the data from any one of these widgets and the changes should be immediately reflected in the other widgets. Naturally, I am planning to use MVC. However, I normally do all my GUI programming in C++/Qt, and have very limited exposure to Java. So I would really appreciate any advice on how to organize such an app in Java. In particular, should I use Swing or JavaFX? Which widgets would you pick for the job? Could you recommend any books/online tutorials that cover these aspects of the Java platform? I will greatly appreciate any feedback. Thanks! (this question was originally posted on Stack Overflow, but this site was suggested as a more appropriate place to ask it)


title: Is it better to use $filehandler or FILEHANDLER?

text: It seems like FILEHANDLER is more commonly used as a handler naming convention than $filehandler. But it can give a bareword error if one forgets to use *FILEHANDLER in some constructions. What are advantages and disadvantages of HANDLERS and $handlers? Which naming convention is a better practise, and why?


title: C# server side application 100 GB dataset + Garbage Collection

text: If I have server with 256 Gb of ram. I was wondering can I create a C# application which has a 100 GB of memory footprint? I want to create a dictionary like               Dictionary<DateTime,Dictionary<string,Dictionary<string,DataClass>>                    Fist dictionary     DateTime - Max 40 distinct values          Second Dictionary     string : 2000 distinct values          Third dictionary     string : 100 distinct values      Object will be removed from the DateTime part (after every say 1 hour), till 1 hour, various internal members are populated. With Java I am told even if the server has large memory, JVM will stall because of GC.


title: Is PHP the only popular language that mixes simple and associative arrays into a single type?

text: I'm doing a research on PHP and wondering if there any other commonly used programming langues that use an associative array for both simple indexed element storage and key-value functionality. Does it make PHP unique in this sense? For example, a language like C# distinguishes clearly between a simple array and a map\dictionary\hash               T[] array = new T[];     Dictionary<T, S> map = new Dictionary<T, S>();      Meanwhile PHP makes no such distinction (at design time)               $array = array(1, 2, 3);     $map = array("one" => 1, "two" => 2, "three" => 3)


title: Has anyone attempted to create a system which uses e style capabilities in Javascript?

text: The object level capabilities that show up in E seem like an interesting addition to the Javascript language, especially considering the security issues that Javascript programs face. Has anyone tried implementing an object- capability type security system in Javascript, or by modifying a javascript VM?


title: Why did an interviewer ask me a question about people eating curry?

text: I had an interview question once which went... Interviewer: "Could you tell me how many people will eat curry for their dinner this evening" Me: "Er, sorry?" Interviewer: "Not the _actual_ number just an estimate" I actually started to stumble my way through it, when I stopped and questioned what it had to do with anything about the job. The interviewer mumbled something and moved on. I guess the question is, what is the point in the ridiculous questions? I just don't understand why they started coming up with these things.


title: A Programmers Version of Pygmalion

text: How long would it take and what resources would you need to train someone right out of high school and make them a 'technically' employable programmer? Granted they may not be mature enough to pass many inteviews, have the required time-based or domain experience.


title: How to build a team of people not working together?

text: I am in charge of a group of about 30 software development experts and architects. While these people are co-located in the companies organization chart, they do not really feel as a team. This is due to their work enviroment: 1) The people are spread over eight locations, with a max. distance of about 1000km (this is Europe). 2) The people don't work as team but instead get called as single people (and sometimes small groups) into projects for as long as the projects run. 3) Travelling is somewhat limited as this requires business reasons. Lot is done via phone. Do you have ideas or suggestions on how I could make these people feeling part of a joint organization where they support others and get supported by others. So that they get to know their peers, build a network, informally exchange information? So that they generally get the feeling of having common ground and derive motivation and job satisfaction?


title: Effectively Learning 3 Languages Simultaneously

text: So I have been developing with PHP for a year and a half now. Somewhere along those times, I decided to pick up skills in Python and Ruby, and learn ASP with C# just recently (as my first compiled language). Adding to that I'm a sucker for good CSS and Javascript coding. What I'm worried about is that this is a huge undertaking. Please don't tell me "you should focus on one language" right now because it's just that my damned brain is telling me to study the aforementioned languages and get up and running ASAP. I'm 21, and work at a small web dev company. They're not that strict so I can sneak some time learning Python and improving my PHP. At home I work with Ruby and C#. I have done the following to effectively manage my learning process:   1. Focus on web-only projects   2. Reuse my codes from PHP and convert rewrite them according to the language syntax (to Ruby, to Python)   3. Create an online blog to store some of my codes in case I need to get back to them later I know it's quite insane to juggle 4 server languages and 2 frontend languages at once but hey, I am having fun doing this. I'm not saying I want to master them immediately, because I know it takes years to master a single language. Have you done this before? How did you manage your learning process? Did you give up halfway and just focused on one?


title: How can I work on multiple programming languages at same time

text: It always happen to me that if I leave the stuff for 1-2 months I forget the stuff. 5 months back I had symfony project and I did that. At that time I was very much confident that I can do any project in symfony2. Then we got one Python project in django and I worked full time on that for few months. But now when I had to fix the error in symfony2, I completely forgot the structure and I keep mixing python stuff with php symfony. I want to know that how people work with different languages at same time. Should I need to keep studying all languages at same time so that I don't forget? I am confused what should I do. Or whenever I do some project then I keep notes of each and every step so that I can follow that later on how I did it?


title: Revisiting Learned Languages

text: I'm an aspiring programmer, I really wish to be great at multiple programming languages. I began programming from my school where they didn't teach me well, they didn't follow the standards, they didn't even tell the difference between an IDE and a compiler, they kept calling the Turbo C++ IDE a compiler, which sucked. And at that time I didn't have good internet access. But I do have internet, now I can learn new things and how to do them properly. The problem I'm having now is how to relearn everything and at the same time learn new things. I'm trying to do JavaScript and Ruby at this time but I can't concentrate on any of these because I'm worried about the one I am not learning (and also when I find something interesting, I get attracted to that and not the one I'm looking for, eg. attracted to C function pointer while I'm trying to learn callbacks in JavaScript) . How do I manage this? Make a routine? And many of us recommend practicing by making, but I have no idea what to make or making what would be better as a programming practice. Really need help. Edit: How is my question a duplicate? The mentioned question asks whether it "is" better to learn multiple languages simultaneously or not. What I'm asking here is how to be able to concentrate and manage on learning languages properly. Therefore it is not a duplicate, plus the answers I'm getting here are great (which are not there in that question, I'd like to point out the moderators to quit judging like that).


title: How can a beginner develop an algorithm for this problem?

text: Before I'm flamed, I'm just a beginner in programming. I have been learning Python for about 1 week by myself. I have a real problem to solve: **Goal:** The fastest route through a pathway. **Problem:**   * Walk forward to get to the goal. The pathway is 128 steps.   * Walking 1 step increases the danger value by 113   * If the danger value is over the limit then there is a fight. The fight takes 15 seconds to win.   * The limit is randomly assigned on each step.   * The danger value resets to 0 after a fight. **Here's the essence of the problem though:** There are two possible options if there is a fight:   * The fight can be escaped. Escaping takes 2 seconds. But does NOT reset the danger value.   * Accept the fight. Resets the danger value.   * The higher the danger value, the higher the chance of getting a fight. I've written the code to take one step. And I've written the code for the relevant randomness of the danger value, etc. I've even made a graph that shows exactly the pathway and potential fights, with the respective limits. This graph shows what happens when you accept every fight (don't escape): ![Fighting Pathway](http://i.stack.imgur.com/7p4Nv.png) **Being self-taught, I just don't know how to write a search algorithm for finding the quickest way through a particular route.** I believe I need to write a **backtracking algorithm** ; essentially a kind of **brute force**. I just don't know how to translate it from english into code. It's been around 4 days of just thinking about this, and I cannot write anything that expresses the even attempts to solve the problem. Any books or advice on how to even start solving this? As I've said, I have all of the code for what happens on each step (here: http://pastebin.com/LnV4h9NV). I just don't know how to even begin trying to brute force/search.


title: In IT companies employees are working in the same project mean how they will join these part of work (programs) together?

text: In IT companies employees are working in the same project mean how they will join these part of work(programs) together? I mean I am working in `.zul` file (client side), some of my teammates are working in server side or other Java files, in the end of the day how they can join those programs from different system to single system?


title: Chain-of-Command/Responsibility pattern for my simple API. A good idea?

text: I need to write a simple API for a project I'm working on. This API will be used internally to perform some server side actions that were triggered by AJAX calls. To make things easier for me, I thought of using the Chain-of- Command/Responsibility pattern. Here are more details about what I want to do: I am creating a "dashboard" where admins of my app will be able to update information (meta data) about items stored in a database. To make things easy and simple for the admins, I chose to use AJAX. So, if an admin wants to delete an item, (s)he clicks on the "delete button". A POST request is then sent to `edit.php` page with all the information needed to perform the deletion (action : delete, element : link, id : xx ...). Where `action`, `element` and of course `id` can change. This is why I opted for a mini-API that will, depending on the `action` and the `element` data, call a different function from a different class. Now, to implement the API, I decided to use Chain-of-Responsibility design pattern. Why? Because I can easily add, delete or update classes without having to modify the API itself. Is the Chain of Responsibility design pattern good fit for my case?


title: Rethinking testing strategy

text: Working on Plone projects our team tries to achieve full test coverage at least for important products. The kind of tests we write are unit tests, functional tests and integration tests. (Also stress-tests, but those aren't in the scope of this question). The goal is two fold at least: to facilitate upgrades and to catch bugs (sometimes it even happens in the process of writing tests). However, Plone/Zope is a complex system, and with years of experience I've noticed, that test strategy should be re-thought. First of all, unit tests, which often require to use a lot of mocking, are not that (cost)efficient. They are mostly easy and beneficial when some core, logic-heavy functionality is being written, like pure Python modules, which have negligible couplings with Plone/Zope, databases, etc. I rarely seen unit-tests catching any bugs at all, except while writing them. So, when doing the usual thing (writing views/portlets/viewlets), from my experience, it's much more efficient to write functional and integration tests. The rationale of it is that in case Plone/Zope changes (in an upgrade) we can catch the mishaps in our code. Views usually do not have a lot of "algorithmic" logic, they glue together several data sources (like catalog queries), maybe with some form handling and preprocessing for templates. It is quite often views call one or more tools to do some routine job (like getting navigation tree or looking up site root). Mocking it all seems unwise. For example, sometimes Plone/Zope changes some default to another type and all those mocked tests happily continue to work while code fails in the real instance. Functional/Integration tests may be at times fragile (HTML can change), but they are cheaper to produce too. They provide basic coverage, and trigger alarms when underlying system changes. Spotting the source of mishap is usually not an issue. ( **update** : Wrong: spotting where integration test fails can be a big issue, but **our** code's unit tests are usually of no help.) The question is, am I overlooking something of importance confining unittesting to functions and classes, which do not require mocking the environment heavily and are instead "purely" logic-heavy? I can't find any justification for writing unit-test "first", or even at all, for every piece of code in Plone/Zope (I do not mean the core of the system, just our own additions for our clients). To make the question less opinion based, are there other reasons, I have not mentioned or tackled above, which necessiate to consider writing more unit tests (and less integration tests) in a situation when code heavily depends on a complex (and somewhat hairy) framework, and code serves more as a glue for framework's subsystems?


title: Interview Coding Assignments… how much do they account for?

text: So I've ran into a couple of companies that requires completing coding assignments before they give you a phone interview. I'm curious, do these coding assignments account for anything after the interviews? Or are these assignments just there to see if you're worthy of their time to be phone- interviewed? I'm more interested in hearing from those who had involvement in an actual hiring process that included a coding assignment. I would appreciate if you can mention your involvement (e.g., you were the hiring manager or one of the people on the team that did the hiring). Thanks!


title: Should I close database connections after use in PHP?

text: I wonder if I should close any unnecessary database connection inside of my PHP scripts. I am aware of the fact that database connections are closed implicitly when the block stops executing and 'manually' closing the connections could kinda bloat the codebase with unnecessary code. But shouldn't I do so in order to make by code as readable and as easy understandable as possible, while also preventing several possible issues during run time? Also, if I would do, would it be enough to `unset()` my database object?


title: Data Access Levels of Abstraction

text: I'd like to describe this situation from two perspectives. I have a system called `Accounts`. This system is made up of subsystems which handle different account-based activities. For example:               Company.Accounts.NewAccounts     Company.Accounts.Loans     Company.Accounts.Transactions      **Perspective One** From this perspective, imagine I have a shared data access tier:               Company.Accounts.DataAccess      This subsystem is built seperately and each of my other Accounts subsystems reference the built assembly. This Company.Accounts.DataAccess subsystem connects to multiple tables. Some of the tables are specific to certain subsystems, and some of them are shared. There are separate modules for use by some specific subsystems, but also one or two common modules that multiple subsystems reference. The common modules include a lot of basic CRUD activities, but also a good number of low/medium complexity actions. So from this perspective, would it be fair to keep this architecture, but to pull out the subsystem-specific logic into a subsystem-specific data access layer? That way, each subsystem has their own specific Data Access piece, but also still references the original Data Access Tier for the common modules.               Company.Accounts.NewAccounts         Company.Accounts.NewAccounts.DataAccess          Company.Accounts.Loans         Company.Accounts.Loans.DataAccess          Company.Accounts.Transactions         Company.Accounts.Transactions.DataAccess          Company.Accounts.DataAccess      **Perspective Two** From this perspective, imagine I have existing Data Access Layers for each subsystem:               Company.Accounts.NewAccounts.DataAccess     Company.Accounts.Loans.DataAccess     Company.Accounts.Transactions.DataAccess      They are logical layers as part of each subsystem, and only each subsystem references its own data access piece. So there are no cross references here. Each of these Data Access Layers perform operations against their own specific Database Tables. However, each of them also has code to perform common operations against tables that are shared amongst all subsystems in the Accounts system. So from this perspective, would it be fair to keep this architecture, but to abstract the common operations into a subsystem-agnostic data access Tier? That way, each subsystem keeps its own logical layer for specific operations, but also references an externally built tier for the common operations.               Company.Accounts.NewAccounts         Company.Accounts.NewAccounts.DataAccess          Company.Accounts.Loans         Company.Accounts.Loans.DataAccess          Company.Accounts.Transactions         Company.Accounts.Transactions.DataAccess          Company.Accounts.DataAccess      **Conclusion** So as you can see, the ending is the same, but coming at the description from two different perspectives. My idea is to have two different levels for data access. So a subsystem references its Data Access Layer for its own data operations, but also references a common Data Access Tier for common operations. Is that legitimate? Is there already a pattern named for this?


title: Typing skills do developers need a formal training?

text: Developers key in lots of code, write bogs, write software designs and stuff. Do we need formal typing training? I have seen many developers struggling with keyboard thus slowing down development momentum. At least we can play around with a software typing emulator to begin with.


title: factors that are important for success when letting an agile framework emerge for the whole organisation?

text: I previously posted a question [link] on programmers.stackexchange.com asking when it makes sense to adopt an existing enterprise scale agile framework and when it makes sense to allow your own enterprise scale agile framework to emerge (e.g. through trial and error). This question takes the previous question a step further and asks for **the factors that are important for success** when you have decided to go down the route of letting your enterprise scale agile framework emerge? \-- Downvoters: down voting without adding a comment provides no opportunity for improving the question. Please let me know why you are down voting so that I can improve the question.


title: NoSQL Document Database as a Message Queue

text: I am considering using a NoSQL Document database as a messaging queue. Here is why:   * I want a client to post a message (some serialized object) to the server and not have to wait for a synchronous response.   * I want to be able to pull messages off of the "queue" based on some criteria, which may be more sophisticated than just a priority level (I am working on a hosted web app, so I want to give all of my customers a fair amount of "computing time", and not let one customer hog all of the processing).   * I want the queue to be durable - if the server goes down I want any remaining messages to be handled when it comes back up. So, I am considering using MongoDB or RavenDB as a message queue. The client can post the message object to a web service which writes it to the database. Then - the service doing the work can pull the various message types based on any criteria that may arise. I can create indexes around the scenarios to make it faster. So - I am looking for someone to shoot a hole in this. Has anybody successfully done this? Has anybody tried this and failed in some way?


title: Where do you go to read good examples of source code?

text: I have heard a few people say that one of the best ways to improve your coding ability is to read others code and understand it. My question, as a relatively new programmer, where do I go to find good source code examples that are not too far over my head?


title: Good introduction to artificial intelligence?

text: I have been told that as part of my degree year I will be learning about Artificial Intelligence. My lecturers have recommended a couple of books: Artificial Intelligence: A Systems Approach (Computer Science)   Artificial Intelligence (A Modern Approach) I've watched a couple of lectures hosted by Jeff Hawkins, they were good although a little advanced for me. Could someone recommend any other books or lectures that introduce the topic?


title: Is Power++ worth buying/learning?

text: I found Power++ and to my suprise it looks like a good alternative for Delphi and Visual Studio. Anyone used it? Can you tell me if it is worth it buying/learning it?


title: Hard-copy approaches to time tracking

text: I have a problem: I suck at tracking time-on-task for specific feature/defects/etc while coding them. I tend to jump between tasks a fair bit (partly due to the inherit juggling required by professional software development, partly due to my personal tendancy to focus on the code itself and not the business process around code). My personal preference is for a hard-copy system. Even with gabillions of pixels of real-estate on-screen I find it terribly distracting to keep a tracking window convienient; either I forget about it or it gets in my ways. So, looking for suggestions on time-tracking. My only requirement is a simple system to track start/stop times per task. I've considered going as far as buying a time-clock and giving each ticket a dedicated time-card. When I start working on it, punch-in; when done working, punch-out.


title: How can my team avoid frequent errors after refactoring?

text: To give you a little background: I work for a company with roughly twelve Ruby on Rails developers (+/- interns). Remote work is common. Our product is made out of two parts: a rather fat core, and thin up to big customer projects built upon it. Customer projects usually expand the core. Overwriting of key features does not happen. I might add that the core has some rather bad parts that are in urgent need of refactorings. There are specs, but mostly for the customer projects. The worst part of the core are untested (not as it should be...). The developers are split into two teams, working with one or two PO for each sprint. Usually, one customer project is strictly associated with one of the teams and POs. Now our problem: Rather frequently, we break each other's stuff. Someone from Team A expands or refactors the core feature Y, causing unexpected errors for one of Team B's customer projects. Mostly, the changes are not announced over the teams, so the bugs hit almost always unexpected. Team B, including the PO, thought about feature Y to be stable and did not test it before releasing, unaware of the changes. How to get rid of those problems? What kind of 'announcement technique' can you recommend me?


title: How does Telnet work?

text: **Is telnet just a simple socket connection?** I usually have a difficult time in the networking area so I use some code from the internet to help me out, but I can't seem to find a library for Telnet in Objective-C. The closest thing I've found is `CocoaAsyncSocket` I was wondering, _Is telnet just plain socket connections?_ _Do I just create a socket to the server and send the commands?_


title: need advice for building evaluation system in Java for the web

text: I have made a java program that allows to mark an exam made by one student. In the interface the student chooses between a set of options for each question, and by an array (that holds the correct answers) I get the score of the student. By the way this simple program is made using console java, no swing or applets at all. The information of which answers are correct are stored in a vector, so each answer of the students is compared with this vector for getting the final score. I would like to put his program into one domain that I recently got, so that one student at the moment of entering into the webpage could make the exam; and another program installed in the server will check the correct answers and give other questions, in case the student wants to practice. One friend told me that it is possible to wrap the console java application into java for web, but I just dont know the details for doing that. What would anybody suggest or if there is any online tutorial that could help me with that? My domain has the following extensions:   * FTP    * MySQL    * Apache    * SharedTomcat Please this is not a discussion to know which tool is better, I want just to use Java, but I am pretty lost with all the web technologies that one can use with this language.


title: Failed to allocate memory - What is it trying to say?

text: In my early days of programming I often used to get memory related fatal errors in the following format:               Fatal error: Allowed memory size of <some big number> bytes exhausted      (tried to allocate <some small number> bytes) in /path/to/filename.php      on line <some line number>      I'm a little embarrassed to state that even though I have figured out how to solve them and take steps to avoid them altogether, I'm still not quite sure what exactly does the message translate to in simple words. For example, if I get a message such as:               Fatal error: Allowed memory size of 67108864 bytes exhausted (tried to allocate 4000 bytes)      in ........ on line 34      As things stand at the moment, I assume it to be stating that the script consumes 67108864 bytes of data, but only 4000 bytes are available during runtime.   * Am I right in my assumption?   * If not, what's the correct interpretation?


I want to learn to Design Hash table with simple hash function for better understanding. I understand that the hash table will work as long as the hash function maps each key to a non-negative integer less than the size of the hash table, but it will only perform well if it distributes different keys across different buckets. My question is : What's a alternative ways to implement hash function using ASCII code. I found ASCII code hash function implementation it's easy to build a hash function on the idea of treating each character of the string as a digit in a number. I try to represent a number is to use a radix-10 system with the Arabic numerals. For example, I could represent numbers using the letters "a" - "z" for the numbers 0 through 25 to obtain the Radix-26 system described in your text book. Characters in the computer are often stored using 7-bit ASCII codes (with values 0-127). So we can treat a string of ASCII characters as a Radix-128 number.


title: MVC Design Pattern to Combine Multiple Models for use

text: In my design, I have multiple models and each model has a controller. I need to use all the models to process some operation. Most examples I see are pretty simple with 1 view, 1 controller, and 1 model. How would you get all these models together? Only ways I can think of are 1) Have a top-level controller which has a reference to every controller. Those controllers will have a getter/setter function for their model. Does this violate MVC because every controller should have a model? 2) Have an Intermediate class to combine every model into a one model. Then you create a controller for that new super model. Do you know of any better ideas? Thanks.


title: Best practice for projects architecture - server side

text: The usual way (that I'm familiar with) to divide the server side is the n-layer architecture :   1. **DAL** \- data access layer, usually has the Entities and the context (and maybe include also a repository)   2. **BLL** \- business logic layer   3. **Contract** \- Interfaces   4. **Services** \- classes which implement the interfaces ( could be a Web API for E.G ) Of course there is also the n-tier Architecture which i don't want to discuss . lately I've seen more and more a "Modules" architecture and i was wondering about it ( I'm not familiar with the professional term of this architecture ) Where each module is not a table in the database but a group of tables that have a shared concept . something that looks like that : ![Modules and DAL architecture](http://i.stack.imgur.com/qPrqb.jpg) Is there any known good architecture that separate the layers by modules on the server side? if so, what is the professional term for this kind of architecture and what are the advantages / disadvantages of each of this architectures ?


title: What is the right way to parse HTML?

text: I've heard, that parsing HTML using the Cthulhu way is not very good. But what are the right ways to parse HTML? Or is it possible to parse it at all?


title: Is there a purely technical term for 'monkey patching'

text: **EDIT** The original title of the question was **Is there a non-derogatory term for 'monkey patching'**. As I have learned that the term is actually not derogatory, or is at least not meant to be, I changed the name to free it from mistaken implications. * * * I would like to describe a piece of software, and try not to use emotionally biased language. However I am not aware of an unbiased alternative to 'monkey patching'. The term is meant to be derogatory for a reason. Many see it as a useful but problematic technique. I am aware of an alternative, but it is equally derogatory: 'duck punching'. I see 'open classes' not as an alternative name, but as a prerequisite for monkey patching. 'Overriding' does not seem right either. I would like to differentiate between monkey patching and the regular overriding as part of inheritance-based polymorphism.


title: What should I know about C++?

text: I've recently started learning C++, and I enjoy it a lot. I've often read it's easier to write bad code in C++ than in most languages, and that it is a lot deeper than what it seems. As I'd like to avoid writing bad code, I was wondering what exactly I shouldn't do, and what I should do, to write good code in C++.


title: Selling middleware

text: I am close to completion of a useful suite of tools for 2D game development (with mobile platforms in mind), for working with sprites and animations. Can anyone advise the best way to sell and promote my product (without investing capital). I am aware that there are lots of websites that can market and sell software to end consumers, but I need to target game developers specifically as middleware is completely meaningless to your average joe. So, aside from using PayPal on my website, are there any marketplaces for game middleware? How can I promote the application outside my website without spamming developer forums?


title: How long of a trial period do you use with programmers - how quickly can you tell if they are talented and a good fit?

text: It seems most jobs that I've been exposed to come with a 3 month trial period, during which the employer decides whether the employee is doing good enough work, and is a good fit. 3 months seem like overkill to me, for most cases we've known much sooner whether someone wasn't a good fit. How long does it take you, on average, to evaluate whether a newly hired programmer is both talented and a good fit for your team?


title: What “Industry Classification” is Computer Programming?

text: Whenever I fill out a survey (especially, but not limited to trade- papers/mags/sites), there’s one question (or any derivation thereof) that always trips me up: > Which industry classification best describes your line of work This is usually followed by a list of things like _Retail_ , _Health_ , _Education_ , _Construction_ , _Manufacturing_ , etc. I can never figure out exactly what industry computer programming falls in. I usually just end up picking either _Manufacturing_ because I suppose in a way, I’m manufacturing something, _Retail_ since in a way, I am producing goods, or else whatever option happens to mention either “computers” or “electronics” (if any). I tried Googling it but came up empty. Does anyone know what the “correct” answer is? What do other programmers enter in these surveys?    * * *    ![enter image description here](http://i.stack.imgur.com/YOTmp.png)


title: PHP - How to Automatically Post Form in Another Website and Parse the Result

text: I am planning to create a website like what http://dohop.com is doing that will allow a user to pull the airlines price rate and date from the http://airasia.com website. Currently the site will only allow the user to view the flight schedule for one day and if they wish to view x days ahead they need to repost the data. I would like to collect the data in x days ahead and group them in table so that user can view all the flight prices & schedule variances in one screen without reposting. I have checked the `AirAsia.com` site and they currently don't have any API support which would allow me to extract their data. While they are using 'aspx' for their website and POST method. Can anyone give me some guidance on what is the method, approach or technique for me to harvest the data?


title: What is best practice on ordering parameters in a function?

text: Sometimes (rarely), it seems that creating a function that takes a decent amount of parameters is the best route. However, when I do, I feel like I'm often choosing the ordering of the parameters at random. I usually go by "order of importance", with the most important parameter first. Is there a better way to do this? Is there a "best practice" way of ordering parameters that enhances clarity?


title: Is a 1:* write:read thread system safe?

text: Theoretically, thread-safe code should fix race conditions. Race conditions, as I understand it, occur because two threads attempt to write to the same location at the same time. However, what about a threading model in which a single thread is designed to write to a location, and several slave/worker threads simply read from the location? Assuming the value/timing at which they read the data isn't relevant/doesn't hinder the worker thread's outcome, wouldn't this be considered 'thread safe', or am I missing something in my logic?


title: Is software innovation still primarily North American and European? Why, and for how much longer?

text: Since this site is read by a global audience of programmers, I want to know if people generally agree that the vast majority of software innovation - languages, OS, tools, methodologies, books, etc. - still originates from the USA, Canada, and the EU. I can think of a few exceptions, e.g. Nginx webserver from Russia and the Ruby language from Japan, but overwhelmingly, the software I use and encounter daily is from North America and the EU.   * Why? Is history and historical momentum (computing having started in USA and Europe) still driving the industry? And/or, is some nebulous (or real) cultural difference discouraging software innovation abroad?   * Or are those of us in the West simply ignorant of real software innovation going on in Asia, South America, Eastern Europe, etc.?   * When, if ever, might the centers of innovation move out of the West? Your experiences and opinions welcome, thanks!


title: Example cases for each data structure?

text: I've been looking all over the Internet for a page that lists **cases** for when to use each abstract data type. I expect that reading through a series of both surprising and obvious uses for each type will help readers recognize future opportunities for applying a particular ADT in their algorithms. For example: > **Trees** > >   * File System >   * HTML DOM tree >   * Family Genealogy >   * Syntactic Parsing of Strings >   * etc... > I'll provide a list of basic ADTs that should be included; feel free to add more, or to specify subtypes:               Arrays, Linked-Lists, Sets, Dictionaries/Maps, Stacks, Queues, Trees, Graphs.


title: Is it worth writing a unit test for a DTO with the most basic getter/setters?

text: The advantage is it protects your DTO against future "enhancements" ?


title: Java EE - Configuration over convention?

text: I'm a systems administrator and am also pursuing a more specific career in development. I started about a year and a half ago with Javascript and C#/.NET ... one day I decided I wanted to learn Java. Then I have found myself amazed with all of the options available and the community seems wonderful and I think the JVM is a great piece of technology and development platform. However...one thing about Microsoft is that everything is completely out of the box. If you want to build an infrastructure or just a simple app then you are dealing with one technology, one vendor, one IDE, one set of forums ... you just point, click, develop. I know there have been huge strides made with Java. More specifically I am spending most of my time with the Pivotal stack. Spring, Spring Boot, Grails, etc. But because there are so many options and everything is so open it seems that the tutorials on different sites are kinda hard to follow and because everything is changing so fast I finally find a good book or tutorial and the layout for everything just changes. I am able to build simple Java apps and I can also get a Grails project up and running in an instant. Also the Play! framework ... wow. But the point is .. just wanting a little bit of advice as someone who is new to Java development. I know that if I can just dig through all of these XML files and just figure it all out that I'll be able to really start taking advantages of these technologies. Just wanted to know if there is a de facto tutorial I should start with. Spring is pretty easy even though sometimes my stuff just ... doesn't work. Even when I'm following the guide on the site. And another part of this question is should I go with Maven or Gradle? I haven't used any of these tools. Is this supposed to make everything easier? All the projects I have created have come straight from the IDE (Spring Tool Suite). .. Ok this is getting long .. I really want to get an application up and running with Spring Data/Rest and start building an Angular JS frontend. Lots of options..a little overwhelming. But want to learn it well and the only thing I miss about .NET is the ease of use. Anybody feel anything similar when learning Java web development? Whats the best place to shut up and start?


title: How to map the english dictionary to UNSPSC codes?

text: Is there a db which maps the words from the english dictionary to the UNSPSC codes?(http://www.unspsc.org/) My problem is the following: I am building a search system. And the customer searches for 'pencil' and 'pencil sharpeners' are also returned. Each of the returned item has a UNSPSC code associated with it. So one possible solution would be to search only for those items in the categories the search word belongs to. But this solution would require a mapping from english words to the UNSPSC codes...


title: Redis & MongoDB for Metrics Platform

text: I'm in the process of writing an app that will ultimately display analytics to the user. I've written a service that collects data from an API. This data will then be processed, stored, then when the user requests the data, pulls it from the store and displays it. Fairly straightforward. We plan on using MongoDB for the app database (storing users, settings, etc.). I've read that Redis is good for storing metric information because of the key/value pair nature. My question is, what would be the best way to go about interchanging how the data comes from the API service to the user being able to request it? I've initially come up with storing the API data in another MongoDB store, seperate from the app. Then having another service that runs at a longer interval than the API service that aggregates the raw data in Mongo, moves it into Redis, then archives the parsed Mongo data into either some log file or something. The app would then be able to reach into Redis to grab the metrics based on predetermined keys. Is Redis even the right option for something like this? I've also considered swapping out MongoDB with Postgres or MySQL since operations like SUM run well on a relational platform.


title: Javadoc for a static "overloaded" method

text: My problem is the following: I have an interface that requires its implementations to implement a static method, namely `void load()`. However, until Java 8, it seems we won't get static methods in interfaces. I trust my users to still implement it correctly, but my problem is how to write a proper doc. There are up to 50 implementations of this interface and not being able to inherit the javadoc is a bother. What is the best way to proceed in my case? Should I document a random implementation and add `@see` annotations in the others? It seems dirty to me. Any suggestion is welcome.


title: Best design for Windows forms that will share common functionality

text: In the past, I have used inheritance to allow the extension of Windows forms in my application. If all of my forms would have common controls, artwork, and functionality, I would create a base form implementing the common controls and functionality and then allow other controls to inherit from that base form. However, I have run into a few problems with that design.   1. Controls can only be in one container at a time, so any static controls you have will be tricky. For example: Suppose you had a base form called BaseForm which contained a TreeView which you make protected and static so that all of the other (derived) instances of this class can modify and display the same TreeView. This would not work for multiple classes inheriting from BaseForm, because that TreeView can only be in one container at a time. It would likely be on the last form initialized. Though every instance could edit the control, it would only display in one at a given time. Of course, there are work-arounds, but they are all ugly. (This seems to be a really bad design to me. Why can't multiple containers store pointers to the same object? Anyhow, it is what it is.)   2. State between forms, that is, button states, label text, etc., I have to use global variables for and reset the states on Load.   3. This isn't really supported by Visual Studio's designer very well. Is there a better, yet still easily maintainable design to use? Or is form inheritance still the best approach? **Update** I went from looking at MVC to MVP to the Observer Pattern to the Event Pattern. Here is what I am thinking for the moment, please critique: My BaseForm class will only contain the controls, and events connected to those controls. All events that need any sort of logic to handle them will pass immediately to the BaseFormPresenter class. This class will handle the data from the UI, perform any logical operations, and then update the BaseFormModel. The Model will expose events, which will fire upon state changes, to the Presenter class, which it will subscribe (or observe) to. When the Presenter receives the event notification, it will perform any logic, and then the Presenter will modify the View accordingly. There will only be one of each Model class in memory, but there could potentially be many instances of the BaseForm and therefore the BaseFormPresenter. This would solve my problem of synchronizing each instance of the BaseForm to the same data model. Questions: Which layer should store stuff like, the last pressed button, so that I can keep it highlighted for the user (like in a CSS menu) between forms? Please criticize this design. Thanks for your help!


title: Are stand up meetings really useful?

text: My coworkers tell me stand up meetings are useless. My project manager also makes us end every morning meeting with a company chant.


title: Trade-offs of local vs remote development workflows for a web development team

text: We currently have SVN setup on a remote development server. Developers SSH into the server and develops on their sandbox environment on the server. Each one has a virtual host pointed to their sandbox so they can preview their changes via the web browser by connecting to developer-sandbox1.domain.com. This has worked well so far because the team is small and everyone uses computers with varying specs and OSs. I've heard some web shops are using a workflow that has the developers work off of a VM on their local machine and then finally push changes to the remote server that hosts SVN. The downside to this is that everyone will need to make sure their machine is powerful enough to run both the VM and all their development tools. This would also mean creating images that mirror the server environment (we use CentOS) and have them install it into their VMs. And this would mean creating new images every time there is an update to the server environment. What are some other trade-offs? Ultimately, why did you choose one workflow over the other?


title: What is the best way of storing date?

text: I am a new to storing dates based on time zones. Need to know the standard way to store the date in the datastore. My requirements are   1. Easy to query the date based on the date range.    2. show the date with the client appropriate time zone selected by him(I am having a table maintained for the timezone separately)    3. Able to query using the datastore Admin console also. Any suggestions/ideas regarding this will be a great help in proceeding further.


title: Discovered large security hole in someone elses website... What to do?

text: A chap I'm bidding to do some development for has a social network he wrote himself. Not the next facebook by any stretch. But a few thousand local users. I went to have a look at it to see what level of knowledge he had so I knew how to position myself for this potential job. I tapped a single quote into the login box on the front page and up pops a SQL error. So I tried a simple " a' or 'a'='a " in each box and was immediately logged in as the administrator. He had written a fairly comprehensive administration site by the looks of things. At the bottom of the page a "Download SQL Backup" button. This is where I stopped. My question is this. What do I do? As a developer myself I would appreciate the heads up. But as someone who's hopefully going to be paid to do some work for him I wouldn't want to throw all sorts of trust issues into the mix. Any ideas?


title: Why are there separate L1 caches for data and instructions?

text: Just went over some slides and noticed that the L1 cache (at least on Intel CPUs) distinguishes between data and instruction cache, I would like to know why this is..


title: Do I need to publish deployment scripts for deploying AGPL licensed work (MongoDB)

text: MongoDB is dual-licensed with AGPL (the engine) and ASL 2.0 (the drivers). In a nutshell, merely using MongoDB through the drivers does not dictate to release your source code (due to drivers' ASL 2.0 license). AFAIK, only if you directly call the mongo engine, you need to give out your code that's using it (but still not the _application_ code that talks to mongo via the drivers). Check this MongoDB blog entry: http://blog.mongodb.org/post/103832439/the-agpl What if you deploy (install, configure) mongodb in your deployment scripts. And then start/stop/restart those processes. And then maybe create some users via mongo shell. Do you need to publish your _deployment scripts_? (A bonus question: how can they publish the drivers as ASL 2.0 if those drivers use the AGPL-licensed part of MongoDB over the network? Because they are authors of both?)


title: How to design an IDisposable that unconditionally needs to be disposed?

text: Consider a class that implements `IDisposable`, and that has members in such a way that it will never become eligible for garbage collection when it is not disposed. And as it will not be garbage collected, it will not have the chance to use the destructor for cleaning up. As a result, when it is not disposed (e.g. unreliable users, programming errors), resources will be leaked. Is there a general approach how such a class can be designed to deal with such a situation or to avoid it? _Example_ :               using System;          class Program     {         static void Main(string[] args)         {             new Cyclical();             GC.Collect();             GC.WaitForPendingFinalizers();             Console.ReadKey();         }     }          class Cyclical     {         public Cyclical()         {             timer = new System.Threading.Timer(Callback, null, 0, 1000);         }              System.Threading.Timer timer;              void Callback(object state)         {             Console.Write('.');  // do something useful         }              ~Cyclical()         {             Console.WriteLine("destructor");         }     }      (Omitted `IDisposable` to keep example short.) This class uses a `Timer` to do something useful at certain intervals. It needs a reference to the `Timer` to avoid it is garbage collected. Let’s assume the user of that class will not dispose it. As a result of the timer, somewhere some worker thread has a reference to the `Cyclical` instance via the callback, and as a result, the `Cyclical` instance will never become eligible for garbage collection, and its destructor will never run, and resources will leak. In this example, a possible fix (or workaround) could be to use a helper class that receives callbacks from the `Timer`, and that does not have a reference, but only a `WeakReference` to the `Cyclical` instance, which it calls using that `WeakReference`. However, in general, is there a design rule for classes like this that need to be disposed to avoid leaking resources? * * * For the sake of completeness, here the example including `IDispose` and including a workaround/solution (and with a hopefully less distracting name):               class SomethingWithTimer : IDisposable     {        public SomethingWithTimer()        {           timer = new System.Threading.Timer(StaticCallback,              new WeakReference<SomethingWithTimer>(this), 0, 1000);        }             System.Threading.Timer timer;             static void StaticCallback(object state)        {           WeakReference<SomethingWithTimer> instanceRef              = (WeakReference<SomethingWithTimer>) state;           SomethingWithTimer instance;           if (instanceRef.TryGetTarget(out instance))              instance.Callback(null);        }             void Callback(object state)        {           Console.Write('.');  // do something useful        }             public void Dispose()        {           Dispose(true);           GC.SuppressFinalize(this);        }             protected virtual void Dispose(bool disposing)        {           if (disposing)           {              Console.WriteLine("dispose");              timer.Dispose();           }        }             ~SomethingWithTimer()        {           Console.WriteLine("destructor");           Dispose(false);        }     }        * If disposed, the timer will be disposed.   * If not disposed, the object will become eligible for garbage collection.


title: Is there a difference between the terms "Open Source" and "Open Source Software"?

text: Until today, I have always used the terms **open source** and **open source software** interchangeably. But then I read Phil Haack's blog post in which he suggests that the two terms are not necessarily referring to the same thing. He proposes the following definitions: **Open Source Software** is source code which is licensed under a license that meets the Open Source Definition. **Open Source** is a development methodology which includes certain characteristics:   * Developed in the open with community involvement   * The team accepts contributions that meet its standards   * The end product has an open source license. This encompasses open source software, open source hardware, etc. So Phil argues that the end product of open source development is open source software, but open source software is _not necessarily_ the product of open source development. Since he also mentions that there are many different understandings of what open source means, what do you think about these definitions? Do you agree with the distinction he has made?


title: RDF and OWL: Have these delivered the promises of the Semantic Web?

text: These days I've been learning a lot about how different scientific fields are trying to move their data over to the Semantic Web in order to "free up data from being stored in isolated silos". I read a lot about how these fields are saying how their efforts are implementing the "visions" of the Semantic Web. As a learner (and from purely a learning perspective) I was curious to know why, if semantic technology is deemed to be so powerful, the efforts have been around for years but myself and a lot of people I know have never even heard of it until very recently? Also, I don't come across any scholarly articles deeming "oh, our inferencing engine was able to make such and such discovery, which is helping us pave our way to solving...." etc. It seems that there are genuine efforts across different institutions, fields, and disciplines to shift all their data to a "semantic" format, but what happens after all that's been done? All the **ontologies** have been created/unified, and then what?


title: In MVC, what is the difference between controller and router?

text: Do they mean the same thing (attaching URLs to actions, or actions to URLs) or is there any difference I'm missing? Example: http://github.com/dannyvankooten/PHP-Router vs. http://konstrukt.dk


title: How do I (tactfully) tell my project manager or lead developer that the project's codebase needs serious work?

text: I just joined a (relatively) small development team that's been working on a project for several months, if not a year. As with most developer joining a project, I spent my first couple of days reviewing the project's codebase. The project (a medium- to large-sized ASP.NET WebForms internal line of business application) is, for lack of a more descriptive term, a disaster. There are three immediately noticeable problems with the coding standards:   1. **The standard is very loose.** It describes more of what not to do (don't use Hungarian notation, etc..) than what _to_ do.   2. **The standard isn't always followed.** There are inconsistencies with the code formatting **everywhere**.   3. **The standard doesn't follow Microsoft's style guidelines.** In my opinion, there's no value in deviating from the guidelines that were set forth by the developer of the framework and the largest contributor to the language specification. As for point 3, perhaps it bothers me more because I've taken the time to get my MCPD with a focus on web applications (specifically, ASP.NET). I'm also the only Microsoft Certified Professional on the team. Because of what I learned in all of my schooling, self-teaching, and on-the-job learning (including my preparation for the certification exams) I've also spotted several instances in the project's code where things are simply not done in the best way. I've only been on this team for a week, but I see so many issues with their codebase that I imagine I'll be spending more time fighting with what's already written to do things in "their way" than I would if I were working on a project that, for example, followed more widely accepted coding standards, architecture patterns, and best practices. This brings me to my question: **Should I (and if so, how do I) propose to my project manager and team lead that the project needs to be majorly renovated?** I don't want to walk into their office, waving my MCTS and MCPD certificates around, saying that their project's codebase is crap. But I also don't want to have to stay silent and have to write kludgey code atop _their_ kludgey code, because I actually want to write quality software and I want the end product to be stable and easily maintainable.


title: What is the best design pattern for asynchronous message passing in a Chrome extension?

text: I have a background script that is responsible for getting and setting data to a `localStorage` database. My content scripts must communicate with the background script to send and receive data. Right now I send a JSON object that contains the command and the data to a function. So if I'm trying to add an object to the database I'll create JSON that has a `command` attribute that is `addObject` and another object that is the data. Once this is completed the background scripts sends a response back stating that it was successful. Another use case of the function would be to ask for data in which case it would send an object back rather than a success/fail. The code gets kind of _hacky_ once I start trying to retrieve the returned object from the background script. It seems like there is probably a simple design problem to follow here that I'm not familiar with. Some people have suggested future/promise design problems but I haven't found a very good example. Content Script               function sendCommand(cmdJson){     chrome.extension.sendRequest(cmdJson, function(response){         //figure out what to do with response     });     }      Background script               if (request.command == "addObject"){       db[request.id]= JSON.stringify(request.data);          sendResponse("success");     }     else if(request.command == "getKeystroke"){       var keystroke = db[request.id];       sendResponse(keystroke);     }


title: Why don't inherited methods use child properties? (PHP)

text: I'm trying to get the code below to work in child classes. But it keeps failing because it is checking the `basicDbClass` rather than the child class. For those complaining and voting my question down because of my use of static methods and variables, the static getBy method serves the purpose of returning an array of matching class objects. If you have a complaint about that methodology, then rather voting down every question that uses code you don't agree with, look for the next question about that subject and then give them your brilliant answer. If you're really antsy, I'll even do you the favor of asking that question so that you can get this out of your system. The main problem is in `static::$data_table`. When I do the following, I get a fatal error: > access to undeclared static property: basicDbClass::$data_table * * *               $obj_array = childClass::getBy('id',5);               class basicDbClass {              public static function getBy($property,$value) {             if(!property_exists(get_called_class(),$property) ) {                 debug::add('errors',__FILE__,__LINE__,__METHOD__,$property . ' is not a valid property.');                 return false;             }             $obj_array = array();             dbConnection::connect(MAIN_DB);             $sql = sprintf('SELECT `id` FROM `%s` WHERE `%s` = \'%s\'',static::$data_table,mysql_real_escape_string($property),mysql_real_escape_string($value));             $result = mysql_query($sql);             if($result === false) {                 return false;             }             while($row = mysql_fetch_assoc($result)) {                 $obj_array[$row['id']] = new static($row['id']);             }             return $obj_array;         }     }          class childClass extends basicDbClass {       protected static $data_table = 'child_class_table';       protected $name;       protected $id;     }


title: How do large-scale applications handle GUI creation?

text: I'm interested in developing GUI-based Windows applications in C++, but I'm not sure how it's done in professional or large-scale settings. It seems it would take a lot of development time to describe all the elements (e.g., dimensions and such) within code. Presumably it's not all done visually, right? How is it normally done? What methods are used to prevent a lot of time wasted on defining each and every property a UI control might have?


I have been programming for many years but I am still not comfortable with the concept of "Interfaces". I try to use interfaces but many times I don't see a mandatory use for it. I think this is probably because the projects weren't so big, or because interfaces are more useful when teamwork is involved. So, making another attempt to understand the importance of interfaces, here is my question: What problems will I face if I remove the concept of interfaces from my code?


title: Java-style package naming and second-level country domains

text: I own a .co.uk domain, and I whenever I've dealt with Java-style package naming, I've gone with `uk.co.domainname`. Once I encountered package that did the following: `co.uk.domainname`. Is one of these right, or is it something that's up to the developer's discretion? Is there some sort of convention that deals with this?


title: Were the first assemblers written in machine code?

text: I am reading the book The Elements of Computing Systems: Building a Modern Computer from First Principles, which contains projects encompassing the build of a computer from boolean gates all the way to high level applications (in that order). The current project I'm working on is writing an assembler using a high level language of my choice, to translate from Hack assembly code to Hack machine code (Hack is the name of the hardware platform built in the previous chapters). Although the hardware has all been built in a simulator, I have tried to pretend that I am really constructing each level using only the tools available to me at that point in the real process. That said, it got me thinking. Using a high level language to write my assembler is certainly convenient, but for the very first assembler ever written (i.e. in history), wouldn't it need to be written in machine code, since that's all that existed at the time? And a correlated question... how about today? If a brand new CPU architecture comes out, with a brand new instruction set, and a brand new assembly syntax, how would the assembler be constructed? I'm assuming you could still use an existing high level language to generate binaries for the assembler program, since if you know the syntax of both the assembly and machine languages for your new platform, then the task of writing the assembler is really just a text analysis task and is not inherently related to that platform (i.e. needing to be written in that platform's machine language)... which is the very reason I am able to "cheat" while writing my Hack assembler in 2012, and use some preexisting high level language to help me out.


title: Given some code, how can I learn where it loads resources from if the developer failed to document?

text: According to this tutorial OpenNI does not support custom gestures. However, Youtube has videos of people doing just that. Now, clearly this thing loads gestures from somewhere. How can I find out where if they've managed to obfuscate the code successfully?


title: Entity Component System Coupling

text: Lately I've been working on a small personal project which is basically an Entity Component System framework with autoupdated Systems. While I have a pretty good idea on the way the framework should work, because of lack of experience I am having trouble with actually keeping everything decoupled. Some details on the framework: Each entity is defined by it's components. Systems are responsible for the actually modifying the entities by changing their components. In order to improve locality of reference, instead of keeping each component in the appropriate entity, all components are stored in homogenous vectors and each entity keeps a list of indices to each vector. Since each System modifies specific components, it should keep a list only of the entities with the corresponding components. How I dealt with all of this until now was to have a ComponentManager, an EntityManager and a SystemManager. These classes however have very tight coupling with each other. The EntitManager needs to have access to the ComponentManager in order to handle the size of the the index lists and the mapping of each component type to them. It also needs access to actually add the components in the appropriate vector. Another coupling is between the EntityManager and the SystemManager. Whenever an entity is created, it needs to be added to the list of the appropriate Systems. A general event bus would appear to help but I am not sure how to implement it without making it global. How do I improve this design by removing coupling while still maintaining the system's functionality?


title: How to enter flow experience for SW development?

text: What are your strategies to improve the flow experience when doing work?


title: Where you are both the Authorization Server and Resource Server does it make sense to use OAUTH2 for security?

text: I'm curious if there are any use cases where it makes sense to use OAUTH2 where you are both the protected resource and the authorization server. In this case you have the passwords already for example so are protecting your own resource. Seems pretty heavy handed - is this a common practice or would it make sense to look at simpler solutions?


title: Can sequence alignment algorithms be used for search implementation?

text: Hi I want to implement a search on a website which includes imperfect search results. Meaning, if the search term is misspelled or slightly different from a 100% match, the function should still return results which are sorted by similarity in terms of the search keyword. I already have implemented algorithms like Smith-Waterman and Needleman-Wunsch which also can be used for database searching. So my idea was to run those algorithms against every keyword in the database and sort them by the score of each result. Is this a good idea? I am using ASP.NET in C#. Are there any tools or tricks which can accomplish this for me without using my own methods? My biggest concern is performance, after all those algorithms create at least one two dimensional matrix, calculate its values and perform a traceback. Any suggestions?


title: Managing debug information of C program for Debugger

text: I am not sure if the title is appropriate. I have written a parser for CDB files in C# and ANTLR that creates runtime objects for me such that I can pass it to the TCF Agent which takes care of everything that needs to be taken care of on the side of Eclipse. Such a CDB file consists of Symbol Records, Function Records, Module Records and also Type Records and so on. It describes a C program compiled with SDCC. I already have a good structure for local variables which debug information I can retrieve by resolving an ID that consists of   * **scope_flag** Indicates the scope of the symbol: `L` local, `G`global, `F`File, ...   * **module_base** The address of the modules where the local variable is declared   * **level** and **level** A tupel that points to a node of a tree where each node is a scope `{ .. }`. It doesn't matter if it is a function scope or a control command (`if`, `for`, etc.)   * **index** The index of the symbol inside a node (Therefore it is an ordered list) This works and should be fast enough even for large programs. If Eclipse wants to know anything about a symbol wheter it's the name, type or value it sends me an ID that looks something like this (values in hex):               L@C415.E.1.1      and I can identify the symbol in my parser. The main problem I got now are global symbols like global variables, function names and so on. At the moment I have a `Dictionary<T>` that maps the name of a symbol to its runtime object:               /* Dictionary that holds all global-scoped symbols. */     private Dictionary<String, CDBSymbol> m_nameToGlobalSymbolDict = new Dictionary<String, CDBSymbol>();      Now consider a very large program where a lot of global symbols may occur. Is such a large hash-table the best I can do? At the moment a global symbol ID looks like these:               G@function_name1     G@global_integer1     G@function_name2      The only thing that I might could do would be to add identifiers for functions, variables etc. like               G@C.function_name1     G@E.global_integer1     G@C.function_name2      where `C` means code and `E` internal RAM but that would only allow me to split the hash-table and nothing else. Can anybody suggest me a solution or tell me if this is already okey the way I'm doing it? I hope it is clear what I am asking for. If not please let me know.


title: How should I design a correct OO design in case of a Business-logic wide operation

text: **EDIT:** Maybe I should ask the question in a different way. in light of ammoQ's comment, I realize that I've done something like suggested which is kind of a fix and it is fine by me. But I still want to learn for the future, so that if I develop new code for operations similar to this, I can design it correctly from the start. So, if I got the following characteristics:   * The relevant input is composed from data which is connected to   several different business objects   * All the input data is validated and cross-checked   * Attempts are made in order to insert the data to the DB   * All this is just a single operation from Business side prospective, meaning all of the cross checking and validations are just side effects. I can't think of any other way but some sort of Operator/Coordinator kind of Object which activates the entire procedure, but then I fall into a Functional-Decomposition kind of code. so is there a better way in doing this? **Original Question** In our system we have many complex operations which involve many validations and DB activities. One of the main Business functionality could have been designed better. In short, there were no separation of layers, and the code would only work from the scenario in which it was first designed at, and now there were more scenarios (like requests from an API or from other devices) So I had to redesign. I found myself moving all the DB code to objects which acts like Business to DB objects, and I've put all the business logic in an Operator kind of a class, which I've implemented like this: First, I created an object which will hold all the information needed for the operation let's call it InformationObject. Then I created an OperatorObject which will take the InformationObject as a parameter and act on it. The OperatorObject should activate different objects and validate or check for existence or any scenario in which the business logic is compromised and then make the operation according to the information on the InformationObject. So my question is - Is this kind of implementation correct? PS, this Operator only works on a single Business-wise Operation.


title: PHP MVC error handling, view display and user permissions

text: I am building a moderation panel from scratch in a MVC approach and a lot of questions cropped up during development. I would like to hear from others how they handle these situations.   1. **Error handling** Should you handle an error inside the class method or should the method return something anyway and you handle the error in controller? What about PDO exceptions, how to handle them? For example, let's say we have a method that returns true if the user exists in a table and false if he does not exist. What do you return in the catch statement? You can't just return false because then the controller assumes that everything is alright while the truth is that something must be seriously broken. Displaying the error from the method completely breaks the whole design. Maybe a page redirect inside the method?   2. **The proper way to show a view** The controller right now looks something like this:              include('view/header.php');     if ($_GET['m']=='something') include('view/something.php');     elseif ($_GET['m']=='somethingelse') include('view/somethingelse.php');     include('view/foter.php');      Each view also checks if it was included from the index page to prevent it being accessed directly. There is a view file for each different document body. Is this way of including different views ok or is there a more proper way?   3. **Managing user rights** Each user has his own rights, what he can see and what he can do. Which part of the system should verify that user has the permission to see the view, controller or view itself? Right now I do permission checks directly in the view because each view can contain several forms that require different permissions and I would need to make a seperate file for each of them if it was put in the controller. I also have to re-check for the permissions everytime a form is submitted because form data can be easily forged. The truth is, all this permission checking and validating the inputs just turns the controller into a huge if/then/else cluster. I feel like 90% of the time I am doing error checks/permissions/validations and very little of the actual logic. Is this normal even for popular frameworks?


title: Automated Qt testing framework

text: Can someone recommend a good robust "Free" testing framework for Qt? Our requirements:   1. Should be able to test basic mouse click / mouse move events   2. Should be able to handle non-widget view components   3. Should have "record" capability to generate test scripts.   4. Should be automatable for running it daily. We looked at:   1. Squish - this solves all our problems. But it is just too da** expensive.   2. KD Executor - the download page now links to the squish page and says that's what they recommend for testing. Not sure what they mean by that.    3. TDriver - from nokia.qt. Super difficult to install. Very little documentation. Having a hard time to just install. I wonder how much harder it would be to write tests.   4. qtestlib - Could not handle non-widget components. Everything has to be a widget to be tested. No "record" feature.  Can someone help with any other alternative?


title: Saving all hits to a web app

text: Are there standard approaches to persisting data for every hit that a web app receives? This would be for analytics purposes (as a better alternative to log mining down the road). Seems like Redis would be a must. Is it advisable to also use a different DB server for that table, or would Redis be enough to mitigate the impact on the main DB? Also, how common is this practice? Seems like a no brainer for businesses who want to better understand their users, but I haven't read much about it.


title: Programming language features that help to catch bugs early

text: Do you know any programming language features that help to detect bugs early in the software development process - ideally at compile-time or else as early as possible at run-time? Examples of well-known and effective bug-reducing features are:   * Static typing and generic types: type incompatibility errors are detected by the compiler   * Design by Contract (TM), also called Contract Programming: invalid values are quickly detected at runtime (through preconditions, postconditions and class invariants)   * Unit testing I ask this question in the context of improving an object-oriented programming language (called Obix) which has been designed from the ground up to 'make it easy to quickly write reliable code'. Besides the features mentioned above this language also incorporates other Fail-fast features such as:   * Objects are immutable by default   * Void (null) values are not allowed by default The aim is to add more Fail-fast concepts to the language. If you know other features which help to write less error-prone code then please let us know. Thank you.


title: Why have minimal user/handwritten code and do everything in XAML?

text: I feel the MVVM community has become overzealous like the OO programmers in the 90's - it is a misnomer MVVM is synonymous with no code. From my closed StackOverflow question: Many times I come across posts here about someone trying to do the equivalent in XAML instead of code behind. Their only reason being they want to keep their code behind 'clean'. Correct me if I am wrong, but is not the case that: XAML is compiled too - into BAML - then at runtime has to be parsed into code anyway. XAML can potentially have more runtime bugs as they will not be picked up by the compiler at compile time - from incorrect spellings - these bugs are also harder to debug. There already is code behind - like it or not InitializeComponent(); has to be run and the .g.i.cs file it is in contains a bunch of code though it may be hidden. Is it purely psychological? I suspect it is developers who come from a web background and like markup as opposed to code. EDIT: I don't propose code behind instead of XAML - use both - I prefer to do my binding in XAML too - I am just against making every effort to avoid writing code behind esp in a WPF app - it should be a fusion of both to get the most out of it. UPDATE: Its not even Microsoft's idea, every example on MSDN shows how you can do it in both.


title: What's wrong with circular references?

text: I was involved in a programming discussion today where I made some statements that basically assumed axiomatically that circular references (between modules, classes, whatever) are generally bad. Once I got through with my pitch, my coworker asked, "what's wrong with circular references?" I've got strong feelings on this, but it's hard for me to verbalize concisely and concretely. Any explanation that I may come up with tends to rely on other items that I too consider axioms ("can't use in isolation, so can't test", "unknown/undefined behavior as state mutates in the participating objects", etc.), but I'd love to hear a concise reason for why circular references are bad that don't take the kinds of leaps of faith that my own brain does, having spent many hours over the years untangling them to understand, fix, and extend various bits of code. **Edit:** I am not asking about homogenous circular references, like those in a doubly-linked list or pointer-to-parent. This question is really asking about "larger scope" circular references, like libA calling libB which calls back to libA. Substitute 'module' for 'lib' if you like. Thanks for all of the answers so far!


title: Using a Directory Service instead of a Database

text: I've just started working on an existing application that uses an LDAP directory service as its object store instead of a database. Many of my coworkers have been commenting how an application should never use a directory service instead of a database as its object store. I've got to work on it regardless, and won't be able to change it from LDAP to a database anytime soon. That said, my coworkers comments brings up the question in my mind: _Why is it bad to use a directory provider instead of a database as an object store?_ Could there ever be cases where this would not only acceptable, but even better than using a database?


title: Visual Design implementation timing in Agile

text: We work in Scrum with the caveat that we don't have a potentially shippable product at the end of each Sprint, instead requiring several hardening/stabilization Sprints before release. One of the reasons for this is that our chief UX designer prefers that we'll complete all the visual work (such as colors, fonts, exact layout and controls) at the later stages of the project. On one hand it makes sense because a feature with decent UI based on a wireframe is usually good enough to receive feedback from the users, so working too hard on the final visuals and styles is not necessary for risk reduction. It might even be wasteful if the feature fails at usability tests or if after further user feedback we'll decide to change the visual design for the entire system, including features that were already implemented. On the other hand with this approach we will have a list of features that are not completely developed, and with the final polishes being left out until the final Sprints. What do you think we should do? Should we go with the recommendation of the chief UX designer or should we go for a potentially shippable product? Thank you.