title: Should I pick up a functional programming language?

text: I have recently been more concerned about the way I write my code. After reading a few books on design patterns (and overzealous implementation of them, I'm sure) I have shifted my thinking greatly toward encapsulating that which change. I tend to notice that I write less interfaces and more method- oriented code, where I love to spruce life into old classes with predicates, actions and other delegate tasks. I tend to think that it's often the actions that change, so I encapsulate those. I even often, although not always, break down interfaces to a single method, and then I prefer to use a delegate for the task instead of forcing client code to create a new class. So I guess it then hit me. Should I be doing functional programming instead?   **Edit:** _I may have a misconception about functional programming._ Currently my language of choice is C#, and I come from a C++ background. I work as a game developer but I am currently unemployed. I have a great passion for architecture. My virtues are clean, flexible, reusable and maintainable code. I don't know if I have been poisoned by these ways or if it is for the better. Am I having a refactoring fever or should I move on? I understand this might be a question about _"use the right tool for the job"_ , but I'd like to hear your thoughts. Should I pick up a functional language? One of my fear factors is to leave the comfort of Visual Studio.


title: Why do Chrome and Adobe use "download wizards" to install software?

text: Why do software companies use download wizards for large files instead of letting users download the file directly? Is it so the user does not get discouraged by the waiting time, or is it something else?


title: When a client asks for Proof Of Concept  and expects finished product

text: We have a client with whom we have a relationship of delivering proofs of concepts _only_. But when it comes the time to demo they expect an early version of what would be the solution. They want databases populated with real data, look-and-feel of a finished product and other things (including features) which are trivial and no way contribute towards _proving_ the concept. What do you do with that? How do you handle such a situation? (I'm the developer as well as the person who will be talking to the client along with other non-developers.)


title: Need some critique on .NET/WCF SOA architecture plan

text: I am working on a refactoring of some services and would appreciate some critique on my general approach. I am working with three back-end data systems and need to expose an authenticated front-end API over http binding, JSON, and REST for internal apps as well as 3rd party integration. I've got a rough idea below that's a hybrid of what I have and where I intend to wind up. I intend to build guidance extensions to support this architecture so that devs can build this out quickly. Here's the current idea for our structure:   1. Front-end WCF routing service (spread across multiple IIS servers via hardware load balancer)      * Load balancing of services behind routing is handled within routing service, probably round-robin     * One of the services will be a token     * Multiple bindings per-service exposed to address JSON, REST, and whatever else comes up later     * All in/out is handled via POCO DTOs     * Use unity to scan for what services are available and expose them   2. The front-end services behind the routing service do nothing more than expose the API and do conversion of DTO<->Entity      * Unity inject service implementation to allow mocking     * automapper for DTO/Entity conversion     * Invoke WF services where response required immediately     * Queue to ESB for async WF -- ESB will invoke WF later   3. Business logic WF layer      * Expose same api as front-end services     * Implement business logic     * Wrap transaction context where needed     * Call out to composite/atomic services   4. Composite/Atomic Services      * Exposed as WCF     * One service per back-end system     * Standard atomic CRUD operations plus composite operations     * Supports transaction context The questions I have are:   * Are the separation of concerns outlined above beneficial? Current thought is each layer below is its own project, except the backend stuff, where each system gets one project. The project has a servicehost and all the services are under a services folder. Interfaces live in a separate project at each layer. DTO and Entities are in two separate projects under a shared folder.   * I am currently planning to build dedicated services for shared functionality such as logging and overload things like tracelistener to call those services. Is this a valid approach?   * Any other suggestions/comments?


title: Is it better to learn the DOM or jQuery first?

text: I have gotten very familiar with the core functionality of Javascript and now I am aiming at learning DOM manipulation. I have already thought of learning jQeury for this but I don't know if it is good idea to learning it before first getting familiar with the core functionality of the DOM. Should I first learn the core functionality of the DOM and then learn jQuery? If so, why? Or should I just go on ahead and learn jQuery?


title: How to manage time for studying while working?

text: I've been programming 8 years for a company. We build business intelligence software systems. Since I thought working is learning, I've always studied in terms of what I was doing at the company while working for 60 hours per week. These days, however, I am looking for a new company for employment, I can see that thought was a dumb idea because I frequently fail in job interviews mainly due to lack of knowledge on the other areas. Of course, I am still willing to improve myself and am really trying. But while working that much of time per week, I can't find good amount of study time to catch up. I don't think I am the only one to concern about this so I would like to ask how you guys find time to study for your career? How many hours do you assign to studying other areas? Am I missing some time management skills?


title: What are the deliverables to give to the client for a web application ?

text: I have completed a web application which is basically developed in PHP and is just another regular web application. Usually when I deliver the final production release I just handover the code documentation and the architecture information to the client. However, for this particular project the client insists on having the complete in and out data about the project. So I'm just wondering... What are the mandatory technical and non technical docs that I can give my client apart from the code and architecture documentations ? (Also it would be kinda cool to hit the client about various stats and data about the project so that he would actually know the amount of work involved and how cool the product actually is.)


title: How can I sharpen my team player skills?

text: Currently I'm in my dream job in a research lab as the only developer in a multidisciplinary team. I'm getting a little bit worried because I'm forgetting about coding in a team (I don't have legacy code, I maintain my own code, I handle my own agenda, etc). Although I try to follow some of the the best practices like continuous delivery, TDD, and SCRUM just for me I think I'm losing my ability to work in a team of developers. I've joined an open source project and began into the code katas and code golf. But these won't polish my team player profile. What would be your suggestions to sharpen my team player skills? _Update:_ Yes, my communications skills are now better and I can talk to PhD's like never before. Like @Nicholas and @Erick said, someday I will be facing a developing team (maybe in my current job, maybe not) and I want to keep current with those practices that makes a good developer a better team member, like pair programming or code review.


title: What are some good programming cheat sheets?

text: What are some good downloadable cheat sheets for learning a particular language or tool?


title: Approaches for learning or teaching linux development environments and build systems

text: I've seen a few instances where programmers have been stymied when installing a new piece of software or creating a non-trivial software project, due to a lack of knowledge of how to use compilers, build systems, and binutils. Examples of errors where someone gets stuck are   * 'make' doesn't know how to build a particular filename   * A build system invokes a program with arguments that it doesn't understand    * A header file outside the project is not found   * A symbol name isn't found at link time How do you teach developers what they need to know to understand what a build system error means, narrow down its cause, and fix it? Is there a good reference on how linux development environments work?


title: Swing component name suggestion for a specific interface

text: As a university project, I have to replicate Raptor. A flowchart interpreter. The interface looks like this ![enter image description here](http://i.stack.imgur.com/GTFmw.gif) But as I am not a experienced swing developer, I don't have much idea about which swing components to use for which part. I know:   1. The whole thing is a JFrame.   2. There is MenuBar on the top.   3. ToolBar exactly beneath it. Question 1: Am I right? Question 2: What component should I use for left hand side _symbols_ and rest of the part named _main_ in the picture? What you would have used? Note 1: We can drag and drop the symbols from Symbols to main. Note 2: I am not looking for any code. I just want direction. As there are always so many options in Java. It's easy to get confused easily. I researched a lot, but found nothing specific as it is mostly a design issue.


title: Bin sorting problem - Please help categorize

text: I have a problem I am developing a solution for and currently I solve it with a brute force solution that checks all possibilities. It works for small numbers of bins but I'd like to work with a reasonable speed for increasing numbers, however the algorithm I use (brute force) increases in computing time in a factorial manner related to the number of bins. In other words it gets way too slow pretty quickly after about 6 or 7 bins. I'd like to classify the problem to see if it is NP-Complete, NP-Hard or other so I know where to look in attempting to optimize. The basic problem is this. You have a number of points n and you have weights for these points. The points also have an ordering such that points in a bin must be consecutive. You must place these into a total of a maximum of k bins. The bins contain an estimate for the set of points placed in it and the total error of the absolute value of difference in the points and the estimate must be minimized. The goal is to find how to place these points in the bins to have the minimal total error. Thanks!


title: The reason to make some code open source

text: I have a library that makes architecture to load data from server and display all controls in table layout. It works great but it have a lot of TODOs there. Also, this library in 99% created by me. I starts developing it in when I working in one company, continue developing in in other company - I just move code prototype to new working place. Library contain large amount of iPhone features/hacks/fixes that write again make no sense. All created iOS business applications by me, based on this library. When library become needed in few projects simultaneously, I wanted to make library open source on GitHub but my Team Lead ask to create private repository for it. Library contains and uses 12 open source libraries.   * So:      1. Is it a good idea to make such library open source? It contains all my iOS development experience.     2. How to argue my wish to make library open source for Team Lead?     3. If I can't make this library open source - can I use it in other company? In contract, thats I work with, said that I assign all copyrights to employer.


title: Are operators clearer to read than keywords or functions?

text: It's a bit subjective, but I'm hoping to get a clearer understanding of what factors make an operator clear to use vs obtuse and difficult. I've been considering language designs recently, and one issue that I always circle back around on is when to make some key operation in the language an operator, and when to use a keyword or function. Haskell is somewhat notorious for this, as custom operators are easy to create and often a new data type will come packaged with several operators for use on it. The Parsec library, for example, comes with a ton of operators for combining parsers together, with gems like `>.` and `.>` I can't even recall what they mean right now, but I do remember them being very easy to work with once I had memorized what they actually mean. Would a function call such as `leftCompose(parser1, parser2)` have been better? Certainly more verbose, but clearer in some ways. Operator overloads in C-like languages are a similar issue, but conflated by the additional problem of overloading the meaning of familiar operators like `+` with unusual new meanings. In any new language, this would seem like a pretty tough issue. In F#, for example, casting uses a mathematically derived type-casting operator, instead of the C# style cast syntax or the verbose VB style. C#: `(int32) x` VB: `CType(x, int32)` F#: `x :> int32` In theory a new language could have operators for most built-in functionality. Instead of `def` or `dec` or `var` for variable declaration, why not `! name` or `@ name` or something similar. It certainly shortens up declaration followed by binding: `@x := 5` instead of `declare x = 5` or `let x = 5` Most code is going to require a lot of variable definitions, so why not? When is an operator clear and useful, and when is it obscuring?


title: The "blub paradox" and c++

text: I was reading the article here: http://www.paulgraham.com/avg.html and the part about the "blub paradox" was particularly interesting. As someone who mainly codes in c++ but has exposure to other languages (mostly Haskell) I'm aware of a few useful things in these languages that are hard to replicate in c++. The question is mainly to people who are proficient in both c++ and some other language, is there some powerful language feature or idiom that you make use of in a language that would be hard to conceptualize or implement if you were writing only in c++? In particular this quote caught my attention: > By induction, the only programmers in a position to see all the differences > in power between the various languages are those who understand the most > powerful one. (This is probably what Eric Raymond meant about Lisp making > you a better programmer.) You can't trust the opinions of the others, > because of the Blub paradox: they're satisfied with whatever language they > happen to use, because it dictates the way they think about programs. If it turns out that I am the equivalent of the "Blub" programmer by virtue of using c++ this raises the following question: Are there any useful concepts or techniques that you have encountered in other languages that you would have found difficult to conceptualize had you been writing or "thinking" in c++? For example the logic programming paradigm seen in languages like Prolog and Mercury can be implemented in c++ using the castor library but ultimately I find that conceptually I am thinking in terms of Prolog code and translating to the c++ equivalent when using this. As a way of broadening my programming knowledge I'm trying to find out if there are other similar examples of useful/powerful idioms that are more efficiently expressed in other languages that I might not be aware of as a c++ developer. Another example that comes to mind is the macro system in lisp, generating the program code from within the program seems to have many benefits for some problems. This seems to be hard to implement and think about from within c++. EDIT: This question is not intended to be a "c++ vs lisp" debate or any sort of language-wars type debate. Asking a question like this is the only way I can see possible to find out about things that I don't know I don't know about.


title: Do you perfect your code as you go or FINISH the product first, improve structure later

text: I recently read a blog post (which I lost the link) that really make me think. The writer said that the one of the biggest problem in software projects is actaully completing it, and most people will end up abandoning the work. I have been self-learning programming for over 15 years now, at this stage I actually feel pretty competent. However, I have never finish any big project that I set out to do. What I usually do is this:   1. I "sketch" my idea in code, compile and run to see if it works, and imagine how other stuff can come toogether.   2. As the "sketch" becomes messy, I start to refactor it, consolidate functions, make classes, re-organisation data structures etc.   3. Repeat 1 and 2.... forever! I tried to write on paper UML diagrams etc. but it always end up with things I overlook and then requires some drastic changes and then I becomes 1, 2, 1, 2, 1, 2 again. How does commercial projects handle deadlines? Should I just keep on sketching until the final product is completed before thinking of making the readability/reusability/architecture/engine more sound?


title: Building dedicated codepad in PHP

text: I am author of growing framework, which is focused around User Interface building in PHP. Essential requirements for the up-coming website redesign is ability to **run code examples**. I am willing to extend this option to add-on authors which would mean **other people** will be able to execute code on my server. Please suggest how to securely set up the environment which would allow me execute 3rd party PHP code built on my framework. I'd like to hear ideas from someone who have had experience with building sandboxed solutions.


title: Which k-best shortest-path algorithms should I consider?

text: I'm solving a graph-search optimization problem. I need to find the k best acyclic shortest-paths through a directed weighted graph. I know there are a number of exact and approximate k-best algorithms, but most of the recent research seems to be oriented toward very large, very sparsely- connected graphs (e.g. road routing and directions), and my graph is neither. Distinguishing aspects of my problem:   * The graph consists of approximately 160 vertices.   * The graph is nearly fully connected (bidirectionally, so ~160^2 ~= 25k edges)   * k will be quite small (probably less than 10)   * The maximum path length will probably be bounded and very small as well (e.g. 3-5 edges)   * I said 'acyclic' above, but just to reiterate - solutions must not include cycles. This isn't an issue for 1-best shortest path, but it becomes a problem for k-best - for example, consider a road routing - the 2nd shortest path from A to B might be the same as the 1-best, with a quick trip around a block somewhere. That's might be mathematically optimal, but not a very useful solution. ;-)   * We may need to re-weight edges on-the-fly for each calculation. An edge cost consists of a weighted sum of several factors, and the final requirements (whenever we get them) may allow a user to specify their own prioritization of those weighting factors, altering edge weights. This is a relatively small graph (we should be able to represent it in a few hundred KB), so it's probably reasonable to clone the graph in memory, apply the re-weighting, and then execute the search on the cloned graph. But if there's a more effective method of performing the search while computing weights on-the-fly, I'm interested. I'm looking at the algorithms described in Santos (K shortest path algorithms), Eppstein 1997 (Finding the k Shortest Paths), and others. Yen's algorithm is of interest, primarily because of the existing Java implementation. I'm not scared to read the research papers, but I thought it was worth throwing out the details of my problem and asking for pointers to save some reading time. And if you have pointers to Java implementations, even better.


title: Is it possible to have setup and tear down methods run only for specific unittests?

text: I currently have a test class with a `setUp` method for creating a temp file and a `tearDown` method for deleting a temp file. However, only some of the the `test_` methods in that class require this functionality. Is possible to either ignore those 2 methods for the test cases which do not require it or to only call those 2 methods for test cases which do require it? It feels a bit 'wrong' to call these 2 methods for every test even if the temp file is not getting used in each one.


title: Ordering menu items fed from multiple modules.

text: I have a main application that can load modules (or plugins). Each modules can define one or more links (or items) that will be displayed in a side menu defined in the main application. Right now, my main application execute a list of ItemProviders which are loaded from the modules. These ItemProviders return a list of items to display in the side menu. My question now is how am I supposed to order these items since they are not aware their siblings in the menu? Keep in mind that there is not a particular logic in the order, it depends on what the client wants. My primary solution was to give them an order number (an index). The problem with this approach is that my modules would no longer be completely independent, the "order number" would depend on other modules' number. What would be the proper way to handle this particular case?


title: About shared (static) Members and its behavior

text: I just realized that I can access shared members from instances of classes (probably this is not correct, but compile and run), and also learn/discover that, I can modify shared members, then create a new instance and access the new value of the shared member. My question is, what happens to the shared members, when it comes back to the "default" value (class declaration), how dangerous is it do this ? is it totally bad ? is it valid in some cases ?. If you want to test my point here is the code (console project vb.net) that I used to test shared members, as you can see/compile/run, the shared member "x" of the class "Hello" has default value string "Default", but at runtime it changes it, and after creating a new object of that class, this object has the new value of the shared member.               Module Module1         Public Class hello                  Public Shared x As String = "Default"                  Public Sub New()                  End Sub         End Class              Sub Main()                   Console.WriteLine("hello.x=" & hello.x)              Dim obj As New hello()                   Console.WriteLine("obj.x=" & obj.x)              obj.x = "Default shared memeber, modified in object"              Console.WriteLine("obj.x=" & obj.x)                   hello.x = "Defaul shared member, modified in class"              Console.WriteLine("hello.x=" & hello.x)                   Dim obj2 As New hello()              Console.WriteLine("obj2.x=" & obj2.x)                    Console.ReadLine()               End Sub          End Module      **UPDATE:** First at all, thanks to everyone, each answer give feedback, I suppose, by respect I should choose one as "the answer", I don't want to be offensive to anyone, so please don't take it so bad if I didn't choose you answer.


title: Loose coupling and shuffling dependencies

text: I have a bunch of classes that look something like this:               public class MyGame()     {         private Graphics graphics;              private Player player;              public MyGame()         {             graphics = new Graphics();             //...         }              protected void Initialize()         {             player = new Player();             //...         }              protected void Update()         {             player.DoStuff();             //...         }      I've been reading about design patterns, and I've come to understand that this is not a very good design because it isn't loosely coupled. Instead of coding to interfaces, I'm coding to implementations (Graphics, Player, etc.). In order to fix this perceived problem, I start by changing those dependencies to interfaces:               public class MyGame()     {         private IGraphics graphics;              private IPlayer player;              public MyGame()         {             graphics = new Graphics();             //...         }              protected void Initialize()         {             player = new Player();             //...         }      I'm not sure how helpful that really is, but it's nice that the graphics field (for example) isn't tied to the Graphics class - I can use the AwesomeGraphics class or SparklyGraphics class instead as long as those classes implement IGraphics. But I still have hard dependencies on Graphics and Player, so what was the point of all that refactoring? (My actual code is much more complicated.) I've also come to understand that dependency injection is a good idea, so that's what I try to do next:               public class MyGame()     {         private IGraphics graphics;              private IPlayer player;              public MyGame( IGraphics graphics, IPlayer player )         {             this.graphics = graphics;             this.player = player;             //...         }      This looks really nice because I no longer have any hard dependencies in MyGame. However, the dependencies are still in my code - they've just been moved to the class that instantiates MyGame:               static class Program     {         static void Main( string[] args )         {             using ( var game = new Game( new Graphics(), new Player() )             {                 game.Run();             }         }     }      Now I'm back where I started! This class is not loosely coupled at all! So, again, what was the point of all that refactoring? I'm pretty sure I could use an IoC container to take care of these dependencies somehow, but that would likely just add a ton of complication to an already complicated project. Plus, wouldn't that just be moving those dependencies once again to another class? Should I stick with what I had in the first place, or is there some tangible benefit that I'm not seeing yet?


title: Does the $100 Google Apps Marketplace Fee Apply To All My Developers or Just Me?

text: On the Google Apps Marketplace Vendor Listing page, Google says the following: > Google charges a one-time fee of $100 for submitting your first listing. I've searched Google Groups and other forums, and I cannot seem to find the answer to the question of whether or not the one time $100 fee applies to _only my individual Google Apps login_ or if it applies to other Google Apps logins on my domain as well. For instance, If I, james@mydomain.com, pay the $100 fee so I can submit N listings, does this also apply to john@mydomain.com or does John have to pay the $100 fee to so he can publish his apps without having to ask me to do it? Is it best to use a single, group login like admin@mydomain.com or development@mydomain.com when paying the $100 Listing fee? What is your experience in this regard with posting multiple listings to the marketplace where N developers are involved?


title: Question about raw Javascript vs frameworks in interviews

text: If it's wiser to know a framework such as jQuery, MooTools, DoJo, etc. to get over cross-browser issues, why are interviews asking for only javascript?


title: Where do you look for help?

text: I have been on four interviews and this question ("Where do you look for help?") was asked three times. What is the point of it? What is my opinion is a bit controversial like googling is OK? Is this answer OK? **UPDATE:** Seems it went well.


title: Is there minimap plugin for Eclipse?

text: I'm looking for Eclipse plugin which may show something like mini-map of code. I think this may be nice feature. Here you can see example of what I mean (it's TextMap plugin for gedit).


title: What should the relation between parent and child GUI components be?

text: This seems to happen every time I create any sort of GUI. I have trouble figuring out how child classes should communicate to their siblings. It's a general problem, but it's probably easier to use a concrete example (hopefully that's still okay for this forum? I know it's different from StackOverflow): I have a window that contains 4 panels. Right now, I simply have the children as member objects of the parent. Keypresses change all 4 panels, so I have the child objects throw the event back to their parent, which does the logic, then makes the appropriate calls for each panel. However, mouse events are different. They change the position of a camera (owned by the parent), which every panel uses to render itself. So I must recompute a few matrices, in order to render each panel. The matrices are different for each panel. The problem I'm having is: when do I give the children the matrices? I think I have three possibilities:   1. When reading a mouse event, compute the matrices and call setter methods for each panel. However, sometimes the matrix will be replaced before the window renders.   2. Give the child panel a reference to the parent, and during the render call, request the matrix from the parent (either by method or member variable).   3. Modify child.render() so that it accepts two matrix parameters, and make parent.render() call them appropriately. #2 seems good, because I'm not unnecessarily setting the matrix in the child window. But it also requires me to mess with forward declarations for member objects, which seems like bad practice. And #3 I'm not quite sure how to implement, because render is called by many things other than my code (un- minimizing, for example), and I can't touch them. So I suppose it is #1? Is there a design pattern people usually follow for this? Am I just overthinking, and #1 is actually completely OK?


title: Automatic source code generation -- good idea or potential nightmare?

text: In response to my question regarding Java source code generation, I received this answer warning me about potential maintenance problems: >   1. mixing auto-generated code always pose a risk of someone modifying it > in future to just to tweak a small behavior. It's just the matter of next > build, when this changes will be lost. >   2. you will have to solely rely on the comments on top of auto-generated > source to prevent developers from doing so. >   3. version-controlling - Lets say you update the template of someMethod(), > now all of your source file's version will be updated, even if the source > updates is auto-generated. you will see redundant history. > His proposed alternative is enhancing classes at runtime using bytecode generation. My thinking was that injecting generated code into existing source code files would enhance maintainability, because it makes it obvious what is going on instead of performing some operations behind the scenes. Should I:   1. create a tool to add generated code to existing source code; or   2. augment the classes using bytecode generation at runtime? What has been your experience with either of these approaches?


title: If you are going to deploy a Rails 3 app, which platform you'll recommend?

text: I am looking for advice of where to deploy a Rails app for a small business:   * web-based   * https needed   * fewer than 500 users   * (probably) fewer than 20 concurrent users So far, I am reading pricing information of:   * Amazon EC2   * Dreamhost VPS   * Heroku   * Self-hosting (most unlikely) Any suggestions and/or pros and cons to share? Thanks!


title: How do you recruit a graduate developer?

text: > **Possible Duplicate:**   >  What are effective interview questions? I'm currently looking to recruit a .Net developer and we've decided to take a graduate straight out of university. The job role will (eventually) be mainly web development. Does anyone have experience of recruiting graduates straight out of university? How do you go about recruiting someone when they have very little in the way of hard skills that you can test directly? What kind of interviewing techniques can you use (telephone/technical test/question and answer/whiteboard session etc.)? What skills or personality traits should you look for?


title: How do I follow DRY when documenting module structure and interfaces?

text: In this paper, it is recommended that one document the following:   * module structure   * module interfaces If I'm writing detailed module structures and interfaces in a standalone document, aren't I repeating work that is also done with object declaration statements, unit tests, and docstrings? If so, and if this is bad repetition in the DRY sense of the term, how do professional programmers avoid this kind of repetition?   * Automatically generate tests/docstrings/code from documentation?   * Automatically generate documentation from tests/docstrings/code?   * Rely on the code as documentation and don't duplicate in the first place?   * Suck it up, Nancy! It's called "work" for a reason.


title: Is there an accepted name for a fake object injected via a preprocessor seam?

text: I am dealing with some old, sloppy C++ code in which there is a structure with a lot of data members and functions. I want to test a class that I have implemented which uses the struct, but this dependency is going to make the unit tests extremely ugly. Inspired by Michael Feather's discussion of **preprocessing seams** in _Working Effectively with Legacy Code_ , I am getting ready to solve this problem by faking the ugly structure with the preprocessor (not with inheritance) polymorphism as demonstrated in the following notional code. ### test.cpp               #include <iostream>     #include "NotAsUgly.hpp"     #include "DependsOnUgly.hpp"     int main() {         std::cout << DependsOnUgly().getDescription() << std::endl;     }      ### DependsOnUgly.hpp               #ifndef _DEPENDS_ON_UGLY_HPP_     #define _DEPENDS_ON_UGLY_HPP_     #include <string>     #include "Ugly.hpp"     class DependsOnUgly {     public:         std::string getDescription() {             return "Depends on " + Ugly().getName();         }     };     #endif      ### Ugly.hpp               #ifndef _UGLY_HPP_     #define _UGLY_HPP_     struct Ugly {         double a, b, ..., z;         void extraneousFunction { ... }         std::string getName() { return "Ugly"; }     };     #endif      ### NotAsUgly.hpp               #ifndef _UGLY_HPP_ // Same name as in Ugly.hpp---deliberately!     #define _UGLY_HPP_     struct Ugly { // Once again, duplicate name is deliberate         std::string getName() { return "not as ugly"; } // All that DependsOnUgly depends on     };     #endif      Is there a special name for the type of fake object I'm using here? I'm inclined to call it a stub, but it is rather different than what I would normally think of as a stub. I would expect something called a _stub_ to implement the interface of the class which is to be faked through inheritance. Here the implementation is only partial, and happens through the preprocessor. Is there already a known name for this kind of fake/testing object? I want to name the header file that contains it (`NotAsUgly.hpp` in my example) to properly signify to other developers what it is for.


title: Is data integrity possible without normalization?

text: I am working on an application that requires the storage of location information such as city, state, zip code, latitude, and longitude. I would like to ensure:   1. Location data is accurate      * ~~Detroit, CA~~       * Detroit **_IS NOT_** in California     * Detroit, MI        * Detroit **_IS_** in Michigan   2. Cities and states are spelled correctly      * **California** not ~~Calefornia~~     * **Detroit** not ~~Detriot~~   3. Cities and states are named consistently      * Valid:        * CA       * Detroit     * Invalid:        * Cali       * california       * DET       * d-town       * The D Also, since city/zip data is not guaranteed to be static, updating this data in a normalized fashion could be difficult, whereas it could be implemented as a _de facto_ location if it is denormalized. A couple thoughts that come to mind:   1. A collection of reference tables that store a list of all states and the most common cities and zip codes that can grow over time. It would search the database for an exact or similar match and recommend corrections.   2. Use some sort of service to validate the location data before it is stored in the database. Is it possible to fulfill these requirements without normalization, and if so, should I denormalize this data?


title: In a 4 hour Powershell 101 class should I skip for/while/do and just teach ForEach-Object

text: I'm making a syllabus to teach non-programmer co-workers PowerShell. The first non-pilot group I will run the course with will be a team that deploys and configures one of our software products. They are bright intelligent motivated IT workers, but not programmers. I intend to cover the basics (variables, arrays, functions, and loops), and then move onto examples that are close to their problem domain. I'm not married to a 4 hour class, if necessary I can expand it to two four hour classes. I'm toying with the idea of skipping for and while loops and simply teaching ForEach-Object. I've personally used traditional for and while loops in powershell scripts, but they can always be rewritten as ForEach-Object loops with a bit of creativity. Part of me feels the good old for ($i=0 $i < foo; $i++) is a necessary fundamental before moving onto foreach, but the other part of me thinks that might be me clinging to my Model M and my K&R Bible. To draw an analogy to SQL, I'd never teach a CURSORs or other loops in a 4 hour class there because you're supposed to be able to do everything in SQL as a SET operation. In theory you should stick to the pipeline in PowerShell. I use for and while loops in PowerShell more often than I do do cursors and while loops in SQL. However, PowerShell is a scripting language and conventions are less strictly enforced and I also push the boundaries of powershell with inline C# and excessive dependencies on calling native .NET APIs. My audience will not be ding this. For those not adept at powershell, I'm pretty sure you don't actually need a for or while loop. I use them, but that's because I have experience with other languages. For example if you only want the first 10 members of an array of 20 members:               1..20 | Select-Object -First 10 | ForEach-Object { Write-Host $_ }


title: What is the solution for "not enough commercial experience"?

text: I have almost 2 years commercial experience in web development. Yet every time I apply for a job I get a call back "Sorry you don't have enough commercial experience for this position." The last 6 months have run like this:               10 Try to gain commercial experience.     20 Can’t get a job because I don’t have enough commercial experience.     GOTO 10      I've been applying for PHP developer roles working with existing codebases and requiring between 1 and 2 years of experience. How can I gain creditable 'commercial experience' when no-one will hire?


title: Is running an executable as a child process the same as linking a library?

text: I'm planning on running an executable as a child process in my program (e.g. using Ruby's `popen` or C's `exec()` family of functions). However, the executable I'm planning on running is licensed through the GPL. The GPL, as I understand it, requires that all linked code to GPL licensed code needs to also be GPL. But there's also an "arm's length" exception, discussed in the FAQ: > However, in many cases you can distribute the GPL-covered software alongside > your proprietary system. To do this validly, you must make sure that the > free and non-free programs communicate at arms length, that they are not > combined in a way that would make them effectively a single program. Would runnning an executable as a child process be part of this exception, or would it still be considered "linking" for the purposes of the license? If it is considered "linking", how does it differ from running program, like Nmap, from the a command line?


title: RESTful web service and delta updates - advantages and disadvantages

text: Our front-end developers have requested that the RESTful Java web services to support delta queries. The use case for this is to handle periodic ajax refresh of the screen to bring in new data (deltas). I can see a few advantages of this:   * Makes front-end logic simple (i.e. no complicated deduping logic)   * Reduce network traffic (i.e. response size is smaller) However, there are some concern as well:   * supporting delta will require the service to be stateful, which impact scalability   * heavy use of caching (results cached per user per query, to determine the delta)   * heavy processing on the server My questions are:   1. Are there additional advantages of the delta queries?   2. What's a good implementation to for delta queries that would eliminate some of the disadvantages (you can assume we are welling to drastically refactor our code)


title: Why do we need REST service security if we have HTTPS

text: I refer to this excellent article http://www.thebuzzmedia.com/designing-a- secure-rest-api-without-oauth-authentication/ which speaks of amazon like security for web service. However I was asked a question in the team of why do we need it if we already use HTTPS. I was unable to answer as it really seems to me they may be right although gut tells me otherwise. Also is there places when providing REST services where HTTPS may not work? Like 3rd party websites? If anyone has experience in securing Web Services over the public interwebs please shed some light with your experience. Thanks in advance. EDIT: To clarify I am not speaking of user authentication but more of client authentication. The user authentication can be assumed to be plain text over HTTPS+ REST. My worry is that this still allows anyone to use the web service without my client to access it since everything is plai text although over HTTPS the client end point can still use my web service without the client application.


title: OpenGL Image Load-Store Atomics Applications

text: I originally asked this on plain old stack but it was closed for being too open-ended. (Which was a good call as this is a better place for such questions.) Original Link: http://stackoverflow.com/questions/15132135/opengl-image-load- store-atomics-applications So, I've been spending the last couple months or so getting familiarized with the latest OpenGL 4 features when I find myself with free time. (Things like transform feedback, tessellation, compute shaders, etc..) I've finally taken time to mess around with using Image Load-Store textures, and while the idea of being able to atomically read/write to any texture from any GPU core regardless of shader stage seems incredibly powerful, I could not think of interesting applications utilizing the unique facilities these textures provide. Even after consulting "the google" for interesting applications, I was left empty handed. So, are there any WOW-THATS-COOL or even DAMN-THATS- HANDY applications you can think of? Application 1 (Suggested By Nicol Bolas): "Search for order-independent transparency. That requires atomic image operations."


title: Changing an int to be a string in PHP / MySQL Schema

text: ## Background I'm trying to decide the best way to manage a change in requirements. Currently when an admin is assigned to a ticket, the ticket header record is given an owner and the ownerID field is updated with the value of the id which corresponds to the record in the TeamMembers table. The owner (Team member) is notified when a user (Customer) updates the ticket with a comment. I now need to add additional Team Members to the ticket so they are also notified. ## Question ? Do I...   1. Make ownerID field ownerIDs and store a comma separated list of IDs in a string ?   2. Add a new field additionalOwnerIDs and store any extra IDs after the main owner as a comma separated string ?   3. Create a new table that simply links ticketID to assigned owners and have one row per owner ?   4. Do something else ? ## Considerations I want to deliver the new functionality as quickly as possible, repurposing the existing field might seem like the simplest way forward but it would involve changing the schema type of existing data so will need a migration script to rewrite hundreds of thousands of rows. Adding a new field then wouldn't need as much migration work as it would be an empty string for all existing records and default to an empty string for new records. A new link table seems the most programatically correct way (IMHO) but would require the most time to implement and test it and the migrations would be the most complicated in terms of extracting existing ticket owners into the new table. Changing the code for retrieving / updating an owner to query the new table. Then removing the defunct ownerID column from the existing table. Have a missed anything? Which approach is the best in terms of maintaining the code base in the future?


title: Why there is no ISO hardware query interface?

text: I'm currently reading a book, chapter about I/O, and one question came to my mind. Basically, when you program in C/C++, you have an amazing opportunity to optimize for hardware behavior. Using buffering for block devices, use streaming and async I/O for high latency network devices and so on. And if you're writing a server application that is targeted at high load applications, and you can optimize for I/O devices, that can actually change the hardware requirements tremendously. Say, you know that HDD cache is around 32MB, and it likes to stream data in 8MB blocks, and you have 16GB of RAM that's cheap and sitting idle, you could just use low level `_read` with a 8MB buffer and be done with it. Which would remove ton of locking and user->kernel->user transitions that's caused by smaller reads, say 64KB each. The problem is, you basically have to run the program on target platform to get the actual performance data, and optimize for it. And if you port that application to say ARM, the optimizations can even backfire. So why is there no API to get the sweet-spot values for architecture you're running on. Say `QueryOptimalHddReadBuffer`, `QueryOptimalHddWriteBuffer`, `QueryHddSeekTimeCharacteristics`, `QueryOptimalNetworkCardReadBuffer`, etc.


title: Do big software companies develop their business process management solutions (ERP) in-house?

text: I was looking at the customer list of a few ERP vendors like SAP. The companies in the list are mostly non IT companies. So, I'm wondering as to how IT companies approach the business process management problem. For example, any IT company with a few thousand employees across different locations will need software for HR management, accounting, and so on. And a software product vendor (like Microsoft) will need CRM software. It looks like buying enterprise software from an outside vendor can be a messy and expensive proposition, especially when they can code it in-house using their excellent grasp on the requirements specific to their business. Do these companies usually build their own solutions using in-house resources or do they buy it from other software vendors?


title: When would polling for events be better than using observer pattern?

text: Are there scenarios where polling for events would be better than using the observer pattern? I have a fear of using polling and would only start using it if someone gave me a good scenario. All I can think of is how the observer pattern is better than polling. Conside this scenario: > You are programming a car simulator. The car is an object. As soon as the > car turns on, you want to play a "vroom vroom" sound clip. You can model this in two ways: **Polling** : Poll the car object every second to see if it's on. When it's on, play the sound clip. **Observer pattern** : Make the car the Subject of the observer pattern. Have it publish the "on" event to all observers when itself turns on. Create a new sound object that listens to the car. Have it implement the "on" callback, which plays the sound clip. In this case, I think the observer pattern wins. Firstly, polling is more processor intensive. Secondly, the sound clip does not immediately fire when the car turns on. There can be up to a 1 second gap because of the polling period.


title: How does a dynamic library's references to a static variable get translated once in the running app?

text: If a dynamic library exports the address to a global variable defined within the library, how are accesses to that variable translated during dynamic linking so that a running application can interact with it?


title: is there a security issue when using Jquery to develop asp.net web applications

text: I'm new to web applications. I have developed a web application using ASP.net. After hearing about jquery and going through some examples, I changed the existing application and used jquery to do most of the ajax work. On the server side I used html handlers for db connections and data processing. Because I'm using jquery, my concern is my script is visible to users of the application. Will this be a security issue? Am i following a right path?


title: Should I test my China-targeted website with "360 Secure Browser" (browser in China)?

text: Developing a website aiming to the Chinese market, I am wondering whether I should do compatibility tests with the 360 secure browser, which is based on the Trident layout engine (like Internet Explorer). Any developer experienced in designing websites for China? Did you test on this browser? Is it really different from IE? What is its market share in mainland China? _Note: Multiply by OS versions x use cases x website releases, and testing ends up costing a lot, so I need to think carefully about adding a browser to the supported browsers list._


title: What is the purpose of red zone?

text: Red zone is a fixed size area in memory beyond the stack pointer that has not been "allocated". Compilers do generate assembly to access that area in simple leaf functions. But I can't see any real advantages for red zone. Accessing memory beyond stack pointer is really dangerous and can easily lead to data corruption. Why even do this? Saving 2 processor instructions (push ebp; mov ebp esp) won't give real speed up. P.S. There was already question on SO that was closed as off-topic (awful injustice).


title: Is hooking Data access method on wrong object detrimental for a developer

text: In a simple application I am creating there are Admin and users where admin can create users. Right now I am creating Classes that encapsulate database CRUD calls with methods. For example: `adminStore.CreateUser(userObject)` will persist that user object into the Database and return the object. I am now confused as to which DataAccess entity I need to attach methods like these. Doing them on `adminStore` will make them sensible in sense developer would understand that admin is creating the user and has access role. But from another perspective the below to sounds logical. like: `userStore.CreateUser(userObject);`. So my questions would somewhat sound like a Api design,Class design question but I would like to know which if the below is the right one. 1 `UserStore.CreateUser(userObject)` 2 `AdminStore.CreateUser(userObject)` Update: Here is what i came up with later after viewing the answers. > User { Name ,Email, Password } > > Admin:User,IImplementsAdmin { FlagPost() etc etc } > > AdminStore { CreateUser(), SetUserStatus() }


title: How to draw a good diagram of a business workflow? What software?

text: I want to create an illustration for a **product purchase wizard** , and I want to illustrate the way user interacts with the wizard. It's basically a simple flowchart or a simple workflow:   1. User starts the wizard   2. User selects product   3. User should check the availability of that product (manually)   4. If the product is available, then the next button is enabled, else it's disabled   5. If user change the product type, then the next button should be disabled   6. User goes to the next step   7. Based on the product type, a different UI is shown to him in the next step   8. He should adjust some other settings, ... I started creating a sequence diagram, but soon it proved not to be a good fit. Then I changed to activity diagram, again no success. What type of diagram should I choose to illustrate this flowchart (which is full of conditions, branching, state management, user interaction and more)? Do we have such a general diagram at all? What software should I use? **Update:** To clarify further, I'd like to draw a diagram of a **scenario** rather than a **workflow**.


title: what is the meaning of a "Teardown Report"

text: I am sorry if this a wrong place to ask the question. I saw the usage "Teardown report" for a product What does it mean?


title: What should I be responsible for as the first developer in a large scale web project?

text: I am the first developer in a large scale web project, in the real estate sector. I am not an expert in any field, I know the basic of all, programming, databases, something about design and a little bit about SEO, and website optimization / caching. And I have some knowledge about other technologies and stuff that could be required in the project. So I am a developer, my boss does some drawing on a paper to present me his ideas and then I start programming and I show him the result. Until now there was no problem, but now the web application is large enough, and it lacks a little bit of database optimization and intuitive user interface. Beside the website, the project also has an offline newspaper, and a desktop application that is a reduced version of the online one, both this things are not managed by me, but by other people or developers that are external to the company. We do not use a collaboration tool for sharing knowledge between the people working on this project, just emails, and we do not use a development methodology, as for the team, we are:   * the developer(me),    * a designer,    * a secretary, and    * the boss. I have the possibility to ask the boss hire the people I want so I can increase the team and have the right person dealing with the right part of the project. This is the story, the real question is, what should be my attitude towards the project and the company? Should I stay a developer and participate in taking decisions and organizing tasks from time to time to help the boss? Or should I get more serious about this and try to learn project management and implement everything I consider it's required to ensure the quality of the work and final results? I am the one who best knows what has been developed until now, should I try to organize all the work and the team? Or should I ask my boss to hire some expert to do that?


title: Minimize touching the already-working code when a radical change is required

text: I have a code that highly relies on an `Array` structure like the following:               $array['customer'][$customer_id]['details'][..];    // it goes to about 10 levels deep      However, after almost two years since the initial development, now I have to include another high-level element to that array which will make it something like this:               $array['company'][$id]['customer'][..];      The challenge is that about 12,000 lines of source code are written by four programmers -- I'm the only one still working on the project, AND there is no unit tests, getters and setters, DI, etc. just a bare-bone MVC structure. So, changing the structure of that array will probably require 30% percent of methods to be modified to adapt with the new change, otherwise they just simply won't work as expected. Is there any general approach for these kinda of headaches? Can I implement a method that could somehow bridge the gap? I know the question is too vague without seeing the actual source code, however I highly appreciate any recommendations. **Update** Currently I'm thinking of having a method/function which returns the _legacy array_ , however you can actually pass the desired _identifier_ and put it in a loop to get the same effect -- I'm not certain if it will work in all cases, but hopefully will fit in most cases:               $data = get_legacy_array( $company_id );    // Instead of: $data = $array['customer']...


title: R* Tree work with dynamic data

text: I'm searching an algorithm to store my data (which are moving objects' coordinates) and allow me to query objects within a specific radius of a specific point. I came up with R* Tree which is said as good solution for geographical data, but as I studied further, R* Tree stored data in secondary memory and its data mostly don't change over time. But my data is updated per second, so if I implement R* Tree, the insert and delete part of the algorithm will be called many time. Is R* tree is suitable for my case or not? If it isn't, can anyone suggest me a better algorithm?


title: How to clear up basics as well as keep performing in your job?

text: I am a software Engineer in a Embedded domain. Here, we are using QT, C++, Sql, UPNP,LINUX and DBUS. However, I have never practiced all the IPC mechanism, C++, Sql, QT, and UPNP. For example, how socket works, etc? I am trying to clear up my fundamentals,but at the same time I need to learn new technologies. In my opinion, one can easily grasp new technology if there fundamentals are good. But, I am facing a problem here. How can I learn as well as work well? When I try to look at basics then I lose time. This effects in the productivity. But without basics also, I can work since one need generally logical skills. But, then you should be ready to burn yourself as you will do permutation and combination. How can I cope with it? How can I balance it?


title: What is the purpose of chunking strings in natural language processing?

text: I see many examples of libraries that use a 'chunker' and also people asking how to write chunkers, but what is this for and why do we need it? Isn't it enough to split a text by whitespace or other characters that delimit boundaries between words?


title: Declaration vs. Prototype vs. Symbol vs. Definition vs. Implementation

text: I see the terms "declaration," "prototype" and "symbol" thrown around interchangeably a lot when it comes to code like the following:               void MyUndefinedFunction();      The same goes for "definition" and "implementation" for things like this:               void MyClass::MyMethod()     {         // Actual code here.     }      Are there any distinctions between the terms, or are they truly synonymous? EDIT: I'm unsure whether or not this belongs on Stack Overflow...


title: Where does non-MVVM code belong in an MVVM app?

text: By non-MVVM code, I mean things like highly generalized components, like one with common extension methods for CLR types, and other 'homeless' helper classes etc? I have a `Core` project that most others reference, but to resolve circular dependencies I had to refactor the extensions to another project. This seems a common challenge in a well layered project. In some cases it's easier and produces a better project structure to have one copy of a class in each of two or more components, and I can't use symlinks for these copies because the namespace differs. Or else I'm going to end up with quite a fat `Core` project, hosting disparate groups of helper classes. Down to what granularity can I factor these out and increase the dependency count of clients of these servives. What is a general convention here?


title: Using Python/Ruby/Lua for Java startup scripts

text: I have a number of distinct Java utilities that are shipped together. Currently there are two startup scripts for each utility: a `.sh` one for Linux and a `.bat` for Windows. I'm thinking of rewriting the startup scripts using Python, or perhaps Ruby, Perl, Lua or other scripting language. This way I avoid having different versions for each OS. Is this a good idea? Are there projects that already use this approach? What scripting language would be best suited for the task? What other alternatives exist to avoid having separate `.sh`, `.bat` files for this group of utilities?


title: Just being hired as a senior developer, never even been a junior developer, what should I expect?

text: I've been a freelancer and a coder by night for a while, and recently, I've been hired after several levels of interviews in a nice NY company, even though I've some lacks in specific fields. Is this common for companies to hire seniors with less experience? Will they wait some weeks to respect a certain learning curve? I don't know anything about working in a company, so that's why I worry. After one week, I'm still checking and exploring sources, but after one week of work, it seems that some coworkers are considering that I'm slow. I'm good in maths, physics, algorithms, but still I need to learn about all the templates used in this company. Anyone here already received a less-experienced senior member in his team? Is this acceptable? I'm planing on having a meeting with my boss to stop worrying about that. Sounds like a good idea? [EDIT] Thanks for these answers. I'm definitely a -new - senior developer. I returned to the office with more confidence on Monday. I guess that it's normal to feel a bit incompetent in front of unknown templates/sources during the first weeks when you receive a good pay.


title: Are performance and salary reviews *really* harmful?

text: In the second edition of PeopleWare, DeMarco and Lister suggest that annual performance and salary reviews foster teamicide because they encourage competition within the team. Spolsky re-iterates this idea in his "Incentive Pay Considered Harmful" essay. Is this really the case? And if we don't have salary reviews, how should pay rises be done?


title: How do you explain the importance of using a [distributed] version control system to someone who's not in the CS field?

text: A good example of someone who fits that description might be a project manager. I was asked by my boss the other day, "what this Github thing is and why it's important?" He has some proprietary projects so he would need private hosting and I found myself struggling to explain beyond the usual: VCSs make collaboration trivial, provide a history and "backup" of all your data, and allow you to record atomic changes in a code base. In my mind I was thinking, "it's almost as if you have to use a DRVS to really understand how beneficial it is". I ended up pointing him to BitBucket because they give you unlimited private repositories (I even had to explain what a repository was). Does anyone have ay really good concrete examples of how a VCS has saved their ass or made life easier, etc -- basically, how would you sell a DVSC to someone who's not unfamiliar with programming, but not a programmer by profession?


title: Is there any reason to use "plain old data" classes?

text: In legacy code I occasionally see classes that are nothing but wrappers for data. something like:               class Bottle {        int height;        int diameter;        Cap capType;             getters/setters, maybe a constructor     }      My understanding of OO is that classes are structures for data _and the methods of operating on that data._ This seems to preclude objects of this type. To me they are nothing more than `structs` and kind of defeat the purpose of OO. I don't think it's necessarily evil, though it may be a code smell. Is there a case where such objects would be necessary? If this is used often, does it make the design suspect?


title: What design pattern is best suitable with this context?

text: I have a base class Shape, and drived classes Line Segment, Arc, B-spline,... I want to find the intersection point between these shapes. I would like:               Shape* a = new LineSegment();     Shape* b = new Arc();          bool did_intersect = a->Intersect(b);      I don't like this design in Intersect:               bool LineSegment(Shape* s) {       Arc* arc = dynamic_cast<Arc*>(s);       if (NULL != arc)         return LineSegmentArcIntersection(this, arc);            BSpline* bspline = dynamic_cast<BSpline*>(s);       if (NULL != bspline)         return LineSegmentBSplineIntersection(this, bspline);       ...     }      So, What **design pattern** is best suitable with this context?


title: Are breadcrumbs still a viable way to navigate web sites and web apps?

text: I'm currently working on the following types of web sites and apps:   1. ecommerce like Amazon   2. Reservation system (think of a hotel receptionist checking rooms availability)   3. Invoice management like Freshbook On Amazon, I didn't notice any breadcrumbs, just facets from the left panel. However, newegg is using both breadcrumbs and facets. In a management system like hotel reservations or invoice management, you usually have unique reservation or customer number that you search through your system. Each reservation can then expand to more sections, for instance:               Reservations         > Reservation #123456             > Guests             > Room             > Airport pickup             > Payment      In each unique reservation page, I'm using breadcrumbs to show the location of the current page relative to the site. Is that a good method to present that kind of information? Should I use tabs or other techniques?


title: How to have my callbacks authenticated in a REST app?

text: I'm developing a REST application and I allow my clients to authenticate in several ways (typically using `Authorization: Token ...` as in OAuth 2.0, but also there's session-based auth option for the web-browsable API). The application allows the client to provide their endpoint to which my application would later POST with some data whenever a particular event happens. Now I wonder: what's the best way for the client application to authorise that it's my application calling? Should I roll something up myself (like, include a token derived from the client application secret, which the client app would then verify), or is there a more conventional approach I can follow?


title: CSS File Editing for Teams? (how to avoid stepping on each others' feet?!)

text: I'm wondering if anyone has a good solution for when you're working as a team and there's a single file used throughout a project (like a styles.css file) and everyone needs to use it throughout the day - inevitably someone will make changes and save without grabbing the most recent version first. Is there some sort of group editing program for Windows/web? We currently just access the CSS files via FTP & edit in our usual editors. Probably an editor that can load & save changes on the fly?


title: SBCL development on Windows, including CFFI

text: I have been asked to automate the operation of a Windows (WinForms) application, performing some fairly complicated statistical analysis along the way. My first thought was the usual suspects: .NET, C# and White or AutoItX. Then it occured to me that I could try an alternative stack: SBCL, CFFI, and AutoItX. That way, I could write in a language I like (Common Lisp), using my native Linux development tools via SLIME and Swank. Hence my question: is there some reason I _shouldn't_ try this? I'm a Common Lisp newbie, and have essentially zero experience in CL FFI or SBCL on Windows. The learning curve isn't a problem, though. I'm worried that someone may have tried something like this in the past and discovered insurmountable issues. My list of concerns includes:   * stability / completeness of CFFI on SBCL on Windows   * getting SLIME on Linux talking to SBCL running on a Windows box Any experience, advice or warnings on any aspect of my proposed stack would be greatly appreciated.


title: career development strategy for complementing 0+ years of OO PHP

text: I started programming in PHP sometime before last Christmas. Before that, I had done some development with Access/VBA (1-2 years). I have a BA in Art History and a masters in Music Composition. I've been studying up on OOP with PHP 5.3, Zend Framework and some design pattern textbooks, and I'm starting to feel comfortable, conversant. I work for a bank, unfortunately. I say unfortunately simply because I'm not really in a bona fide technical role at the bank (although my manager really supports my development work, probably b/c I work for peanuts), and most of the job openings here I would apply for are for .Net or Java. I'm really enjoying myself, though, and I'm finishing up my first complete ZF application here at work. But I'm at a point where I'd love to start learning something different and new. I want to be excited about it, but I also want to be realistic/strategic about this, because I haven't been able to land a "real" developer job, and that is my goal (I don't care what language, or even what working environment at this point--I don't have any real experience with working as a developer yet to know what I like best, honestly. I just know I need to be part of a team now--no more working alone in the dark). I've heard people say that it's best to learn several languages vs. sticking to the same one (especially if it's PHP, for some reason). But I've also heard the opposite. My question then has to do with that: what best complements a 0+ years professional experience PHP developer who wants to learn something new, but aim for being marketable? Should I learn other PHP tools like Drupal, Joomla, Wordpress? Or should I learn a different scripting language, such as Groovy, Python or Ruby? Or should I go for a language more like Java or C# (or even Objective-C)? I'll have fun either way, I just want to be sure I'm not diversifying too much (or not enough), impeding my chances for a first real gig. How should I go about making myself marketable?


title: Vocabulary: Should I call this apply or map?

text: So, I'm tasked with organizing the code and building a library with all the common code among our products. One thing that seems to happen all the time and I wanted to abstract is posted below in pseudocode, and I don't know how to call it (different products have different domain specific implementations and names for it)               list function idk_what_to_name_it ( list list_of_callbacks, value common_parameter ):        list list_of_results = new list       for_each(callback in list_of_callbacks)         list_of_results.push(callback(common_parameter))       end for_each       return list_of_results     end function      Would you call this specific construct a               list ListOfCallbacks.Map( value value_to_map)       method or would it better be               value Value.apply(list list_of_callbacks)      I'm really curious about this kind of thing. Is there a standard guide for this stuff?


title: How to find optimal path visit every node with parallel workers complicated by dynamic edge costs?

text: Say you have an acyclic directed graph with weighted edges and create N workers. My goal is to calculate the optimal way those workers can traverse the entire graph in parralel. However, edge costs may change along the way. Example:               A -1-> B     A -2-> C     B -3-> C (if A has already been visited)     B -5-> C (if A has not already been visited)      Does what I describe lend itself to a standard algorithmic approach, or alternately can someone suggest if I'm looking at this in an inherently flawed way (i have an intuition I might be)?


title: Using a list of tuples vs a list of custom objects

text: I have a situation where I have several text documents and I want to create a list that contains the words in those documents. But I also need to record several properties of each word. These properties are   * The index of the word within all the words in the documents (Integer)   * The word itself (String)   * The document that the word is in (Integer)   * The topic value associated with this word (Integer) I can think of two ways of doing this. The first is simply creating a list of tuples of the form (word,doc,topic) where the word index is given by the index of the tuple in the list. My second idea is to create a word class where the given properties are member variables in the class. Then just create a list of objects from this class. So my question is which is the best solution - the list of tuples or the list of word objects? And a related question is what are the situations when either of these approaches is preferable?


title: Storing editable site content?

text: We have a Django-based website for which we wanted to make some of the content (text, and business logic such as pricing plans) easily **editable in-house** , and so we decided to store it outside the codebase. Usually the reason is one of the following:   * It's something that **non-technical people** want to edit. One example is copywriting for a website - the programmers prepare a template with text that defaults to "Lorem ipsum...", and the real content is inserted later to the database.   * It's something that we want to be able to change quickly, **without the need to deploy new code** (which we currently do twice a week). An example would be features currently available to the customers at different tiers of pricing. Instead of hardcoding these, we read them from database. The described solution is flexible but there are some reasons why I don't like it.   * Because the content has to be read from the database, there is a **performance overhead**. We mitigate that by using a caching scheme, but this also adds some complexity to the system.   * Developers who run the code locally see the system in a significantly **different state** compared to how it runs on production. Automated tests also exercise the system in a different state. Situations like testing new features on a staging server also get trickier - if the staging server doesn't have a recent copy of the database, it can be unexpectedly different from production. We could mitigate that by committing the new state to the repository occasionally (e.g. by adding data migrations), but it seems like a wrong approach. Is it? Any ideas how best to solve these problems? Is there a better approach for handling the content that I'm overlooking?


title: Using Hash Bang URL's. Best practices? Best libraries? Important pitfalls?

text: SO I'm about to put together a new site and I'd like to go about it by making a web application that parses /#!/ url's and requests content accordingly via AJAX calls to a JSON API that is already put together. My questions are...   1. What are the best practices concerning #! url's   2. Are there any good JavaScript libraries that are built to handle Routing as well as History? or should I roll my own?   3. What are the pitfalls I should be aware of? Please no "/#!/ url's are breaking the internet!" comments , I've read Mike Davies Article as well as this one and this other one. I want to hear from people who have already implemented this type of a url structure and can tell me about their experiences.


title: Manager/Container class vs static class methods

text: Suppose I have a Widget class that is part of a framework used independently by many applications. I create Widget instances in many situations and their lifetimes vary. In addition to Widget's instance specified methods, I would like to be able to perform the follow class wide operations:   * Find a single Widget instance based on a unique id   * Iterate over the list of all Widgets   * Remove a widget from the set of all widgets  In order support these operations, I have been considering two approaches:   1. **Container class** \- Create some container or manager class, WidgetContainer, which holds a list of all Widget instances, support iteration and provides methods for Widget addition, removal and lookup. For example in C#:              public class WidgetContainer : IEnumerable&ltWidget;>       {         public void AddWidget(Widget);         public Widget GetWidget(WidgetId id);         public void RemoveWidget(WidgetId id);       }          2. **Static class methods** \- Add static class methods to Widget. For example:              public class Widget     {       public Widget(WidgetId id);            public static Widget GetWidget(WidgetId id);       public static void RemoveWidget(WidgetId id);       public static IEnumerable&ltWidget;> AllWidgets();       }      Using a container class has the added problem of how to access the container class. Make it a singleton?..yuck! Create some World object that provides access to all such container classes? I have seen many frameworks that use the container class approach, so what is the general consensus?


title: When modeling a virtual circuit board, what is the best design pattern to check for cycles?

text: To make it simple assume you have only AND and OR gates. Each has two inputs and one output. The output of two inputs can be used as an input for the next gate For example: A AND B -> E C AND D -> F E OR F -> G Assuming an arbitrary number of gates, we want to check if the circuit ever connects back into itself at an earlier state? For example: E AND F -> A This should be illegal since it creates an endless cycle. What design pattern would best be able to check for these cycles?


title: MVC design, singleton in model with initialization

text: I've recently learned of MVC (model view controller) and am trying to refactor an existing program. I am in a situation where I'd like to have exactly one object of a particular class so it seemed evident that I should use a singleton. This singleton will be used to keep a hashmap of certain things. However this hashmap will have to be initialized when the singleton is created by reading nodes from a xml file and storing them as class objects. Now my dilemma is:   1. If I initialize the xml attributes (reading and converting to class objects), I'm effectively doing things in the model class that the controller should be doing, which is definitely not good.    2. If I put the initialization method in a controller class, I would have to refer to a controller class from a model class, which does not conform to the MVC design.   3. If I put the whole singleton in controller, then I'd have to look for the hashmap in the controller package, which defeats the purpose of having model classes.   4. I can't pass a premade hashmap to the singleton as a parameter neither, because the constructor is private.. Well, I technically could, by giving it to the getInstance() method as a parameter, but it feels like a dirty way of fixing, since I now either pass null every time, or make another getInstance() method that doesn't accept a parameter. Right now, my code is looking like this:               public class CategoryCatalog{              private static CategoryCatalog categoryCatalog;         private HashMap<CarOptionCategory, Set<ICarOption>> categoryOptionsMap;              private CategoryCatalog(){             categoryOptionsMap = new HashMap<CarOptionCategory, Set<ICarOption>>();             initialize();         }              public static CategoryCatalog getInstance(){             if(categoryCatalog == null){                 categoryCatalog = new CategoryCatalog();             }             return categoryCatalog;         }              private void initialize(){             // TODO: xml         }     }      Am I overlooking something or should I use a different approach?


title: Should a stored proc try to do more, in the attempt to avoid php mysql back and forth overhead

text: I have a REST architecture, running PHP on the server side which store and query a Mysql database. I am re-evaluating one architecture design decision: **DECISION** to re-evaluate: In an attempt to avoid back and forth communications overhead between PHP and Mysql:   1. For some browser requests (for example: 'GET /sessions/4'), one request requires a big response with related objects links.   2. For these situations, I have designed some big mysql stored procedures to query multiple tables. Therefore, for one browser request, PHP launch this one Mysql stored procedure which execute. On PHP result reception, my PHP code goes through each Packet of query results to create objects and link them logically.   3. At the end of this process, PHP query my internal logical view objects to construct the formatted response returned to the browser request.   4. The alternative would be to request multiple stored procedure and launch each of them within PHP instead of within this one stored procedure. **PROBLEMS** : It becomes quite hard to manage changes over time. These stored procedure becomes hard to maintain cause each table change, have an impact on one of them. **QUESTION** : I have started this design, because many code generated framework are being criticized for their lack of efficiency on communication between the PHP and Mysql layer. Doing those stored procedure by hand, I expected to have the best performance in production, however, the maintenance start to be annoying. Is real life high efficiency architecture attempts to limit the number of PHP-(Mysql stored procedure) back and forth communication or am I attempting to surround a false problem ??? Thanks


title: How lookaheads are propagated in "channel" method of building LALR parser?

text: The method is described in Dragon Book, however I read about it in ""Parsing Techniques" by D.Grune and C.J.H.Jacobs". I start from my understanding of building channels for NFA:   1. channels are built once, they are like water channels with current   2. you "drop" lookahead symbols in right places (sources) of the channel, and they propagate with "current"   3. when symbol propagates, there are no barriers (the only sufficient things for propagation are presence of channel and direction/current); i.e. lookahead cannot just die out of the blue Is that right? If I am correct, then `eof` lookahead should be present in all states, because the source of it is the start production, and all other production states are reachable from start state. How the DFA is made out of this NFA is not perfectly clear for me -- the authors of the mentioned book write about preserving channels, but I see no purpose, if you propagated lookaheads. If the channels have to be preserved, are they cut off from the source if the DFA state does not include source NFA state? I assume no -- the channels still runs between DFA states, not only within given DFA state. In the effect `eof` should still be present in all items in all states. But when you take a look at DFA presented in book (pdf is from errata): DFA for LALR (fig. 9.34 in the book, p.301) you will see there are items without `eof` in lookahead. The grammar for this DFA is:               S -> E     E -> E - T     E -> T     T -> ( E )     T -> n      So how it was computed, when `eof` was dropped, and on what condition? ## Update It is textual pdf, so two interesting states (in DFA; `#` is `eof`): State 1:               S--- >•E[#]     E--- >•E-T[#-]     E--- >•T[#-]     T--- >•n[#-]     T--- >•(E)[#-]      State 6:               T--- >(•E)[#-)]     E--- >•E-T[-)]     E--- >•T[-)]     T--- >•n[-)]     T--- >•(E)[-)]      Arc from 1 to 6 is labeled `(`.


title: Is it safe to modify sources in repository while git svn dcommit is in progress?

text: I have a big repository and `git svn dcommit` takes pretty big time. Will my repo be in consistent state if I'll modify sources (without any git operations) while dcommit is in progress?


title: Why is the sudden increase in number of Git submitters on Debian popcon graph in 2010-01?

text: Almost every article I've read 1 comparing Git and Mercurial it seems like Mercurial has a better command line UX with each command being limited to one idea only (unlike say `git checkout`). But at some point Git suddenly became looking super popular and number of Git submitters on Debian popcon graph (see graph image below) literally exploded. ![Git vs. Mercurial popularity](http://i.stack.imgur.com/nq8qW.png) Source: Debian What happened in 2010-01 that things suddenly changed. Looks like GitHub was founded earlier than that - 2008.


title: Type inference in Java 8

text: Is the introduction of the new lambda notation (see e.g. this article) in Java 8 going to require some kind of type inference? If so, how will the new type system impact the Java language as a whole?


Do you know any scenario where asp.net mvc can outperform asp.net? Because while comparing these two, people always say that each of them are different beasts and may be a better choice depending upon the scenario.


title: Is TCP message order still guaranteed when using async IO

text: Here the scenario I'm imagining. Two messages are transferred, both will require 2 packets each (I know you don't deal with packets directly with TCP, but on the IP level each message will consist of 2 packets [or segments as they're called in TCP]) The problem I'm imaging is buffering the first packet of the first message, but a router dumps the second packet for some reason. Being TCP, the second packet is guaranteed to be resent, and I know that TCP will hand these two packets up to the application layer in order. But while being handled asynchronously, this first packet will still be handed up to the application which will not block during the period in which the underlying TCP layer handles the retransmission of the second packet. What will happen if the first packet of the second transmission arrives before the last packet of the first transmission? Will TCP not hand these packets up until the first transmission is handled in full? Will an async client not send the second message before the first has been handled in full? I know that TCP will guarantee the order of packets for each message. My confusion is whether it will fully complete one transmission before processing the second transmission when being handled asynchronously.


title: Best book to learn objective C for experienced programmers

text: I am an experienced C#/C++ developer. What is the best book to learn Objective C for programmers like me? PS: I interested in developing for the iPhone.


title: What function or method can I use to equally distribute a workload

text: This is more of mathematical question than an algorithmic one; nevertheless it will be implemented in php. I have an array of N tasks. Each task has taken t time to complete(e.g. task 1 has taken 5 hours to complete.) Now, in order to review that these tasks were completed correctly, I have to assign a certain number of users U to review each of them. Each user will be assigned a certain number of tasks, ideally, with each user having roughly the same amount of hours assigned as the other. E.G. There are 10 tasks. task 1 took 4 hours, task 2 took 18 hours, task 3 took 6 hours...etc... totaling 80 hours. There are 8 users. If each of the 8 users is to ideally have the same amount of hours (some users get more, yet less lengthier tasks, some users get less, yet lengthier tasks), what is a good way to automatically sort assign the tasks?


title: When making a website. How do you keep track of an ever growing set of url parameters and expected values?

text: A website I'm making has been growing larger and larger feature wise. Which means there's more URL parameters that get passed from page A to B or B to C, etc. Does anyone have any tips for how to keep track of and use parameter keys and expected values? Ex. Say a url I need to build is `www.example.com?type=this&mode=a` Is there some kind of a system that will let me easily keep track of the fact that the "type" parameter key is in fact "type"? I tried to keep them all in a constants class, but that class quickly grew out of hand.               public class URLParameters {             public static final String TYPE = "type" ;        public static final String MODE = "mode" ;             //more "keys"            public static class Values {               public static final String TYPE_THIS = "this" ;          public static final String TYPE_THAT = "that" ;               public static final String MODE_PRIMARY = "a" ;          public static final String MODE_SECONDARY = "b" ;              //more expected values       }          }


title: Type checking and recursive types (Writing the Y combinator in Haskell/Ocaml)

text: When explaining the Y combinator in the context of Haskell, it's usually noted that the straight-forward implementation won't type-check in Haskell because of its recursive type. For example, from Rosettacode:               The obvious definition of the Y combinator in Haskell canot be used     because it contains an infinite recursive type (a = a -> b). Defining     a data type (Mu) allows this recursion to be broken.          newtype Mu a = Roll { unroll :: Mu a -> a }          fix :: (a -> a) -> a     fix = \f -> (\x -> f (unroll x x)) $ Roll (\x -> f (unroll x x))      And indeed, the “obvious” definition does not type check:               λ> let fix f g = (\x -> \a -> f (x x) a) (\x -> \a -> f (x x) a) g          <interactive>:10:33:         Occurs check: cannot construct the infinite type:           t2 = t2 -> t0 -> t1         Expected type: t2 -> t0 -> t1           Actual type: (t2 -> t0 -> t1) -> t0 -> t1         In the first argument of `x', namely `x'         In the first argument of `f', namely `(x x)'         In the expression: f (x x) a          <interactive>:10:57:         Occurs check: cannot construct the infinite type:           t2 = t2 -> t0 -> t1         In the first argument of `x', namely `x'         In the first argument of `f', namely `(x x)'         In the expression: f (x x) a     (0.01 secs, 1033328 bytes)      The same limitation exists in Ocaml:               utop # let fix f g = (fun x a -> f (x x) a) (fun x a -> f (x x) a) g;;     Error: This expression has type 'a -> 'b but an expression was expected of type 'a                                                The type variable 'a occurs inside 'a -> 'b      However, in Ocaml, one can allow recursive types by passing in the `-rectypes` switch:                  -rectypes               Allow  arbitrary  recursive  types  during type-checking.  By default, only recursive               types where the recursion goes through an object type are supported.      By using `-rectypes`, everything works:               utop # let fix f g = (fun x a -> f (x x) a) (fun x a -> f (x x) a) g;;     val fix : (('a -> 'b) -> 'a -> 'b) -> 'a -> 'b = <fun>     utop # let fact_improver partial n = if n = 0 then 1 else n*partial (n-1);;     val fact_improver : (int -> int) -> int -> int = <fun>     utop # (fix fact_improver) 5;;     - : int = 120      Being curious about type systems and type inference, this raises some questions I'm still not able to answer.   * First, how does the type checker come up with the type `t2 = t2 -> t0 -> t1`? Having come up with that type, I guess the problem is that the type (`t2`) refers to itself on the right side?   * Second, and perhaps most interesting, what is the reason for the Haskell/Ocaml type systems to disallow this? I guess there _is_ a good reason since Ocaml also will not allow it by default even if it _can_ deal with recursive types if given the `-rectypes` switch. If these are really big topics, I'd appreciate pointers to relevant literature.


title: Presenter accessing the value in text box using sender object

text: I have following method in my presenters which validates the user inputs on the UI. Basically to capture the value of the text property of the text box, it uses sender object which was passed in by the event fire on the form. **PRESENTER**               _View.ValidateInPut += new EventHandler(_View_ValidateInPut);          private void _View_ValidateInPut(object sender,  EventArgs e)     {         var controller = (TextBox)sender;         var text = controller.Text;              If (text is InValid)         MessageBox.Show ("The value in the Text box is invalid");          }      **VIEW**               private void txtACNo_Validating(object sender, CancelEventArgs e)     {         ValidateInPut(sender, e); // Firing the event     }      Will this lead to unexpected errors? If so please let me know a better way to do this?


title: Handling table name collisions in Django

text: Django creates a table name by joining the app label with the model name. A project can have many apps. If two have the same label, how can both be used in the same database? I'm currently using very long app names to minimize that risk (such as `foo_bar_baz` instead of nesting modules like `foo.bar.baz` \- app label `baz`). That might be overkill for an internal app (i.e. not meant for reuse), but I have also some modules that are generic and could be used in different projects (which I'm making freely available on the internet, so the possibility of name clashing is greater). If someone downloads my modules, finds a name collision with another third-party app, but doesn't want to change either code (it would be a maintainance hell) what could he do about it? I thought of "monkey patching" the apps to add a custom `db_table` to each model, or Django, to change the way the default table name is derived, or maybe ensuring every app uses dependency injection to refer to other apps (so one could freely rename/symlink the app without breaking others that depend on it), but all options seem a lot of work and/or too easily broken. Is there an easier way? Should I drop all this altogether and just keep using fully- qualified names?


title: C++ on Windows vs Linux - common issues?

text: So far all my development in C++ has been targeted to Windows, however I have always had it in the back of my mind that I will someday be targeting Linux. I am aware therefore of the need to select cross-platform libraries, and to keep my code as portable as possible (or provide alternative implementations for code which isn't portable). This question therefore does not relate to issues of code compilation. I would like to know, what are some common issues that a developer will face when targeting both Linux and Windows? In particular, but not limited to:   1. Best practices for handling configuration files. On Windows it seems this is fairly arbitrary - I've seen software store their configuration inside the program folder, in the user's folder (under appData), and in the registry. On Linux it seems much more heavily weighted towards dedicated configuration folders (/etc). How should I handle these differences in my code? Do I hard code the locations, or is there some system-defined function I can consult?   2. Same as (1) but for logging.   3. How do I go about keeping my project files in sync? E.g. if I update something in a Visual Studio project file, do I generally need to manually update the equivalent thing in whatever Linux environment I'm working in, or is there a commonly used method of avoiding this?   4. What is the best way to handle platform implementation differences in my code? Should I use #ifdefs, or should I keep the platform-specific code in separate files and have the project specify which files are included?   5. Anything else I haven't thought of which I should start considering / researching?


title: Benchmarking databases

text: I see lots of discussions flying around about performance of db 'x' or that moving from 'x' to 'y' improved our site performance. I'm yet to see proper benchmarking that works across different types of databases.   1. **Is it possible to write a meaningful benchmark that could be used across multiple db types, such as Relational, Document-oriented, etc.**   2. **How would you go about designing such a benchmark?**


title: Why and when should I make a class 'static'? What is the purpose of 'static' keyword on classes?

text: The `static` keyword on a member in many languages mean that you shouldn't create an instance of that class to be able to have access to that member. However, I don't see any justification to make an entire class `static`. Why and when should I make a class `static`? What benefits do I get from making a class `static`? I mean, after declaring a static class, one should still declare all members which he/she wants to have access to without instantiation, as static too. This means that for example, `Math` class could be declared normal (not static), without affecting how developers code. In other words, making a class static or normal is kind of transparent to developers.


title: use of jquery-latest

text: I recently had some code I wrote a year ago fail because someone linked my code to > http://code.jquery.com/jquery-latest.js In the latest version, jquery had deprecated/replaced a function. Nice to have a dynamically updated version but my code isn't going to change, it's going to break. Is there any reason to use jquery-latest?


title: How to introduce a new pattern into an existing codebase?

text: In my quest to better my development skills I learn new design patterns. In sample projects or personal projects it's really easy to adapt new patterns into my code. However at work I have a large code base that I am responsible for architecting and maintaining. This question is focused on writing consistent and maintainable code will still providing business value. When I learn new patterns I find myself conflicted on how to proceed moving forward on an existing codebase. **Do I go back update my code to use my new pattern ?**   * This has the downside of not providing a ton of business value and might not be the best way to efficiently utilize my time. **Do I move forward and use my new pattern/technique in any new code ?**   * This has the downside of being inconsistent, thus making my code less maintainable and setting a poor precedent for new team members.  Optionally I could just catalog the new technique in my head but not implement it. I really dislike this option though.


title: WCF and Service Registry

text: I am about to build some WCF Services. Those services need to communicate to each others too, in some scenarios. I've done some "Google-ing" about Service Registry but can't figure out how to implement service registry with WCF; is there any other alternate? Is there any Microsoft technology available for Service Registry? I'm new to SOA and I will really appreciate any help or guidance (what and where should I exactly look for registry services).