title: Custom directive or ng-show/hide

text: On my form I have an icon which represents whether my entity is locked (shown by a locked padlock) or unlocked (an open padlock). At the model level, this is represented by a boolean property (isLocked). The user can toggle the entity between locked and unlocked by clicking the icon. This also updates the icon tool-tip text. This calls a controller method that toggles the entity.isLocked property. It is like a fancy kind of checkbox. I can implement this in one of (at least) two ways: 1) Create a custom angular directive that changes the class of the icon element to show the correct icon and also sets the tool-tip text. The icon will then be a single DOM element in my view, decorated with the custom directive. 2) Put both the locked and unlocked icon elements in the DOM and show/hide each one using the custom ng-show directive. Option 1 involves writing custom code which feels like the wrong thing to do, whereas option 2 makes maximum use of the built in Angular features, but leaves the HTML more cluttered. In general, should I prefer the custom directive method (option 1) or the HTML method (option 2) or some other method? Which would be considered more idiomatic for Angular do you think? And, more importantly, why? I did consider putting this on StackOverflow, but it feels like it would be considered off-topic there because it is a matter of opinion in the end...


title: Should timeout be a public static property or a parameter to every function?

text: **TLDR:** Should TIMEOUT be a public property on my static class, or a parameter to every function? * * * **Background:** I am releasing a c# client-api library that facilitates communicating with our REST api. The client-api consists of an object model and one large static class with a bunch of request extension methods for various types. 10 or so `.Get()` variations, a few `.Post()`, `.Put()`, etc. This static class full of extension methods is preconfigured with our server URL, and some other static configuration constants related to the connection. Because all the functionality is exposed via extension methods, there's no need to create an instance of this class. Any configuration is done via static properties and affects all requests made by the application. **Problem:** Right now, all requests use a default timeout of 3 seconds (which seems generous to us, as our API is meant to be very responsive.) Some users with a bad connection though might want to wait longer for a response. Our quick-fix solution is to expose the DEFAULT_TIMEOUT at a public static property on the class which can be set once on initialization, but is the proper thing to do to add a new optional parameter to every single one of our dozens of methods?               .Get(int timeout = DEFAULT_TIMEOUT) { ... }     .Get(..., int timeout = DEFAULT_TIMEOUT) { ... }     .Get(..., ..., int timeout = DEFAULT_TIMEOUT) { ... }     .Get(..., ..., ..., int timeout = DEFAULT_TIMEOUT) { ... }     ...     .Post(..., int timeout = DEFAULT_TIMEOUT) { ... }     .Put(..., int timeout = DEFAULT_TIMEOUT) { ... }     .Save(..., int timeout = DEFAULT_TIMEOUT) { ... }     ...      On the one hand, we want to be flexible to whatever the consumer of our client-api library might need, but on the other hand, I won't want to get in the habit of polluting every method with every optional parameter that might impact a request (server url, authorization tokens, etc.) What I don't want, is for the user to feel the need to do this:               ClientAPI.DEFAULT_TIMEOUT = 5000;     Thing found = new Thing(){ id = "19473" }.Get();     found.count += 1;     ClientAPI.DEFAULT_TIMEOUT = 20000;     found.Put();     ClientAPI.DEFAULT_TIMEOUT = 8000;     List<Widgets> widgets = found.GetSubresource("widgets");     ...etc      Is it reasonable to assume users won't be micromanaging timeouts for individual requests like that?


title: Web development in a small team - best practices

text: Currently developing a web app in a team of two maybe three in the near future. Tech stack is at the moment : flask, mongodb, and extjs for the fontend. I currently have the project under version control using mercurial and bitbucket. Question What is exactly the best way to work as a team on a we app peoject? I ussually work on the back end while my colegue works on the frontent. Sometimes i also help out on the front end. How should we do this? Each has a repo on their system but whee is the web server started? Curentlly i have it on my computer but that means that my partner needs to commit and push for each modification and i need to pull the changes and merge for each change. And for frontend stuff there needs to be a lot of changes. We tried having a server started on each of our machines but its a pain with multiple mongodb servers. Anyway any tips, clues and advices are greatly appreciated and welcomed.


title: HTML5 card game

text: I created a card game in Silverlight a year ago, in order to learn a bit about Silverlight. I am now wanting to make a HTML5 version of the game in an effort to learn a little bit more about that. I am thinking I'd like to take advantage of stuff like Knockout.js and WebSockets and the canvas element. Now what I'm confused about is how to lay out the cards on the screen. With Silverlight I was able to make a "Hand" control, which was made up of two sub controls: the cards the player has in their hand and the ones they have on the table. They were made up of Card controls. I don't believe there is the concept on a User Control in JavaScript; so I am possibly thinking about this in entirely the wrong way. I have a client side JSON object called game, which contains an array of players; each player has a hand which is made up of an array of in-hand cards and on-table cards. Ideally I would like to bind these to something using Knockout.js, but I don't know what I could bind to. How could I lay out some cards on the table, and perhaps make reuse of something for each player? Would I simply position images (of cards) on a canvas? Is there a way to make some kind of hand object that each player could have and that I could bind to?


title: Can I brand my open-source application?

text: Is it possible for the author to register a logo or the name of his/her application when it is open-source because it uses a gpl library (for example)? The application uses the library but it has its own features, that is it's not a modification of the library. So everyone can see the source code, downloading an "anonymous" non-branded version from Sourceforge, but none can use the logo or the name and so the author can sell it from his/her web-site (for example) to non-expert users, only after payment. Is he/she obliged to give directly the source code, or it is enough that there is the non-branded version available on Sourceforge or other official repository?


title: Do you keep intermediate files under version control?

text: Here's an example with a Flash project, but I'm sure a lot of projects are like this. Suppose I create an image with Photoshop. I then export this image as a jpeg for integration in Flash. I compile the fla as an asset library, which is then used in my Flash Builder project to produce the final swf. So it goes like :               psd => jpg -> fla => swc -> Flash Builder project => swf.          => : produce     -> : is used in      The psd, fla, and Flash Builder Project are source files : they are **not** the result of some process. The jpg and swc are what I would call "intermediate" files. They are the product of one (or more) source file(s) that are used as input in another tool or process. The swf is the final result. So, would you keep those intermediate files under version control? How do you deal with them?


title: Optimum Number of Parallel Processes

text: I just finished coding a (basic) ray tracer in C# for fun and for the learning experience. Now I want to further that learning experience. It seems to me that ray tracing is a prime candidate for parallel processing, which is something I have very little experience in. My question is this: how do I know the optimum number of concurrent processes to run? My first instinct tells me: it depends on how many cores my processor has, but like I said I'm new to this and I may be neglecting something.


title: Big source tree refactor ahead - what tool to use?

text: We are doing a major refactor of the layout of our source tree. Masses of files are being moved, folders are being renamed, etc. etc. We currently have everything in SVN. We're going to move to either GIT or HG in the future. However, now we're thinking that maybe we should move to GIT or HG first and then do the refactor. We're worried that work in progress on svn branches aren't going to be able to merge the refactoring changes into their branch NOR are they going to be able to merge any changes to files that have been moved and/or renamed back into the trunk.   1. Which between GIT and HG would better handle this type of refactoring?    2. If we do move to GIT/HG and then do the refactor, what will be merging be like for the work in progress branches once they move to GIT/HG?


title: OpenID implementation - PHP, Javascript, MySQL

text: I've started doing some research on the technologies that I will need for my website. I'm trying to implement a really simple website with OpenID user registration. The website will store a block of text for each user. I imagine this means that I will need a database with:   * User ID   * Open ID url   * Data Having said that, I'm still having trouble deciding what I really need to do this. I know that I will need the following for the actual site:   * Javascript   * JQuery   * CSS But on the back end, I'm kind of lost at the moment. I've been looking at the OpenID-Selector, which is coded in Javascript. It seems like it's exactly what is used on this site. Will I actually need PHP? MySQL for the data and user registration?


title: How to tell if a license is compatible with your program?

text: I'm using a code sample from MSDN in my project. Accompanying the sample is this license: http://pastebin.com/K46NYf69 I've modified the code sample slightly to better suit my needs and I now want to release my program as open source. However, I'm not sure which licenses are compatible with this license because I cannot find it on Google. The license claims it is a Microsoft _Permissive_ License but I can only find Microsoft _Public_ License. Also, I'm not completely sure what this license allows. Can I modify the sample? Can I package it in my project under another license like the GPL or the Apache/BSD license? Thanks for reading.


title: Form Follows Function in Programming?

text: Does the saying, " **form follows function** " hold true in programming or language-design? Why or why not?


title: Why do languages such as C and C++ not have garbage collection, while Java does?

text: Well, I know that there are things like malloc/free for C, and new/using-a- destructor for memory management in C++, but I was wondering why there aren't "new updates" to these languages that allow the user to have the option to manually manage memory, or for the system to do it automatically (garbage collection)? Somewhat of a newb-ish question, but only been in CS for about a year.


title: What is the name for this variation to Adapter Pattern?

text: ### Introduction An Adapter normally wraps another object, so that it can be used in an interface it wasn't designed for, e.g., when you want to use               interface Node {         Node parent();         Iterable<Node> children();     }      together with               class TreeModel {         private Node root;         // example method (stupid)         Node grandparent(Node node) {             return node.parent().parent();         }     }      and you're given a class like               class File {         File getParent() {...}         File[] listFiles() {...}     }      you need to write some `FileToNodeAdapter`. Unfortunately, it means that you need to wrap each single object and you also need both a way to get from `FileToNodeAdapter` to `File` (which is trivial, since it's embedded), but also from `File` to `FileToNodeAdapter`, which leads either to creating a new object each time or to using some `Map`, which must be either globally accessible or referenced in each `FileToNodeAdapter`. ### The Pattern Replace the interface `Node` by               interface NodeWorker<T> {         T parentOf(T node);         Iterable<T> childrenOf(T node);     }      and modify the `TreeModel` like               class TreeModel<T> {         private NodeWorker<T> nodeWorker;         private T root;         // example method (stupid)         T grandparent(T node) {             return nodeWorker.parentOf(nodeWorker.parentOf(node));         }         ...     }      Does this pattern have a name? Are there any disadvantages, besides the fact that it is little bit more verbose and only applicable when you are in charge of the `TreeModel` code?


title: Hobbyist programmer releasing software with a donate button

text: I'd like to start this with a disclaimer that I realize that a full, clear-cut answer should be sought out by a lawyer. I am more so curious about what other users of this community have done * * * Say that I had a small program that I had developed for fun, that I wished to release to the public. I'll drop it out there with one of the various open- source licenses, and probably put it up on SourceForge or Git in case if anybody should ever want to fork/maintain/check out code. Also say that I wanted to accept donations for the project, with absolutely 0 expectation that people will send any money. However, if somebody donated in order to buy me a beer or a pizza for the work that they liked, I would accept gladly. The question, then, is what are the general requirements of accepting donations? Can it go into a personal account with no questions asked as a "gift," or do I need to setup an LLC to avoid any taxation issues? (US citizen here). Again, yes this should be lawyer discussed, but I also know that many projects that I see have the ability to donate, and assume that the community probably has a decent amount of experience in this regard.


title: How not to suffer from ideologists when you're a pragmatic person?

text: I'm a pragmatic person (I think I am. But then again, Jon here has an interesting point ). Sometimes, the most simple solution to a problem to get the job done is the one that fits best for me, if it's not an utter blasphemy and reproach to any design principles. Check out my answer to this question on Stack Overflow. Simple. Works. Was accepted. Could be improved. Is clearly not perfect and not very elaborate. And along comes this guy. He downvotes me, comments on the question how his answer is better, more accurate etc and when I ask him why he downvoted me, he calls me _plain wrong_ in his comments. Reminds me of this comic strip. Just to get this straight: His answer is clearly better. But that's not the point! While on Stack Overflow I can laugh and not really care about these things because those people are far away, in the real world I'm suffering from ideologies every now and then. Heck, I'm not creating a miracle piece of software, I need to keep that huge legacy thing running, and it's an adventure to me every day. I'm good at some things and bad at other things. I'm eager to learn stuff. But I can accept one or two flaws in a system as what they are: flaws. Tomorrow, we're going to refactor all of them, but first let's do what the customer wants, and then have a beer. My questions are:   * How do you deal with ideologies / ideologists, when you're a pragmatic person?   * How do you deal with pragmatism / pragmatists, when you're an ideologic person? I'm interested in both point of views.


title: Is it possible to be good at both programming and graphic design?

text: The stereotypical view of a programmer can't do graphics very well, from what I've read and seen. However, I love programming (preferably OOP, PHP, C++, Objective-C) and can't deny the fact I have a unique taste in web design and others have said I am doing well at it (CSS). I thought to myself "Hey, wait, I'm a programmer - how can I design well?". Question is: is it possible to be good at programming and designing? Does anyone here feel the same? For the record: actual images I have created have been called programmer art several times before by friends


title: Search algorithm

text: I would like to create a site where users can post articles with the following optional parts:   * A title   * Contents (text)   * Categories   * Keywords Articles will be stored in mongodb and the site will be built in node.js. Users can search the site using a normal search text box. I'm thinking about creating the following collections:   * Users   * Articles   * Keywords I will then create an entry for each keyword used in the Keywords collection with an array containing all the articles that use it. If a user conducts a search, the search is broken up into keywords and each keyword is looked up in the Keywords collection. Each article is then retrieved from the db and ranked based on relevance. My questions are:   1. Would it be efficient to use a Keywords collection like this, should I just use the Articles collection (Using full-text search or something) or should I structure it in some other way?   2. How would I incorporate the ability to search the title, contents or categories for articles instead of just the keywords?   3. Would it be better to use something like Apache Lucene than to build this functionality myself?


title: How do I test my validation without being too much perfectionist, yet to leave most part of logic tested?

text: For example I would like to validate that name is letters only and is between 4 and 14 letters length. I have the following code in model:               validates: name, :format => { :with => /^[a-zA-Z]+$/,                                   :message => 'Name should be letters only. },                      :length => { :minimum => 4, :maximum => 14 }      So it clearly lets me do what I want. But as for unit tests, I have a bit too much perfectionism so I set something like               invalid_names = ['1234',                      'qwe',                      '1%#$#$',                      'Sam1',                      '%',                      random_string(15)] #I also have a test method to create random string with parametrized length          valid_names = %w['test',                      'Travis',                      'John',                      random_string(5),                      random_string(14),                      random_string(4)]      and test each of them in a loop with asserts, like               invalid_names.each do |name|         user = User.new(:name => name)         user.save         assert user.errors[:name].any?, "#{name} is valid."     end      So it definitely works great. But it is too verbose (because of valid/invalid names arrays, and added `random_string` method), also I can't be sure my test actually tests all symbols and their combinations possible and all lengths and stuff, even though I am definitely sure it works as expected. So what is acceptable way to test my validation without being too much perfectionist, yet to leave most part of logic tested? Am I just set in a mind trick of trying to write a perfect code just to write a perfect code and forgetting about main finish goal: working product?


title: My proposed design is usually worse than my colleague's - how do I get better?

text: I have been programming for couple of years and am generally good when it comes to fixing problems and creating small-to-medium scripts, however, I'm generally not good at designing large scale programs in object oriented way. Few questions   1. Recently, a colleague _who has same number of years of experience as me_ and I were working on a problem. I was working on a problem longer than him, however, he came up with a better solution and in the end we're going to use his design. This really affected me. I admit his design is better, but I wanted to come up with a design as good as his. I'm even contemplating quitting the job. Not sure why but suddenly I feel under some pressure e.g. what would juniors think of me and etc? Is it normal? Or I'm thinking a little too much into this?   2. My job involves programming in Python. I try to read source code but how do you think I can improve me design skills? Are there any good books or software that I should study?  Please enlighten me. I will really appreciate your help.


title: Seeking advice on design of application protocol

text: **UPDATE 1** as requested by Brendan. We are developing a Unix batch application for storing millions of customer records into a relational database. In order to allow multiple batch jobs to run in parallel, and to achieve a certain amount of concurrency while processing an input record, we've distributed the work across nine server daemons, all within the same LAN as the client, each of which is responsible for an isolated task (e.g. store the name in the name table, store the address in the address table, etc.). Each daemon will be able to accept connections and requests (concurrently) from multiple clients. Finally, whatever communication protocol we design (or adopt) must be extensible to accommodate different _kinds_ of connections - for instance, we'd like for a monitor tool to be able to connect to a daemon, over the same port as the clients, and request statistics or send commands. There will also eventually be different kinds of clients that require different functions to be performed by the daemons. In other words, a client connecting to a daemon will have to be able to declare "I want to post customer records," or "I want to apply a batch of changes-of-address to the database" or "I want to send you a few commands." I think it's a foregone conclusion that the underlying transport of these connections be TCP. Finally, apart from the "command session", these will be multi-million record batch jobs, and performance is critical. The processing is iterative, and every record has the same layout (so wrapping each one in XML, say, would be unnecessary and highly wasteful). I've no idea if this is enough information for someone to suggest some formats and protocols to use, but I'll gladly try to clarify or supply additional details if asked. **END OF UPDATE 1** * * * (Below is the original post, which may or may not be of any value.) * * * I'm in charge of designing an application protocol for a set of in-house, batch-oriented, client-server applications. I'm familiar with IBM LU 6.2 (a.k.a. "Advanced Program-to-Program Communication"), and for the past 15 years have worked in Unix environments. The client is a batch job that connects to a server process — which, in turn, connects to nine other "sub-server" processes. The client passes a customer transaction record to the server, which distributes different portions of the record to the sub-servers. Each sub-server processes its portion independently and concurrently, and passes some results back to the server which then passes them back to the client. These are TCP connections, and we decided that, first of all, we'd use newline-terminated ASCII strings (we call these **lines** ) as our Protocol Data Unit. A **record** is a line that is subdivided into tab-separated **fields** , and since each process will have its own data requirements, field#1 of every record will contain a **record type**. This is used as a key into a metadata store to find the **field names** , in the order they’re expected to appear in the record, in order to know how to interpret the record. For example:               Metadata: NAME=(prefix, first_name, middle_name, last_name, personal_suffix, professional_suffix)     Record:   NAME||CHAP||HARRISON|JR|CTO#      (Here I use '|' to represent the tab character, and '#' to represent newline character) Very straightforward so far, I think. But then, new twists arose. The first was that, instead of sending all the data about one transaction in a single [large] record, we'd like to possibly use several records: a NAME record, an ADDRESS record, an EMAIL record, etc. So we invented the **block** \- a series of records, preceded by a “special” **BB** record and followed by an **EB** record. The BB record’s first field is, of course, 'BB', and the second field holds the **block type**. Block type, like record type, is a key into metadata listing the record types (required, or optional) in this block type. Understandably, each of these ten or so processes, having its own unique data requirements, has led to its own set of record types, enclosed in their own set of block types. That's a lot of metadata, but it isn't really a showstopper. The next thing requirement that emerged was a special "context-setting" message, to transmit certain configuration variables that would remain constant from transaction to transaction. This gave rise to a new record and block type, as well as a new column in the block metadata that indicated this kind of block was somehow "special". Then, envisioning circumstances where the "context" could _change_ during the runtime of the client, we lifted the rule that stipulated there could be only one "context" message, at the beginning of a connection. At the same time, we realized there was still a need for a true "initialization" message that could only come once, at the beginning, conveying "session-global" parameters. Thus the INIT block was born, and now there were three flavors of block: session- initialization, context-switching, and normal application data. Then, how about a connection that isn't for transaction-posting at all, but rather a control session for querying the health of the server, retrieving statistics, changing operational settings? The INIT block’s role became more general, declaring the "mode" of the session, which could now be either "posting", or "control." We've been trying to wedge all of this into a single-layered application protocol, and it's getting out of hand. Just defining a "special" BB record should have raised a red flag - it's constructed from application-level objects and metadata, but it is not application data - rather, it _frames_ the application data. * * * I think what has evolved is a 2-layer architecture atop TCP: one layer that simply provides typed containers (blocks and records), and a higher layer that uses those containers for a specific purpose, be it posting, or control, or something else - the true application protocols. However, I'm not well-versed enough in the design of protocols to recognize "patterns" that might be obvious to the pros. I'd appreciate any feedback on how to approach this. It also seems possible that someone may have written a guide to designing protocols, that addresses these very concerns. I just haven't found it. And my apologies for the length of this post. I hope none of it was immaterial. My deep thanks for your patience! Chap


title: Coding Style for Visually Impaired Programmer

text: I am visually impaired. With glasses I see well enough to drive, but at the font size I'm comfortable working at I can only see about 15 lines of 100 characters at a time. This has affected my coding style. One thing I do is write shorter functions. My code tends to get good reviews because these short functions with good names make the higher level functions very readable, but in high performance situations some folks make comments about how much space I'm taking up on the stack by passing variables down several layers for processing. A second thing I do is divide classes up between files to make shorter files. This reduces the scrolling distance to get to relevant functions and depending on organization may allow me to put the files up on different monitors to look at them together. Both of these practices make for more documentable units that most coding styles require I document, which further aggravates the issue by extending the length of my file and the distance between related functions. I'm currently using Visual Studio, which allows code folding at the function and comment block level (which I use frequently) but does not fold at the bracket level like Notepad++ does. The editor that offers better code folding doesn't have all the intellisense features of VS. I could use regions in VS, but this looks very cluttered if used every 10 lines. Folding is occasionally helpful to get completed code out of view while I'm working on a different feature of the code. Can anyone recommend better coding practices to help with limited visibility of the code?


title: Do you have to include a license notice with every source file?

text: I've been looking for various licenses that I can use for an open-source project of mine, but all of the projects that I've seen, with all kinds of licenses, appear to have a giant, obnoxious (in my opinion) notice in each source file that states that the file is listed under a certain license. I don't think that I've found a single source project that isn't public domain that _doesn't_ have a notice like that. This just seems like a waste of time and file space. I plan on putting `@license` and `@author` tags in my projects, but I don't see why I need to list such a giant notice in each individual file if I don't want to make my code public domain. Is there any reason why I would want to include such a notice in my projects, or would simply including a notice in the `README` and a `@license` tag be good enough? Does this affect the "clearly stated" rule of most licenses, or is it just overkill so that people won't argue?


title: Copyright in all files or just a license file?

text: Does it have any legal merit to put a copyright comment on each class. Example:               //     // MyClass.h     // Companyname     // Created by DeveloperName on MM/DD/YY     // Copyright YYYY Companyname. All rights reserved.     //     public class MyClass { ... }      Or does it have the same effect as putting a license file in the root of the source code, like many do on github.


title: How much design happens in your implementation phase?

text: For those of you who work in big-design-up-front/waterfall groups: how much critical thinking and design is skipped in your design phase and left to your implementation phase? How complete and detailed are your functional and technical specifications delivered at the end of the design phase? It seems to me that there's a lot of room for interpretation in the level of detail that needs to be provided at the end of the Design phase, and it irks me when the design phase is rushed and then managers get angry that the build phase doesn't progress like we're churning out widgets on an assembly line. On the other hand, a design phase that's complete enough to make the build phase operate like an assembly line practically includes the implementation phase with it - all that would be left in "build" is to type stuff into the editor. Of course, it also means your design phase is gigantic. **I realize that this is a shortcoming of the waterfall model** , but if there's anyone out there that can provide some constructive advice: Where does one draw the line? What should the expectations for the design and build phases be, and what kinds of design shortcomings or mistakes should/shouldn't be tolerated in the build phase?


title: Need advice on designing interactions between various parts of my application

text: I'm trying to design the "main" classe(s) of a Rich Desktop Application based on NetBeans Platform 7. This application will consume HTTP services and, through a "push system" over TCP, will receive messages.   * We are 3 developpers and we want to develop modules in parallel   * Application will be layered (Data, Business, Presentation)   * We'll use Presentation Model in order to separate responsibilites   * Some granular data (a bean Person for example) will be shared by several screens (and possibly displayed on several screens at the same time)   * ... We are able to develop individual screens, but We don't know exactly how to organize the whole application and define each module content.   1. So, have you any advice (a pattern / best practice / book / sample app) to coordinate/manage interactions inside of the whole application?   2. Any advice about how to define modules content? Thanks! * * * Small example to illustrate what I want to build: **A Foo User Management Application**   1. Launch the application   2. At the left [explorer] we have a list of platforms (list is stored in a local file)   3. At the top we have button to add a new Platform (also available with right click)   4. By double-clicking on a platform, the app calls a HTTP service a retrieve a complete list of users. This list is displayed in the [editor] (in a JTable)   5. A background process is started: through a TCP connection we receive messages   6. It is possible to Add new user thanks to a button in a Toolbar If the application is launched on another PC, and if the user is connected to the same platform, its User List will be updated dynamically (add/remove/status:{offline/online}) (thanks to messages) In the future it a Chat Module will be provided. My question is (in other words): any advice/best practice to decide on content of each module? If PM (Presentation Model) is a good way to separate view/business and data and create screens, what is the best way to link several screens based on PM? Imagine we develop the Chat Module, how to add an entry "Discuss with..." to the Context menu available with right click on User List?


title: How can I properly manage commits, prevent feature conflicts, and manage dependencies with a VCS?

text: It’s become an annoying factor of working with large teams: how do you manage checkins and prevent feature conflicts and manage dependencies with source control properly? Currently at my workplace we use TFS 2008 and we're migrating to TFS 2010 in early December. Firstly any source control is better than none but what approach has anyone found useful to prevent multiple checkins and rollback all over source control history? Is a volatile trunk the best way to go or branch off when your implementing a new feature and once you're happy merge back into the trunk? I'd really like to hear other people experiences and perhaps some best practices to managing source control.


title: Tdd on a datadriven webapp

text: How would one go about to use tdd/bdd on a mostly data driven webapp? For example a blog or a forum?


title: Is it reasonable to assume/require the .NET framework these days?

text: **Background:** I have a project where I need to provide the user a download package with some sensitive data in it. The data needs to be encrypted. After they download it, they need to be able to view it (no editing required). For this question, let's approximate the data as a series of static html files. Because the data is sensitive, it needs to be encrypted any time it is on disk. We are thinking of providing the user with a download option that would give them a zip file containing two files:   * A data file (we'd probably use an encrypted zip file behind the scenes) with the data they asked for   * An application to view the data that would appropriately prompt for a passphrase and handle decrypting the data and displaying it via an embedded web browser. Additional details:   * Users are not under our control. They are consumers.   * We are not worried about cross platform in this question. This is just about Windows. We will have a separate download for Mac users. **Get to the question already:** For that application we need to create, we're internally debating if it is reasonable for that app to be a .NET winforms application. We want a single .exe, and we want the download to be reasonably small (e.g. 100k).   * Dare we use the .NET framework (we don't need to use a particularly recent version of .NET--2.0 would be fine)?    * Is it reasonable to assume that most consumers have .NET on their machines now due to Windows Update?    * Is it reasonable to ask the ones that don't have it to install it? We know that 100% of users will not have .NET. The real question is if it is _reasonable_ to ask them to have it in this day and age. P.S. Does anyone know of any reliable statistics of what percentage of people actually do have .NET installed already?


title: What is a job in programming really like?

text: More specifically: **Is a job in programming really as bad as it sounds?** I'm still in high school, but I love programming. I take all of the programming classes that my school offers (which are actually quite a lot), and program in my free time. In college, I intend to do something related to programming, and then I eventually hope to get a job in programming something. However, from what I've read on the internet, a job in programming sounds really terrifying and intimidating, and I'm wondering what it's like, and if it's really as bad as it sounds.


title: Controller layer and 3-tier architecture

text: What is controller layer and where we put this in our 3-tier architecture?               1)UI     2)Business Logic Layer     3)Data Access Layer      I search in net but unable to get exact ans.Any links or sample example helps to understand better.Thanks.


title: If you had to go back and re-learn your skill set, how would you do it?

text: My younger brother is looking to start programming. He's 14, and technically- inclined, but no real experience programming. He's looking to me for guidance, and I don't feel as if my experience is enough, so I figured I'd ask here. He's more interested in web programming, but also has an interest in desktop/mobile/server applications. What would be a good learning path for him to take? I'm going to buy him a bunch of books for Christmas to get him started; the question is, what should he learn, and in which order? The way I see it, he needs to learn theory and code. I'd like to start him off with Python or Ruby or PHP. If he wants to get in to web, he's also going to need to learn HTML, CSS, Javascript, etc. Out of those three domains (Languages, Theory, Markup/Etc.), what is the best order do you think to learn in? Also, am I missing anything? Thanks!


title: 'import module' vs. 'from module import function'

text: I have always been using this method:               from sys import argv      and use `argv` with just **argv**. But there is a convention of using this:               import sys      and using the argv by `sys.argv` The second method makes the code self documented and I _(really)_ adhere to it. But the reason I prefer first method is it is fast because we are importing only the function that is needed rather than import the whole module (which contains more useless functions which python will waste time importing them). Note that I need just argv and all other functions from sys are useless to me. So my questions are. Does the first method really makes the script fast? Which method is preferred most? Why?


title: Database Design for Web based RSS Feed Agreegator

text: I am working on an open source application which can allow users to add RSS feeds. All users of the site can read the content of those RSS feeds. It's not just for user's own feeds. Using PHP and SimplePie library I have created a simple app. I am trying to implement category based listing. I have a list of RSS/Atom feeds in a database. Each post in the feed can have a category/label associated to it and a single feed can have multiple posts falling under multiple categories. **Question:** I want to get only the posts of category "Science". In worst case, if I have 1000 RSS feeds, should I read posts from each feed and check the category of each post? Storing all posts of each feeds and its categories is not a good solution. How best can we have a database design for this? Database schema is provided below. Nothing is fixed and I am free to change any schema or design. http://sqlfiddle.com/#!2/2b519/1 NOTE: The fiddle is just for reference and does not need to worry. Its optional as I thought it might help to make others understand.


title: Which programming language is the best to start learning/teaching about programming

text: As this question is closed, let me do an attempt that actually meets all 6 requirements. At our faculty, there's for the moment a big change in the classes "informatics". We used to teach Java, but this is going to be replaced with Matlab (and the class will be called "Scientific Computing"). Personally, I'm not in favor of that idea, because :   * Matlab is not freeware, hampering the possibilities for the students to get hands-on experience. They can on campus or via VPN, but not on their own computers.   * ~~Matlab isn't even a real programming language, but a mathematical environment that excells in that but fails in anything else.~~   * ~~Matlab isn't suited for general concepts of programming.~~ edit: these last two points seemed a bit strongly formulated. Matlab has progressed quite a bit since I last encountered it. Now I also had a problem with Java, as that turned out to be a real pain in the proverbial behind for many students, mainly because of the verbosity. As it's for a general course in programming, I think these points are important :   * all basic concepts of programming   * rather easy syntax without too much verbosity    * the possibility to easily program both procedurally and object oriented   * a short feedback loop on your programming    * a proven usefulness in many applications, especially in the scientific world (bioPerl, bioConductor, bioPython, bioJava, ...) so they can be used for practical work during their studies. **What's your idea about the best teaching language on a serious level (hence not the pseudo languages used in primary or secondary school, I'm talking bachelor level at university/college)?** * * * edited to keep the question more general. Originally I mentioned R, Python or Perl, and : R is maybe less of a good choice as that one is a vectorized language. This is far from general, so it might be too specific. **edit:** I consider it a blessing, but the argument here was that a vectorized language is not general enough for teaching purposes as people would get into trouble when moving to Perl and Python. I'm also not talking statistics education, we're talking students of level 1st bachelor. Any direction, any kind. I just added the personal experience.


title: How should I document a multi-tier application?

text: I have to create a documentation structure for a legacy application, and I'm not sure of how to organize it. **Documentation goals** :   * List of use-Cases   * Program flow for each of the use cases. ( _Flow-chart of all the logical steps the code does for a particular use-case_ ).   * As far as possible explanations of _why_ a certain business/code logic is followed.   * Documentation format if possible should not require installing a new tool, and at best be readable in Word or PDF Format (so that the business types can check it easily).   * Some questions that should be answerable using the documentation: "What business logic does the code execute for a given use case?";"Is this code redundant elsewhere in the application?"; "If I change this code, what Use-Cases are affected?"; **Application characteristics** : (it's generally a bit messy, with presentation and business logic slightly mixed in almost every layer)   * Presentation in .NET Web Forms using WebControls (GridViews, ObjectDataSource, Reports) and JavaScript(jQuery, jQuery-ui) in *.aspx pages   * Server-Side Code in C# in the *.aspx.cs to handle post-back events.   * C# Code-Pages and a Seperate Project integrated into the WebApplication supplying Business Logic as part of the Web-Application   * SQL Server for data persistence (Master-Data DB, Data Staging DB)   * Views including some data from others Servers   * C# CLR assemblies for business logic deployed on the SQL Server, and some minor SQL Stored Procedures/Triggers   * A File structure on the same server as the SQL DB that handles archiving, data-import from files.   * File interface to SAP (that I don't fully understand yet). **So far...** I've started documenting in Word. I have a separate Word file for the Front-End and the Database/File Structure. I begin each File with Use- Cases (user-initiated are in the front-end, scheduled jobs in the Database file), followed by the code structure. Each use case has a hyperlink to a flowchart/explanation of the code that first gets executed, which has a hyperlink to the flowchart/explanation of the code that next gets executed, etc... I do this so that each part of code is documented only once, and that other parts of code documentation can link to it if they execute it in the application. **Problems** :   * I can't navigate backwards from hyperlinks ( _i.e. I can't answer the question: "If I change this code, what Use-Cases are affected." I can only go from Use-Case to Code, not the other way around._ )   * The word document already feels clunky and messy after I've barely started to write stuff into it. **Question** : How can I document this multi-tier application without making a great mess?


title: How to effectively telecommute when working for a small firm?

text: I'd like to know what experiences others have had telecommuting full time? What software tools and processes helped maintain cohesion and maximized collaboration & productivity?


title: Can we guarantee a program will never go wrong?

text: We have a system here. Recently there is a wrong calculation in one of the number in the report generated by the system. Through out our experience, we've never encounter any problem/error in this system for some years. Because the writer of this system had already gone, we can hardly trace the programs. But we've verify the input data, the setting and they are right. Now my question is, will a computer program suddenly go wrong without any logical reason? If I slam on the server machine, will one of the number which the computer is calculating, become another number and make the calculation wrong? I agree my idea there is quite mad, but I just want to know, how can we know the problem is not caused by the program and the input, but some other factors? P.S. This mad system has no log.


title: Can I remove all-caps and shorten the disclaimer on my License?

text: I am using the MIT License for a particular piece of code. Now, this license has a big disclaimer in all-caps:               THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY     OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT     LIMITED TO THE WARRANTIES OF...     ...      I've seen a normally capitalised disclaimer on the zlib license (notice that it is above the license text), and even software with no disclaimer at all (which implies, i take it, that there is indeed a guarantee?), but i'd like some sourced advice by a trusted party. I just haven't found any. GNU's _License notice for other files_ comes with this disclaimer: > This file is offered as-is, without any warranty. Short and simple. My question therefore: Are there any trusted sources indicating that a short rather than long, and a normally spelled rather than capitalised disclaimer (or even one or the other) are safely usable in all of the jurisdictions I should be concerned with? For the purposes of this question, the software is released in the European Union, should it make any difference.


title: What is the difference between a Future and a Promise?

text: What is the difference between a Future and a promise? (In Akka and Gpars.) They look the same to me as both block and return the value of the future when get is called and a promise is to get the result of a future.


title: Technology choice for cross platform development (desktop and phone)?

text: I'm a Microsoft developer mainly, but there are a couple of small-ish projects I'd like to fiddle with which would benefit from being cross platform. The platforms I want to target are: Windows, Linux, Mac, Android and preferably iPhone, web (running in a browser). I need 3D (Around the level of support seen in something like Minecraft (I'm not writing Minecraft)), some networking. I'm pretty certain Java would work on all except iPhone. Looking at the "related questions" above it's offered up QT (no browser or phone afaik) and also HTML/CSS/Javascript (3D? package for desktop?) The other alternative is to have seperate versions for seperate platforms, developed with some common code where possible. That option isn't something I know anything about. Does anyone have experience of this sort of conundrum? I figured here was better than SO, because I imagine there are compromises which extend beyond technical choice. Finally, this is not a commercial operation, so some of the very expensive cross platform tools are out of the question unless they offer some sort of community edition.


title: What mistakes in managing software products must be avoided to keep people from hating the vendor?

text: A previous question about why people hate Microsoft was closed. This is an attempt at a somewhat more constructive question along the same general line. This one is both broader and narrower though. It's more general by being about software vendors in general, not just Microsoft. It's narrower by dealing only with management of software products. So, what steps should be taken (and/or avoided) in managing individual software products to assure that not only the individual products, but the company as a whole is respected/liked/seen in a positive light?


title: Is the Product Owner also a developer on your team?

text: I'm confused about the PO's responsibility here. I was a developer on a Game Feature Team, but also a PO. The daily work of the developer is almost full time, so I have to work over time to take care my PO duty, and the responsibility of PO seems to be against developer's thoughts. As a PO, I will chose more features next sprint. Otherwise, I will tell myself not to do so, because I'm a team member to develop those features. This situation makes me confused, so I want to hear some ideas from you guys. I'm a new to Scrum and Game Dev (about 1 and half year), and also new to here and English.


title: Leadership does not see value in standard process for machine configuration and new developer orientation

text: About 3 months ago our lead web developer and designer(same person) left the company, greener pastures was the reason for leaving. Good for them I say. My problem is that his department was completely undocumented. Things have been tough since the lead left, there is a lot of knowledge both theoretical knowledge we use to quote new projects and technical/implementation knowledge of our existing products that we have lost as a result of his departure. My normal role is as a product manager (for our products themselves) and as a business analyst for some of our project based consulting work. I've taught myself to code over the past year and in an effort to continue moving forward I've taken on the task of setting my laptop up as a development machine with hopes of implementing some of the easier feature requests and fixing some of the no brainer bugs that get submitted into our ticketing system. But, no one knows how to take a fresh Windows machine and configure it to work seamlessly with our production apps. I have requested my boss, who is still in contact with the developer who left, ask them to document and create a process to onboard a new developer, software installation, required packages, process to deploy to the productions application servers, etc. None of this exists, and I'm spinning my wheels trying to get my computer working as a functional development machine. But she does not seem to understand the need for such a process to exist. Apparently the new developer who replaced the one who left has been using a machine that was pre-configured for our environment, so even the new developer could not set up a new machine if we added another developer. My question is two part:   1. Am I wrong in assuming a process to on-board and configure a new computer to be part of our development eco-system should exist?   2. Am I being a whinny baby and should I figure the process out and create a document on my own?


title: How is transparency defined in context of the broker architecture?

text: I would like to know how transparency is defined, and what is the measurement for this in the context of a broker architecture. For example : from a developer point of view, [in the broker architecture] distribution is transparent. you talk to a broker one way or the other and it introduces an object model in which distribute services are encapsulated within objects.


title: Is there any way to get faster at solving bugs? I've just had a warning from my boss

text: I've just been told by my boss that I will receive a negative performance review on Monday. He wants to talk to me about why I am so slow and why my bug fix rate is so low. I love programming and solving problems but I actually do find my job really really hard. I've actually been a programmer for about 10 years. But this is my first multithreading embedded linux job - I've been here 2 years and it's obvious to everyone that I'm still struggling. And I think I've become so demoralised and feel so marginalised that I've lost a lot of the fire that I had at the start of the job. Has anyone ever been in a similar situation and how do you go about increasing your bug fix rate? * * * Update: I had the review. I have been put on a 3 month 'employee development program' (of the type mentioned by Dunk ). Not sure whether I can turn this around. But even if I do have to move on, I've learned a lot from this experience. ## Another Update It's now about 6 weeks since the first review. My advice to anyone facing the same situation is to be humble enough to take criticism and learn from your mistakes. And to not be afraid to look dumb. Ask loads and loads of questions. Let people know you're trying to learn and keep asking until you understand. But be prepared for it not to work out. I'm constructing a portfolio of code ... as well as giving it my best shot. ## Yet another update I am hesitant to put this on here, since I'm concerned that I will not be able to refer future employers to my stackoverflow profile... But anyway, it might be of interest for someone reading this question, but I actually lost my job a few weeks ago. I'm in the midst of brushing up on all the skills I need to - I've taken a lot from the advice given here.


title: Visiting points on a number line while minimizing a cost not related to distance

text: I need some help on this ACM ICPC problem. My current idea is to model this as a shortest path problem, which is described under the problem statement. **Problem** There are `N = 1000` nuclear waste containers located along a 1-D number line at _distinct_ positions from `-500,000 to 500,000`, except `x=0`. A person is tasked with collecting all the waste bins. Each second that a waste container isn't collected, it emits 1 unit of radiation. The person starts at `x = 0` and can move `1` unit every second, and collecting the waste takes a negligible amount of time. We want to find the minimum amount of radiation released while collecting all of the containers. **Sample Input:** `4` Containers located at `[-12, -2, 3, 7]`. The best order to collect these containers is `[-2, 3, 7, -12]`, for a minimum emitting of `50` units. Explanation: the person goes to `-2` in 2 seconds and during that time `2 units` of radiation are emitted. He then goes to `3` (distance: `5`) so that barrel has released `2 + 5 = 7` units of radiation. He takes `4` more seconds to get to `x = 7` where that barrel has emitted `2 + 5 + 4 = 11` units. He takes `19` seconds to get to `x = -12` where that barrel has emitted `2 + 5 + 4 + 19 = 30` units. `2 + 7 + 11 + 30 = 50`, which is the answer. **Notes** There is an obvious `O(N!)` solution. However, I've explored greedy methods such as moving to the closest one, or moving to the closest cluster but those haven't worked. I've thought about this problem for quite a while, and have kind of modeled it as a graph search problem:   1. We insert `0` in as a baseline position (This will be the initial state)   2. Then, we sort the positions from least to greatest.   3. We then do a BFS/PFS, where the `state` consists of      * Two integers `l` and `r` that represent a contiguous range in the sorted position array that we have visited already     * An integer `loc` that tells us whether we're on the left or right endpoint of the range     * An integer `time` that tells us the elapsed time     * An integer 'cost' that tells us the total cost so far (based on nodes we've visited)   4. From each state we can move to [l - 1, r] and [l, r + 1], tweaking the other 3 integers accordingly   5. Final state is [0, N], checking both ending positions. However, it seems that `[L, R, loc]` does not uniquely define a state, and we have to store `L, R, loc, and time`, while minimizing `cost` at each of these. This leads to an exponential algorithm, which is still way too slow for any good. Can anyone help me expand on my idea or push my into the right direction? **Edit:** Maybe this can be modeled as a dynamic programming optimization problem? Thinking about it, it has the same issues as the graph search solution - just because the current `cost` is low doesn't mean it is the optimal answer for that sub problem, since the `time` also affects the answer greatly. Greedy doesn't work: I have a greedy selection algorithm that estimates the cost of moving to a certain place (e.g. if we move right, we double the distances to the left barrels and such). Could you do a Priority-first search, with a heuristic? The heuristic could combine the cost of the current trip with the amount of time elapsed.


title: How to integrate google search results in a spring mvc app

text: Here's what am trying to do (and searching for similar hasn't shown any results anywhere): On my website - provide an input box which will search google for results. I want to display those results on my page and customize the URL of those search results. So whenever a user clicks on the displayed result, my application will (internally search for profile pages and) provide the future course of action. The only integration of google is, providing the search results (and probably the map coordindates) Env: Spring mvc, jsp, hibernate. Can some one please advise on how can I achieve this ?   I dont where to begin but I have read about the Google custom search, but I think that is only for searching within your site or to redirect users to relevant sites found from the result.


title: How do handle developer keys that are supposed to be non human readable in your app? (example: specific conflict with twitter api and twitter gem)

text: How do handle developer keys that are supposed to be non human readable in your app? From twitter's developer page, under My Access Token it says: "Keep the oauth_token_secret a secret. Along with your OAuth consumer secret, these keys should never be human readable in your applications." However, the awesome twitter gem ( https://github.com/jnunemaker/twitter ) says to make an initializer with this:               Twitter.configure do |config|       config.consumer_key = YOUR_CONSUMER_KEY       config.consumer_secret = YOUR_CONSUMER_SECRET       config.oauth_token = YOUR_OAUTH_TOKEN       config.oauth_token_secret = YOUR_OAUTH_TOKEN_SECRET      end      What do you do about this type of conflict? You can't just reset the oauth_token and oauth_token_secret, as far as I know you have to create a whole new twitter app. I concerned as I am going to begin working with some freelancer programmers and to begin with I wouldn't want to trust them my apps private keys/tokens. Thanks.


title: What is the logic behind filtering/sanitizing input?

text: I have always found it more logic to validate input instead of filtering it. How to appropriately filter data depends on the situation, so IMO it should be done in output or when saving to a database. But I see that some frameworks provide automatic XSS filters for incoming POST and GET data. What is the logic behind this solution? I can't see any advantages in doing this except providing a quick and easy solution to "lazy" developers. Or is there some specific security reason I don't understand?


title: Maintain a web application once the only developer is gone

text: I have a terminal disease and there is a very high chance that I will no longer be in this world by the end of the year. I have developed a web application that it is extensively used in my family’s business (a small hairdressing shop). No member of my family has neither programming nor system administration skills. I have neither close friends with those skills. The business makes at most 10k in net profits per year. In fact, the business profits can only afford to pay the salaries of its 3 employees (father, mother and sister) and those are quite low and decreasing each year due to the financial crisis. In fact, I am not an employee of my family’s business, I work for a normal software development company. I developed the application during my free time in order to help them. So far I do not care if another business also uses my application or even if the application itself loses my ownership. I just want that my family’s business can continue using it, which means system administration support if something goes wrong and development for new features/bugs. I would like to ask you if you could give me the measures you think I could take in order to guarantee as much as possible the continuity of the application. The technologies of the application are: Platform: Tomcat (Java), MySQL and Linux Frameworks: mainly JPA and ZK


title: How can I effectively explain technical concepts to a non technical boss when I'm not a good talker?

text: ## Preface I work as web developer for a big retail company, which sells goods to smaller retails through its e-commerce web site, developing both for the e-commerce and intranet. The main source of profits is made through the sales through the e-commerce, followed by the ad-hoc customer management by the marketing department. Our department (web development) report directly to the top managment (AD, CEO, etc). ## My problem Even though my direct manager is an ex developer who understands the various programming issues, the department head is a marketroid who doesn't understand a thing about programming. He thinks that everything that doesn't yield benefits in a short span is a waste of time and not worthy, and his behaviour is hurting us developers. The main problem is I'm unable to explain technical concepts or issues to non technical people, so I fail to persuade him about what I should do or not do or what would make my work easier and more efficient. ## My questions Reading the similar questions I understood that I should   * Not make him feel stupid.   * Not look like I'm insubordinating.   * Not look like I'm trying to skip my work. But how the hell can I do that?   * How can I cross this "cultural" gap?   * How can I speak his language?   * What's the best way to convey him that thing X should be done Y way, that thing W is not a good idea and that tool Z is something really useful for us?   * Is there any good material on how to deal with non technical managers? Some of the answers around are suggesting examples he can understand, but I find these answers a little vague, I fail to come up with anything decent. Lately I'm starting to think that maybe we should take marketing classes or buy Mitnick's social engineering book... :\ ## Beware Let me stop those who are starting to scream "let your manager handle him". When my manager fails to handle him, the ones who will pay the consequences are us, the developers. So, helping my boss getting the point through is helping myself keeping my sanity around, and certainly something worth the trouble. ## Some examples   * Both the password for the intranet user and the e-commerce customers are saved in clear text in the database and must be changed every sixty days. This is a nonsense to me: aside from all the implications of not encrypting passwords before saving them, forcing the user to change their password every two month is begging them for using weak passwords. (He thinks the first is not an issue and that changing password frequently is more secure.)   * When a customer log in, all the user informations are saved into a cookie and using HTTPS everywhere is only a burden. This too doesn't make sense to me: we're bouncing arounk 75 KiB of cookies with every request instead of looking up user details from database, and by sniffing the cookie (e.g. unprotected WiFi) you can impersonate the user and buy stuff (even really expensive things) under his name yet only the login process is encrypted. (The former is not worth refactoring, and the latter is a non issue to him.)   * A colleague handles trouble tickets quickly because he's been working for the company for twelve years, many of the tools he's been "entrusted" have been developed by him and tells the user "don't do X" instead of fixing the problem in the code, and we who have been working here for one or two years, are managing tools written by former employees and go digging through the code to fix the problem get chewed for out higher mean resolution times. (He tells us we should be quicker, like him, because the time spent dealing with trouble tickets is not profitable, yet he won't allow the rebuild of the most crappy tools which would save time in the long run.)   * An issue tracking a la Redmine is seen only as a time sink because it does not "produce" any tangible benefit, yet we're stuck on taking note of to dos and problems on paper or .txts and keeping spreadsheets of the modifications as reference.


title: XSLT and possible alternatives

text: I had a look at XSLT for transforming one XML file into another one (HTML, etc.). Now while I see that there are benefits to XSLT (being a standardized and used tool) I am reluctant for a couple of reasons   * XSLT processors seem to be quite huge / resource hungry   * XML is a bad notation for programming and thats what XSLT is all about. It do not want to troll XSLT here though I just want to point out what I dislike about it to give you an idea of what I would expect from an alternative. Having some Lisp background I wonder whether there are better ways for tree- structure transformations based upon some lisp. I have seen references to DSSSL, sadly most links about DSSSL are dead so its already challenging to see some code that illustrates it. Is DSSSL still in use? I remember that I had installed openjade once when checking out docbook stuff. Jeff Atwood's blog post seems to hint upon using Ruby instead of XSLT. Are there any sane ways to do XML transformations similar to XSLT in a non-xml programming language? I would be open for input on   * Useful libraries for scripting languages that facilitate XML transformations   * especially (but not exclusively) lisp-like transformation languages, or Ruby, etc. A few things I found so far:   * A couple of places on the web have pointed out Linq as a possible alternative. Quite generally I any kind of classifications, also from those who have had the best XSLT experience.   * For scheme http://cs.brown.edu/~sk/Publications/Papers/Published/kk-sxslt/ and http://www.okmij.org/ftp/Scheme/xml.html


title: How long should someone take classes in a language they don't plan to work professionally in?

text: I was late in my signing up for classes at the start of last term, so I signed up for the only programming class I could find C++. After doing well in that class I was allowed into intermediate C#, which I learned was what I needed to be in for my major. I also took intermediate C++ thinking that taking both would make them both easier. I was right. I will be moving on to ASP.NET next term, and while I really like C++, I'm not sure that it will help me overall with my future education in C#. I also have the option to move into java, so I would be taking ASP.NET and java at the same time. So do I take C++, Java, both, or neither? and why?


title: Why were short, int, and long invented in C?

text: I'm having trouble understanding, what were the exact purposes of creating the `short`, `int`, and `long` data types in C? The reason I ask is, it doesn't seem like their sizes are bounded -- they could be of any size, so long as `short` is smaller than an `int`, for example. In which situations, then, should you use an `unsigned int` or `unsigned long`, for example, instead of a `size_t`, when doing so offers no hope of binary compatibility? (If you don't know the size, then how would you know when to choose which?)


title: Who should support and maintain development infrastructure?

text: I am interested to know what other peoples' experiences are with managing development infrastructure are. I am talking about things like the build server, the central git repo etc etc. Any infrastructure which end users would probably not even know existed, but which are essential for the development team.   1. Do your dev/devops/ops teams consider them to be as important as 'true' production systems?   2. What happens when one goes down (both in terms of ramifications and recovery processes)?   3. Who should be responsible for managing them? Note: to complicate things (especially (3) above, our "teams" are small, about five or six devs and only the one sys admin. Hence, there is a lot of crossover of us devs in to ops, especially with the advent of the "devops" movement and technologies. Disclaimer - I am the author of this blog post about the subject.


title: Where are programming languages published?

text: I have read that a number of new programming languages are created each year, however I have never seen a single one. Where exactly are these things published? Is there some site out there that keeps track of them? (I don't have any intention to learn such languages - I am only interested)


title: Should I care about Junit redundancy when using setUp() with @Before annotation?

text: Even though developers have switched from junit 3.x to 4.x I still see the following 99% of the time:               @Before     public void setUp(){/*some setup code*/}          @After     public void tearDown(){/*some clean up code*/}      Just to clarify my point... in Junit 4.x, when the runners are set up correctly, the framework will pick up the `@Before` and `@After` annotations no matter the method name. So why do developers keep using the same conventional junit 3.x names? **Is there any harm keeping the old names while also using the annotations** (other than it makes me feel like devs do not know how this really works and just in case, use the same name AND annotate as well)? **Is there any harm in changing the names** to something _maybe_ more meaningful, like `eachTestMethod()` (which looks great with @Before since it reads 'before each test method') or `initializeEachTestMethod()`? **What do you do and why?** I know this is a tiny thing (and may probably be even unimportant to some), but it is always in the back of my mind when I write a test and see this. I want to either follow this pattern or not but I want to know why I am doing it and not just because 99% of my fellow developers do it as well.


title: Technical interview and programmer ability

text: What I will say might be a tad controversial in nature but I am very disheartened today - and so I will ask this. I just had an interview with a major tech firm for an internship position, where I was asked a lot of typical algorithm oriented interview questions. Now, given my background, I consider myself to be strong in algorithms (I have also got good grades in graduate level algorithms -stuff involving NP- completeness and beyond (approximation and randomized algorithms), but unfortunately I flunked the interview. I could not think of a very efficient method of solving a string problem in approximately ~10 minutes. Once the interview was over, I had a glass of water, ate a banana and relaxed for a while and tried the problem again. And vola! there is the answer I could arrive in under 5 minutes. And the worst of it all - I was actually on that track and the interviewer did hint about it, but too much pressure cooked me. My entire experience got me thinking about tech interviews. I had some questions and I wanted to pose them in this forum -   1. Is it really possible to judge someone's technical ability in half an hour? Honestly? Or is it just a throw of dice?   2. Do technical interview questions measure problem solving ability? This point is very debatable? As a PhD student I know that Mathematical problem solving involves solving something that you have never heard about before. On the other hand questions like - merging two linked lists in sorted order, or printing all the elements of a binary tree in the kth level become "mere exercises" once someone has seen the solution or solved the problem beforehand?   3. Do people who come out with flying colors in these interview go on to become great programmers? Do they go on and design a sleek game engines, graphics libraries, write fast fork-join frameworks? Is there any evidence to point to a positive co-relation between doing well in technical interviews and actual programming ability? Or are these interviews more geared towards finding "getting things done" type of person (Spolsky)? I can bet that lots of academics publishing ground breaking ideas in - ICML, VLDB, Mobicom - will flunk these interviews. But I can assure you that they are some of the smartest people you will find on this planet. I am mainly in academia (grad student) - so I will greatly appreciate some perceptive from someone in the other side of the fence. Someone who actually conducts these interviews? [Ok everyone. Thanks for all the nice and thoughtful responses. Since I do not want to ask another question, I will ask you to answer this question for me. Suppose candidate X has a good public portfolio of works where he has contributed to some known open source project where - you can actually go and verify his patches, verify the bugs he has closed and take a look at the designs he has created. In that case, the question is how much weightage are you willing to give to his publicly available/verifiable work versus how well he does in answering some very contrived binary tree interview question in under 15 minutes?]


title: Simple questions about apache and cgi

text:
I'm just learning about using cgi in html files. I've read a lot of stuff on the web, but most of it is all about the trees and not enough about the forest. I'm a top-down learner and I'm having trouble understanding what's going on with cgi, apache, and html. At the moment I'm using python as my cgi scripting language, but if you'd care to answer using perl, I can handle that. Here's a MWE for a failed test I ran. HTML: (file is getname.html)                              <form method="POST" action="./test.py">
Your First Name: <input type="text" name="firstname">
Click here to submit form: <input type="submit" value="Submit">       <input type="hidden" name="session" value="1f9a2">     </form>                  Python: (file is test.py)               #!/usr/bin/python     import sys, os, os.path, shutil, string, fileinput     import cgi, cgitb          print "Content-type: text/html\n"     form = cgi.FieldStorage()     f = open('./testOutput', 'w')     if form.has_key("firstname"):         f.write(form["firstname"])     else:         f.write("Failure")     f.close()      So, it _looks_ like what's happening is that the info the user enters into the form is put into a variable called 'firstname' (actually it's a key-value pair put into a hash-like thing in the scripting language. In python it's a dictionary). This variable is then sent as input to the cgi script (test.py), and the script is run. But, that isn't what's happening. When I hit the 'Submit' button in the html file, the test.py script is displayed in the browser and the script isn't run. BTW, the reason that I have the script write to a file is so I can see whether it gets run. When I run test.py from the command line, it works fine. The fact that test.py is displayed in my browser indicates, I think, that apache isn't running or is misconfigured or has permission problems. As far as I can see, none of those things is true, but I could be wrong. So here are my questions: 1) why is apache involved at all? Is it needed to send the variables gathered in the html form to the script? If so, why? I know that html is just a markup language, but I thought the 'form' tag had the ability to send a variable to a script and run the script. 2) Is there a way to test an apache configuration? Is it possible for apache to use 127.0.0.1 as the 'ServerName' (i.e. ServerName 127.0.0.1:80 in my httpd.conf file) Basically, I just want to write cgi scripts for some webpages I'm hand-coding and test them on my home laptop. I don't seem to know how to do that and I could use some help. TIA.


title: Can resizing images with css be good?

text: After reading Is CSS resizing of images still a bad idea?, I thought of a similar question. (too similar? should this be closed?) Lets say you need to use 10 different product image sizes throughout your website and you have 20k-30k different product images, should you use 10 different files for each image size? or maybe 5 different files and use css to resize the other 5? Would there ever be combination that would be good? Or should you always make separate image files? If you use css to resize them, you will save on storage (in GBs) but you will have slight increase in bandwidth and slower loading images(but if images are cached, and you show both sizes of the image would you use less bandwidth and have faster loads?) (But of course you wouldn't want to use css to resize images for mobile sites.)


title: In Functional Programming, should domain-relevant simple functions (e.g., sorts) be reified?

text: In a functional application, should you wrap common higher-level functions in domain-meaningful names or should you leave them "bare"? For instance, if you have a list of Addresses, and "sorted by zipcode" is a common domain-meaningful ordering (targeted mailers, etc.), is it preferable to write:               val sortedCustomers = customers.sort((a,b) => (a.zipCode compareTo b.zipCode) < 0)       Or is it better to create a function `sortedByZip(cs : Iterable[Customer]) : Seq[Customer]`? Creating the function has the advantage of being (minutely) more abstract, but has the disadvantage of being opaque, creating a name to remember, etc. I'm asking in the context of a significant professional codebase, one that you intend to live for years, be as maintainable as possible, be "true" to the expectations of functional programmers, etc.


title: Are developers more productive at night?

text: I personally stay awake late at night, coding and enjoying working on personal projects. My other colleagues also feel the same and like coding at night. However, it's not about being passionate about personal hobbies, rather, I really feel that I'm more productive at night. I think that there is something about night, maybe its darkness, maybe its silence, maybe another attribute that makes developers become more productive. Is there some truth to this? Why do some developers believe that they are more productive at night? Is there any scientific proof to justify this proposition? Maybe something like "in night, monitor light is less harmful" or "the natural air in night has more oxygen, thus is more suitable for thinking process", or anything like that. > ### Moderator Note: > > The question is asking for **scientific proof** and otherwise cited > information on this subject. Answers that do not provide supporting > references will be removed. This is _not_ a poll where you should share when > you wake up and what parts of the day you personally are productive.


title: When they say its open source it means i can take their pictures?

text: when they say that a project is open source (i.e. LifeRay) does it mean that I can take anything I want from that project? I want to use some of the icons used in LifeRay portal for my own (commercial) apps. Is this legal?


title: Is there a way to prevent others to steal your open source project and use it to make a profit?

text: This might seems like a silly question to ask, but I can't really figure out the answer. The title pretty much says it all. Let's say you have an open source music player, along comes someone, copies it, adds features, modifies the interface, etc and sells it. Nobody would find out. So how does it work? Related: I'm working in some projects myself to make me more employable, so employers can take a look at my code but with some of them I don't feel like uploading them to an online repository, ie sourceforge, and make them visible for the general public.


title: Why text editors are recommended over IDEs for beginners in books like Head First Java?

text: I am a programmer with some experience in C++ and I am learning Java. In most of the Java books (like Head First Java) authors ask readers to stay away from IDEs and recommend using a good text editor, but I could not find a convincing reason apart from the fact that a beginner might be overwhelmed by many options being thrown at once. However I started using Eclipse after writing a couple of small programs and I think that tools like auto-completion, inbuilt help debugging etc makes learning a better experience. I would like to know which approach is better and if I am missing out anything by using an IDE rather than a text editor.


title: Succinct Lazy Initialization Pattern

text: # Background I often use the following lazy initialization pattern:               public class Clazz {       private Object object;            private Object getObject() {         Object object = this.object;              if( object == null ) {           object = createObject();           setObject( object );         }              return object;       }            public Object setObject( Object object ) {         this.object = object;       }            protected Object createObject() { return new Object(); }     }      Member variables are only ever used directly twice (in the accessors), which includes internal calls. This also allows subclasses to inject new behaviour by overriding `createObject()`. # Problem This is a lot of code to ensure every member variable is always initialized. # Question What Java mechanism (syntactic sugar) can simplify the code? For example, Scala has the `lazy` keyword. # Ideas Ideally I would like to code:               public class Clazz {       @lazypolymorph       private Object object;            public Clazz() {         // Uses the object...         System.out.println( getObject().toString() );       }     }      The compiler would then expose a public mutator, a private value accessor, and a protected polymorphic creation method (used by the value accessor), following the typical Java naming conventions introduced in the background section.


title: Programmer Timeliness vs Effort

text: The engineering team I am on has a very laid back approach to work hours. People come in at 6am and at 11am, and work until things are done when necessary. Engineers will routinely work very late, on weekends, etc as pressing issues arise (and deadlines loom). Recently, the company has decided to implement a "core business hours" initiative, which is fundamentally incompatible with the Engineering Team's "get it done" approach. What would be a good way to expose the nature of the hard work the team does to the rest of the company, in such a way that: a) It does not come off as self congratulatory bragging b) It does not encourage the development of a no work-life balance culture


title: How to find number of points with same minimal distances on matrix

text: I'm trying to find the number of points in a matrix with the same minimal distances. Start with a MxN matrix, where M and N < 50000\. There is given a set of fixed points, with their respective coordinates.   The problem is to find the number of points in the matrix such as the minimal distance from any point in the set can be reached for at least two point in the set. The distance is measured by moving one units a time horizonatally or vertically. You can't move diagonally. An example would make things clearer.   Let's say we have 3 fixed point: (1,3), (3,1) and (3,6). Here the point (3,3) would be one point since the minimal distance is 2 units and it can be reached for the first two fixed points in the set. However, the point (4,4) doesn't satisfy the requirements. Although the distance from (1,3) and (3,1) is same, 4 units, the minimal distance is 3 units. My idea was to use any point with integer coordinates that lies on the bisector of a segment joining each par as a point that would fill our requirements. But I find a lot of false positives were a point satisfies the requirements, but doesn't lie on the perpendicular bisector. Brute-force methods won't work, because we need too check a billion of distance for each point and that one heck of a job to do. How should I go about solving this problem?


title: Finding a definition for this anti-pattern

text: Working on a large and multi-tiered software project, I just found a recurring anti-pattern to be occurring in the code. I coulnd't find its definition in Wikipedia or other sources after a quick search, so I would like to ask you if there is a known anti-pattern for our current situation. I'll explain it both in the general way and by providing you an example. In general, this anti-pattern could be called like the Italian expression "scaricabarile" (lit. _passing the buck_ , avoiding your responsibility and giving it to someone else under you). ![Funny image describing this](http://i.stack.imgur.com/Td3JI.png) If there are several people on a [sub]project, and they are organized in a chain of responsibility, someone on the upper levels could decide to deliberately avoid resolving a design problem and leave it resolution to the person next to him, who could repeat this and ultimately "leave the last developer in a mess of development complexity". The anti-pattern appears when it's discovered that if the person on top of the chain resolved the problem on his own, much less work and rework would have been done by people under him. Real world situation (in general): you are developing a middle-tier service which handles calls from front-end and has to perform several calls to different back-end services (a DB, a web service, a file storage, outsourced services...) which are not very well documented. When you get an input field you immediately can't handle on your own, instead of asking further information you simply put it in your front-middle-end interface and require the front-end guy to supply you with this parameter that will be passed unprocessed to the back-end. The front-end guy may have to perform several calls to services to get a single value that could be else obtained by the middle-tier with few calls/instructions. In my case (assuming that in the middle-back-tier interface all values are considered to be `string`, and please don't comment on that becuase there are reasons), I discovered that the back-end services require fields such as `order`, `flagDescription` which can be thought to be respectively an enumeration of `ascending`, `descending`, and a `boolean`. One of the problems is to encode the enumeration. What does the service accept as values? `ASC`/`DESC`? `A`/`D`? `0`/`1`? Only BE developers know. In fact, we **ultimately** discovered that the original ME developer was too lazy to ask for detailed information about the possible values of these fields. He instead put them in the front-middle-end interface as two `string`s, leaving the FE guys angrily questioning "where do we pick values these fields?". I'll describe another case with a fictional example: suppose an outsourced back-end service define an operation as `doSomethingOnAPerson(string socialSecurityNumber, string phoneNumber, Date birthdate)`, your `Persons` DB table identifies people by a unique ID and contains all of these information. At a certain time, FE knows only person ID and a bunch of information insufficient to make a complete call. However, the middle tier exposes the same signature as the back-end instead of a simpler `doSomethingOnAPerson(long personID)` which can be implemented as a DB call followed by a service call. Since ME is already deployed, this forces the FE guys to request a rework for a new service to retrieve the missing information to call the middle end services, or in other cases request that the service is re-developed to change the signature and perform the missed operation. In general words, _the original developer didn't take the time to resolve the [very simple/simplified] problem of obtaining the required information from the smallest information of data available, but decided to **pass the buck** to the FE_ In a few words, a better design and much more attention could have prevented **both** situations. In fact, the first also led to troubles when switching from a mocked environment to **integration testing**. I would like to explain the team that we did wrong by passing the buck between ourselves rather than solving problems. ## Do you find a popular definition for what I have descripted so far? Can you help me find _articles_ about this, if it has been documented yet?


title: Utterly Confused with OOP - How do I overcome a beginner's hurdle?

text: I have been reading and working through the exercises of Steve Lott's book _Building Skills in Python_. However, on the very **first** exercise dealing with OOP I have gotten completely stuck. **The problem set is here** : http://www.itmaybeahack.com/book/python-2.6/html/p03/p03c01_class.html#class- definition-exercises **My attempt** (sourcecode):               # Stock Valuation OOP     class StockBlock(object):         def __init__(self, purchdate =0, purchprice =0, shares=0):             self.date = purchdate             self.price = purchprice             self.shares = shares         def __str__(self):             return "Price: %2f \tDate: %s \tShares: %d" % (self.price, self.date,                                                        self.shares)         def getpurchvalue(self):             return self.price * self.shares         def getsalevalue(self, saleprice):             return saleprice * self.shares         def getroi(self, saleprice):             return (self.getsalevalue() - self.getpurchvalue()) / self.getpurchvalue()     blocksGM = [         StockBlock(purchdate = "25-Jan-2001", purchprice = 44.89, shares = 17),         StockBlock(purchdate = "25-Apr-2001", purchprice = 46.12, shares = 17),         StockBlock(purchdate = "25-Jul-2001", purchprice = 52.46, shares = 15),         StockBlock(purchdate = "25-Oct-2001", purchprice = 37.73, shares = 21),         ]     blocksEK = [         StockBlock(purchdate = "25-Jan-2001",purchprice = 35.86, shares = 22),         StockBlock(purchdate = "25-Apr-2001",purchprice = 37.66, shares = 21),         StockBlock(purchdate = "25-Jul-2001",purchprice = 38.57, shares = 20),         StockBlock(purchdate = "25-Oct-2001",purchprice = 27.61, shares = 28),         ]     class Position(object):         def __init__(self, name, symbol, *blocks):             """Accept collection of StockBlock instances."""             self.name = name             self.symbol = symbol             self.blocks = blocks         def __str__(self):             return "Symbol: %s \tTotal Shares: %d  \tTotal Price: %d " % (self.symbol,                                                                            self.blocks[1],                                                                            self.blocks[2])         def getpurhvalue(self):             value = 0             for stock in self.blocks:                 value += stock.getpurchvalue()             return value         def getsalevalue(self, saleprice):             value = 0             for stock in self.blocks:                 value += stock.getsalevalue(saleprice)             return value         def getroi(self, saleprice):             (self.getsalevalue() - self.getpurvalue()) / self.getpurchvalue()          portfolio = [         Position("General Motors", "GM", blocksGM),         Position("Eastman Kodak", "EK", blocksEK),         Position("Caterpillar", "CAT",                  [StockBlock(purchdate = "25-Oct-2001",                              purchprice = 42.84, shares = 18)])         ]     # display individual blocks purchased, and purchase value of the block     def main():         for position in portfolio:             StockBlock(position)          main()      There is no solution in the book, so I cannot check that way. It seems that I totally do not understand OOP? It's just so frustrating and I don't know what I should do to continue... My question is, when I get this utterly stuck learning programming, what strategies can help me overcome the problem? I think this is an important question because I am learning programming by myself. I cannot ask a teacher or friend for help (because I don't have any that are programmers.)


title: Correctly value a development?

text: I started a discussion on StackOverflow earlier this week about one of my work project and how to lead it correctly. But it seems that this stack is a more appropriate place to ask those sort of questions, so here is my last question about my project: **How do you value your work? / How do you rate it in a financial way?** I'm working on a quite cool project with two other friends and people that we know ask us for an earlier access and how many it would cost per month for us to access it. Unfortunately, I was not able to answer this simple question due to the fact that I'm not agree with my friends on this specific topic. For me a bill of 80$/month/contract seems to be reasonable and appropriate for our targeted market (Institutions and Corporations) but my partner would rather count a charge of 500$/month/contract. Our project is an asset manager in SAAS mode, and I don't really think that our potential clients would be ready to pay more than 90$/month/contract even if they have a lot of money due to their situation. So, I would really like to have some opinions and advices on this kind of question. PS: If my post is not on the appropriate stack, feel free to tell me. PS2: I'm quite sorry if I'm not totally crystal clear, I'm not a native english, if you do not understand something, as above, feel free to notice me and I'll rephrase.


title: Always keeping 2 people expert on any one chunk of code

text: I interviewed for a job at a company where they said their policy is to make sure that at least 2 people understand any piece of code, just in case one of them "goes on vacation". They also said that some people don't last more then a few months at this company, although many have stayed for years. I think I get the message: They are inclined to fire people right away who don't like the work culture or who don't integrate into their cliques. But is there another interpretation? Thanks.


title: What are the principles of open source projects?

text: Although its generally agreed by organisations like the OSI and the FSF what is and isn't an open source software (basically, the the terms of the source code license) what are the guiding principals for open source projects? Other software movements have principals like the Agile Manifesto. It seems as though open source share some common values (such as transparency, collaboration, etc.). Are these documented somewhere?


title: Which stages of the requirements analysis process in mobile requirements engineering are the most challenging ones?

text: I'm doing a research on formulating a requirements analysis model as a stage of requirements engineering for mobile-application development by considering the limitations and the needs of it ( agility and etc.. .), what I'm trying to figure out is that which parts of this process (requirements analysis for mobile development) are the most challenging ones ( so i can focus more on) , and if there is any stage that u think I need to include or exclude (exp. some may think a quality plan may or may not be necessary and etc.) to make it more clear below is the list of few of the areas in which I can focus on ( by the way your suggestions can be anything out of the below list.) -Requirements specification -Prototyping -Requirements Prioritization -Focusing on quality functions