title: Managing DLL files, deployment, and ease of use for the end user

text: I've been thinking recently about being an end-user who wishes to download one of my own projects and use it on a perfectly average machine. Having an equal background in Unix as well as Windows, I know that package management on Unix makes it FAR easier for the programmer to make it easy for the end-user. If a package is required, it's simply required, and all the required libraries are just there. However, it's a different story on Windows. I have a project that I store on GitHub that is basically a C++ GUI application to interface with the Wii Remote. Nothing much. However, early on, I separated some of my initial project into a separate library project, because I could foresee that it would be useful to do so. The end result of all this is that I have the actual application project on GitHub, which requires both some wxWidgets DLL files and the DLL from my separate library project, which in turn requires a boost DLL file (threading) and the wiiuse DLL file, none of which the normal user is going to have on their computer, much less their PATH. I could take ALL those DLL files, zip them up, and put them with the application, but I'd have to remember to replace my separate library DLL file whenever I did work on the library. Anyway, what is the common approach for dealing with this on Windows? Are there installer tools that can help me with the kind of issues described above?


title: How to deal with OOP design problems in interviews?

text: This is a question where I seek guidance from fellow/senior developers to get into my dream company - it's a pioneer in OOP and Agile. I've already failed once to clear an interview. One part I feel most challenging is to come up with a proper Object Oriented design(classes, interfaces, methods, interactions etc.) in a very short time for certain situations like Pacman, Game Of Life and so on. As the problems are unprecedented ones - my approach is mostly to try different things and then make decisions - which they feel is not clear and not what they expect from a developer with 5+ years of experience. I've already studied a few books on patterns, OOP - it didn't help me much and I think it'll take a bit more than that. Could some one please guide on what specifically shall I practice so that I can do better at design problems as above. I want to refine my approach and have a better thought process.


title: ASP.NET vs ASP.NET MVC

text: I just started learning the ASP.NET MVC framework and it's very different in architecture from regular ASP.NET development. Transitioning from windows forms to WPF was nice, and seemed a way forward in technology. But, while learning ASP.NET MVC, I don't feel the same, I am unable to convince myself that MVC is better than WebForms. It just seems that they made some tweaks to the already available web framework and adopted the MVC architecture from some other language. Is ASP.NET MVC the step ahead in development? Should I learn and develop my future projects based on this platform and architecture? To me, it just seems like Microsoft is throwing a new architecture just along with WPF or copying Ruby on Rails. WPF seems promising and great while ASP.NET MVC just makes you crumb-some _[sic]_. They have removed the controls, thrown a new control system and data-packaging, and it's all together an extreme change to WebForms. I realize that with MVC you have great freedom in the testing aspect, but I don't believe that this makes a lot of difference in small website or projects. If you ignore the value of testing, What are your takes on this?


title: Why is C++ still "hybrid"

text: On a related question, it has been clarified why C++ is not compatible with C in many aspects. However C++ is still a "hybrid"* language. And unfortunately, many programmers still consider C++ as a "C with streams and built-in strings". That results in really bad written code, that it's neither C++ nor C. IMHO, it would be better if the language/compiler forced to some extent programmers to write more elegant code. So is there a rationale for keeping modern C++ (for instance C++0x and future versions) hybrid? * By hybrid I mean that it's up to the programmer to decide if he/she will use: standard strings and streams, classes, namespaces other than the default, etc.


title: PHP Cache Strategy - Genius or Sheer Stupidity?

text: I have a shared hosting with limited capabilities. Memcache and mod_cache are not available to me. I would like to implement my own PHP caching method to cache the results of load-intensive SQL query. Using summary tables in SQL is not an option because the query takes multiple parameters that can assume thousands of different values (it's a statistical system). My idea is like this               function execQuery($parameter)     {          $query = "SELECT ....... " . $parameter; //query code has been generated               $rand = mt_rand(0,10);           //no need to check/save expiry dates,generate cache randomly for speed               if($rand == 0)          {                //execute query normally and generate new cache                $result = mysql_query($query);                $md5 = md5($query); // the name of the cache file equals the md5 of the query                $cache_file = fopen("/cache/" . $md5 ."php", "w");                fwrite($cache_file, $result); // the result is written as php code generating a ready for use result array, code has to be modified I think                //return the result          }          else          {                 //cache will be used                 $md5 = md5($query);                 if(file_exists("/cache/" . $md5 ."php"))                 {                       include("/cache/" . $md5 ."php");                       return $result;                 }                 else                {                       //no cache exists, run query normally and generate cache                }          }        }      What do you think of this and what are the possible pitfalls? What are the implications of using mt_rand, md5? Do you think they will out-perform a load- intensive query? Are the multiple system file writes worth it (only one write for every 10 hits and can be even increased)? Improvements and suggestions are highly welcomed.


title: Best organisation for a team application

text: I'm developing an application based on this structure :               /Root     /--- Index.php     /--- /includes/     /--- /modules/     /-------- /Mod1/     /-------- /Mod2/     /-------- /ModN/      In the future, 2 developers will participate in the project.   1. I have to restrict the access for the developers. They shouldn't get access for the "/includes/" folder. It contains the system's Core. They just will have to code modules.   2. I Will use Mercurial. What is the best "organisation" (repository, lock, permissions...) for this kind of project. A need advices. Thank you :)


title: Does one's native spoken language affect quality of code?

text: There is a school of thought in linguistics that problem solving is very much tied to the syntax, semantics, grammar, and flexibility of one's own native spoken language. Working with various international development teams, I can clearly see a mental culture (if you will) in the codebase. Programming language aside, the German coding is quite different from my colleagues in India. As well, code is distinctly different in Middle America as it is in Coastal America (actually, IBM noticed this years ago). Do you notice with your international colleagues (from ANY country) that coding style and problem solving are in-line with native tongues?


title: Tools to support learning a new business domain

text: Suppose you just accepted a job, writing code in an industry sector that you've never worked in before. To be effective, you want to immerse yourself in the business domain - to understand the vocabulary, issues and people you'll be working with. Obviously the first step is to find good mentors and reading material to begin to get acquainted with the domain. After that, how do you "learn" the business? What tools, techniques and resources do you use? For instance, is a wiki a good way to capture the domain language?


title: Why applications don't have constraint-based security?

text: In almost any security system I've ever seen, what is controlled is that **which person has access to which part**. However, in real life, in many situations, security systems also consider **when** and **where** a person is permitted to do something. For example, **you can drive fast in day** , but **you can't drive fast in night** , or **you can marry a homosexual officially in X** , but **you can't marry the same gender in Y**. Does constraint-based security has any meaning in the context of software. For example, a system can prevent you from entering in certain times of the day (after work for example), or another system can let you stay signed in, only if you type fast enough, or another system can let you enter data, only if you are currently located in the USA (Geolocation API), etc. Why computer security systems don't match real life scenarios?


title: Terminology question: Generalize Heisenbug

text: Is there some kind of generalization to the effect called Heisenbug? Because I would like to describe in my documentation how instrumenting a program changes the execution no matter what. In The New Hacker's Dictionary it is defined as following: > **heisenbug** /hi:'zen-buhg/ /n./ [from Heisenberg's Uncertainty Principle > in quantum physics] > > **A bug that disappears or alters its behavior when one attempts to probe or > isolate it.** (This usage is not even particularly fanciful; the use of a > debugger sometimes alters a program's operating environment significantly > enough that buggy code, such as that which relies on the values of > uninitialized memory, behaves quite differently.) Antonym of Bohr bug; see > also mandelbug, schroedinbug. In C, nine out of ten heisenbugs result from > uninitialized auto variables, fandango on core phenomena (esp. lossage > related to corruption of the malloc arena) or errors that smash the stack. Actually this is a general problem, when trying to observe the programs state by instrumentatation (tracing, debugging, etc.) the program execution is changed no matter what. But the definition for Heisenbug clearly says, it is a bug which is masked due to debugging and which disappears. What about bugs, which appear due to debugging - there is no word for that. Is there some kind of generalization, like _Heisenbug principle_?


title: What is the biggest obstacle ASP.NET MVC ever had for you? Why and how it can be fixed?

text: What aspects of ASP.NET MVC can be considered bad practices of Microsoft or problematic? In ASP.NET web forms, thing like ViewState, Automatically generated Id and names, single form usage and pattern like this are many times problematic. As no claim should be reason-less, so, it's better to mention why that aspect is an obstacle. Also finding any problem intrinsically means that we like to solve it. Therefore, Please also recommend ways to solve that issue.


title: Is it legal to show thumbnails on my site of photos that aren't mine?

text: I would like build an web-application that has thumbnails (around 100x100) of photos. These thumbnails will be linked to the original site (the copyright holder). Is this something that is legal to do? E.g this will be similar to Google Image Search.


title: JavaScript - Why do frameworks bind to $()

text: Disclaimer: I know there is no strictly correct answer to this, but I've come across something that does not make sense to me, and I'd like to try to understand it better by seeing what other people have to say on the subject. Anyways, I was thinking about how many different JavaScript frameworks all define slightly different variations of a `$()` function (and also things like `$$()`, `$E()`, and so on), and was wondering why they do it. This is basically what I came up with: **Pros**   * Typing `$()` is fast. **Cons**   * The name `$` does not imply anything semantically meaningful by itself.   * `$` is a property in the global namespace, and thus can only be claimed by a single framework at any given time.   * Having multiple frameworks competing over the same global name(s) makes them less easily compatible with each other.   * Older code that uses the `$()` function defined in one framework can be accidentally broken by simply importing a second framework that provides its own version of `$()`.   * With everybody providing a different version of `$()`, code becomes less readable because one cannot make assumptions about what `$()` is doing without knowing what framework is in use.   * Sometimes novice developers get the wrong idea from all the dollar signs flying around, and think that they need to prefix all their function declarations with "$". So it seems to me that the cons far outweigh the pros. Which begs the question, if there are so many negatives associated with claiming `$()` as one's own, why do many frameworks do this automatically? Are there some other benefits that I am missing?


title: C++ Linkage Languages other than C?

text: The C++ language allows intermixing of both C++ and C in one source file. For example,               extern "C" {         struct bar { /* ... */ }     }      Does C++ or has it ever supported any other "linkage languages" other than C? e.g. `extern "Pascal"` or `extern "Haskell"`


title: Do ASP.Net Web Forms actually produce ADA compliant HTML? Does the ASP/AJAX toolkit undermine the goal of ADA compliance?

text: I'm trying to convince my employer to let us use the Microsoft ASP/AJAX toolkit since it simplifies the implementation of many controls. However they have rejected the idea on the grounds that it produces "AJAX code" which is not ADA compliant. However the same employer requires webpages to be written in ASP.NET Web Forms which, as far as I can tell from the source, is very very far from ADA compliance. I am new to both web programming and ADA compliance. My questions are:   1. Do ASP.Net Web Forms actually produce ADA compliant HTML?   2. Will the ASP/AJAX toolkit undermine the goal of ADA compliance?


title: Data Oriented Design - impractical with more than 1-2 structure "members"?

text: The usual example of Data Oriented Design is with the Ball structure:               struct Ball     {       float Radius;       float XYZ[3];     };      and then they make some algorithm that iterates a `std::vector<Ball>` vector. Then they give you the same thing, but implemented in Data Oriented Design:               struct Balls     {       std::vector<float> Radiuses;       std::vector<XYZ[3]> XYZs;     };      Which is good and all if you're going to iterate trough all radiuses first, then all positions and so on. However, how do you move the balls in the vector? In the original version, if you have a `std::vector<Ball> BallsAll`, you can just move any `BallsAll[x]` to any `BallsAll[y]`. However to do that for the Data Oriented version, you must do the same thing for every property (2 times in the case of Ball - radius and position). But it gets worse if you have a lot more properties. You'll have to keep an index for each "ball" and when you try to move it around, you have to do the move in every vector of properties. Doesn't that kill any performance benefit of Data Oriented Design?


title: Why don't more companies hire remotely?

text: I keep hearing about the desperate recruiting efforts of companies in tech hubs such as SF and NYC. However, every time I'm contacted by a startup I'm told the position is on-site and working remotely isn't possible. Let me clarify that these are tech startups. They should be very comfortable with the idea of using technology to get things done and connect teams together. With the housing market the way it is, many of us can't relocate even if we wanted to pay the higher cost of living. Why are so many companies still stuck in the industrial mindset of butts in seats?


title: Handling fast growing multi-function services

text: My team has been developing a web business application for more than a year. It started quite small, but now it is growing bigger and bigger. I think it's time for refactoring. Looking at the code, I see the below situation: IUserService   * addUser   * deleteUser   * updateUser   * addMember   * deleteMember   * updateMember   * registerMember   * deactivateMember    ....   * getExpiringMember   * nominateMember Generally saying, there are about 50 functions for more than 2500 lines of business logic. I once read "Clean code", it states that there should be no more than 200 lines for a normal class. Our code violates this requirement seriously, and I'm beginning to feel the hardship of code management. The simple solution might be spliting this service into many other services, but it is not feasible/reasonable:   1. This service class serves as an API point for mobile client, so that every change on Interface (even renaming) requires change for the client as well. I don't want to spend the precious time of our team if not for good reason.   2. I already split a part of this service into another classes, but that class (RegistrationService) also grow quite fast and reach 500 lines of code recently.   3. More and more business logic request recently, and these services are going to grow even more. I'm afraid that at some point we will lose the tracks if a team member who manage a specified service got retired. Is there any way I can make this service more manageable? Any Design Pattern, Refactoring technique that I can apply? I'm still not experienced enough in this field... any suggestions or directions are welcome.


title: Good resources for advanced C++ topics?

text: What are some good resources for advanced C++ topics. I know C++, but have little knowledge of threading, advanced meta-programming and inner-workings of meta-programming and I'd like to get better.


title: Are chained methods that require only one parameter per method equivalent to currying?

text: I've been toying around with Ruby lately and I found myself wondering if in pure object oriented languages (and even those that are not pure) making methods that take only one parameter and then get chained together is equivalent to currying in languages with a functional style? If not, why not? I'd appreciate a detailed, even rigorous answer on the subject.


title: Does programming in general become easier to read, write and understand as you gain experience?

text: I'm a beginner in programming and I've been reading books, studying, reading articles, and whatnot. I'm getting great results since I've started learning programming, and when I was a beginner I used to think I knew everything about programming, but as I learned more I realized how difficult this field is (In fact all fields are difficult, but that's not the point). Nowadays, I've written functional software and I've learned the BASICS of 3 languages and I'm intermediate in just one language. When I look at advanced things like MYSQL, or OpenGL programming, or even visual studio C++ code it gives me headaches, and even when visualising HTML source code of many websites (Most source codes on websites, seen by google chrome seem very messy and unorganized) it makes me confused to the very limit of my brain. It all seems simple at first, yet when looking at these advanced things it just makes me wonder how can one learn so much. The question, in a nutshell, is if these things become clearer to a programmer as he advances in his career. Do complicated topics as the ones listed above (OpenGL, MySQL, advanced html sites) become easier to read, write and understand as you learn more, or does it just get more complicated as you go by? How can you combat this feeling that you're an ant in the programming world and this stuff is the foot about to squash you?


title: Is it a good approach to rely on 3rd party software ( not library )?

text: We have program( written in VB ) using a call to a winzip program or 7zip command line tool to zip some files. Once I accidentally uninstall the winzip on my computer and making one of our program( created by the programmer already left ) crashed. So we cannot uninstall the winzip program. Now we am writing another program with java + windows batch file. And I've come to a point which I need to make a decision between 1) using a call to external tool ( for example 7z ) for gzip in windows batch file, 2) or I make a java program to gzip the file. Obviously a external tool such as 7z is convenient and we can avoid some extra coding with java. On the contrary, if 7z is uninstalled accidentally, our program will crash. What do you think?


title: When business rules affect presentation in MVC

text: The MVC design pattern is supposed to led itself to separating business rules from presentation. But sometimes business rules AFFECT presentation. What is the best way to deal with this? Is that when a ViewModel should be used? For example, going back to my non-existent Library application, a librarian is scanning returned books. The system indicates that a book is late, and applies a fine to that patron. Certain employees may have security to override that fine based on certain conditions. The presentation layer of my library application will need to let the employee set the fine to 0, or click a button to override the fine. But employees who do NOT have security to do this should see the fee as either a disabled input or maybe read only. _Note that security may not be the only business rule_. This is just an example. For example, my application may have configuration information set up somewhere that causes a field on a screen to become unnecessary, etc. While the code could just let anyone change the fine and then show a validation message, that's not a good user experience. What is a good practice to accomplish this? The options I can think of (using ASP.NET MVC) are:   1. Have the view itself check the business rule and disable or enable the field.   2. Use a HTMLHelper function that implements the presentation for the fine field, and have that helper function check the business rule.   3. Have the controller check the business rule and use a different view.   4. Have the controller check the business rule and set a property in the ViewBag that indicates whether the field is enabled.   5. Use a ViewModel checks the business rule and set information indicating that the field is enabled. Options 1 & 2 cause the presentation layer to have to do business rule validation, and that muddles things. Option 3 will cause duplication of effort in that now you have two views defined. Option 4 & 5 requires the presentation layer to know that the field COULD be enabled or disabled, but not WHY. I think I like 4 or 5 best. Our there other options I'm not thinking of?


title: What is the starting point for Ubuntu app development?

text: I'm thinking of developing software for Ubuntu and other related Linux-based distros (like Linux Mint). But currently am at a loss for where to start. Would learning Python be enough/good? And what are the other things I should know about before starting this kind of developing? And will I be able to publish my apps to a software store like Ubuntu store even if I am from outside USA/UK? If not, what are the options I have to make my apps reach the audience? * * * As a lot of users had asked, I intend to build applications only for Linux (I'm thinking of Gnome) that will be a bit business and enterprise oriented. Currently I am an Oracle certified Java developer in J2SE and J2ME. And I know Python a bit.


title: Apply for supercomputing time

text: For testing and running some very intensive C++ number crunching applications, we need to apply for supercomputing time. I would like to get feedback and opinions from you; which calls do you follow, which supercomputing centers do you apply to, etc. As of now I only know DEISA in Europe.


title: Resumes: Open-Source Projects, Reinventing the Wheel?

text: When writing a resume, should I be concerned that certain open source projects I've created might be a hindrance to me because they would be perceived as reinventing the wheel? I've created a few open source libraries that might be perceived as such by hiring managers, because there are much more established tools that perform similar tasks. I have my reasons for wanting to start from scratch, but they're virtually impossible to explain on a resume and might be mildly controversial among techies. Basically, these libraries are written in D, and there was no D library that did what I wanted. I felt that creating bindings to libraries in another language instead of starting from scratch would constrain my ability to take advantage of D-specific features too much and make the libraries too brittle and hard to get up and running. On the other hand, these projects are related to the domain I'm applying for and would be a good way to show my domain knowledge. Should I put them on my resume or leave them off?


title: Is it safe to display information about old passwords on login failure?

text: When I changed my Facebook password yesterday, by mistake I entered the old one and got this: ![Screen capture of facebook login](http://i.stack.imgur.com/T1M59.png) Am I missing something here or this is a big potencial risk for users. In my opinion this is a problem BECAUSE it is FaceBook and is used by, well, everyone and the latest statistics show that 76.3% of the users are idiots [source:me], that is more that 3/4!! All kidding aside:   * Isn't this useful information for an attacker?   * It reveals private information about the user!   * It could help the attacker gain access to another site in which the user used the same password      * Granted, you should't use use the same password twice (but remember: 76.3%!!!)   * Doesn't this simply increase the surface area for attackers?   * It increases the chances of getting useful information at least.   * In a site like Facebook 1st choice for hackers and (bad) people interested in valued personal information shouldn't anything increasing the chance of a vulnerability be removed? Am I missing something? Am I being paranoid? Will 76.3% of the accounts will be hacked after this post?


title: How to tell your boss that his programming style is really bad?

text: I'm a student and in my spare time I'm working for a big enterprise as Java developer. The job is good, but the problem is, my boss writes very strange code. I don't want to complain, but some issues are in my opinion really strange. For example:   * he doesn't know any booleans. All boolean conditions are Strings called "YesOrNo" and then in the condition he uses if (YesOrNo == "Yes")   * there are a lot of very strange characters in method names and variables like é õ ô or è   * all loops are infinite loops in the style of for(;;). Then at the end of the loop the condition is tested and if the conditions is fulfilled break; is called. I don't know if I should tell him that I think this isn't a good practice, since he is my boss and decides how and what to do. On the other hand some of his examples are really very weird. Any hints how to cope with? And is this only me who thinks that's bad style?


title: What benefits are there to native JavaScript development?

text: Given how much simpler jQuery development is, when compared to native JavaScript, what makes people forgo libraries like jQuery altogether? Is this because jQuery has limitations or it is slow? I mean, if jQuery is so easy compared to native javascript, what reasons do people have to still use pure javascript?


title: With PHP frameworks, why is the "route" concept used?

text: The reason I ask this is because isn't a PHP script a route? For example, if you have an article.php then your route is simply http://mysite.com/article.php. Why further abstract away the concept of a route when it already exists as a simple file?


title: Why is scanf called scanf? (Same for printf.)

text: I am just curious why in the C programming language the function to read formatted input was called "scanf" as opposed to "readf". I assume it is derived from an earlier language, so in that case why was it named that way in the earlier language? (Recurse.) Also, why "printf" rather than "writef"? In languages other than C, why "print" or "write" rather than "display"?


title: what's a good approach to working with multiple databases?

text: I'm working on a project that has its own database call it InternalDb, but also it queries two other databases, call them ExternalDb1 and ExternalDb2. Both ExternalDb1 and ExternalDb2 are actually required by a few other projects. I'm wondering what the best approach for dealing with this is? Currently, I've just created a project for each of these external databases and then generated Edmx and entities using the entity-framework approach. My thought was that I could then include these projects in any of my solutions that require access to these databases. Also, I don't have any separate business layers. I just have a solution like below:               Project.Domain     ExternalDb1Project.Domain     ExternalDb2Project.Domain     Project.Web      So my Domain projects contain the data access as well as the POCOs generated by Entity Framework and any business logic. But I'm not sure if this is a good approach. For example if I want to do Validation in my Project.Domain on the entities in the InternalDb, it's fine. But if I want to do Validation for entities from either of the ExternalDbs, then I wonder where it should go? To be more specific, I retrieve Employees from ExternalDb1Project.Domain. However, I want to make sure they are Active. Where should this Validation go? How to architect a project like this at a high level? Also, I want to make sure that I use IoC for my data contexts so I can create Fakes when writing tests. I wonder where the interfaces for these various data contexts would reside?


title: Minimizing data sent over a webservice call on expensive connection

text: I am working on a system that has many remote laptops all connected to the internet through cellular data connections. The application will synchronize periodically to a central database. The problem is, due to factors outside our control, the cost to move data across the cellular networks are spectacularly expensive. Currently the we are sending a compressed XML file across the wire where it is being processed and various things are done with (mainly stuffing it into a database). My first couple of thoughts were to convert that XML doc to json, just prior to transmission and convert back to XML just after receipt on the other end, and get some extra compression for free without changing much. Another thought was to test various other compression algorithms to determine the smallest one possible. Although, I am not entirely sure how much difference json vs xml would make once it is compressed. I thought that their must be resources available that address this problem from an information theory perspective. Does anyone know of any such resources or suggestions on what direction to go in. This developed on the MS .net stack on windows for reference.


title: How can I extract words from a sentence and determine what part of speech each is?

text: I want to write something that takes a sentence and identifies each word it contains and defines what part of speech each word is. For example > Hello World, I am a sentence would return this               verb noun, pronoun verb adjective noun      Ideally, I'd like to eventually take it one step further and take a sentence and programmatically have it understand what it is trying to interpret and maybe do something about it. So my question is, has someone heard of something like this?


title: Which data structure for representing possible navigations between a game's screens?

text: I am trying to find an appropriate data structure for representing available navigations between a game's screens.   * Using a _linked list_ , a node can only have one node after it : inappropriate.   * Using a _tree_ seems up to the job as nodes can have many children nodes but it's inconsistent in the sense that a supposedly children item _Options_ can have a parent _Title_ as a children. Also how am I supposed to represent the infinite sequence of the case _Title -> Race -> Title -> Race ..._ without endlessly repeating it in my tree ? Still, this is the best structure I found to accomplish the job. Here is an example of the possible sequences :   1. Title      * Options     * Race   2. Options      * Title     * Race   3. Race      * Options     * Title Do you know whether a _tree_ is the way to go or if there's a better structure for this job ? * * * **Edit:** There is a great library for creating graphs for C#/WPF : http://graphsharp.codeplex.com/ It uses http://quickgraph.codeplex.com/ internally. Here's a small example : ![enter image description here](http://i.stack.imgur.com/jsYew.png) Code-behind:               using System.Collections.Generic;     using System.Windows;     using GraphSharp.Controls;     using QuickGraph;          namespace WpfApplication15graph     {         internal class ScreenVertex         {             public string Hello { get; set; }         }              internal class ScreenEdge : Edge<ScreenVertex>         {             public ScreenEdge(ScreenVertex source, ScreenVertex target)                 : base(source, target)             {             }         }              internal class ScreenLayout : GraphLayout<ScreenVertex, ScreenEdge, ScreenGraph>         {         }              internal class ScreenGraph : BidirectionalGraph<ScreenVertex, ScreenEdge>         {         }              public partial class MainWindow : Window         {             public MainWindow()             {                 InitializeComponent();                 Loaded += MainWindow_Loaded;             }                  private void MainWindow_Loaded(object sender, RoutedEventArgs e)             {                 // build graph                 var screenGraph = new ScreenGraph();                 var screenVertex1 = new ScreenVertex {Hello = "1"};                 var screenVertex2 = new ScreenVertex {Hello = "2"};                 var screenVertex3 = new ScreenVertex {Hello = "3"};                 screenGraph.AddVertex(screenVertex1);                 screenGraph.AddVertex(screenVertex2);                 screenGraph.AddVertex(screenVertex3);                 screenGraph.AddEdge(new ScreenEdge(screenVertex1, screenVertex2));                 screenGraph.AddEdge(new ScreenEdge(screenVertex2, screenVertex1));                 screenGraph.AddEdge(new ScreenEdge(screenVertex1, screenVertex3));                 screenGraph.AddEdge(new ScreenEdge(screenVertex3, screenVertex1));                 screenGraph.AddEdge(new ScreenEdge(screenVertex3, screenVertex2));                 ScreenLayout.Graph = screenGraph;                      // get connections for a particular vertex                 IEnumerable<ScreenEdge> inEdges = screenGraph.InEdges(screenVertex3);                 IEnumerable<ScreenEdge> outEdges = screenGraph.OutEdges(screenVertex3);             }         }     }      XAML :               <Window x:Class="WpfApplication15graph.MainWindow"             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"             xmlns:controls="clr-namespace:WPFExtensions.Controls;assembly=WPFExtensions"             xmlns:controls1="clr-namespace:GraphSharp.Controls;assembly=GraphSharp.Controls"             xmlns:wpfApplication15Graph="clr-namespace:WpfApplication15graph"             Title="MainWindow"             Width="525"             Height="350">         <Window.Resources>             <DataTemplate x:Key="SvTemplate" DataType="wpfApplication15Graph:ScreenVertex">                 <Grid>                     <TextBlock Text="{Binding Hello}" />                 </Grid>             </DataTemplate>             <Style TargetType="controls1:VertexControl">                 <Style.Setters>                     <Setter Property="Template">                         <Setter.Value>                             <ControlTemplate TargetType="controls1:VertexControl">                                 <Border CornerRadius="5" Width="50" Height="50" Background="LightBlue">                                     <ContentPresenter Content="{TemplateBinding Vertex}"                                                       ContentTemplate="{DynamicResource SvTemplate}" />                                 </Border>                             </ControlTemplate>                         </Setter.Value>                     </Setter>                 </Style.Setters>             </Style>         </Window.Resources>         <Grid>             <controls:ZoomControl>                 <wpfApplication15Graph:ScreenLayout x:Name="ScreenLayout"                                                     HighlightAlgorithmType="Simple"                                                     LayoutAlgorithmType="Circular"                                                     OverlapRemovalAlgorithmType="FSA" />             </controls:ZoomControl>         </Grid>     </Window>


title: How can I get better at explaining complex software processes to developers?

text: I'm really struggling with my software specs. I am not a professional programmer but enjoy doing it for fun and made some software that I want to sell later but I'm not happy with the code quality. So I wanted to hire a real developer to rewrite my software in a more professional way so it will be maintainable by other developers in the future. I read and found some sample specs and made my own by applying their structure to my document and wanted to get my developer friend to read it and give me advice. After an hour and a half he understood exactly what I was trying to do and how I did it(my algorithms,stack,etc.). **How can I get better at explaining things to developers?** I add many details and explanations for everything(including working code) but I'm unsure the best way I can learn to pass detailed domain knowledge(my software applies big data, machine learning, graph theory to finance). My end goal is to get them to understand as much as possible from the document and then ask anything they do not understand, but right now it seems they need to extract alot of information from me. How can I get better at communicating domain knowledge to developers?


title: RESTful applications logic and cross resource operations

text: I have an RESTful api that allows my users to receive enquiries about their business e.g. 'I would like to book service x on date y. Is this available?'. The api saves this information as a resource to the following URI               users/{userId}/enquiries/{enquiryId}      The information shown when this resource is retrieved are the standard sort of things you'd expect from an enquiry - email, first_name, last_name, address, message The api also allows customers to be created for a user. The customer has a login and password and also a profile. The following URIs expose these two resources               PUT users/{userId}/customers/{customerId}     PUT users/{userId}/customers/{customerId}/profile      The problem I am having is that I would like to have the ability to allow users to create a customer from an enquiry. For example, the user is able to offer their service on the date requested and will then want to setup a customer with login details etc to allow them to manage the rest of the process. The obvious answer would be to use a URI like                users/{userId}/enquiries/{enquiryId}/convert-to-client      The problem with this is is that it somewhat goes against a lot of what I've been reading about how to implement REST (specifically from the book Restful Web Services which suggests that URIs should point to resources not operations on resources). The other option would be to get the client application (i.e. the code that calls the api) to handle some of this application logic. This doesn't quite feel right to me. I have implemented in my design that the client app is fairly dumb. It knows just enough to display the results from the API, and does not contain any application logic. Would be great to hear what others views are on the best way of setting this up Am I wrong to have no application logic in the client app? How would I perform this operation purely in the REST api?


title: Is sticking to one language on a particular project a good practice?

text: I'm developing a pipeline for processing text that will go into production. The question I keep asking myself is: should I stick to one language for the project when I'm looking for a tool to do a particular task (e.g. NLTK, PDFMiner, CLD, CRFsuite, etc.)? Or is it OK to mix and match languages on the project? So I pick the best tool regardless of what language it's written in (e.g. OpenNLP, ParsCit, poppler, CFR++, etc.) and warp (wrap) my code around it? Note, I am _not_ asking about should a developer stick to just one language for their career.


title: WPF - What are the implications of the current rumours

text: My personal experience has always been with web applications and lots of "back-end stuff" but recently I've been poking around for some personal projects to widen my knowledge. An obvious thing to look at as I'm in the .net world is WPF but now I read this: WPF has no product manager And from the same guy's blog (he is a former Silverlight Product Manager): > WPF has no investment, it’s kept together by a skeleton crew and its > evangelism / community efforts have little to no funding attached to it. > It’s dead, the question now is how is the corpse going to be buried and no > amount of cheer leading will change that outcome in the near future. Although it won't change my short term plans - should this affect the amount of effort I put into learning WPF? What are my alternatives to look at if I want some up-to-date winapp gui knowledge?


title: When do we need assembly language?

text: In what kind of situations, assembly language will be the only solution?


title: shortening url to cms

text: Hi We have a CMS application that lets people create websites under our domain. The system was built a few years ago and it used a method that transfers parameters such as website id, folder code and more using the url. this method created a giant url for every item in the website For example: My domain is www.domain.com   A users website on my domain is www.domain.com/user   and every time that a user enters his website he gets a link like this www.domain.com/page.aspx?code=blablasdsdsdsdsds&folder=blablablablablabla and more. We are trying to reduce the string size in the url. What are our options? can we show the user one url like a virtual one and still work the same with the old url? We are trying to locate a solution that wont make us rewrite our entire application. the application is built in c# and the web server is iis 6. Thanks


title: How to use data shaped by the UI from the ViewModel while keeping concerns separated?

text: I'm coming from a winforms background and trying to get ahold of MVVM and XAML. Right now I'm wondering how I can take advantage from a data-shaping control (either native or provided by a third party) while maintaining separation of concerns intact. An example: I have a typical third party grid that comes with data grouping, sorting and filtering functionalities. I want the end user to be able to use these features so that he can get a custom set of data on which he can perform actions. These actions are exposed by the view model. Of course it knows about the record collection but it has absolutely no clue about how it is currently displayed in the UI. Given that, how can the view model know on which data actions should be performed, **without knowing about the control in which it is displayed**? Right now the only way I can think of is exposing an additional property in the ViewModel (something like `CurrentUIData`) and handling every single data- shaping events within the View so that the property is always representative of the UI state. This, however, feels kind of wrong to me. Is this how I should proceed, or am I missing something here?


title: Learning C for C++ programmers

text: That's right, I learned to program in C++, and of course know the common set of features of both languages, so I can program in C.   But I'd really like to read tutorials or books that teach you C, and _the C way_ of programming, from a C++ programmer's perspective.


title: How to deal with a 'public' work environment?

text: In the last 6 months, I have changed desks at my office 4 times. I don't mind, as it's due to expansion of the company and acquiring new office space and getting everybody settled. However, I truly miss the semi-private office I sat in 2 desks ago. I am now sitting in a large room with a number of other people. My problem with this isn't with my co-workers; everybody here is great. My problem is that based on the configuration of the room, no matter which desk I sit in, my monitors WILL be facing an open window. This causes a glare on my monitors, and it drives me crazy. I prefer a dark IDE theme as I find it easier on the eyes, however this just makes the glare that much worse. How should programmers cope with public office settings? Secondly, how should I cope with my specific problem? Should I give in and adopt a light IDE theme that will reduce the visibility of the glare but increase eye strain, or should I stick to my guns and find another solution?


title: How do you measure the value of your software?

text: One of the principles of agile is that you should measure working software: > Working software is the primary measure of progress - 12 principles of Agile The thing is, while I can measure my software in terms of stories done, bugs squashed or the volume of defect reports decreasing, I'm stuck on how to measure the value of my software. If I use Mike Cohn as an example and his helping SalesForce.com deliver 500% more value to it's customers compared to the previous year* - how do I measure that increase? How do I measure where I am right now? Other metrics he uses are the number of features and the number of features per developer. This is something I could work out if my backlog was in good order and the stories were cut up by 'feature', but we're just starting out with Agile, so I need some way of working out what the value is we deliver now, then use a similar metric in say, six months, to see if we've increased our output. I've heard about measuring value of software by an uptick in revenue, or an increase in customer satisfaction (how would you measure that though?) but those increases could be attributed to anything in the company (sales, accounting, support) and not directly to the work my department is doing. So, how do you guys measure the value of your software and how did you start? * Succeeding With Agile \- Mike Cohn


title: Book recommendations for a high school drop out

text: If one of your friend dropped of high-school and wanted to sharpen his programming & software engineering skills which book would you advise him to read & study to make up for the knowledge he could have gained from a top US Computer Sciences University. All type of books are welcomed : Algorithms, Data Structures, Compiler Design, languages, design patterns, Machine Language, Maths (absolute minimum required for Sofware Engineers), Problem Solving, General Engineering book that can be of some help for SE ...


title: Best Practice for Argument Checking

text: Say I have a web service with a method `MyWebServiceMethod(string passedValue)`. The web service calls a method `MyServiceMethod(string passedValue)` where the value from the web service is passed along. The service calls a repository method `MyRepositoryMethod(string passedValue)` where again, the value from the service is passed along. I hope that is clear enough. I can post code if need be. **My question is around null argument checking.** Should I check `passedValue` and throw an exception in:   1. The Web Service   2. The Service   3. The Repository Obviously, if `passedValue` is null in the web service, the following methods will never get invoked but should I check in case the solution changes in the future? Edit I should have said that I don't expect null to ever be a valid value. Also, My worry in these situations is that someone may change the web service or create another client with no argument checking that will call the service with invalid arguments. So I tend to think the checking should be in both places. Then I think of YAGNI and wonder if we should cross that bridge when we come to it. What is considered best practice in these situations?


title: Can the Jacquard loom be considered stateless?

text: Can the Jacquard loom, pictured below complete with its chains of paper cards ![Jacquard loom](http://i.stack.imgur.com/zyqKB.jpg) be considered stateless? As far as I can tell I can tell, each operation is not dependant on the previous. Or did it have any concept of branching and/or looping?


title: Ideas for Offline & Sync Across Multiple Platforms

text: I'm looking for some implementation ideas to be able to have offline apps sync data to a central server. The server will be Sql Server 2008. The clients will download data from the server when internet access is available and will need to allow the user to make changes offline and then sync the changes back to the server when it becomes available again. The clients will come in multiple flavors ranging from Windows to Android, so whatever I use needs to be easily translated into multiple OSes. I have been looking at using Microsoft's Odata (odata.org) on the server. It looks to have some pretty neat features and appears to even partially support what I want (by means of a concurrency token) -- though I'm not sure how the logic would revolve around the use of this token yet, that's what I hope to get from this. So - my question is this: Is there a 3rd party tool or app that I can use on multiple platforms which can handle offline & sync scenarios? If not, can anyone provide me with ideas on how to implement logic for syncing data back to a server and handle things like conflicts, etc.?


title: Is there any use for a smart algorithm developer who will delegate the coding?

text: In my job as an algorithms developer, I am responsible not only for developing algorithms, but also for implementing them, all the way down to writing the code that goes into production. I've heard that there are companies where there is a separation between algorithms development and implementation. The algorithm people come up with the "concept", and don't write any code except for research purposes. Then there are programmers in charge of implementing the algorithms. At my company there are thoughts recently of hiring designated algorithm developers who will not write code, as described above. I am intuitively opposed to that idea, but I've never worked in such a place before, so I may be biased. Is this a viable model for software development?


title: Is Lisp the first language to adopt structured programming?

text: I couldn't find any links or books claiming that Lisp is the first programming language to adopt structured programming (actually, most of them don't even mention Lisp at all), but if conditionals were invented by McCarthy and got into Algol later, is it fair to say that Lisp is the first?


I am trying to broaden my understanding of the history and development of object-oriented programming, and I am curious to find out **if C was designed to facilitate Object-Oriented programming?** (like **C++** and **Objective-C** definitely are) or if it was, on the contrary, simply just a clever exploitation of the language's constructs. I cannot seem to find any sources, including _K &R_, where the original authors comment on this approach. Recently I have been looking into OOP in ANSI-C, which is described in **Object-Oriented Programming With ANSI-C** by **Axel Schreiner**. For a freely available PDF version visit http://www.cs.rit.edu/~ats/books/ooc.pdf. A slightly different approach is used in the part of the Linux kernel dealing with file systems, visit http://lwn.net/Articles/444910/ for more info. The common idea is to put `function pointers` in a `struct` along with `fields` in order to 'emulate' a `class`' methods and `data members`. **Chronology** From Wikipedia.org/wiki/Object-oriented_programming#History > Objects as a formal concept in programming were introduced in the 1960s in > Simula 67 While Wikipedia.org/wiki/C_programming#K.26R_C states that > In 1978, Brian Kernighan and Dennis Ritchie published the first edition of > The C Programming Language. The chronology seem to suggests that K&R must have been well aware of OOP. So again: **Was C designed to facilitate Object-Oriented programming?**


title: Effective way to gain practical knowledge

text: I am currently nearing the end of my first year of my CS degree and have been disappointed with the lack of coding I have been asked to do (one unit). I am basically looking for an effective way to gain practical knowledge but am unsure where to look for experience from a near **beginner's** perspective.


title: Should one generally develop a client library for REST services to help prevent API breakages?

text: We have a project where UI code will be developed by the same team but in a different language (Python/Django) from the services layer (REST/Java). The code for each layer exits in different code repositories and which _can_ follow different release cycles. I'm trying to come up with a process that will prevent/reduce breaking changes in the services layer from the perspective of the UI layer. I've thought to write integration tests at the UI layer level that we'll run whenever we build the UI or the services layer (we're using Jenkins as our CI tool to build the code which is in two Git repos) and if there are failures then something in the services layer broke and the commit is not accepted. Would it also be a good idea (is it a best practice?) to have the developer of the services layer create and maintain a client library for the REST service that exists in the UI layer that they will update whenever there is a breaking change in their Service API? Conceivably, we would then have the advantage of a statically-typed API that the UI code builds against. If the client library API changes, then the UI code won't compile (so we'll know sooner that there was a breaking change). I'd also still run the integration tests upon building the UI or services layer to further validate that the integration between UI and the service(s) still works.


title: User Configuration of a Shell Script. Best practices?

text: I am writing a shell script with a few variables that should be configured by the user. There will be an installer for downloading and configuring the script, possibly by asking a series of question. The script in question is aimed at other developers. This can be implemented in a number of ways:   1. **Use placeholders** in the script itself and use `sed` to replace them during installation (something like this: http://stackoverflow.com/questions/415677/how-to-replace-placeholders-in-a-text-file)     * Pros: All variable definitions are contained within the script. It's easy to download the script manually and configure the variables for users who prefer an editor over the installer.     * Cons: It's hard to reconfigure the variables through the installer once they are in place. Unless I create a more complex regexp which would be prone to errors.   2. **Use a config file** , basically another shell script with assignments, and use `source` to include it. (And probably place it in `~/.scriptname`? The main script is copied to `/usr/local/bin`)     * Pros: It's easy to reconfigure the script. Could even add a parameter for doing so from the main script (Would probably work in the first solution as well, but editing a script from itself doesn't sound like a very good idea)     * Cons: The script is now dependent on two files and the user is required to run the installer for the configuration file to be created. This can be solved by auto generating a config file if none exists. But locating an external configuration file will still be more cumbersome for users who just want to download the script, edit it, and be done with it. Also, a few options regarding how the configuration should be managed by the user after the installation:   1. **Git like**   $ myscript config server.host example.org $ myscript config server.proxypath /home/johndoe/proxy $ myscript config server.httppath /home/johndoe/web   2. **Interactive**   $ myscript config   Enter the server hostname: example.org   Enter the path to the proxy on the server: /home/johndoe/proxy   Enter the path to the http directory on the server: /home/johndoe/web   3. **getopts with long options**   $ myscript --host example.org --proxypath /home/johndoe/proxy --httppath /home/johndoe/web   4. **Simple**   $ myscript config example.org /home/johndoe/proxy /home/johndoe/web Are there any other ways of doing this that you would consider?   Any best practices, anything elegant?


title: What specific features of NHibernate cause it to be recommended for legacy database systems?

text: So, I've been evaluating Entity Framework and NHibernate (I'm not looking for an EF vs. NH battle here, though!). One thing that I see come up very often is that NHibernate is recommended for "legacy"/brownfield database projects, and lighter-weight ORMs (Dapper, etc) are sometimes recommended for newer dbs. I will be applying my ORM to a brownfield database. What specific features of NHibernate make it so widely recommended for "legacy" dbs. (I have never heard anyone say "here's _why_ NHibernate is better for legacy DB's -- I really want to know that, so that I can evaluate NHibernate appropriately) And by the way, what is the definition of legacy here? Do people mean   * "databases that are not well normalized"?   (or)   * "databases that are being accessed through non-ORM means, such as SQL queries or stored procs? (or)   * not talking about the database at all, but referring to classic 2 tier systesms (or 2-tier web apps, where there is thick session state, and no application tier)?   (or)   * Any database that is isn't a noSQL database? If it's of any use the discussion. I will be using this ORM to build distributed, multi-tier software. So I think that a lot the stateful features in ORMs -- like change tracking, etc, will not matter to me very much.


title: Use ruby's array sort() method, or add items in correct place with a binary lookup?

text: If I am loading a whole load of items (un-ordered words from a file or something) would it be more efficient to load them all to a Ruby array, and then use the built in `sort!` method or to do a binary lookup for the place of each item in the list as I load it, and add it in that position. Basic code:               array = []     lines.each do |line|         array.push line     end     array.sort!      vs               array = []     lines.each do |line|         array.insert(find_index(line), line)     end      `find_index()` would lookup the correct index for the item in the array using a binary search.


title: Is there any way to limit the scope of a knockout.js application?

text: I have a legacy project which I have been approved to work in a `knockout.js` module. This is great, however the application is extremely complex and I need to use some of the pre-built form validation of our application. My form validators work fine until a dynamic template gets switched out. I can't for the life of me figure out the error. Nothing in the console and my vast debugging efforts have been fruitless. I'm thinking that my solution could be something along the lines of limiting the scope of the knockout application similar to how one can declare `ng-app` in `angular.js`. I can't find a working example of how to do this or any documentation relevant to `knockout.js`


title: Why does Apple only allow for Static Frameworks on iOS?

text: Clearly Apple has the ability to create dynamically loaded libraries (known as frameworks) for iOS, as they ship several with XCode (such as UIKit). App developers only have the ability to create static libraries, or at best, trick Xcode into thinking it's loading a framework when it's actually loading a static library, this is known as creating a fake framework, some of the drag- and-drop convenience, but none of the dynamic loading benefits. What is Apple's reasoning for keeping dynamic frameworks from app developers? It seems like it would ease using external libraries considerably, since developers wouldn't have to rely on finicky linker flags or open-source library dependency chains. Edit: I see a common reason is security. Why then does Apple allow it on OSX and not iOS? Isn't security a requirement there as well?


title: impact of product information leak due to matrix resource models for development projects

text: I read somewhere that Amazon has a dedicated team for each of its major products. This approach facilitates the growth of the domain knowledge for each product team and as a result of this retained knowledge, it allows Amazon to rapidly add new functionality to products. I have experience working with lots of companies where they follow more of a matrix based resource model. In this model, the company has a portfolio of products, but architects, developers and project managers are very frequently moved around from product to product. For example, if new functionality is to be added to a product, a completely new project team will be created for this. The project team is likely to have no previous exposure to the product. As a result of this matrix resourcing, the product technical architecture becomes weak (each architect will use a different approach/style), and adding new functionality takes much longer because of the domain knowledge that the new project team needs to acquire before starting the project. Information leak is sometimes used to describe the effects of lost knowledge such, which seems to be exacerbated by the matrix resourcing approach. **Questions** : Is there any research or documentation that supports my experience and identifies the impact (cost/time) of information lost due to matrix resource models? * * * EDIT: Also, most of the companies had a tendency to switch resources mid-project. This cost a lot of time lost due to:   * handovers required between old and new staff (if they even happened at all)   * new staff getting up-to-speed on the project   * low morale due to constant resource changes on projects Link describing Amazon's Philosophy: you build it; you own it. * * *


title: Builds, continuous integration and deployment for python projects?

text: Could you please tell me which tools are used in python to build projects, as well as which continuous integration servers are used and how to deploy projects to the server? What I mean is web projects, but will still be happy to know more of this information not only around the web.


title: Is there somewhere I can post code used to hack my site?

text: I left a bit of a door open recently on my site. Someone tried to post PHP code to a CMS page editing module, but it wasn't executed. I have this code and was wondering if there is somewhere I should post this code for peoples interest etc. It's PHP code.


title: How to switch From Java to .Net?

text: Has anyone out there done this? Did you have to spend a few years learning .NET before you could get a job or were there employers just willing to throw you into the fire based on your Java experience? I'm wondering if it would be good for me to start learning .NET now in case a few years down the road I end up wanting to make the switch or maybe I don't need to worry.


title: When does one NOT need to use queues in an application?

text: I've been developing an application using the Laravel Framework & have been exposed to the idea of queues for the first time. There are a multitude of tutorials & articles about using queues & examples of what to use for, but I've never seen anyone writing about or highlighting when one does not need to actually use any. I've seen examples or even forum questions about using say beanstalked or iron.mq for offloading jobs that then take place in a managed manner, I understand the concept; but is there a need to make use of queues if say my application makes use of a mailing service like Postmark or Mandrill? Is there a benefit in that case? I mean I've tested both & obviously they both queue jobs on their service to allow their service to function; do I need a queue for email when I'm offloading the act of mailing to a service detached from my application. ( my application has not been released into the wild, I do not actually have benchmark type information at present ) How different is giving jobs to ironmq (which still calls an api and sends data) to making a call to say Mandrill by sending data? More to the point; does one need to have a queue like using iron.mq to send mail requests to mandrill which happens to queue stuff too?


title: Basic OOP theory: misunderstanding surrounding database and user classes

text: New to OOP and trying to understand some basic fundamentals. Currently using PHP5 to build a basic web app. In using PHP's built in PDO as my database class and a separately created user class that handles, among other things, user log in and out, is it best to have the db class connect to the database in a log in situation, or does the user class need to directly connect to the db? If the latter, I think I'm likely misunderstanding how PDO would standalone. If the former, presumably some kind of 'helper class' needs to be created that would facilitate the db connection between PDO and my user class?


How do I include the copyright/license for a library if I use on 1 function? Say if I have a class that I have taking 1 function from another library:               class MyClass {         ...         public function someOtherLibrariesFunction() {}     }      And the at the top of the file I took the function from it says:               /*      * This file is part of the Other Library package.      *      * (c) James Smith <j.smith@gmail.com>      *      * For the full copyright and license information, please view the LICENSE      * file that was distributed with this source code.      */      And the LICENSE file:               Copyright (c) 2004-2013 James Smith          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.          ...standard as is warranty...      So my understanding is I would have to have a copy of the LICENSE file included with my code, and I would also somehow point out the exact function it it applies to?


title: Interview question: Percentage of time spent coding

text: I've been asked to estimate the percentage of time I spend coding at my current position in a job interview (I said about 70%). This excludes time for things like documentation and meetings. What does this statistic tell an interviewer? I'm guessing that they are looking for a balance between coding too little (thus being out of practice) and coding too much (not seeing the bigger picture of product development). * * * EDIT: After reviewing your answers I'm even more curious what the actual reasoning behind this question was... I should have just asked the interviewer! Your answers are actually really funny in the context of this company.


title: REST Service and CQRS

text: I am struggling with architecture on a new project. I am using the following patterns/technology.   * CQRS - anything going in goes through a command   * REST - using WebAPI   * MVC - asp.net mvc   * Angular - building a spa   * nhibernate I belive this provides some great separation and should help keep a very complex domain from growing into a giant set of services that mix queries with other business logic.   * The REST services have become non restful. They are putting methods in rest that are "SearchByDate", "SearchByItem" etc.    * Service Methods that execute commands are called with a "web" model class, a new command is built in the service and executed, I feel like there is a lot of extra code.  I expected this to be much different but I wasn't around to keep things on track. Finally my questions are this... I would have liked to see `PUT Person (CreatePersonCommand)` but then I realized that isn't restful either is it? the put should be a person entity not a command. Can I make CQRS and REST service work together or am I going about this all wrong? How do I handle service methods that don't fit into a REST model. I am not performing CRUD on the object but rather executing some business logic. I.E. I don't want the UI to be responsible for how a shipment is "unshipped" I want the service layer to worry about that.


title: "Mac" vs "OS X" vs "Mac OS X"

text: I am writing server software that gives administrators options that apply only to Mac OS X clients. When naming those options, I need to decide how I am going to refer to such clients. I can see three choices:   * Mac OS X   * Mac   * OS X In context, I feel that "Mac OS X" might be a little clumsy: "Default protocol for Mac OS X clients"; "Change Mac OS X protocol". In discussing with my boss, he suggests "OS X", as that's the name for the OS itself, while I think that "Mac" is more recognizable. While "OS X" is technically correct and is what Apple recommends, I feel that it has a lot less name recognition than "Mac"; in particular, administrators who work in a Windows-only environment may not even recognize "OS X" and wonder what the options is about, while I think everyone knows what "Mac" refers to. In looking at what several popular pieces of software choose, I see that Microsoft has "Office for Mac". Adobe calls it "Macintosh" (which sounds very outdated, I believe that Apple stopped using that "Macintosh" years ago). Firefox uses "Mac OS X". Google has "Google Software Downloads for Mac". I don't see many popular pieces of software that refer to it solely as OS X; it seems that either "Mac OS X" or "Mac" is used most often. Apple does refer to it as OS X, but I think the fact that it's coming from Apple provides the disambiguation that you need, so it's not confusing coming from them, while it may be in another context. Is there any good solution for this? Should I just use the somewhat clumsy "Mac OS X" everywhere (or at least, the first time I refer to it in any given screen)? Obviously, my boss has final say, but I'd like to be able to provide a coherent argument.


title: Terminology For Web Development and General Programming/Software?

text: EDIT: I should clarify. THe particular terms I listed below I fully understand. I also understand w3schools doesn't have the greatest information. These are just examples. I don't expect everybody to understand what an example is, but I hope the majority do. Does anybody have any resources listing terms related to programming and web development, or care to pitch in? Things like: Runtime   Build time   Framework   Library   Normalize I'm primarily a PHP developer so anything about that. I really am looking for general terms and specific terms related to web development, PHP, SQL, CSS, HTML. Appreciate any input. Couple I found: http://www.w3schools.com/site/site_glossary.asp   http://docs.roxen.com/pike/7.0/tutorial/fundamentals/concepts.xml


Should a class know about its subclasses? Should a class do something that is specific for a given subclass for instance? My instincts tells me that is a bad design, it seems like an anti-pattern of some sort.


title: How would I unit test database logic?

text: I am still having a issue getting over a small issue when it comes to TDD. I need a method that will get a certain record set of filtered data from the data layer (linq2SQL). Please note that i am using the linq generated classes from that are generated from the DBML. Now the problem is that i want to write a test for this. do i: a) first insert the records in the test and then execute the method and test the results b) use data that might be in the database. Not to keen on this logic cause it could cause things to break. c) what ever you suggest?


title: What is the difference between a Splay Tree and an Optimal Binary Search Tree?

text: Both these trees try to keep the most frequently accessed element at the top. Is there any difference between these two trees?


title: How Scala Developers Are Being Interviewed

text: How are Scala programmers being interviewed? What are the aspects that the interviewer looks for when interviewing a Scala developer?


title: How do I showcase my work experience in programming?

text: I'm a student of web development languages like PHP, Ruby, and Python. Currently I'm working on some school projects but I'm trying to work on some weekend projects which I can use to showcase for potential employers, what's the best way to set this up? Specifically, are there any tips you have for a new programmer because I don't want opinions on how this or that should or shouldn't be set up. If possible please give real examples. **Edit:** what about Git? Is this a good place to show my projects?


title: How do you deal with e-mail overload?

text: Probably many of you receive hundreds/thousands of e-mail every week. This happens especially when you are part of wide distribution lists. How do you find the relevant ones? Do you use any _smart_ plugins (for Outlook)? Until now I tried:   1. Sorting them in folders but it failed because then I got into folder overload   2. Making rules. Fails especially when doing text matching because is not taking into account the context.


title: i want to make some programmer friends but dont know where to really look

text: I know this is one good place but what I'm really looking for is contacts, maybe seeing them online, have intelligent conversations etc. Where I live there isn't that many programmers around me because I'm self employed. I'm sure if I were to work in a company I would be surrounded by some. I don't know maybe sharing our screen names or facebooks or something.


title: Development setup in a company with external developers

text: EDIT: This is about where the users will have their files, and TEST their changes - a development server so they can edit, save and then refresh a page to see whats changed. I am currently looking over our systems we have in place, here we have 2 internal developers, and 2 designers. All 4 used the same server for development work with their own enviroments and databases and code all housed in an external SVN repo, this works pretty sweet however we are looking at opening up this server for external staff. We have 2 external designers who we'd like to be able to edit files/insert designs etc etc. One runs a mac, other windows - ideally we'd like to open up access to our development server but one of these users it outside the country so access would be slow for anything other than something which runs in terminal however they use graphical IDEs. Do anyone have any experience/how their companies handle doing this? Not really keen on FTP to upload, check, edit, upload, check etc


title: Why separate unit tests into an assembly

text: I primarily develop in .Net, and have been playing around with F#. It's a nice concise language, but I'm just using it for throwaway code currently. I've taken to sitting my tests in the same file as the main code that I'm writing. I am under the unexamined opinion that this is done so that we don't have testing code floating around in production, and that we have separate dependencies for testing which we don't want to go to production. This has raised the question for me: why do we traditionally separate out test assemblies and not just use conditional compilation?


title: How to implement interactive programs (like games/simulations) using logic programming?

text: I've heard that logic programming can serve as a general-purpose alternative to other programming paradigms such as OO or functional programming. (Since Prolog is Turing-complete, this must be so!) However, I'm having trouble seeing how one would implement an interactive program, like a simple, graphical console game in Prolog or a similar language. You have facts, rules which can derive more facts, and queries which retrieve facts. It's easy to see how you can use those basic elements to create something like a sudoku solver. But how about Pac-man, or more simply, Pong? **PLEASE NOTE:** I'm not looking for low-level details, but a conceptual overview. (For example: in high-level terms, how would you handle I/O? How would you store the game state? How would you implement something like a "main loop"? How would you measure and respond to the passing of time?)


title: How to structure a modern web application

text: ## Background I recently developed, for two different projects, two web applications. The two followed quite different approaches. The first one was a classic inventory application (lists of stuff to view, select, edit.. very CRUD) and was developed with Razor and ASP.NET MVC: controller accepting requests, getting a model through a Repository, building different Viewmodels out of it for view and editing, pass the Viewmodel to the view engine and render of the page. Very direct stuff (you can almost build such an application with wizards only using ASP.NET MVC), with very little Javascript "magic" (only the minimal offered out of the box by the MVC framework, mainly for validation). The second one was quite different: this application is basically a bunch of screens (views) through which the user can navigate back and forth, which appearance change as users input data in different places - it is basically a hub in which the user views and reviews information linked to his account(s). I built this second application as a REST service (built with ServiceStack, and therefore following the design patterns it enforces - like Data Transfer Object) and a SPA application implemented using AngularJS. The angular application uses its (excellent) http service to get the JSON objects from the rest service, and then populate its (client side) Viewmodel (the scope). Very neat and clean; it is easy to navigate back and forth the various account information (which is visualized in many different ways: lists, graphs, ...) It is maybe a little more difficult to code at times (authentication/authorization is a bit more difficult (you have to be careful to mimic control on client and server, for example). Now, I am starting a third project. It is something in between: it is still a CRUD application, but it needs to be very responsive. For example, in a page, we have a complex information to enter (combo of form and list); in the list the user need to select a item from another list, but if the item is not there we want to open the "edit list items" view, let him/her insert the item, and go back to the original page... all without refresh/pushback/... You got the idea. ## The question Which is the best way to accomplish this, to develop a modern, quick, responsive web application? I have seen too many different approaches:   * "control based" (jQuery) approach: build the page using your MVC framework (which will produce html, a table for example), use jQuery to "enrich" the html and make it ajax   * "data based" (Angular): build the page as an html page with data bindings, a JS application, and structure the server side as a REST service, that the JS app uses to get/post data   * the mix #1: part of the app is built using your MVC framework (which spits out html), part using a data-based framework (like angular). Angular scope/model is initialized using jQuery to extract the initial data out of the html DOM.   * the mix #2: part of the app is built using your MVC framework (which spits out html), part using a data-based framework (like angular). In addition to html, the server writes a "script", which is JSON data, and embeds it into the page. Angular then uses it as its model to render the data visualization (client side)   * the mix #3: same, but this time no embedded JSON: the server exposes a REST service that is used by Angular to retrieve the data it needs. It is essentially part generated on the server, part on the client through a secon call to get e JSON object   * (more...?) I personally find the mix #1 and #2 ugly, but I am too "new" to modern Javascript development to judge. Are they common? I see for example that one advantage of mix #1 is that you get the initial view immediately, you do not need to wait for JS to render it. And both mix #1 and #2 do only one call to the server. So, which one is the best practice? Or which one(s) should I really avoid? I (personally) am more comfortable with a mix of server-side generated pages and client-side JS; making a SPA completely using services was not that easy, more than one time I wished to have something generated using server-side logic, but I may be doing it wrong (that is why I am asking!)


title: Encoding a bash script for use in Python

text: I am writing some code in Python which checks for the validity of a license key after polling a server. If it is valid then the Python program in turn runs some bash scripts. How to create a combined binary of the python script (to check the license) and the bash script (which performs the task)? Here are what I think could be the solutions but I am really not sure:   1. I use the encode function in python and encode the bash script file once and add combine that file and the license_checker.py file into a single binary. When the binary runs, the python code should decode the file into a temp file, run the script and delete the temp file.   2. Find a mechanism which wraps/embeds the bash code in the python script. I have heard of decorators but I haven't used them and do not know if they would serve the purpose.


title: How can I defend Ruby on Rails against customers' not technical opinion?

text: My customer, a translations business owner, just told me that he has been reading about Ruby on Rails and told me that " _there are more PHP guys around there_ " and " _it seems the community prefers it_ ". What would you, as software engineer and freelancer, say to the customer to achieve these goals:   * Sell    * Make him see that the technology is my expert decision and Rails is as good or better than PHP (+ whatever framework) for this particular project. UPDATE: Thank you all for the suggestions! Tomorrow I've got another meeting with him, let's see how it goes, I will update again :) UPDATE 2: Finally I told him to read this thread and the result has been fantastic: He gave me the project and we are going to start right now. Thank you all for the help, you have free beer in my charge if we see someday :) BTW: I learned the lesson: be as transparent as possible, because if you believe in yourself and your work, there is no question compromising enough to beat you. regards


title: Google App Engine overview

text: I have gone through many Google App Engine tutorials, and I became quite familiar with how to do basic stuff like implementing a `webapp2.RequestHandler`, and using `ndb.Models` to manage your data. Now, I kind of reached a wall with a few small concepts that were either missing from the resources I went over, or I simply missed them. So, here they are: ### What happens to class variables? As far as I understood, once I set my app to threadsafe, it can handle multiple requests concurrently, not to mention possibly on different machines. Does that mean I simply cannot use class variables (that can be changed at anytime)? ### How to model an application wide logic? It is very straight forward to write logic associated with requests. I don't have to worry about locking or any of that stuff, since a new RequestHandler is instantiated for each request. What about application-wide logic? Like, if I had a python module called "Game", and after importing it, I do somthing like: `Game.matchmaking_queue.append(player)` As far as I can tell, there is just one `Game` instance, and it has an instance variable accessed from within the `RequestHandler` logic. Will that be OK? Must I make the `matchmaking_queue` backed on memcache and/or datastore in order for **all** requests to see it? Do I have to do any thread-saftey magic on `Game`?


title: Tests for emptiness vs tests for nothingness

text: Is there any consensus between languages how tests for emptiness are distinct from tests for noneness? In python the following expression is false: `{} is {}` However this expression evaluates to True `False is False` Why is the first expression not evaluated to True?


title: How do you pronounce the '...' operator

text: Now, in c++ '...' became a first class operator. In speech, how do you pronounce it? So far I've heard:   * dot dot dot   * triple dot   * ellipsis related: Is it OK to replace ... with ellipsis in writing? e.g. "The ellipsis operator expands the pack" EDIT (clarification): We are all aware that '...' as a **punctuation** mark is indeed called ellipsis. But in the context of C++ we don't pronounce the names of the punctuation mark. For example, the '&' operator, depends on the context is pronounced as 'and', 'bitwise and', 'address of', 'logical and' (when && is used), or 'reference'. It is rarely pronounced as 'ampersand'. In speeches, I've a feeling that 'dot dot dot' is used more often. For example: http://channel9.msdn.com/Events/GoingNative/GoingNative-2012/Variadic- Templates-are-Funadic (an excellent presentation about variadic templates). On the other hand, 'dot dot dot' is awkward hard to pronouce ('d' and 't' are both pronounce with the tongue). Can we pronounce it 'unpack'?


title: How can I get rid of just the untracked files in git?

text: In Mercurial I can do this with the bundled Purge Extension and executing the following command:               hg purge      Also good to get rid of ignored files:               hg purge --all      I'm curious about the most practical/used equivalent solution in git. **Edit** : I want to just get rid of the untracked files, not reset everything (e.g. suppose I have a program generating cache files or generated code and I want to delete them with git's help)


title: Build Once, Deploy to Multiple Enironments

text: I build one **MAIN** branch. This is our trunk and our only code base for the project. Once this is built, ideally it would continuously deploy to our Dev environment. Once the developers have confirmed operation in that Dev environment, I'd like to simply publish the binaries that were previously built, to the Test environment. Once QA has confirmed operation in the Test environment, I'd like to publish the same original binaries to the Stage environment, and then to the Production environment. I guess it's sort of like deploying old school where you just copy over the binaries onto the box you're doing the deployment to. Any strategies, tuturials, tips, links and third party software recommendations (preferably with link to tutorial) are appreciated. I'd like to keep everything within Visual Studio if possible.


title: Processing a list of atomic operations, allowing for interruptions

text: I'm looking for a design pattern that addresses the following situation:   1. There exists a list of tasks that must be processed.   2. Tasks may be added at any time.   3. Each task is wholly independent from all other tasks.   4. The order in which tasks are processed has no effect on the overall system or on the tasks themselves.   5. Every task must be processed once and only once.   6. The "main" process which launches the task processors may start and stop without warning. When stopped, the "main" process loses all in-memory data. Obviously this is going to involve some state, but are there any design patterns which discuss where and how to maintain that state? Are there any relevant anti-patterns? Named patterns are especially helpful so that we can discuss this topic with other organizations without having to describe the entire problem domain.


title: How much segregation is too much in this design?

text: We are working on ASP.NET webforms application developed using WCSF (MVP pattern). In the application, there is a search screen that allows the user to enter some fields and display the results. We have segregated the functionality into user controls and each user control has its own view and presenter.   1. Search -> It consists of search fields along with submit button. It contains validations inside the presenter. After the page is validated, it raises the custom event.   2. Search criteria -> Contains DataList control to display the readonly search criteria by subscribing to search event.   3. Search results -> Communicates with controller and binds the grid by subscribing to search event. It also contains sorting and all grid related events. Since each control has its own controls and behavior following SOLID principles, views and presenters are thin and testable. Also, it increased the productivity by facilitating developers to be able to work on tasks independently. But on the other end, we are thinking whether we over-engineered and increased the complexity by introducing the user controls, custom events, etc. for this simple functionality?


title: RESTful API development : is it web developer's work or software developer's work?

text: First of all, I am sorry that the issue I'm going to say is not about a technical thing. I'm just confused. I am trying applying to several companies as a software engineer. The latest work that I developed is to develop RESTful APIs which is written in Python django. Here's the problem that I'm curious. can this work be classified as a software engineer's work? or is it just a web developer's work?


title: Why shouldn't "responsive" web design be a consideration?

text: This might seem like more of a graphic design question than a programming question, but I think it has much more technical/programming merit than actual graphic design. The concept of "responsive" web design revolves around using media queries in CSS3 to detect the size of the viewing device and adjust the CSS rules accordingly - essentially, dynamic CSS. This fills the void on a lot of deployment cases - mobile, in particular. I think use of media queries is surfacing slowly (I've found that many people don't really know about it), but I'm wondering if there is a reason for slow adoption. Is it impractical for web applications? Is there something I'm missing that might be a fundamental pitfall?


title: Is there a design pattern for updating lists?

text: I want to modify one list (actually info stored in a database). A person doesn't have access to update every part of the list, but can update and delete parts they do have access to and add whatever they want to the list. Here's my pseudocode:               ModifiedList      OriginalList     OriginalListWithUserRights          for each Thing in ModifiedList do       if Thing in OriginalList then         //Leave Along - nothing to change       else         OriginalList.add(Thing)          for each Thing in OriginalList do       if (Thing in ModifiedList) then         //LeaveAlone - nothing to change (same as above)       else          for each RightsThing in OriginalListWithUserRights do            if RightsThing not in OriginalList then              //Leave Alone - don't remove things you don't have rights to            else               OriginalList.Remove(RightsThing)          OriginalList.ReIndex() //because there will be some gaps      So, I guess this would work, but I think it's not right because it's just an obvious solution. I don't need to start with three lists as my inputs to this function. I could look up particular pieces of information while I'm iterating through my modified list. It just seems to structured and not object oriented enough for 2014. One problem I have is that I'm going to be adding everything to the end of the list, seems like I should be adding things relative to where they were in the passed in list, but in a way that doesn't mess up the order of things that are not in my OriginalListWithUserRights.


title: How to stop the WCF service (database queriying) running behind

text: I have a WCF service which will get an object with huge data from database in the form of collection. I have a UI which has get and cancel buttons . Get button : make service request and continue with data population with the returned data from service.I start it as below               Thread _workerThread = new Thread(DoExportTreeLoad);     _workerThread.Start();      Cancel : stops the above thread.It does as below               _workerThread.Abort()      My DoExportTreeLoad() has the synchronous service call which in turn hits database and gets data.               result = serivce.GetData(criteria);      Problem: When I cancel the operation after requesting the service, the DAL code is still running in the background (getting data from database) where it should not happen. As soon as i cancel the operation from UI ,the transaction (to get the data ) from database need to be aborted. It leads to big performance problem. Please help me with any way to end up the backend task when thread is cancelled. Thanks in advance.


title: Pythonic design for controlling multiple devices through an I2C bus

text: I'm writing a piece of software in python that will communicate with a bunch of devices via an I2C bus. Each of these devices are going to need some sort of a module or class to handle the communication and data conversion in some sensible way. The operations that each of the device modules perform are drastically different. My main concern is the I2C bus control. I fear that sharing the bus, by for example having each of the device modules instantiate a new I2C bus control object results in code that is hard to follow and I'm not sure how these objects would communicate if the there's an interrupt in the bus. However, not sharing it, I fear I'll end up with a _huge_ control class that is hard to maintain and extend. If I lean towards the control class, each of the device modules would hold a map of operations, like an `OrderedDict` or a list of tuples of functions with expected result values or ranges. The I2C control object could then iterate that dictionary, write and read the results from the bus and move to the next function if the result is in the expected range. This sounds like a state machine design, but I'm not sure if I can really generalize all operations enough. I suppose my question boils down to _does anyone have a good suggestion for a design pattern_?


title: Split up large interfaces

text: I'm using a large interface with about 50 methods to access a database. The interface has been written by a colleague of mine. We discussed this: Me: 50 methods is too much. It's a code smell.   Colleague: What shall I do about it? You want the DB access - you have it.   Me: Yeah, but it's unclear and hardly maintainable in the future.   Colleague: OK, you are right, it's not nice. How should the interface look like then?   Me: How about 5 methods that return objects that have, like, 10 methods each? Mmmh, but wouldn't this be the same? Does this really lead to more clarity? Is it worth the effort? Every now and then I'm in a situation where I want an interface and the first thing that comes to mind is _one, big_ interface. Is there a general design pattern for this? * * * **Update** (responding to SJuan's comment): The "kind of methods": It's an interface for fetching data from a database. All methods have the form (pseudocode)               List<Typename> createTablenameList()      Methods and tables are not exactly in a 1-1-relation, the emphasis is more on the fact that you always get some kind of list that comes from a database.


title: Web Development Law/Ownership of Website

text: I'm a budding web developer, and I wondered if it was illegal to edit a website for a client to include a link that says 'encourage the owner of this site to pay their web developer' and follows up with a pre-made email encouraging the man to pay me. Here are the conditions:   * I've completed the work for the contract.   * I've asked to be paid, and tried to set up meetings with the owner.   * I've informed the owner of the site that my work will not continue unless I am paid.    * I should have been paid nearly a month ago (12/27) Any thoughts other than small claims? This is my first web-development job!


title: Career Advice: Change from developer to tester

text: I have three years and nine months of java development experience specifically in finance domain and now I want to move into testing (functional). But I took a break from my job due to location change. Is it advisable and how should I do it?


title: Should front-end integration tests make HTTP requests?

text: I am developing a single-page web application using AngularJS. Data for this application is consumed over a REST API which is well tested in its own right. The Angular application has a bunch of unit tests that test e.g. individual controllers and their methods. It also has a bunch of integration tests that currently verify that those controllers behave correctly when applied to a view. Both the unit and integration tests are currently sharing a set of stubbed JSON data that is returned when certain HTTP requests are about to be made (by way of the `$httpBackend` Angular service). No actual HTTP requests are sent to the API server during testing. **Is this a good approach for front-end integration testing?** The way I see it, the unit tests are testing small units of code (such as individual methods in controllers) and the integration tests are testing the way those units behave in the wider context of a view or template. The setup allows the front- end application to be tested completely independently. However, the developers of Protractor (the integration testing framework I'm using) have stated on numerous occasion that they believe integration tests should make HTTP requests to a real server (see this GitHub issue): > Protractor is intended for end to end tests, so the primary use case is when > you have an actual backend hooked up. Assuming the answer to the above question is "yes" (or "maybe"), should there be a third set of tests that do actually test the communication between front- end application and REST API?