title: How can a code editor effectively hint at code nesting level - without using indentation?

text: I've written an XML text editor that provides 2 view options for the same XML text, one indented (virtually), the other left-justified. The motivation for the left-justified view is to help users 'see' the whitespace characters they're using for indentation of plain-text or XPath code without interference from indentation that is an automated side-effect of the XML context. I want to provide visual clues (in the non-editable part of the editor) for the left-justified mode that will help the user, but without getting too elaborate. I tried just using connecting lines, but that seemed too busy. The best I've come up with so far is shown in a mocked up screenshot of the editor below, but I'm seeking better/simpler alternatives (that don't require too much code). ![code editor nesting level indication](http://i.stack.imgur.com/Bqdo5.png) **[Edit]** Taking the heatmap idea (from: @jimp) I get this and 3 alternatives - labelled a, b and c: ![Initial ideas](http://i.stack.imgur.com/EHDZ2.png) ### The following section describes the accepted answer as a proposal, bringing together ideas from a number of other answers and comments. As this question is now community wiki, please feel free to update this. * * * ## NestView The name for this idea which provides a visual method to improve the readability of nested code without using indentation. ### Contour Lines The name for the differently shaded lines within the NestView ![enter image description here](http://i.stack.imgur.com/w9K2Q.png) The image above shows the NestView used to help visualise an XML snippet. Though XML is used for this illustration, any other code syntax that uses nesting could have been used for this illustration. ## An Overview:   1. The contour lines are shaded (as in a heatmap) to convey nesting level   2. The contour lines are angled to show when a nesting level is being either opened or closed.   3. A contour line links the start of a nesting level to the corresponding end.   4. The combined width of contour lines give a visual impression of nesting level, in addition to the heatmap.   5. The width of the NestView may be manually resizable, but should not change as the code changes. Contour lines can either be compressed or truncated to keep acheive this.   6. Blank lines are sometimes used code to break up text into more digestable chunks. Such lines could trigger special behaviour in the NestView. For example the heatmap could be reset or a background color contour line used, or both.   7. One or more contour lines associated with the currently selected code can be highlighted. The contour line associated with the selected code level would be emphasized the most, but other contour lines could also 'light up' in addition to help highlight the containing nested group    8. Different behaviors (such as code folding or code selection) can be associated with clicking/double-clicking on a Contour Line.   9. Different parts of a contour line (leading, middle or trailing edge) may have different dynamic behaviors associated.   10. Tooltips can be shown on a mouse hover event over a contour line   11. The NestView is updated continously as the code is edited. Where nesting is not well-balanced assumptions can be made where the nesting level should end, but the associated temporary contour lines must be highlighted in some way as a warning.   12. Drag and drop behaviors of Contour Lines can be supported. Behaviour may vary according to the part of the contour line being dragged.   13. Features commonly found in the left margin such as line numbering and colour highlighting for errors and change state could overlay the NestView. ## Additional Functionality The proposal addresses a range of additional issues - many are outside the scope of the original question, but a useful side-effect. ### Visually linking the start and end of a nested region The contour lines connect the start and end of each nested level ### Highlighting the context of the currently selected line As code is selected, the associated nest-level in the NestView can be highlighted ### Differentiating between code regions at the same nesting level In the case of XML different hues could be used for different namespaces. Programming languages (such as c#) support named regions that could be used in a similar way. ### Dividing areas within a nesting area into different visual blocks Extra lines are often inserted into code to aid readability. Such empty lines could be used to reset the saturation level of the NestView's contour lines. ### Multi-Column Code View Code without indentation makes the use of a multi-column view more effective because word-wrap or horizontal scrolling is less likely to be required. In this view, once code has reach the bottom of one column, it flows into the next one: ![enter image description here](http://i.stack.imgur.com/OnuKX.png) ### Usage beyond merely providing a visual aid As proposed in the overview, the NestView _could_ provide a range of editing and selection features which would be broadly in line with what is expected from a TreeView control. The key difference is that a typical TreeView node has 2 parts: an expander and the node icon. A NestView contour line can have as many as 3 parts: an _opener_ (sloping), a _connector_ (vertical) and a _close_ (sloping). * * * ### On Indentation The NestView presented alongside non-indented code complements, but is unlikely to replace, the conventional indented code view. It's likely that any solutions adopting a NestView, will provide a method to switch seamlessly between indented and non-indented code views without affecting any of the code text itself - including whitespace characters. One technique for the indented view would be 'Virtual Formatting' - where a dynamic left-margin is used in lieu of tab or space characters. The same nesting-level data used to dynamically render the NestView could also used for the more conventional-looking indented view. **Printing** Indentation will be important for the readability of printed code. Here, the absence of tab/space characters and a dynamic left-margin means that the text can wrap at the right-margin and still maintain the integrity of the indented view. Line numbers can be used as visual markers that indicate where code is word-wrapped and also the exact position of indentation: ![enter image description here](http://i.stack.imgur.com/2s2mb.png) ### Screen Real-Estate: Flat Vs Indented Addressing the question of whether the NestView uses up valuable screen real- estate: Contour lines work well with a width the same as the code editor's character width. A NestView width of 12 character widths can therefore accommodate 12 levels of nesting before contour lines are truncated/compressed. If an indented view uses 3 character-widths for each nesting level then space is saved until nesting reaches 4 levels of nesting, after this nesting level the flat view has a space-saving advantage that increases with each nesting level. _Note: A minimum indentation of 4 character widths is often recommended for code, however XML often manages with less. Also, Virtual Formatting permits less indentation to be used because there's no risk of alignment issues_ A comparison of the 2 views is shown below: ![enter image description here](http://i.stack.imgur.com/N23MY.png) Based on the above, its probably fair to conclude that view style choice will be based on factors other than screen real-estate. The one exception is where screen space is at a premium, for example on a Netbook/Tablet or when multiple code windows are open. In these cases, the resizable NestView would seem to be a clear winner. ### Use Cases Examples of real-world examples where NestView may be a useful option:   1. Where screen real-estate is at a premium a. On devices such as tablets, notepads and smartphones b. When showing code on websites c. When multiple code windows need to be visible on the desktop simultaneously   2. Where consistent whitespace indentation of text within code is a priority   3. For reviewing deeply nested code. For example where sub-languages (e.g. Linq in C# or XPath in XSLT) might cause high levels of nesting. ### Accessibility Resizing and color options must be provided to aid those with visual impairments, and also to suit environmental conditions and personal preferences: ![enter image description here](http://i.stack.imgur.com/PQJiK.png) ### Compatability of edited code with other systems A solution incorporating a NestView option should ideally be capable of stripping leading tab and space characters (identified as only having a formatting role) from imported code. Then, once stripped, the code could be rendered neatly in both the left-justified and indented views without change. For many users relying on systems such as merging and diff tools that are not whitespace-aware this will be a major concern (if not a complete show- stopper). * * * ## Other Works: ### Visualisation of Overlapping Markup Published research by Wendell Piez, dated from 2004, addresses the issue of the visualisation of overlapping markup, specifically LMNL. This includes SVG graphics with significant similarities to the NestView proposal, as such, they are acknowledged here. The visual differences are clear in the images (below), the key functional distinction is that NestView is intended only for well-nested XML or code, whereas Wendell Piez's graphics are designed to represent overlapped nesting. ![enter image description here](http://i.stack.imgur.com/6YpG7.png) _The graphics above were reproduced - with kind permission - from_ http://www.piez.org Sources:   1. Towards Hermenutic Markup   2. Half-steps toward LMNL


title: Is there any reason to use VARCHAR sizes rounded to a 128/256/4096 byte offset?

text: In database schema's, I often notice VARCHAR sizes are rounded to the byte offsets 128/256 or 4096. I've done it before as well, and the idea behind it was probably something with efficiency. However, is there still a valid reason to do so nowadays? I often use '50', '100' or '200' as VARCHAR sizes these days, as they are more natural and typically also shown in validation checks to the user.


title: How can I rewrite this linked-list manipulation as tail-recursive?

text: This is an interview question I was once asked, and now I ask many of my interviewees. I have yet to see anyone come up with a tail-recursive solution during the interview. Given a liked list, I'd like to swap every pair of nodes as follows: **input** : `a-b-c-d-e-f-g` **output** : `b-a-d-c-f-e-g` If there's an odd number of nodes then the last node is tacked on as-is. This should be done in-place. Implement the method: `Node* SwapTo(Node* start)` I'm using this Node definition:               class Node {         public:             char data;             Node* next;     };      Here's the unoptimized recursive solution:               Node* SwapTwo(Node* start) {         if (!start) {             return start;         }              Node* second = start->next;         if (!second) {             return start;         }              Node* third = second->next;         second->next = start;         start->next = SwapTwo(third);         return second;     }      What is the tail-recursive solution?


title: How to run developer team meetings?

text: Our team of 10 developers meet weekly. The meetings are rather boring and not particularly useful. What format/agenda do you utilize to have good meetings? We meet weekly in the conference room with pizza provided. The format is we go around the room and list the status of various tasks we are working on and discuss tasks for the next week. Managers will provide an overview of upcoming projects and priorities for the coming months and year ahead. **Update** The goal of these meeting is more or less - general team building, to share the knowledge of what everyone is working on, and to keep everyone aware of shifting company initiatives. It is not to formally 'hand out' work assignments (that is done via other means).


title: create site with Codeigniter without database support

text: What approach could You suggest, If I don't have mysql or other database support on webhost, but I need to store data ( textual information ) for website somewhere. It's informative site for school - approx 20 to 50 visitors per day, 6 to 7 categories with 3 to 5 subcategories. Would xml files be normal ?


title: Is a try-catch-finally clause appropriate for production code?

text: While browsing around on SO, I came across an answer that suggested using a `try-catch-finally` clause to fix the problem he was having. (A rare bug that sometimes happened to his users). Someone commented that it was a valid solution, but he said it was not recommended for production code. > Is this true? Why is it not recommended for production code? It seems perfectly valid to me if it is used for catching exceptions. In this context it was for an app and users are very discouraged from continuing if the app just crashes seemingly randomly. > He also mentioned that it could fail at anytime. Is this true as well?


title: Creating A Library That Requires Other Libraries (PHP)

text: Let's says that I am creating a PHP library that is using PHP 5.3 and namespaces and my library requires another library to work (this case it is the sfYaml library). I am trying to think of the best way to include this library. Is it considered good/acceptable practice to include the third party libraries directly in my code (assuming the license allows which sfYaml does) or is it better to not include the third party libraries and just have the user make sure the libraries are somewhere on their system and have them configure the path? I mean that only issue I have had in the past with including that third party libraries in my libraries is that if the user also has the same library for their project, there would be issues with including it twice however now with PHP 5.3 and namespace, that is not an issue. I am just try to think if there are any other issues with including third party libraries directly in my code (with having them namespaced under my main namespace).


title: What methods exist for handling DB Change Management?

text: I recently began working with version control in my web-development using subversion. This works great for managing the files I develop but does nothing for the changes I sometimes need to make to the databases. To my knowledge the server I'm working on doesn't have any DB management systems in place and I likely wouldn't be able to get them to install anything. What options are there for managing DB's in this kind of environment?


title: Going about increasing salary during performance review

text: I'm currently facing a dilemma with an upcoming performance review. When I started with my company around 1 year ago I tried to be as honest as possible in my perception of my programming skill set and knowledge. I based my perceived skills on my coding ability relative to those I consider to be good programmers and developers. So the salary I was provided I was happy with at the time. I have no problem with that as I believe honesty is important when going for a job and while in it. Also, I believe that once I'm in the job if I'm better than what I have given the employer to believe then my performance will reflect that. At the same another developer was hired. We were both hired to work on the same project doing the same task set. A few months back I found out that this person was on substantially more than me wage wise. Now during the project I have come to realise that this person is well below me in programming skills and even business knowledge. I have had to help him out numerous times with programming tasks, review his code and offer better solutions, and explain concepts about the project we are working on. Even though we both started at the same time. How can I go about increasing my salary (during the review) to be at least comparable with this person without directly mentioning their name or that I know what they are on. If I justify it based on the work I have done, what if they don't offer me a comparative package. Is it fair that I want more or am I being greedy?


title: Can I trust the Basic schedule equation?

text: I've been reading Steve McConnell's demystifying the black art of estimating book, and he gives an equation for estimating nominal schedule based on Person-months of effort:               ScheduleInMonths = 3.0 x EffortInMonths ^ (1/3)      Per the book, this is very accurate (within 25%), although the 3.0 factor above varies depending on your organization (typically between 2 and 4). It is supposedly easy to use historical projects in your organization to derive an appropriate factor for your use. I am trying to reconcile the equation against Agile methods, using 2-6 week cycles which are often mini-projects that have a working deliverable at the end. If I have a team of 5 developers over 4 weeks (1 month), then EffortInMonths = 5 Person Months. The algorithm then outputs a schedule of 3.0 x 5^(1/3) = 5 months. 5 months is much more than 25% different than 1 month. If I lower the 3.0 factor to 0.6, then the algorthim works (outputs a schedule of approx 1 month). The lowest possible factor mentioned in the book through is 2.0. Whats going on here? I want to trust this equation for estimating a "traditional" non-agile project, but I cannot trust it when it does not reconcile with my (agile) experience. Can someone help me understand?


title: User interface design tool

text: Are there any applications that can help me design a user interface in conceptual way?


title: How do I put YAML code in GitHub MarkDown?

text: Following YAML snippet that I'm trying to place in my markdown formatted readme:               ```      libraries:       - name: numpy          version: "1.6.1"        ```      Tried the above with both no and 2 trailing spaces at the end of each line. Both turn out on a single line. Obviously I want them on 3 separate lines in my README.md. How? edit: note tried adding 'yaml' as the optional lang parameter but no dice either.


title: Send mapped data from server-side code to client-side code

text: I'm developing a application based on two technologies: ASP.net (SharePoint) and JavaScript. I use server-side code for retrieve data from database and manipulate it whereas I use client-side code for build front-end(I'm using JSON format). I have very problem with this "architecture" because ASP.net is strong-type whereas JavaScript is less-type. My data "jumps" from front-end to back-and and vice versa. How can I have my model class in client-side code too?


title: Unit-based architecture

text: This is probably a damn fool question, for which I apologise, but I can't seem to get the google syntax right to find an answer. Imagine a Property, like this:               private int _type     public int Type     {         get { return _type; }         set          {             _type = value;             //raise an event in your chosen language or tech             CallAFunction();         }     }      Now, imagine that CallAFunction does some sort of fairly serious heavy lifting in your application, interacting with the database via a repository. It doesn't seem unreasonable to want a unit test for this, to make absolutely sure that Type gets set to whatever you put in and to check that doing so raises the expected event. However, setting the property with a test will call CallAFunction() which means that you're no longer really testing a "unit" of code as such, and perhaps more importantly that a very simple test for this very simple property might well require more elaborate preparation, including repository mocking, which seems huge overkill. In some cases you could split these apart by having CallAFunction raised via the event. But that's not always the case (I'm using WPF, and the events bubble up to non-testable XAML). What's the best way to split these two interdependent things apart?


title: Is there a clever way to calculate a mode of an online series without storing the series?

text: My program's aim is to determine the correct time zone offset (GMT+k) as a series of numbers are fed to it. eg: -4 +11 1 -4 -4 So, here -4 (the mode of the series) is the correct value. But this requires storing the series then analyzing it and I do not have enough storage (RAM and FLASH) for this. The running average can be calculated easily by storing the list size and the sum. Is there a similar case for finding the mode?


title: Parameterized Java Types (Generics)

text: Consider this "legacy" code:               public interface IPersistentCollection {         IPersistentCollection cons(Object o);     }      Genericized in Java, it could become something like this:               public interface IPersistentCollection<T> {         IPersistentCollection<T> cons(T o);     }      Clearly adding a new item to a mutable Java collection shouldn't change the type of the existing collection. But unlike the Java collections, cons() returns a completely new, immutable collection, leaving the old collection unchanged, opening the possibility that it could meaningfully take on a different type than the original collection had.   1. Obviously, you should be able to cons an object of type Ford to a collection of Cars and get a collection of Cars back (covariance). I think this is covered by the above generic example.   2. If Car and Train both extended a Vehicle class, it would be handy to be able to cons a Train to a collection of Cars and get a collection of Vehicles back (contravariance). How would I even write that? I thought by declaring new bounded type variables, S and E for "Vehicle" and "Train" in this example:              // Illegal because of <S super T>     <S super T, E extends S> IPersistentCollection<S> cons(E o);          // Simpler, but still Illegal because java disallows <S super T>     <S super T> IPersistentCollection<S> cons(S o);        3. If we want to assume that the programmer knows what they are doing, you should be allowed to cons something totally unrelated to a collection and get a collection of Objects back. I think this is the extreme case of contravariance, but I'm not sure there is even a name for it ("Dynamic Language" maybe?). I think that if #2 were legal, it would cover cases #1 and #3. My questions are: A. To what degree is it possible to do #2 in Java? B. Is #2 possible/easier in other languages? Scala? Haskell? ML? C. In theory, a type system that preferred the most specific version of S in example 2 could handle a definition like this. What book can I read about type systems without a PHD in math? Is "Types and Programming Languages" by Pierce the best place to start? Sample code would be appreciated. If I'm using terms like covariance and contravariance incorrectly, I would appreciate being politely corrected.


title: Do I have to include the license of a third party library imported as a DLL?

text: I have code using a third party library, QrCode.Net, in the form of a `dll` file. The library is licensed under the MIT License. Do I have to include the license in my project if I did not use or modify the source code? * * * Full license text: > ## The MIT License (MIT) > > Copyright (c) 2011 George Mamaladze > > Permission is hereby granted, free of charge, to any person obtaining a copy > of this software and associated documentation files (the "Software"), to > deal in the Software without restriction, including without limitation the > rights to use, copy, modify, merge, publish, distribute, sublicense, and/or > sell copies of the Software, and to permit persons to whom the Software is > furnished to do so, subject to the following conditions: > > The above copyright notice and this permission notice shall be included in > all copies or substantial portions of the Software. > > THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR > IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, > FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE > AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER > LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING > FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS > IN THE SOFTWARE.


title: Why doesn't C++ allow you to take the address of a constructor?

text: Is there a specific reason that this would break the language conceptually or a specific reason that this is technically infeasible in some cases? ~~The usage would be with new operator.~~ **Edit:** I'm going to give up hope on getting my "new operator" and "operator new" straight and be direct. The point of the question is: why are constructors _special_? Keep in mind of course that language specifications tell us what is legal, but not necessarily moral. What is legal is typically informed by what is logically consistent with the rest of the language, what is simple and concise, and what is feasible for compilers to implement. The possible rationale of the standards committee in weighing these factors are deliberate and interesting -- hence the question.


title: Why use in-memory database for integration testing?

text: I'm really confused when I see a lot of in-memory database implementation used for testing, because I also heard a lot from integration testing best practices that the environment running the test should resemble as closely as possible the production environment, including operating system, library, database engine, etc. What am I missing here?


title: Language Design: Are languages like Python and CoffeeScript really more comprehensible?

text: The " **Verbally Readable !== Quicker Comprehension** " argument on http://ryanflorence.com/2011/case-against-coffeescript/ is really potent and interesting. I and I'm sure others would be very interested in evidence arguing against this. There's clear evidence for this and I believe it. People _naturally_ think in images, not words, so we should be designing languages that aren't similar to human language like English, French, whatever. Being "readable" is quicker **comprehension**. Most articles on Wikipedia are not readable as they are long, boring, dry, sluggish and very very wordy. Because Wikipedia documents a ton of info, it is not especially helpful when compared to sites with more practical, useful and relevant info. Languages like Python and CoffeScript are "verbally readable" in that they are closer to English syntax. Having programmed firstly and mainly in Python, I'm not so sure this is really a good thing. The second interesting argument is that CoffeeScript is an intermediator, a step between two ends, which may increase the chance of bugs. While CoffeeScript has other practical benefits, this question specifically requests evidence showing support for the counter-case of language "readability"


title: Dynamically add/remove components to/from panel

text: I'm in a little planning phase of my java/swing project. Here is a picture:   ![Panel](http://i.stack.imgur.com/EzVm3.png) It is a main panel containing several sub panels depending on the selected date in the top center. I want to browse those sub panels using the blue arrows (next day and previous day). As you can imagine one sub panel can be in more than one - I would say - "page". My MVC structure looks like this: Each sub panel is represented by one class - let's call it subClassModel - so every model gets one subClassView (one of the fife panels in the picture) as observer. One subClassController will handle the interaction between these two classes and additionally the interaction to the mainController (e.g. create new subClassModel). I hope my questions are not too broad but I'll give it a try:   * First: Is there any pattern for this kind of problem. I haven't found any because I cannot find a proper name.   * How should I handle all SubClassView's and SubClassModel's. I thought of storing them in the SubClassController in a `HashMap<SubClassModel, SubClassView>`. So I have every model and view available even though they are filtered out by the date.   * Should I use `panel.add(SubClassView)` / `panel.remove(SubClassView)` or either removeAll and add all wanted view in a loop?   * Should I store all SubClassViews in the controller anyway? Or is it better to create the SubClassViews on every date change?   * ...       I know that I didn't add code to this question, because there isn't really relevant code. I want to settle this questions before I mould it into code.


title: Would you get better performances by coding an application in C, then compile to JavaScript?

text: I am writing an interpreter for a functional programming language that is going to run in the browser. Needless to say, performance is the one and only concern in this application. Emscripten is an LLVM→JavaScript compiler which claims to produce programs that run only 2~3 times slower than native. It is really surprising, considering actual JavaScript applications tend to run 7 to 10 times slower than native, according to the Computer Benchmarks Game. And those are exactly the types of application I am worried about. So, said that, would it be profitable to code my application in C, and then compile it to JavaScript using asm.js, or is there something I am missing?


title: Need overview of concepts and tools to translate a DSL to regular expressions

text: I'm looking for a little guidance. Until this morning, this was all over my head. After spending today researching Wikipedia, StackOverflow, etc., I'd say I've got my nose above the water. I'm tasked with researching a project that, as I understand it, would involve reverse-engineering a domain-specific language that is basically a type of regular expression syntax and translating that into conventional (meaning, Perl-like) regular expressions. I'm hoping someone can fill in the gaps in my understanding, so let me explain what I've got and my understanding, thus far. Regarding the DSL, it basically has two components to it. One is grep-like regular expressions, more or less. The other component consists of what you could call macros. These macros are used when you want to find Social Security numbers, credit card numbers and so forth in the text being analyzed. The DSL is a simpler way for the end-user to specify matching text and exceptions. (Honestly, it's still pretty complicated to use -- but easier than regular expressions.) The DSL is used to write "rules," a rule being a one-line statement describing target text. What I want to do is, taking a rule as input, translate that rule into a conventional regular expression where possible. If a macro doesn't break down into a single regular expression, I will translate the macro into one or more RE's, or any kind of text processing code needed. My largest point of ignorance is the "translating." Here's my first question: will that involve what's called "parsing"? (As you can guess, I'm a self- taught programmer.) Would I be using a tool like ANTLR or PyParsing, or something like that? (I just found out about these tools today, during my research.) I'm guessing yes, but I'd appreciate confirmation. How much do I have to learn? I'm not going to need to get the "Dragon book," right? I am not writing a DSL, but if I'm reverse-engineering one, then I'm guessing I will more or less need to learn how to create a DSL in the first place (since how else would I know how to do the parsing). Yes? What do I need to get under my belt? That's what I'm trying to figure out. I've parsed configuration files; I've written a simple YAML to Java Bean code generator; I've written a simple HTML-stripper; I know a bit about regular expressions and text processing; but this particular endeavor is more sophisticated than anything I've done before. It seems doable, but as a sanity check please tell me if, in my ignorance, I've miscalculated and what I'm describing actually needs 4 years of being a computer science major to accomplish. Can anyone point me in the right direction or give me some pointers? Thanks.


title: Is it reasonable to insist on reproducing every defect before diagnosing and fixing it?

text: I work for a software product company. We have large enterprise customers who implement our product and we provide support to them. For example, if there is a defect, we provide patches, etc. In other words, It is a fairly typical setup. Recently, a ticket was issued and assigned to me regarding an exception found by a customer in a log file that has to do with concurrent database access in a clustered implementation of our product. So this customer's specific configuration may well be critical in the occurrence of this bug. All we got from the customer was their log file. The approach I proposed to my team was to attempt to reproduce the bug in a configuration setup similar to that of the customer and get a comparable log. However, they disagree with my approach saying that I don't need to reproduce the bug as it's overly time-consuming and will require simulating a server cluster on VMs. My team suggests I simply "follow the code" to see where the thread- and/or transaction-unsafe code is and put in the change working off of a simple local development, which is not a cluster implementation like the environment from which the occurrence of the bug originates. To me, working out of an abstract blueprint (program code) rather than a tangible, visible manifestation (runtime reproduction) seems difficult, so I wanted to ask a general question: Is it reasonable to insist on reproducing every defect and debug it before diagnosing and fixing it? Or: If I am a senior developer, should I be able to read multithreaded code and create a mental picture of what it does in all use case scenarios rather than require to run the application, test different use case scenarios hands-on, and step through the code line by line? Or am I a poor developer for demanding that kind of work environment? Is debugging for sissies? In my opinion, any fix submitted in response to an incident ticket should be tested in an environment simulated to be as close to the original environment as possible. How else can you know that it will really remedy the issue? It is like releasing a new model of a vehicle without crash testing it with a dummy to demonstrate that the air bags indeed work. Last but not least, if you agree with me: How should I talk with my team to convince them that my approach is reasonable, conservative and more bulletproof?


title: How does a chess engine decide what move to make?

text: I'm writing a simple chess engine in LISP. I actually know how the engine decide the move, it evaluates and reads some opening books. But that's not what i mean. This is my design.               57 58 59 60 61 62 63 64     49 50 51 52 53 54 55 56     41 42 43 44 45 46 47 48     33 34 35 36 37 38 39 40     25 26 27 28 29 30 31 32     17 18 19 20 21 22 23 24     09 10 11 12 13 14 15 16     01 02 03 04 05 06 07 08      I looked at more complicated solutions but i came out with what i believe is the simplest one. Say the bishop is on the square 23, it could move 4 possible moves, (to 16 or 14 or 32 or 30), so it moves -7 or +7 or +9 or -9. I create an array               (make-array '(8 8) :initial-contents     '((R B N Q K B N R)      (P P P P P P P P)     (NIL NIL NIL NIL NIL NIL NIL NIL)     (NIL NIL NIL NIL NIL NIL NIL NIL)     (NIL NIL NIL NIL NIL NIL NIL NIL)     (NIL NIL NIL NIL NIL NIL NIL NIL)               (P P P P P P P P))               (R B N Q K B N R)))      And move the pieces from index to index. My question is, i cannot simply tell the bishop to move +7 or whatever, if it's an open diagonal. I need to tell it to move +9 * 1 or +9 * 2 etc. and you bishop have to decide which one to go to. I cannot write a condition and a loop for every possible square


title: PHP SplFixedArray How To Deal With billions of indexes?

text: I've built a flatfile db system that will work like mini-noSQL system and it split db to smaller files, and I did a SplFixedArray wrapper for it with a method for searching usage built on preg_grep. Everything working very good till now, but if the array became more than billions of indexes how to handle it? When searching it, it will iterate over the small files then get the matches and put it in a temporary fixedArray so, what if it found very large matches? How the noSQL dbms do that? NOTE: If you wonder why I do that without a real noSQL solution, I'll say because I want to know more.


title: Point and click synonym replacement in text area with Javascript

text: I am trying to create a site that will allow you to type a sentence or passage of text, then click on words to bring up a list of synonyms (from an online API) and possibly authorized abbreviations from a list that I provide. Once clicked, it would replace that word with the word that was clicked on. It would function kind of like After the Deadline or a Javascript based spell checker. Are there any libraries set up to make something like this easy, or what kind of Javascript do I need to be looking at? Are there any tutorials or examples for this kind of thing? I am aware that the source code for After the Deadline is available, but I only need a small portion of their technology, not all of the actual grammar and spelling check technology.


title: What's the best license for my website?

text: I have developed a unique website but do not have a lot of fund to protect it with trademark or patents. I'm looking for suggestions so that when my supervisor gets my codes, some laws restrict anyone from copying it and claim their work. I'm in the middle of thinking, making the application a commercial one or never allowing it to be copied at all. What kind of steps am I required to take in order to make full measurements so my applications are fully- protected? I've come across a few, one under my consideration is MIT license. Some say we can have a mixture of both commercial and MIT. I would also like to be able to distribute some functions so it can be modified by others but I'd still retain the ownership. Last but not least, it's confusing when I think of protecting the whole website, and protecting codes by codes in division. How should we go about this? Thanks. N.B I have to pass it over to the supervisor as this is a Uni project. I need this to be done within 2 weeks. So time to get my App protected is a factor here.


title: How can I consolidate data from a group of remote SQL Server instances?

text: I work for a company whose point-of-sale service uses IIS servers tied to static IP addresses at each of our stores. My boss wants a better real-time stat tracker than what the point-of-sale service provides. I would like to connect to these servers from a central location and retrieve the data. If possible, I'd like to be able to do so from Python, PHP, or Ruby. What are some recommended approaches for doing so.


title: How long was Microsoft working on .NET before they released it?

text: With the whole CLI, CTS, CLS, etc., not only did they release a powerful platform/infrastructure, but they released all the specs that describe it etc. It supports potentially infinite myriad languages, platforms, etc. This seems like an insane amount of work, even for a behemoth like Microsoft - especially since it turns out they did a damn good job. How long were they working on this before releasing it (.NET 1.0)?


title: Developer Compensation System

text: Joel wrote excellent articles on developer compensation system used at Fogcreek. As a team lead and business owner, I would like to design a system that would work best for my team _and_ my business, a system that is perceived as just and fair and transparent, a system that is easy to understand and implement **_but_** difficult to game. And here's the catch: I have no experience in managing a team before, and I don't know what works and what doesn't. How to motivate a team of software developers to bring out their full potential? Or more specifically, what do you think about the "ladder" Joel talks about in the aforementioned articles?


title: HTML code in Java class

text: A conceptual question, I tried to google but couldn't find any definitive answers, so here it goes: Is it a good practice to write Java methods to return HTML strings that will be returned to the display/presentation layer? Example:               public string getTextField(){         return "<input type=\"text\"/>";     }


title: Invalidate cache over multiple applications

text: We have a suite of applications including a website, a client application and multiple windows services. All these applications work on the same dataset and use an in-memory cache. Of course, this setup fails when one of the applications does something that invalidates the cache. I'm looking for a solution that will allow me to invalidate the cache across the applications. We have some ideas, but I'm sure the collective minds of the internet can give us a better solution. Some details:   * this is a legacy application, which means we would like to keep the changes as non-invasive as possible   * We're hesitant to introduce another moving piece to the solution. So using an external cache is out.


title: Is this over-abstraction? (And is there a name for it?)

text: I work on a large Django application that uses CouchDB as a database and couchdbkit for mapping CouchDB documents to objects in Python, similar to Django's default ORM. It has dozens of model classes and a hundred or two CouchDB views. The application allows users to register a "domain", which gives them a unique URL containing the domain name that gives them access to a project whose data has no overlap with the data of other domains. Each document that is part of a domain has its `domain` property set to that domain's name. As far as relationships between the documents go, all domains are effectively mutually exclusive subsets of the data, except for a few edge cases (some users can be members of more than one domain, and there are some administrative reports that include all domains, etc.). The code is full of explicit references to the domain name, and I'm wondering if it would be worth the added complexity to abstract this out. I'd also like to know if there's a name for the sort of bound property approach I'm taking here. Basically, I have something like this in mind: ## Before in models.py               class User(Document):         domain = StringProperty()               class Group(Document):         domain = StringProperty()         name = StringProperty()         user_ids = StringListProperty()              # method that returns related document set         def users(self):             return [User.get(id) for id in self.user_ids]              # method that queries a couch view optimized for a specific lookup         @classmethod         def by_name(cls, domain, name):             # the view method is provided by couchdbkit and handles             # wrapping json CouchDB results as Python objects, and              # can take various parameters modifying behavior             return cls.view('groups/by_name', key=[domain, name])              # method that creates a related document         def get_new_user(self):             user = User(domain=self.domain)             user.save()             self.user_ids.append(user._id)             return user      in views.py:               from models import User, Group          # there are tons of views like this, (request, domain, ...)     def create_new_user_in_group(request, domain, group_name):         group = Group.by_name(domain, group_name)[0]         user = User(domain=domain)         user.save()         group.user_ids.append(user._id)         group.save()      in group/by_name/map.js:               function (doc) {         if (doc.doc_type == "Group") {             emit([doc.domain, doc.name], null);         }     }      ## After models.py               class DomainDocument(Document):         domain = StringProperty()              @classmethod         def domain_view(cls, *args, **kwargs):             kwargs['key'] = [cls.domain.default] + kwargs['key']             return super(DomainDocument, cls).view(*args, **kwargs)              @classmethod         def get(cls, *args, **kwargs, validate_domain=True):             ret = super(DomainDocument, cls).get(*args, **kwargs)                  if validate_domain and ret.domain != cls.domain.default:                 raise Exception()                  return ret              def models(self):             # a mapping of all models in the application. accessing one returns the equivalent of                  class BoundUser(User):                 domain = StringProperty(default=self.domain)               class User(DomainDocument):         pass          class Group(DomainDocument):         name = StringProperty()         user_ids = StringListProperty()              def users(self):             return [self.models.User.get(id) for id in self.user_ids]              @classmethod         def by_name(cls, name):             return cls.domain_view('groups/by_name', key=[name])              def get_new_user(self):             user = self.models.User()             user.save()      views.py               @domain_view  # decorator that sets request.models to the same sort of object that is returned by DomainDocument.models and removes the domain argument from the URL router     def create_new_user_in_group(request, group_name):         group = request.models.Group.by_name(group_name)         user = request.models.User()         user.save()         group.user_ids.append(user._id)         group.save()      (Might be better to leave the abstraction leaky here in order to avoid having to deal with a couchapp-style //! include of a wrapper for emit that prepends doc.domain to the key or some other similar solution.)               function (doc) {         if (doc.doc_type == "Group") {             emit([doc.name], null);         }     }      ## Pros and Cons So what are the pros and cons of this? Pros:   * DRYer   * prevents you from creating related documents but forgetting to set the domain.   * prevents you from accidentally writing a django view -> couch view execution path that leads to a security breach   * doesn't prevent you from accessing underlying self.domain and normal Document.view() method   * potentially gets rid of the need for a lot of sanity checks verifying whether two documents whose domains we expect to be equal are. Cons:   * adds some complexity   * hides what's really happening   * requires no model modules to have classes with the same name, or you would need to add sub-attributes to self.models for modules. However, requiring project-wide unique class names for models should actually be fine because they correspond to the doc_type property couchdbkit uses to decide which class to instantiate them as, which should be unique.   * removes explicit dependency documentation (from group.models import Group)


title: License placement curiosities

text: Ruby gems have `LICENSE` file with the license text in each gem. Cocoa[Touch] open source frameworks (say ShareKit, StackKit, etc.) have license at the very beginning of each file (.h and .m). I am not sure about .NET or other interpreted languages (except ruby), but I'm pretty sure there are own choices at hand. I am wondering what are the reasons behind placing license into open source software source packages like this. Why not `LICENSE` file everywhere or at the beginning of every source file?


title: Unicode Explanation Required

text: Can someone explain what this means? > Unicode defines a codespace of 1,114,112 code points in the range 0hex to > 10FFFFhex. http://en.wikipedia.org/wiki/Unicode


title: Storing and analyzing rock climbing difficulty

text: I'm working on a WordPress plugin to manage rock climbing data, and I need to think of a way to store rock climbing grades from all of the different systems in a unified way. There are many different systems, all of which have some numerical system. A comparison of all the systems: http://en.wikipedia.org/wiki/Grade_(climbing)#Comparison_tables Is there some unified way that I can store and analyze these, or do I just need to assign numbers to them all and call it a day? My current plan is to save the score type and then assign each score a numerical value, which I can then use to compare and graph them.


title: Is it better to have publicly viewable FOSS code even if it is not your best work compared to none at all for employment?

text: I have a number of foss tools I have written and have released but under aliases. I guess I am worried that the code is not my absolute best and is not the most robust code around. So I have always thought it was best to keep it hidden and away from my name. Though I now am wondering if having any code at all puts you about those who have none in this competitive job market? My code is not bad, it works and works well. But lets just say every circumstance may not be handled in a robust way. Some parts are well written while others are hacked together. So is it better to have something while it may not be your absolute best rather than nothing?


title: Why is BASIC bad?

text: > **Possible Duplicate:**   >  Do you think that exposure to BASIC can mutilate your mind? BASIC, and related dialects, have long been branded "bad". I've seen it said by some of the best programmers I know, professors at Stanford, and even one of the most brilliant computer scientists: > It is practically impossible to teach good programming to students that have > had a prior exposure to BASIC: as potential programmers they are mentally > mutilated beyond hope of regeneration - Edsger W. Dijkstra Now, I think that quote may have been taken slightly out of context, and was meant to be something of an exaggeration, but at the same time, anyone who says something along those lines clearly does not like BASIC. When I started programming a while back, I started with BASIC and I don't consider myself a bad programmer, and I know of many good programmers who also started with BASIC. Now, the obvious reason for dislike is that it teaches bad habits, skills, and methodologies. I'm just wondering why people say that, and if it's even correct to say that. In my opinion, any programmer who is bounded by their language is a bad programmer, and that even if BASIC was somehow the boogeyman everyone made it out to be, it still shouldn't significantly hamper someone's "programming life". tl;dr - Why do people consider BASIC a bad programming language (especially for beginners) and why do people say it teaches bad skills? What is the "mental mutilation" that Dijkstra speaks of?


title: How exactly do we go from Binary/Hex to Assembly Instruction sets?

text: So i've been trying to learn some Embedded/Assembly programming for a bit here lately, as well as going far as trying to learn the lowest level (gates and such). One thing puzzles me though....is how do we "get" instruction sets. I understand somewhat how gates/TTL and such works, but I don't see how we get from that to mov,add,clr etc...? It's probably a stupid question....but I mean I think back to the first micro- processors/controllers and think....how exactly did they design an instruction set and make it work? edit: I guess for Clarity, pretend im talking about the first microprocessor, how did they go from Binary to actually creating an Instruction Set?


title: Author's work and copyright. in UI design

text: Typical situation in UI design: you do design of some UI and, say, came up with some bright new idea like "ribbon" or "kinetic scroll past end". What would be the strategy about such thing? Register patent, don't like it, but anyway would like to ask: how long it takes to do all this stuff and how much it will cost in average? If to forget about patents, will the idea have something like "prior art" status or some such if someone will try to patent this in future? All this about project / product published by solo developer.


title: Is Java free/open source or not?

text: On November 13, 2006, Sun released much of Java as free and open source software, (FOSS), under the terms of the GNU General Public License (GPL). **On May 8, 2007, Sun finished the process** , making all of Java's core code available under free software/open-source distribution terms, aside from a small portion of code to which Sun did not hold the copyright. **OpenJDK** (Open Java Development Kit) is a free and open source implementation of the Java programming language. It is the result of an effort Sun Microsystems began in 2006. The implementation is licensed under the GNU General Public License (GNU GPL) with a linking exception. Why there are still people that say Java is not open source or free as in free speech ? Am I missing something? Is Java still privative ?


title: Tailoring your resume for a career switch within programming

text: I am currently interested in job prospects outside of my own area of programming. Specifically, I'm a web developer but want to make the transition to desktop application programming. How should I tailor my resume to show that I am capable of this type of software development when I have had no prior experience with it? This question can also be generalized for any other programmer making a leap to a different area (for example a programmer mostly experienced in finance software that wants to go into embedded systems programming). In short, I've used HTML, CSS, PHP, MySQL and Javascript at work. For a short while I also used ColdFusion. I'm very familiar with OOP concepts and frameworks. In the meantime I've moonlighted for over 3 years on my personal hobby projects in C# and C++. I know it's bad focusing too much on the tools than their application as a metric to measure your abilities, but for making a transition in my career, would emphasizing knowledge in these tools be good idea to put on your resume? Problem is that a lot of jobs put programming languages as strict job requirements (see here). My resume currently shows 5 years of web development experience. I know general programming concepts well enough, and at this point my experience counts much more than my degree. _I want to know how I can make a potential employer of a software company look at my resume with cautious optimism, and not instantly reject it when it shows I have 5 years web experience with PHP and zero desktop software experience._


title: Is writing your own Data Access / Data Mapping Layer a "good" idea?

text: We're currently in a situation where we have a choice between using an out-of- the-box object-relational mapper or rolling our own We have a legacy application (ASP.NET + SQL Server) where the data-layer & business-layer are unfortunately mashed together. The system isn't particularly complicated in terms of it's data access. It reads data from a large group (35-40) of inter-related tables, manipulates it in memory & saves it back to some other tables in a summary format. We now have opportunity for some refactoring and are looking at candidate technologies to use to seperate & properly structure our Data Access. Whatever technology we decide on we would like to:   * have POCO objects in our Domain Model which are Persistence Ignorant   * have an abstraction layer to allow us to Unit Test our domain model objects against a mocked up underlying datasource There's obviously lots of stuff out there on this already in terms of Patterns & Frameworks etc. Personally I'm pushing for using EF in conjunction with the ADO.NET Unit Testable Repository Generator / POCO Entity Generator. It satisfies all of our requirements, can be easily bundled inside a Repo/UnitOfWork Pattern and our DB Structure is reasonably mature (having already undergone a refactor) such that we won't be making daily changes to the model. However others in the group are suggesting architecting/rolling our own D.A.L. completely from scratch. (Custom DataMappers, DataContexts, Repository, Interfaces everywhere, Dependency Injection overkill to create concrete objects, Custom LINQ-to-Underlying Query Translation, Custom Caching Implementations, Custom FetchPlan Implementations...) the the list goes on and to be frank is strikes me as madness. Some of the arguments been thrown about are "Well at least we'll be in control of our own code" or "Oh I've used L2S/EF in a previous project and it was nothing but headaches". (Although I've used both in Production before and found any issues to be few and far between, and very manageable) So do any of your uber-experienced devs/architects out there have any words of wisdom that might help me steer this product away from what seems to me like it's going to be a complete disaster. I can't help but think that any _benefit_ gained by dodging EF issues, will be lost just as quickly by attempting to re-invent the wheel.


title: Is onError handler better than exceptions?

text: I understand that exception in program means that something unpredictable happened (but not so bad to unavoidably crash the application!). The try- catch-finally sequence makes me sad because the program is harder to read (one more level of curly brackets) and harder to understand (jump from anywhere to catch in case of exception happened, it is deprecated GOTO). Since we have OOP, I suggest to create proxy class which in case of exception consumes it silently, returns some default value and fires onError event. So if we propagate exception, we have onError call instead, and the two disadvantages mentioned above are solved. See the example in C#: **Standard exception attitude**                 class Computer {         // let's say we need to propagate exception and decide what to do lately         public int divide(int a, int b) {           int result = a / b;           return result;         }       }            class Program {         public static void Main() {           Computer c = new Computer();           try {             Console.WriteLine(c.divide(1, 0));           }           catch(ArithmeticException e) {             // we are teleported here from the middle of Computer.divide method!             // do something           }         }       } // three levels of brackets (without namespace) in such trivial example??      **onError handler attitude**                 class ProxyComputer {         private Computer c = new Computer();         // it is not virtual, can not be overriden         public int divide(int a, int b) {           // alas, exceptions are standard, but we can stop them in this class           try {             return c.divide(a, b);           }           catch(ArithmeticException e) {             this.onError(e);           }         }              protected virtual void onError(Exception e) {           // do nothing         }       }            class MoreStrictComputer : ProxyComputer {         protected override void onError(Exception e) {           // mail to IT department, revert all transactions etc.           Console.WriteLine("I can't seem to do that");         }       }            class Program {         public static void Main() {           ProxyComputer pc = new ProxyComputer();           MoreStrictComputer msc = new MoreStrictComputer();           // fires onError instead of exception           Console.WriteLine(pc.divide(1, 0)); // no problem           Console.WriteLine(msc.divide(1, 0)); // this time it won't be so easy         }       } // only two levels of brackets      Often I see empty (or trivial) catch blocks. This means programmers often consider exception as no problem situation, but with standard exception attitude, they still have to bother with try-catch. The second attitude makes it optional. **So the question is:** Which solution would you prefer? Is this some kind of pattern or am I missing something? **Edit** As Paul Equis suggests, `throw e;` should be default onError behavior, not do-nothing silence swalowing.


title: What is a Bootstrapper in programming?

text: I sometimes see the term "Bootstrapper". I saw it last when creating some learning exercises for Prism. I stumbled upon `UnityBootstrapper` class. My question is: when would you call a class a "Bootstrapper"? Why? What does it say about the class?


title: Inspiring a co-worker to adopt better coding practices?

text: In the Handling my antiquated coworker question, various people discussed strategies for dealing with coworkers who are _unwilling_ to integrate their workflow with the team's. I'd like, if possible, to learn some strategies for "teaching" a coworker who is merely _ignorant_ of modern techniques and tools, and possibly a little apathetic. I've started working with a programmer who until recently has been working in relative isolation, in a different part of the company. He has extensive domain knowledge and most importantly he has demonstrated good _problem- solving skills_ , something which many candidates seem to lack. However, the actual (C#) code I've seen is a throwback to the VB6 days. Procedural structure, Hungarian notation, global variables (abuse of `static`), no interfaces, no tests, non-use of Generics, throwing `System.Exception`... you get the idea. This programmer is a fair bit older than I am and, by first impressions at least, doesn't actively _seek_ positive change. I'm not going to say _resistant_ to change, because **I think that is largely an issue of how the topic gets broached** , and I want to be prepared. Programmers tend to be stubborn people, and going in with guns blazing and instituting rip-it-to-shreds code reviews and strictly-enforced policies is very likely _not_ going to produce the end result that I want. If this were a new hire, a junior programmer, I wouldn't think twice about taking a "mentor" stance, but I'm extremely wary of treating an experienced employee as a clueless newbie (which he's not - he just hasn't kept pace with certain advancements in the field). How might I go about raising this developer's code quality standard the Dale Carnegie way, through gentle persuasion and non-material incentives? What would be the best strategy for effecting subtle, gradual changes, **without creating an adversarial situation?** Have other people - especially lead developers - been in this type of situation before? Which strategies were successful at stimulating interest and creating a positive group dynamic? Which strategies _weren't_ successful and would be better to avoid? * * * ## Clarifications: I really feel that several people are answering based on personal feelings without actually reading all of the details of the question. Please note the following, which should have been implied but I am now making explicit:   * This coworker is only my "senior" by virtue of age. I never said that his title, sphere of influence, or years at the organization exceed mine, and in fact, none of those things are true. He's a LOB programmer who's been absorbed into the main development shop. That's it.   * I am not a new hire, junior programmer, or other naïve idiot with grand plans to transform the company overnight. I am basically in charge of the software process, but as many who've worked as "leads" will know, responsibilities don't always correlate precisely with the org chart.   * I'm **not** asking people how to _get my way, come hell or high water_. I could do that if I wanted to, with the net result being that this person would become resentful and/or quit. Please try to understand that I am looking for a **social** , **cooperative** method of driving change.   * The mention of _"...global variables... no tests... throwing`System.Exception`"_ was intended to demonstrate that _the problems are not just superficial or aesthetic_. Practices that may work for relatively small CRUD apps do not necessarily work for large enterprise apps, and in fact, none of the code so far has actually passed the integration tests. Please, try to take the question at face value, accept that I actually know what I'm talking about, and either **answer the question that I actually asked** or move on. _P.S. My sincerest gratitude to those who -did- offer constructive advice rather than arguing with the premise. I'm going to leave this open for a while longer as I'm hoping to hear more in the way of real-world experiences._


title: Arguments for storing binary asociations in a single field vs. in a mapping table?

text: When do you draw the line between relational tables, and fields holding multiple values of a particular type. Let me illustrate in an example below where a PokeMaster can be associated to multiple pokemon of unknown number.               TablePokeMasters         PokeMasterId         PokeMasterName          TablePokeMastersToPokemon <- Side question, what is a good naming convention for a linking table?         PokeMasterId         PokemonId          TablePokemon         LinkId         PokemonId         PokemonName      Vs               Table PokeMasters         PokeMasterId         PokeMasterName         PokeMasterPokemon (ex: Picachu, Charizard, Blastoise) <- parse this in code      Is the second method ever preferred over the first one where there is an unknown number of relationships from one table to another? The only value I can see in the second method is a smaller number of tables, and it is easier to see the relationships right inside of one table, instead of building queries to see the relationships.


title: Using Bit Torrent for internal release management

text: We currently abuse our version control system and use it... pretty much as an FTP to store big release binaries (4+ GB). We are seeking to move away from this horrendous practice which has and continues to devolve and take more and more of IT's resources while crippling the integration and release processes. A solution for this would be using P2P file sharing to distribute these release images/binaries, mixing file servers and some key user machines as seeds. So my question comes in two parts:   1. Have any of you resorted to setting up BitTorrent in your intranet to distribute release images/binaries?, if not, what do you think about this idea (which was not actually mine BTW, but I think it is great)   2. Is there open source web-based software for handling publishing of BitTorrent trackers?, so that when there is a new release it can be searchable and display its availability with regards to seeds and leeches? (...you know what I'm referring to) Edit: The intranet is global (e.g. USA, China, Germany, Mexico). Regular FTP could work but it is not as cost-effective.


title: Ambiguous use of "Controller" in MVC

text: I have heard two separate uses for the term _controller_ when speaking of the _Model View Controller_ methodology.   1. An intermediary section of code that communicates between the Model and View, tying them together.   2. The module that deals with input, similarly to how the view deals with output. For starters, **which definition is correct?** I have read more that use the first definition than the second, with the second being the first one I learned. In addition, it seems to me that both of those things are useful - indeed, when I've used MVC-like designs, I've used both of those things in some way (even if I only ever called one of them the controller). **Should MVC really be defined in a way that includes both of these things?** That would mean that the architecture contains the model, an input module, an output module, and an intermediate module to connect them all, and that just makes sense to me.


title: How can you provide a public writeable API and not get spammed?

text: So say you had a site like StackExchange. Now imagine you created a machine- writeable API capable of posting questions and comments and doing everything your browser can do. Of course, about 5 minutes after launching, you'd have so much spam that you would probably have ran out of room on your database servers and will have been permanently blacklisted from every search engine(except for maybe Ask :) ) So, how can you avoid that spam, while allowing a machine to actually use your API(and/or have automation involved? Is it possible in this day and age? I'd expect there is a human moderator at the end of it, but how do you cut down on the majority of spam to measures capable of being handled by human moderators?


title: Freelance Web Developer tools

text: I'm thinking of freelancing and building web sites in my free time. I have experience in C#/ASP.NET, JavaScript/jQuery as well as HTML/CSS and SQL. Thus, I feel like I have sufficient web technologies knowledge to go down this path. What I'm unsure of is if there are any tools which can be used to simplify the life of a freelance web dev. As an example, I once designed an e-commerce website from scratch as a University project, which took around 3 months of hard work to accomplish. The finished product was not even hosted, and I didn't delve into any security aspects. I never even hosted a website or database before! What concerns me is that there are millions of sites out there which can for example be used to create an e-commerce site in minutes. Without having to bother with databases, security and other issues. You don't even need to know how to code in server-side technologies to get these sites up and running. Do professional web developers actually use these tools? If a client had to request an e-commerce site (for example), how would a pro go about developing it? I hear a lot about CMS systems like Joomla and Wordpress, but I think my main problem is that I don't know much about the available tools (other than Visual Studio) and I wouldn't know where to get started. Can anyone guide me in the right direction?


title: How do you put a price on your source code?

text: I was asked to sell the source code (along with existing users) of small utility app I created years ago. I've investigated how to put a price on the source code but so far haven't come up with a good solution. I've searched the net, but haven't found anything useful. Then I came across a few others who also sold their source code with users, but their prices seem unrealistically high. For example, one person calculated price per user at about $200. He had 80 users and ended up selling the source with users for $30k. How did he come up with this price? Can I find a good price with this formula: > (number of users x app price) + (app price x num of new users in one year) ? If this is a good formula, how do you price source that doesn't yet have users?


title: Is what someone publishes on the Internet fair game when considering them for employment as a programmer?

text: (Originally posted on Stack Overflow but closed there and more relevant for here) So we first interviewed a guy for a technical role and he was pretty good. Before the second interview we googled him and found his MySpace page which could, to put it mildly, be regarded as inappropriate. Just to be clear there was no doubt that it was his page (name, photos, matching biographical information and so on). The content was entirely personal and in no way related to his professional abilities or attitude. Is it fair to consider this when thinking about whether to offer them a job? In most situations my response would be what goes on in someone's private life is their own doing. However for anyone technical who professes (implicitly or explicitly) to understand the Internet and the possibilities it offers, is posting things in a way which can so obviously be discovered a significant error of judgement? EDIT: Clarification - essentially it was a fairly graphic commentary on porn (but of, shall we say, a non-academic nature). I'm actually more interested in the general concept than the specific incident as it's something we're likely to see more in the future as people put more and more of themselves on-line. My concerns are not primarily about him and how he feels about such things (he's white, straight, male and about the last possible victim of discrimination on the planet in that sense), more how it reflects on the company that a very simple search (basically his name) returns these things and that clients may also do it. We work in a relatively conservative industry.


title: Why the programmer with Ph.D is a bad candidate for the employer?

text: I have found this comic pic on Steve Hanov's blog: ![enter image description here](http://stevehanov.ca/blog/resume_comic.png) The most of the points are true obviously. What I can't comprehend is, why _having Ph.D is considered as a "bad thing"_? ![enter image description here](http://i.stack.imgur.com/k5jlX.jpg) Any thoughts?


title: How do you deal with boring repetitive tasks and activities?

text: When you encounter in your work some boring, repetitive (possibly not- programming) task how do you deal with it? Do you try to automate it immediately? Do you postpone automation till you encounter the task twice? Do you try to delegate it? Do you try to find something interesting in it? What do you do to make the work more joyful? Learn deeper to make it more interesting? Learn deeper immediately or when you need it regularly?


title: Is Oberon really "a better Pascal"?

text: Reading Niklaus Wirth, one can notice that despite some popularity of Pascal, he is not glad that Oberon (as a "polished" successor of Pascal and Modula) didn't get much popularity. I never did anything in Oberon, but reading the page Oberon For Pascal Developers I really did not like many of the changes as a Delphi/pascal developer, for example   * forcing the reserved words to be always uppercase   * making the language case-sensitive   * getting rid of enumeration types  What do you think about Oberon, is it really "a better Pascal" from your point of view?


title: Oracle Java SE Certification

text: * Which exam(s) should be given for Java certification from Oracle.   * is Oracle 1Z0-851 exam old SCJP ?   * Recommend book which covers Oracle 1Z0-851 exam?


title: What does value propagation mean?

text: This may be a stupid question but I am working on an algorithm which calculates intervals for variables in some given constraints. For example there is a function called propagateValues and its description is               `Propagate value ranges for the given constraints`      What exactly is meant by value propagation ? The algorithm I am working is basically trying to simplify sets of constraints by doing a range/interval analysis before querying the solver for a feasible solution (to make solving constraint sets more efficient)


title: easiest way for push notifications

text: I wanted to implement real time push notification to one of the apps written in RoR. I don't have any experience with nodejs, nowjs, express or socketio. What would be the easiest way to implement the realtime push notification system?


title: where is there a good description of the use of the word 'scope' in computer science?

text: Where is there a good description of the use of the word 'scope' in computer science? In this post of a question about the Java final reserved word one responder implies that scope is textual so each iteration of a `for` loop causes a scope to be resumed as current. Another responder implies scope is time dependent so each iteration is a new scope. In those contexts, it was possible to understand what scope meant even though different people use the word differently but sometimes when I am reading a programming book I am not sure what scope means. What are good qualifiers for the word 'scope'? I suggest 'textual' is one. Can you think of others? Should a qualifier almost always be used or is there a general understanding about contexts that help one perfectly infer the the intended meaning? How is the word 'scope' used when speaking of objects (and object oriented programming) and what qualifiers might be necessary?


title: Inject specific classes or not

text: I have a TableSqlBuilder interface which has a method getCreateTableSql. This interface is used in some other class as follows:               function createTable( $tableDefinition ) {         $sql = $this->tableSqlBuilder->getCreateTableSql( $tableDefinition );         $this->db->execute( $sql );     }      The TableSqlBuilder interface has multiple implementations, such as SQLiteTableSqlBuilder and MySQLTableSqlBuilder. SQLiteTableSqlBuilder originally created all SQL itself, and had methods to create SQL for an index or for a field. It turned own that the functionality of these methods was needed on its own at other places, so it has been split off into a SQLiteFieldSqlBuilder and a SQLiteIndexSqlBuilder. These classes are instantiated by SQLiteTableSqlBuilder - they are thus not injected, and SQLiteTableSqlBuilder depends on these concrete classes. I'm unsure if this should be changed to have these field and index sql builders injected. On the one hand this gives more flexibility. It also allows mocking out this behaviour in tests. Then again, the binding and flexibility is currently the same as before the code was split of into new classes. When going with the injection approach, the accepted types could be FieldSqlBuilder and IndexSqlBuilder, both interfaces implemented by the current concrete classes. This however means one can happily end up with a MySqlIndexBuilder in a SQLiteTableBuilder, which is clearly to be avoided. Could also just type hint against the concrete class, pretending it is an interface, which gets rid of the dependency as long as the construction happens outside of the table sql builder. Do you think these collaborators should be injected, or is it a valid exception where it is better to not go all the way?


title: I Want To Program!

text: I am highly interested in learning how to program but I am unsure whether I want to lean towards web developing or software programming. Or does computer programming cover both in a nut shell? Where should or how should I start?


title: URLs with variable query strings and cache

text: I am developing a media server, the basic functionality is to serve an image, which is done the following way               /media/:id      where :id is the id of the image. You may want to ask for a specific size, with some rules I will provide. Eg:               /media/:id/50x50     /media/:id?witdh=50&height=50      Question: Which option do you think is better? I believe the second one to be more RESTful and beautiful, but we will be using a CDN and varnish for cache, so if we get               /media/:id?width=50&height=50      or               /media/:id?height=50&width=50      we will have 2 hits when we should have 1 Any advice?


title: As a Europe-based company, is it possible to write a custom iPad application for a customer?

text: Our customer wants us to write a custom application for him that he can use on a handful of iPads in his company. This application is probably only useful for this one customer (maybe for two or three more in the future, but only after additional customization). I read that if the customer subscribes to Apple's Volume Purchasing Program, we are able to provide him with a custom B2B application. This, however, seems to be restricted to US developers (or customers? or both?). What are the alternatives for Europe-based (or, more generally, non-US) software developers and their local customers?


title: HTML - Alternative for ID when ID is only unique within a certain scope?

text: So I feel like this should be a common question but I can't find the answer. Maybe I'm using the wrong terminology. Assumptions:   * IDs are supposed to be unique across the document.   * Class attributes are meant for CSS and should not be used in JS selectors.   * Name attributes are not appropriate ID replacements since they don't work the same on all elements and the html 5 spec changed them (removed from certain elements I think). So given something like: The page has multiple of the same widget. Each widget has a unique ID. I need to be able to reference widget sub-elements like `$("#widgetID relativeID")`. So that relative IDs are unique within widgets but may be duplicated outside this scope. I had been using name for this but it seems this isn't the correct way What is?


title: Is anyone teaching the application of ethics to programming?

text: Ethical questions come up more and more in the news, and can be core to a software developers' life. On several occasions this year I was asked for advice that amounts to answering ethical questions, in a computer programming context, and I was surprised to see how much fretting and trouble questions which I consider trivial can lead to. Are there any courses or programs specializing in teaching what is expected of an ethical programmer? Has anyone put together a formal curriculum anywhere?


title: should Product owner be in product management team

text: Should the product owner ideally be as part of the product management team? How does one handle the internal stakeholding if the product owner is outside the product management team? We had problems since the product owner was not part of the product management team and there were lot of conflicts.


title: Does it make sense to generate java classes from class diagram?

text: As we do design & analysis before development, wouldn't be convenient to be able to generate Java classes from a class diagram?   This would promote more exhaustive design and better codes, right? It's strange that why Google returns tons of tools to generate class diagram from Java classes but not the other way around.


title: A pattern to "atomically" update a pair of objects

text: Is there a standard pattern in OOP to kind of "atomically" update a pair of objects, like a pair of bank accounts on a transaction? I would like to have somehow a single public method exposed that does it all at once, but can only come up with ways of doing it by making _two_ calls of public methods to update objects separately. I am currently experimenting with _Racket_ , but i would appreciate examples in any language, or a description of a standard pattern. * * * Here is an example of what i have experimented in _Ruby_ (with which i am more comfortable than with _Racket_ ). I am not concerned with locking here, just with class interface.               class Account       def initialize(total)         @total = total       end            def total         @total       end            def transfer_to(another, sum:)         change_total_by(-sum)         another.change_total_by(sum)       end            protected              def change_total_by(sum)           @total += sum         end          end          a = Account.new(10)     b = Account.new(20)     a.transfer_to(b, sum: 5)     print "New a.total = #{ a.total },\nnew b.total = #{ b.total }"      This works using `protected` instead of `private`.


title: Drawback of using static method

text: For methods that **never access instance variable or static variable** and they act just like a function (name-spaced) and they are deterministic base on only the input arguments , I want to ask, are there any consideration if I change all of them to static method? I keep hearing people saying it static method is poor, but I am looking for some real code example on my above case.


title: Operating systems theory -- using minimum number of semaphores

text: This situation is prone to deadlock of processes in an operating system and I'd like to solve it with the minimum of semaphores. Basically there are three cooperating processes that all read data from the same input device. Each process, when it gets the input device, must read two consecutive data. I want to use mutual exclusion to do this. Semaphores should be used to synchronize:               P1:                     P2:                     P3:     input(a1,a2)            input (b1,b2)           input(c1,c2)     Y=a1+c1                 W=b2+c2                 Z=a2+b1     Print (X)               X=Z-Y+W      The declaration and initialization that I think would work here are: `semaphore s=1` `sa1 = 0, sa2 = 0, sb1 = 0, sb2 = 0, sc1 = 0, sc2 = 0` I'm sure that any kernel programmers that happen on this can knock this out in a minute or 2. Diagram of cooperating Processes and one input device: ![enter image description here](http://i.stack.imgur.com/zQyu7.png) It seems like `P1` and `P2` would start something like: `wait(s)` `input (a1/b1, a2/b2)` `signal(s)`


title: Why SQL numeric precision is specified as the number of digits?

text: I understand that this might be a loaded question. For example, in Sql Server 2008, doing `DECLARE @someNum NUMERIC(10);` means that the range of the variable will be limited by 10 digits. In other languages such as C, Java, etc. the standards for representing whole and fractional numbers are different. The range of the values is being sliced by multiples of bytes, and this is understandable, due to the way hardware works. A language could provide something that most hardware does not yet support, such as a 256-bit integer type, which will work fast on a 64-bit computer, if it is implemented correctly. The numeric types in the databases seem to be not tied to underlying hardware. I understand that the values might need to be null-ablle, which can cost a bit or two, but why such arbitrary precision that does not seem to optimize storage or calculation speed? Perhaps databases do not need to perform numeric computations often. Perhaps digit width of a column is a natural extension of character width. Perhaps SQL was supposed to be a non-programmers language (because it sounds like English :) )? Perhaps history took a weird turn, such as one that allowed the inferior VHS format to prosper. Please help me understand this.


title: Transaction Design Pattern for MVC and location of responsibility?

text: I'm designing a pretty standard Spring MVC application, and I'm trying to figure out where the responsibility for transaction management should lie. I've been reading Java Transaction Design Strategies, and the one that I think best suits is the Server Delegate one, where the controller is what manages the transactions, and the services and DAOs are oblivious to the transactions. Somehow, this doesn't feel right. My gut feeling is that the services are the ones that should control the transactions, but I have cases where a controller may call several services to perform an action. How have you handled Transactions in MVC applications before, and where do you consider the best place for handling the transactions is?


title: uploading MS Access databases to the web

text: I found an easy system for uploading searchable MS Access databases to the web - it's called Caspio Online (http://www.caspio.com/). However, I would rather not pay a monthly fee just to upload databases to our website. Does anyone know of an open source alternative that will allow me to upload a MS Access 2007 Database to a website, and then build a web form that will search it? The easier the implementation, the better :)


title: What makes a good interview question for a junior applicant?

text: We had a debate a few days ago at work about some question we ask during interviews. We are in the on-going process of hiring "junior" C++ developers which is kind-of new to the company (we used to hire only experienced programmers, but those are hard to find in our geographical area). For more experienced applicants, we usually ask C++ questions, some code reading exercises and inheritance, cast, const-correctness, static questions. The goal being to check if the applicant has enough experience with the language (if somebody claims he has 6 years of experience with C++ but can't write a `const` getter, then something is wrong for instance). But for "junior" applicants, those kind of questions don't seem relevant: obviously junior people can't possibly know about all the features of a language, and it is expected of them that they will need some learning time. I thought of asking a question like: "Say you are a given a list of millions of integers. Write some function that computes the average of the numbers." Obviously the main goal of this question isn't to get a perfect solution but to see how the applicant think. First he should ask about the list:   * How are the numbers organized ?   * Are they sorted ?   * Where do the numbers come from ? A file ? Some network socket ?   * Do we know the count of items beforehand ? Then I expect him/her to raise several problems:   * The sum of the integers will likely overflow.   * Do we need an exact average or something close-enough will do ?   * What if the list is empty ?   * ...and so on. Obviously, if the applicant doesn't know what classes, functions to use I tell him/her: he/she could get that information on the Internet in a real situation anyway. Now, some of my coworkers think that is a terrible question because it is vague and open, claiming that "junior" applicants are stressed during interviews and can't think properly, making the test moot. I can see their point, but I still don't agree. So my questions are: is this kind of question acceptable for testing "junior" applicants ? What makes a good "junior" interview question ?


title: Who first coined the term Higher Order Function and/or First Class Citizen?

text: I've come to understand that long before Haskell, O'Caml or LISP, higher order functions were an academic research subject and in mathematics, Schönfinkel (in 1967) and Haskell Curry (in 1968) already applied techniques such as currying, but that was before it was available in any programming language. Scheme, according to Wikipedia, was the first language to introduce proper higher-order functions as first-class citizens, but is there anybody we can attribute the original idea to? Maybe Alonzo Church, who invented lambda calculus in the 1930's? More specifically, who coined the following definition, which I saw in various paraphrases around in several books and online resources? > A function is considered to be of higher order when it takes another > function as an argument or when it returns a function. Any function not > taking functions as arguments or as return types is called a first order > function.


title: Comparison of my own Insertion Sort versus the standard algorithm

text: I come from a background of making MVC websites and HTML5 applications, and have recently decided to dive into the sort of stuff i wasn't taught at university, namely the things most people would learn on a computer science course. I've been reading a book on algorithms, and the first one it mentions was the Insertion Sort. I didn't really understand it the first time, but I understood the goal, so I had a crack at coming up with my own solution before reading more into the proper solution to see how close I got. I got pretty close, and here is my function in C#:                   int[] SortNumbersTomsVersion(int[] numbersIn)         {             int[] output = new int[numbersIn.Count()];                  for (var i = 0; i < numbersIn.Count(); i++)              {                 int cardsLowerThan = 0;                      for (var n = 0; n < numbersIn.Count(); n++)                  {                     if (numbersIn[n] < numbersIn[i])                      {                         cardsLowerThan++;                     }                 }                 output[cardsLowerThan] = numbersIn[i];             }             return output;         }      The concept of it is that, i start off with a group of numbers. Then, for each number, I compare it to all of the other numbers in the array, to see how many others are lower in value. It then takes the resulting count, and places the current number into an output array at that index. The algorithm goes through all the numbers until they are all at the same location. My question is, _what makes the original better than my solution_? for reference, here is the accepted algorithm outside of a function:                   int temp, k;         for (int i = 1; i < array_size; i++)          {             temp = array[i];             k = i - 1;             while (k >= 0 && array[k] > temp)              {                 array[k + 1] = array[k];                 k--;             }             array[k + 1] = temp;         }


title: Fighting technical debt as the "lowest developer"?

text: Let's say you work for a company and what you do is develop software for them. You have no idea of the big picture or maybe slight. What you do have are tasks assigned to you via issue tracking system. You're given tasks, you make them work the way the task describes them, you send them back. Like adding 2 integers:               function add(a,b){return a + b;}      But later, as the project goes forward, you notice that as `add` becomes more complex, you realize that it should have needed some form of architecture, more than just a function that adds parameters and returns a value. However, you didn't know that. In the first place, all they needed was that simple `add`. You didn't expect add to become so complex. The project progresses with more features, which you didn't expect to have in the first place. And in the end, you keep piling up hacks and layer upon layer of functions to avoid breaking/rewriting the existing code. How do you deal with these situations? How do you fight technical debt as "the lowest developer"? **Clarification:**   * You're the "implementer", the lowest in the hierarchy.    * You see the problem, but have no say with the matter.   * I'm not quantifying technical debt or looking for tools.   * Regarding the third "duplicate"     * Refactoring & Rewrite - You are locked to your tasks. You are not paid to do extra.     * Architecture Overview - You know the overall system, but no idea of the architecture.     * Code Freeze - Not your call. You're not management.     * Modularization - No idea of architecture. Modules change as requirements change.     * Automated Tests - None exists.


title: How to deal with management staff (company owner) that downplays the impact of specs changes?

text: I work in a small web development company (3 programmers) for a while. During the last year the company had hard times (less projects) and a few co-workers were fired, including our Production Manager. Having this person out of our team mean to us that we have to deal more and more with the company bosses (owners). It's them who meet the clients and discuss about upcoming projects (custom web app for example) We had a meeting with the boss this week about a particular project for which he wants the specs to change (add a few features). I understand that in the real world specs **always** change during a project (I'm in this business for almost 10 years, I already figured that). What I am having hard time with is when the boss keeps trying to **minimize the complexity, the impacts of the new specs** because in his mind those changes are not that hard and should not take a lot more time (especially because he already signed a contract with our client for a fixed amount of money). With one programmer co-worker we joked about that, saying that it's not by adding two wings on a car that you will make plane, it has major impact on the whole design of the vehicle, time required is not the same, so is the same with software. Any idea how we should handle that kind of attitude from a boss? Is it possible to make him change his minding in that kind of situation ?


title: How do I constructively and professionally deal with anger when I'm on the job?

text: What do you do when something makes you angry while programming? I usually Slap the mouse Hard on my desk and go get a coffee or anything, just to calm down