title: How to justify technology choice to customer?

text: When freelancing / contracting a customer will typically specify functional requirements, acceptance criteria, etc, and the implementation details are in the developer's hands. As a developer your technology choice is a balancing act between what you are most familiar with, technologically what the right tool appears to be, ease of finding coders with this skill and their expense, and a few other factors. I'm in a situation where I have evaluated my options and selected a somewhat obscure open source technology that I believe will get me there faster, easier, and be more maintanable in the long term. It's different, but I think that that is what the requirements call for. The customer has inquired about what I'm going to use to build the solution, and now they are concerned because they've never heard of it before. The reasons for my choice are mostly technical, whereas the customer isn't (but they know some buzzwords!). Explaining these technical reasons will not be easy, and I am not sure if that is the right way to approach this situation anyway. And that's my question: what is the right way to approach this situation so as to cause the least amount of headache for everyone involved?


title: How do you decide what kind of database to use?

text: I really dislike the name "NoSQL", because it isn't very descriptive. It tells me what the databases _aren't_ where I'm more interested in what the databases _are_. I really think that this category really encompasses several categories of database. I'm just trying to get a general idea of what job each particular database is the best tool for. A few assumptions I'd like to make (and would ask you to make):   1. Assume that you have the capability to hire any number of brilliant engineers who are equally experienced with every database technology that has ever existed.   2. Assume you have the technical infrastructure to support any given database (including available servers and sysadmins who can support said database).   3. Assume that each database has the best support possible for free.   4. Assume you have 100% buy-in from management.   5. Assume you have an infinite amount of money to throw at the problem. Now, I realize that the above assumptions eliminate a lot of valid considerations that are involved in choosing a database, but my focus is on figuring out what database is best for the job on a purely technical level. So, given the above assumptions, the question is: what jobs are each database (including both SQL and NoSQL) the best tool for and why?


title: const vs. readonly for a singleton

text: First off, I understand there are folk who oppose the use of singletons. I think it's an appropriate use in this case as it's constant state information, but I'm open to differing opinions / solutions. (See The singleton pattern and When should the singleton pattern not be used?) Second, for a broader audience: C++/CLI has a similar keyword to `readonly` with `initonly`, so this isn't strictly a C# type question. (Literal field versus constant variable in C++/CLI) Sidenote: A discussion of some of the nuances on using const or readonly. My Question: I have a singleton that anchors together some different data structures. Part of what I expose through that singleton are some lists and other objects, which represent the necessary keys or columns in order to connect the linked data structures. I doubt that anyone would try to change these objects through a different module, but I want to explicitly protect them from that risk. So I'm currently using a "readonly" modifier on those objects*. I'm using readonly instead of const with the lists as I read that using const will embed those items in the referencing assemblies and will therefore trigger a rebuild of those referencing assemblies if / when the list(s) is/are modified. This seems like a tighter coupling than I would want between the modules, but I wonder if I'm obsessing over a moot point. (This is question #2 below) The alternative I see to using "readonly" is to make the variables private and then wrap them with a public get. I'm struggling to see the advantage of this approach as it seems like wrapper code that doesn't provide much additional benefit. (This is question #1 below) It's highly unlikely that we'll change the contents or format of the lists - they're a compilation of things to avoid using magic strings all over the place. Unfortunately, not all the code has converted over to using this singleton's presentation of those strings. Likewise, I don't know that we'd change the containers / classes for the lists. So while I normally argue for the encapsulations advantages a get wrapper provides, I'm just not feeling it in this case. A representative sample of my singleton               public sealed class mySingl     {         private static volatile mySingl sngl;         private static object lockObject = new Object();              public readonly Dictionary<string, string> myDict = new Dictionary<string, string>()         {             {"I", "index"},             {"D", "display"},         };              public enum parms         {             ABC = 10,             DEF = 20,             FGH = 30         };              public readonly List<parms> specParms = new List<parms>()          {              parms.ABC,              parms.FGH          };              public static mySingl Instance         {             get             {                 if(sngl == null)                 {                     lock(lockObject)                     {                         if(sngl == null)                             sngl = new mySingl();                     }                 }                 return sngl;             }         }              private mySingl()          {             doSomething();         }     }      Questions:   1. Am I taking the most reasonable approach in this case?   2. Should I be worrying about const vs. readonly?   3. is there a better way of providing this information?


title: Release build vs nightly build

text: A typical solution is to have a CI (Continuous Integration) build running on a build server: It will analyze the source code, make build (in debug) and run tests, measure test coverage, etc. Now, another build type usually known is "Nightly build": do slow stuff like create code documents, make a setup package, deploy to test environment, and run automatic (smoke or acceptance) tests against the test environment, etc. Now, the question:   * Is it better to have a third separate "Release build" as release build?    * Or do "Nightly build" in release mode and use it as a release? What are you using in your company? (The release build should also add some kind of tag to source control of potential product version.)


title: What are the reasons that make PHP more popular for freelancing world?

text: In many freelancing websites, you see many job ads for PHP (backed by MySQL). However, job ads for .NET, Java, Ruby, etc. are not that much. What are the reasons which make PHP so popular for freelancing? Is it because of its importance? Or is it because PHP is free? The reason I'm asking this question is that, I'm an ASP.NET developer and while I see that ASP.NET development productivity is higher (because of fascinating tools it has), it still doesn't attract developers as much as PHP. I want to know if I'm missing something here that I should take into account or no.


title: Algorithm design for comparing split times in a race

text:
I need to determine the ranking of values in an array without altering their position, so that I can print the position of each split time next to the actual value of the split time in a table like so.

       Split 1	       Split 2	       Split 3

       4.66 (1)	       5.12 (3)	       4.75 (2)

      My array = [4.66, 5.12, 4.75] and I need to iterate through it and print the rank rank as seen in parenthesis above. I can't sort, because I need to do this for several decimals in the html table. Any suggestions for implementing this algorithm?


title: Productivity enhancing development strategies for small teams

text: I think one of the best ways to learn and become a better programmer is to share knowledge gained from working on personal or work projects with others. One way to do this at the workplace is to set aside an hour or so a week and let one or several team members present their progress on the part of the code base they have been working on. This is especially helpful when each team member has a specialized skill set. What are some other useful practices that managers can institute to increase team cohesion and improve productivity?


title: Common Industry Term For Negative Logging?

text: It is one thing to log something that happened in code, a process, or procedure. It is another thing to log something that didn't happen. For example, if your ETL system is supposed to receive a file every hour for import, and a file did not arrive at the usual appointed time, then it would be good to log "what didn't happen." I've called this negative logging, but I'm curious if there is an industry common term for this - a term which means "log both what happened **and what didn't happen**." Any idea?


title: Definition of "state"

text: What is a good way to define "state", as in state variable or state machine, to a new (previously non) programmer? What are some good ways to explain why this concept is useful for writing software? Is the concept of state explicitly taught in beginning programming courses or books commonly?


title: Securing client->database game

text: OK, I am creating a game using JavaScript and HTML5. The variables such as `map`, `x`, `y`, `level`, `exp`, etc are stored in JavaScript to keep track. On my client page, the JavaScript variables are stored to play along with the game. Every 5 seconds, the client page sends a POST AJAX call to the MySQL database and it successfully updates it. However a user can easily modify the JavaScript variables and cheat their way in the game. Then once they edit the JavaScript variables, the POST grabs that and updates it even though they edited it unethically. So, how do I prevent this from happening?


title: How do you call the process of taking a part of a function and making an individual function of it?

text: I know there was a **technical term** for this. I'm just can't remember what it was. If the title needs clarification, here is what I mean; If this is the old code:               Result foobar(Param1,Param2,Param3) {       code that does abc       code that does xyz       code that does asdf       more code that does something     }      and it's changed into:               SomeResult do_xyz(SomeParams) {       code that does xyz     }     Result foobar() {       code that does abc       do_xyz(args);       code that does asdf       more code that does something     }


title: Implementing custom "Remember Me" with Stripe

text: Implementing **remember me** with Stripe, while not using their `Checkout` (not supported on PhoneGap), seems to be fine using the path: **First time:**   1. Request token on the client side using card info.   2. Create customer on server side using token.   3. Upon confirm, charge customer. **Second time:**   1. Check if current user is Stripe customer by requesting the info from our server.   2. If is Stripe customer, show "use credit card on file" instead of regular CC form.   3. Upon confirm, charge customer. However, there is one important convenience items missing--last four digits of card number. Most sites inform you of the card you're using before making the payment, pretty important in case you have to switch out cards. I have seen that you can retrieve charges which would allow me to get the last four digits. Is it bad practice to pull that and display it? Are there alternative solutions anyone has in mind?


title: Does a custom scripting language require it's own compiler/assembler?

text: Or is the script generally converted to a known language such as C++ first? And how generally to you integrate a scripting language with the say a game engine?


title: Tracking contributions from contributors not using git

text: I have a central git repo located on a server. I have many contributors that are not tech savvy, do not have server access, and do not know anything about git. But they are able to contribute via the project's web side. Each of them logs on via a web browser and contributes to the project. I have set things up so that when they log on, each user's contributions are made into a cloned repo on the server that is specifically for that user. Periodically, I log on to the server, visit each of their repos, and do a git diff to make sure they haven't done anything bad. If all is well, I commit their changes and push them to the central repo. Of course I need to manually look at their changes so that I can add an appropriate commit message. But I would also like to track who made the changes. I am making the commit, and I (and the web server) are the only users that are actually writing anything to the server. I could track this in the commit messages. While this strikes me as wrong, if this is my only option, is there a way to make userx's cloned repo always include "userx: " before each commit message that I add, so that I do not have to remind myself which user's repo I am in? Or even better, is there an easy way for me to make the commit, but in such a way as I credit the user whose cloned repo I am in?


title: Knowledge and skills required for Sharepoint

text: I was just wondering what skills and technologies I need to know to in order to start a career path in Sharepoint. I know that it primarily depends on the job I am applying for but there must be a number of baseline skills that are common among most Sharepoint jobs. Btw, I'm currently a CS student who has only learnt Java.


title: One boilerplate class or many similar classes?

text: Lets say I'm trying to model a variety of objects that are virtually identical, the only difference being their class variables. Am I better off creating one boilerplate class and just calling the constructor with the specific variables, or creating a lot (in this case 100+) of essentially identical classes and hard coding their class variables (which will never change)? To be clear:   * Identical methods    * Identical class variable names but different values   * Identical intended functionality To be clear, my language (Python) doesn't support interfaces that I'm aware of - some of the other similar questions seemed to get answers recommending that. The other option that seems to make sense to me would be to create a base class with each field and method and then create a bunch of unique child classes that contain their unique values. The amount of work to create all the child classes isn't significant to me - I've written a program that quickly parses a text file (that has all the unique values) and can write all the classes to a .py file quickly and easily. Making changes down the road is rather easy for the same reason. (somewhat) Related questions   * Create many similar classes, or just one   * Good Programming Practice for similar child classes


title: How do you feel about browsers getting into the low level intricacies?

text: i was working on a website with FF4 and while resizing an element with Firebug, FF4 just crashed my nVidia Display Driver. Fortunately Windows 7 was able to help me by recovering from this serious error and i was able to completely recover my work again. So my question is, should those browser developers get into low level hardware intricacies, something that was reserved only for game developers and complex graphic software?


title: Why are so many languages passed by value?

text: Even languages where you have explicit pointer manipulation like C it's always passed by value (you _can_ pass them by reference but that's not the default behavior). What is the benefit of this, why are so many languages passed by values and **why are others passed by reference** ? (I understand Haskell is passed by reference though I'm not sure).


title: Whether to separate out methods or not

text: I am new to java and want to learn best coding practices and understand why one method is better than another, in terms of efficiency and as the coding becomes more complicated. This is just an example, but I can take the principles from here to apply elsewhere. I have need an option to display `stuff`, and have put the method `stuff` separately from the method to ask if the user wants to display the `stuff`, as `stuff` has a lot of lines of code. For readability I have done this:               public static void displayStuff ()     {              String input = getInput ("Display stuff? Y/N \n");                  if (input..equalsIgnoreCase ("Y"))                      {                     stuff ();                 }             else if (input.equalsIgnoreCase ("N"))                 {                     //quit program                   }             else                 {                     //throw error                        System.out.print("Error! Enter Y or N: \n");                      }         }               private static String stuff ()         {             //to lots of things here                  return stuff ();         }      Or               public static void displayStuff ()     {              String input = getInput ("Display stuff? Y/N \n");                  if (input..equalsIgnoreCase ("Y"))                      {                     //to lots of things here                                         stuff;                 }             else if (input.equalsIgnoreCase ("N"))                 {                     //quit program                   }             else                 {                     //throw error                        System.out.print("Error! Enter Y or N: \n");                      }         }      Is it better to keep them together and why? Also, should the second method be private or public, if I am asking for data within the class? _I am not sure if this is on topic for here. please advise._


title: Is it good practice to use functions just to centralize common code?

text: I run across this problem a lot. For example, I currently write a read function and a write function, and they both check if `buf` is a NULL pointer and that the `mode` variable is within certain boundaries. This is code duplication. This can be solved by moving it into its own function. But should I? This will be a pretty anemic function (doesn't do much), rather localized (so not general purpose), and doesn't stand well on its own (can't figure out what you need it for unless you see where it is used). Another option is to use a macro, but I want to talk about functions in this post. So, should you use a function for something like this? What are the pros and cons?


title: How do you feel about being asked to code during an interview?

text: I have seen a lot of comments about good interview questions and puzzles to require potential developers to solve during the interview process. I have personally had several interviews in which the interviewer has asked me to write some piece of code or solve a problem during the interview, and I have always performed very poorly in these "tests". The reason is simple, as a developer who spends my days talking to computers, I find I have to prepare myself and "switch gears" to be in "interview mode". I prepare myself to make a good impression. When I'm programming, I'm very focused and am totally different from when I'm being "interpersonal". I just can't get into "the zone" when I'm also having to be a charming and witty potential employee. I feel that by asking a developer to prove his skills during an interview, all you're doing is finding out if they can code under pressure, and at the drop of a hat. It has almost no ability to determine how you would perform in a "real life" development situation. Maybe, if you're looking for someone that can code and chat at the same time, i can see how that would be beneficial. But I think you overlook potential candidates that simply do not perform well in such an artificial environment. While I appreciate that a potential employer wants to see what I can do, I don't think an interview is the place for such a test. I mean, suppose a job for an over the road trucker required that you drive while being interviewed. How does that really end well? So I'm curious as to what others think about such situations. Have you failed interviews because you were not in the right frame of mind? Have you failed to make a good interpersonal impression because you were too distracted trying to solve the problem? If you're a hiring manager, or someone that gives interviews, do you even think about such things? Is it really important that someone perform well in an interview? EDIT: To clarify, I'm not against testing applicants. My concern is about testing during an interview. **See also** : What are the pros and cons for the employer of code questions during an interview? looking at this from the interviewer's point of view.


title: Is there a name for being able to quickly find the relevant code?

text: I notice that a property of codebases that I like hacking on is that it's quick to find the relevant code for some feature, without knowing much about the code base at all. For example, searching for a label in the GUI, and immediately hitting the code that implements that feature. This seems to be in direct tension with abstraction layers, where the label is probably buried behind an I18N module, and the business logic is probably further removed in an MVC framework. (It can be mitigated by including GUI labels in comments though, for example.) It's obviously part of maintainability, but is there a name for this specific, desirable, property?


title: How do I display copyright correctly when using components with multiple permissive licenses?

text: I am writing a commercial application that will make use of some open libraries licensed under different licenses. For example one library will be licensed under the Apache 2.0 license, another will use the LGPL license. Both licenses allow usage in commercial applications, but differ in the way the attributions of licensed work is given. It is my first commercial application that uses 3rd party libraries and I want to do the right thing so that the 3rd party licenses are satisfied. I am not only asking what I should do, but also what I must not do. What is the best way to go about displaying these licenses?


title: What is meant by "OOP hides the state"?

text: In one of many anti-OOP rants on cat-v.org I found a passage by Joe Armstrong raising several objections against the OOP model, one of which was the following: > Objection 4 – Objects have private state > > State is the root of all evil. In particular functions with side effects > should be avoided. > > While state in programming languages is undesirable, in the real world state > abounds. I am highly interested in the state of my bank account, and when I > deposit or withdraw money from my bank I expect the state of my bank account > to be correctly updated. > > Given that state exists in the real world what facilities should programming > language provide for dealing with state? > > OOPLs say “hide the state from the programmer”. The states is hidden and > visible only through access functions. Conventional programming languages > (C, Pascal) say that the visibility of state variables is controlled by the > scope rules of the language. Pure declarative languages say that there is no > state. The global state of the system is carried into all functions and > comes out from all functions. Mechanisms like monads (for FPLs) and DCGs > (logic languages) are used to hide state from the programmer so they can > program “as if state didn’t matter” but have full access to the state of the > system should this be necessary. > > The “hide the state from the programmer” option chosen by OOPLs is the worse > possible choice. Instead of revealing the state and trying to find ways to > minimise the nuisance of state, they hide it away. What exactly is meant by this? I have very little low level or procedural experience, mostly OOP, so that probably explains how unfamiliar with this I am. And from a more modern standpoint, now that most of the Object-Oriented hysteria is passed (at least as far as I can tell), how accurate/relevant do you guys think that passage is? Thanks for your help.


title: Django CBVs vs FBVs

text: For creating a large Django project with many apps, my first initial thought was to used Class Based Views (as the Django tutorials seem to emphasize). However, I noticed that due to a lot of the customizations to each app (multiple forms on each page etc), it became very tedious and was much easier to just implement Function Based Views where I just added decorators such as `@require_GET` and `@login_required` for easy authentication and method not supported messages, and am thoroughly convinced I will never go back to CBVs. From a long term support perspective, has anyone had issues with choosing FBVs over CBVs? Am I doing something in the short term that will hurt long term, and could perhaps be solved by custom Class Based Views?


title: Architecture for application-wide diagnostic-gathering tool?

text: My product owner wants us to report more information on the state of the product when a user contacts customer service through an in-app form. The form eventually results in an email being sent to a customer service email list and handled elsewhere. The part I'm struggling with is how to augment my existing iOS project to allow for some controller to collect diagnostic information from a variety of disparate classes, and do it in a way that's minimally invasive and won't cause a headache if refactoring later. ## Blocks I've experimented with a few ideas, including having an interface that allows an arbitrary class to register a block to be executed when attempting to collect the diagnostic information:               [DiagnosticCollectionController addBlockForDiagnosis:^(DiagnosticCollectionController *controller){         // Add some information here to the controller to send in the diagnostic report     }];      ## Notifications Another idea I had in mind was to have the diagnostic controller broadcast a notification when it's ready to start gathering information, so that other objects can attach what they need to. The (potential) advantage here is that I can get away from using blocks thus prevent myself from having block copy issues:               [[NSNotificationCenter defaultCenter] addObserver:self                                               selector:@selector(someSelectorToHandleDiagnosticPopulation:)                                                   name:DiagnosticCollectionControllerWillSendDiagnostics                                                 object:someDiagnosticController];     // Elsewhere     - (void) someSelectorToHandleDiagnosticPopulation:(NSNotification *)note {         DiagnosticController *controller = [note object];         [controller addDiagnosticData:someDataDictionary];     }


title: Do $_POST, $_GET, etc violate the encapsulation principle?

text: Using globals makes your code hard to test thus more prone to bugs, not secure and unpredictable. That's why we pass the variables we want inside a function/object. So my question is simple: **Do $_POST, $_GET, etc violatethe encapsulation principle?** I'm thinking that, to retain control of those variables in an OO way, an ideal solution would be to add some lines like this to the code:               // Convert the $_GET array to an object     $get = json_decode(json_encode($_GET), FALSE);  // stackoverflow.com/a/1869147     // Stop it from being included from anywhere     unset($_GET);          // Small example of what could be done later on     $DB = new PDO(/* ... */);     $Person = new Person($DB, $get->id);      I haven't seen this anywhere, not even a tutorial nor recommendation. Also, we can clearly see how the code above is much easier to be tested than one that includes `$Person = new Person($DB, $_GET['id']);` or even (the ugly) `$Person = new Person($DB);` as you can use a mock `$get` object. Is the code above in the right direction or am I missing something? **EDIT:** After some investigation (Zend framework and Cake PHP) as Alexander Kuzmin suggested, it seems to be the right thing to go. They're probably too big for me to dig into the code ATM, but I'll keep it in mind.


title: Is it safe to transmit access tokens via HTTP headers?

text: It's the first RESTful web service and I am concerned about security issues. Is it safe to transmit my access token via HTTP headers? For example:               POST /v1/i/resource HTTP/1.1     Content-Type: application/x-www-form-urlencoded     Api-key: 5cac3297f0d9f46e1gh3k83881ba0980215cd71e     Access_token: 080ab6bd49b138594ac9647dc929122adfb983c8          parameter1=foo&parameter2=bar      The connection made over `SSL`. Also, What is need to be defined as the `scope` attribute for every `access token`


title: Silverlight UI and PRISM - how to properly break down components?

text: This is how my solution looks like right now. And it get's to the point where my Controls need reference to Model. It get's real tough to keep Infrastructure, Constants, Controls and Model separated. For download size and modularity MAIN and Modules (there is many) will stay separate. But those core libraries seem to be referenced by all modules and MAIN. I don't see a point in keeping them in separate projects. I'm sure all of you had this same issue. So, I wonder if I should keep trying and keep them separate/loosely coupled (hard to do now without circular references) or it is OK to merge them into one Infrastructure project? My Model has lot's of metadata and this metadate needed in controls and other places. Thats where it get's tight. ![enter image description here](http://i.stack.imgur.com/GvAus.jpg)


title: Reuse MVC4 codebase / deploy MVC4 as standalone desktop application?

text: We have an MVC4 application that we would also need to distribute as a standalone (no network connectivity) desktop application. Rather than rebuild the HTML/JS front-end we would like to reuse that so in essence we're distributing a self-hosted HTML-view-based .NET MVC application. What we _roughly_ envision is: MVC4 .NET DLL + JS libraries + Self-hosted HTTP core + self/embedded browser view. For this standalone desktop app, we're only concerned with Windows OS. Question: Is that practically doable or just a theoretical idea? How would we practically go about achieving that? We are attempting to minimize codebase fragmentation (and duplicate maintenance). We anyways have to support IE for the "online" version of the MVC app. To Clarify: The user experience we would like to have is:   * Single large .exe file that encapsulates all resources within it   * Double clicking it launches a rectangle window within which the HTML app is rendered. This would be similar to how iOS apps have an "HTML view" which uses the OS's in-built HTML renderer (on Windows I assume it's IE?)


title: How to write unit tests without mocking data

text: My design doesn't allow me to mock the data so I am using sqlite as test database that has minimum data to run the unit tests. Below is the pseudo code               //Method to be tested     public IList<Funds> GetFunds()     {           List<Funds> objFundsList = //gets two records from sqlite db;       return objFundsList;     }               //Test Method     public void Check_If_Get_Funds_Returns_List_of_Funds()     {           FundsService obj = new FundsService();           var lstFunds =   obj.GetFunds();           Assert.AreEqual(2,lstFunds.Count());           //Do I need to get first item here to check if bindings for fund is successful           var fund = obj.GetFunds().First();           Assert.AreEqual("test",fund.Name);     }      Since I am not using in-memory mock objects, I can't do sequenceequal. In this scenario, which other tests I can include.


title: What are the options for setting up a UNIX environment to learn C using Kernighan and Richie's The C Programming Language?

text: I'm a novice programmer and have been experimenting with Javascript, jQuery and PHP but felt I wasn't getting a real depth of understanding of what I was doing. So, after reading Joel Spolsky's response to a question on this site (which I can't find now!), I took it back to basics and read Charles Petzold's 'Code' and am about to move onto Kernighan and Richie's The C Programming Language. I want to learn this in a UNIX environment but only have access to a Windows system. I have Ubuntu 12.04 running on a virtualised machine via VMWare Player, and done some coding in the terminal. Is using a Linux distro the only option for programming in a UNIX environment on Windows? And what are the next steps to start programming in C in UNIX and where do I get a compiler from?


title: How to implement a text editor in a browser?

text: This is purely an exercise in self improvement and education.I am trying to implement an extension for a vi-like text editor within a browser. Can anyone give any advice or pointers as to where and how I should start?


title: Writing a compiler, which targets a custom Virtual Machine

text: I've been stuck on a concept for a while. I've been writing toy-languages that are interpreted recently. I've decided I want to move on and to try and create a compiler. I don't really want to use something like LLVM, but instead I want to create my own Stack Based Virtual Machine to generate code for. My question is, how would I go around this? Or rather, what are some good references for building a compiler, which generates code for a custom virtual machine, and finally -- what's the formal term for such a compiler?


title: How does signing headers and/or body provide security

text: I'm securing a WCF webservice with `TransportWithMessageCredential` security that uses certificates. So I'll have to choosee between **signing** headers & body or **signing and encrypting**. Now my question is, after reading _Understanding Protection Level_ what the advantage is of just signing? The fact that WCF will notice that someone has been messing around with the message and going to reject it or am I wrong? Thanks in advance.


title: What was the worst piece of code you fixed that you are proud of?

text: I have had a few that I am proud of and some of them were written by myself few years ago. It doesn't have to be necessarily buggy, just bad code.


title: Pair programming. How?

text: I always want to try some pair programming especially with the one who is more experienced programmer than I am. But how can it be done? Are there any websites where people can collaborate and find partners or something else?


title: In plain English, what is recursion?

text: The idea of recursion is not very common in real world. So, it seems a bit confusing to the novice programmers. Though, I guess, they become used to the concept gradually. So, what can be a nice explanation for them to grasp the idea easily?


title: Having trouble understanding recursion

text: I have just started learning about recursion but I'm having a hard time understanding it. Please would you recommend any links or books that explain recursion in detail.


title: Which assembly should I learn?

text: I would like to learn about reverse engineering, but I'm little bit confused with many different assemblies. So to say... Let me explain! Everytime I start reading assembly tutorial it states it is for MC8600 or x86 or some other CPU. I found here explanation why there is so many assemblies. And I found here and here some useful stuff about RE and assembly. Nevertheless, I'm still little bit scared that I will be learning assembly for 2-3 months, then take some "real-world" application and won't be able to do RE because I know, let say, MC8600 assembly and it's compilled on x86 CPU. So, the question would be... If I want to learn assembly which can be used on modern application (not only for RE), which assembly should I learn? Thank you in advance!


title: Social Impact projects

text: I'm working at a software consultancy that a has a lot of volunteers available for about a month and a half at a time (when we're between projects and learning things) and we'd like to start contributing to open source projects that have a positive social impact. Any idea which projects we can look at? The constraints are:   * Built on a fairly modern language and stack that's suitable for beginners but has wide adoption - Java+Spring+Hibernate / RoR / Groovy+Grails - basically a stack we'd expect to work on in other projects too.    * Has / aims to have a positive on peoples lives - like Ushahidi, OpenMRS, RapidFTR, FrontlineSMS, etc.    * Has well defined stories and requirements, or has owners who are willing to work with our analysts to come up with them.  Any ideas?


title: Machine Learning Algorithm for Heating/Lighting Optimization

text: I'm working on a project where I'm developing an interface that learns how you typically use a space, and tries to create the most appropriate control strategy for heating/lighting. I've done some research into the area of machine learning techniques, but I was wondering if there were any recommendations on which learning algorithm would work best for this scenario. I have a lot of different input parameters: I designed a low-cost wireless sensor which reports light, temperature, humidity, and motion detection every 8 seconds... I also tap into live weather feeds through the internet for exterior conditions... And I'm also storing all of the different UI changes (toggles, sliders, etc...) so hopefully I can tell when people are actually changing certain settings and adapt accordingly. As far as learning algorithms... there's a lot of different options including (to name just a few):   * K-Means   * Decision Tree   * Naïve Bayes   * Neural Networks   * Hidden Markov Models   * Nearest Neighbors Which of these would be most ideal for the scenario I'm referring to of: Having multiple data sources and correlating them with user input to predict future desires and plan accordingly.


title: How can a server side developer survive in a position which expects front-end involvement?

text: My background is back-end server development. **Very** back-end. Now I work in a position where I need to also take care of front-end. Nothing fancy but I need to be able to code for front-end as well. As I said no fancy stuff as I am not a designer. I know some very basic stuff about html/css/js but most of the time I spend googling when I need to do something. So I am wasting time. **To give an example** I needed to upload a file from the web page but I was not aware that there is an `input` tag specifically for file-upload. So I spend quite a while googling to figure out how to do it. So I am not sure if for example this should be something I should have known and it is a gap that I have or not. So what I am interested in is in what should I invest time to "master" so that what I daily need to do, I will be able to do, without spending too much time searching my way.   In a nutshell I am interested to understanding on what are the core "fundamentals" I should focus. **To give an example:**   In CSS I think I should invest time in attribute selectors or positioning but spending time learning fonts is a waste of time for my needs. Am I wrong? So with this is mind I am interested in the what to _must_ know to survive in html/css/javascript? **UPDATE**   None of the answers so far are really relevant and I really need some help.   May be my post need some clarifications? Is there something not clear?


title: How valuable for my career is working on an extremely primitive platform?

text: I work for an analog company on a proprietary sequencer having a few bytes of free RAM (maybe 20 bytes, not kB, bytes); maybe 500 bytes statically allocated; 8 registers including PC; no indirection (in C, a "pointer"); no stack. We write 100% of our application code in assembly, and 95% of our business depends on legacy code, meaning any new code must neatly fit into the existing assembly code. I write assembly code and verify/debug code written (and _not_ tested) by my superiors. The sequencer would have been considered primitive in the 70's. There is no `MOV` instruction: to move `M` into `K`, you must write `CLX A; ORX M; STX K` which much complicates dependency resolution, or at least optimization. Many operations work only on specific registers: for example, a 32-bit right shift uses `K` in the upper word and M in the lower word. This sequencer is used for extremely low-power applications, and has a ROM program. The chip sells for under $0.50 in unfathomably large quantities. I hope I need not justify a higher level language to you; however, my management is not convinced it will be "worth the effort" of developing it, or porting an existing compiler. I feel confident I could write a little Lisp evaluator to produce machine code, but what would that get me? I feel like what I'm doing is an immense waste of time, money, not to mention my own professional development. Is there some authoritative resource I can show my boss and his boss to make them understand? All of this seems like common sense to me (having studied software, my superiors having studied analog, and not being able to write a single line of C), and it's very hard to convey the idea that "if you put a round block into a square hole, it will not fit" to somebody who doesn't know what a block, hole, round, or square is.


title: Designing the bridge between REST layer to service layer

text: I am working on a project and would like to expose some rest services. The technologies used are RestEasy, EJB and JPA/Hibernate. I have structured my app so that there is a clear delimitation between the service layer and model layer. A typical service that retrieves data from the database have a signature like this: `getWhateverList(idForWhichTheListWillBeRetrieved, start)` \- so pretty basic.   What I'm having a hard time wrapping my head around is how to bring together the stiffness of the service layer with the flexibility of the rest layer. Say for example that I would like a typical GET method producing a json array support operations like:   * filtering - use a query param to get, for example items that have a property of type date greater/lower than the param that I provide   * sorting - rest api should support asc or desc    * limiting the fields that are returned from the GET operation How would one go about designing this?


title: Is Computer Science a "solvable" field?

text: Perhaps this is just an overly futurist version of those "does programming have a future" topics, but the questions been on my mind a lot lately. Maybe you've seen this future timeline or things like it, and one of the predictions it makes is that by the year 4000, computer science will be dead as a science. That is to say, that the hardware will have reached the limits of physics and that all the problems of algorithms and software will be solved. Is that a thing that can happen? I could see how, theoretically, physics might reach an end point where you've found all the natural laws there are. But I'd always considered computer science to in some ways be more like economics, a field about decisions and trade-offs. Or could we someday discover all the algorithms, and then it's just a matter of software engineering to select the most appropriate one to use?


title: Handling login errors with User Class

text: We have a User class which handles all things related to users within a Content Management System. As you'd expect, the class contains a function `login()`. This function accepts three arguments: `$username`, `$password` and `$remember` (the latter defaulting to `true`). My question is: what is the best way to handle login errors so that they can be displayed to the user? We're using a custom MVC model here, so we have controllers and views that need to remain abstract from the class itself. I have identified the following possible solutions:   1. Return signed integers from the `login()` function that can be interpreted inside the controller.   2. Add a variable to the `User` object containing the error message in plain text   3. Output the error directly from within the function call Point 3 is moot, since we won't be doing that (coupling output with a class == bad). Point 2 seems to be the most logical, but will make multi-language (a feature that may well be added later) difficult. For example, we might do something like this:               class User     {         public $loginError;              public function login($username, $password, $remember = true)         {             if($password !== $ourStoredPassword)             {                 $this->loginError = 'Password does not match';                 return false;             }         }     }      I think the best option is #1. For example, we could do this inside the Class:               class User     {         public function login($username, $password, $remember = true)         {             if($password !== $ourStoredPassword)             {                 return -1;             }         }     }      Then inside our controller, just look at the return value from `login()`, and handle it therein. What are people's thoughts? Is there a better way to tackle this?


title: Card deck and sparse matrix interview questions

text: I just had a technical phone screen w/ a start-up. Here's the technical questions I was asked ... and my answers. **What do think of these answers**? Feel free to post better answers :-) **Question 1** : how would you represent a standard 52 card deck in (basically any language)? How would you shuffle the deck? **Answer** : use an array containing a "Card" struct or class. Each instance of card has some unique identifier... either it's position in the array or a unique integer member variable in the range [0, 51]. Shuffle the cards by traversing the array once from index zero to index 51. Randomly swap ith card with "another card" (I didn't remember how this shuffle algorithm works exactly). Watch out for using the _same_ probability for each card... that's a gotcha in this algorithm. I mentioned the algorithm is from Programming Pearls. **Question 2** : how to represent a large sparse matrix? the matrix can be very large... like 1000x1000... but only a relatively small number (~20) of the entries are non-zero. **Answer** : condense the array into a list of the non-zero entries. for a given entry (i,j) in the array... "map" (i,j) to a single integer k... then use k as a key into a dictionary or hashtable. For the 1000x1000 sparse array map (i,j) to k using something like f(i, j) = i + j * 1001. 1001 is just one plus the maximum of all i and j. I didn't recall exactly how this mapping worked... but the interviewer got the idea (I think). **Are these good answers**? I'm wondering because after I finished the second question the interviewer said the dreaded "well that's all the questions I have for now." Cheers!


title: What is the preferred tool/approach to putting a SQL Server database under source control?

text: I've evaluated RedGate SQL Source Control tool (http://www.red- gate.com/products/sql-development/sql-source-control/), and I believe that Team Foundation Server 2010 offers a way to do this as well (as touched on here http://blog.discountasp.net/using-team-foundation-server-2010-source- control-from-sql-server-management-studio/). Are there alternatives, or is one of these considered the preferred/standard solution?


title: Does project architecture have a strong relation to used libraries?

text: Programmers, when it comes to talk about popular patterns in enterprise applications, preach that you should code against interfaces to remove strong relations between components; doing this will aid in changing concrete types while minimizing changes in other areas of the application. The underlying assumption is that interfaces are all about abstractions. When it comes to real life it is almost impossible. Lets use an example: Lets say you currently use an ORM framework in your application, which you abstracted by applying the repository pattern. Now, can you really change ORM framework seamlessly?               public interface IRepository<T>     {                 T GetById(int id);               void Add(T entity);         void Remove(T entity);         void Update(T entity);         IQueryable<T> Query(Expression<Func<T, bool>> filter);                                     }       Theoretically, this implementation can be applied to the rest of the application, but many questions remain about the actual application of this pattern:   1. How does this pattern shield me from the internal process of libraries?   2. How does the abstraction deal with the variation in exceptions thrown by each library?   3. If I have selected an ORM which provides a caching mechanism internally and I later decide to switch to an alternative ORM with no such support, how does the pattern handle this? So, from this, I believe that the project architecture is strongly influenced on the libraries that are used. Is there anything wrong with this? Am I assuming too much from this pattern?


title: Have you ever had to sacrifice programmer integrity for customer satisfaction?

text: I mean did you ever reluctantly adopt a less than ideal solution because management told you that "customer is always right"? I'll go with mine first. A few years back, me and my team developed a website of quizzes. Users create quizzes, answer them, rate/tag/vote/share etc. If a quiz had more than 10 questions in it, the UI would serve the quiz in segments. A 30 question long quiz will be split into 3 segments. We used JavaScript and DOM manipulation to let the user easily switch back and forth between segments, without ever having to refresh the whole page. The customer, a big US corporation that owned the site, wasn't happy with this. They didn't care about user experience, they just wanted high page hits. So they wanted the whole page to refresh when the user hit 'Next' or 'Previous'. We had to replace the JavaScript solution, with a very ugly hack involving PHP and Smarty. The result was a sluggish UI, which irritated the H out of the testers. In the same project, the team researched the best practices for improving front-end performance and worked hard to implement them. But all those efforts were in vain when the customer injected their heavy Flash based ads into the pages, making them load real slow. I know it's not an objective question and very likely to be closed, but I would like to hear from the members of the community if they ever had such experiences.


title: Table scaling with partitions or with separate databases?

text: Let's say I have a table (let's call it `BigTable`) which could experience **5,000,000 INSERTS per day** (with possibly just as many SELECTs). Each row inserted is about 50kb. These daily INSERTs are split across 5 clients equally (the table has a FK called `ClientID`). There is never a need to SELECT or JOIN data across multiple clients. I am worried about the database performance as this table grows, so I have come up with three solutions. **SOLUTION 1:**   * Partition `BigTable` by `ClientID`   * Store each partition on a separate hard disk on the server (using Azure blog storage).    * Partition all data which is 1 month old (archive data, yet still need to be queryable) into another set of READONLY partitions. Essentially this means the following partitions on their own storage devices:   * Primary (all data excluding `BigTable`)   * ClientA's `BigTable` (5,000,000 rows per day / 5 clients x 30 days = 30,000,000 rows)   * ClientB's `BigTable` (30,000,000 rows)   * ClientC's `BigTable` (30,000,000 rows)   * ClientD's `BigTable` (30,000,000 rows)   * ClientE's `BigTable` (30,000,000 rows)   * ClientA's `BigTable` archive   * ClientB's `BigTable` archive   * ClientC's `BigTable` archive   * ClientD's `BigTable` archive   * ClientE's `BigTable` archive The number of rows in the archive tables will be (5,000,000) x (age of DB in days) - (30,000,000). This is still a huge table, but will only be used to drawing up the odd report. SQL Server will be hosted on a 14GB, 8core Azure VM. **SOLUTION 2:** The other option is to host separate databases for each client. This means each will have it's own dedicated SQL Server machine. Partitioning will still happen for archive data. This option is not optimal because of the physical separation of the data. Having to manage updates to multiple databases could be very problematic. Having separate database connections for each client will also be a consideration for the developers. Could anyone perhaps advise on these options? **SOLUTION 3:** Archive data into a faster database platform. I don't know much about this, but perhaps a NoSQL database could handle billions of records much better than SQL Server?


title: What is the principle of least astonishment?

text: In programming what is called Principle of Least Astonishment? How is this concept related to designing good APIs? Is this something applicable to only object oriented programming or does it permeate other programming techniques as well? Is this related to the principle of "doing a single thing in your method and do it well" ?


title: Database data structures for RESTful api

text: I am creating a RESTful API. I am struggling to decide on the best way to design my database tables around my resources. Initially, I though a table per resource would be a good way to go, but I'm now worried that this will result in exponentially bigger tables the further down the resource chain you go. For example, imagine I have three resources - users, clients, sales. Users are subscribers to my api, clients are the users customers, and sales are purchases made by each client to the users account. A sale resource is accessed as follows               GET /users/{userID}/clients/{clientID}/sales/{salesID}      So if there are 10 users, each with 10 customers, and for each customer there are 10 sales, the table size gets larger the further down the resource chain we go. Im fairly confident that SQL can cope with large tables, but I'm not sure how read and writes will slow things down. The example above maybe doesn't illustrate it, but my api will have progressively more writes and reads the further down the resource chain we go. I therefore have the scenario where the biggest tables in my database, will be read and written to more times than smaller tables. It will also be necessary to join tables before running queries. The reason is that I allow each user to have a client with the same name. To avoid getting the wrong client data, the users table and clients tables are joined by {userID}. This is also the case for sales. Will joining large tables and running reads and writes slow things down further?


title: Would a cut and paste coder ever get past a job interview?

text: As a long time cut and paste coder I never committed much of the syntax of a language to memory. Even worse, I now use google to solve many of the coding problems which are of the type typically used in job interviews. This has greatly increased my productivity, the quality of the end result and stops me perpetuating the same bugs across all my code. However it means I don't actually remember the detail of the solution. For some reason in a job interview "I would look that up on google" does not seem to be the right answer. Am I better off in the interview to pass no comment on my coding style and simply pull out an iPad and produce the solution?


title: Is there some software to manage a XP Project?

text: I was wondering if there's some software to manage a XP project. I'm starting a school project and I want to follow this methodology, but, we don't have a place to work. Each one works at home (in pairs), therefore I can't follow XP ambient patterns. So, anyone knows of any software to manage this?


title: Can cloud computing replace enterprise architecture?

text: Is cloud computing mature enough to alleviate some of the pains of maintaining the IT infrastructure on site? If so, what are some of the drawbacks of adopting it? Is security and privacy a big concern?


title: I'm porting my app from iOS to Android: what do I need to know?

text: What pitfalls should I avoid?   * What Java language paradigms do Objective-C developers consistently misunderstand? I learned to program in Java, but I have worked in nothing but Objective-C for years now.   * How are the design patterns different between Android and iOS?   * If you've made the transition yourself, what parts of Android confused you or took you longer to learn than it should have?   * Is Eclipse the best OS X IDE for Android? For the record, my app is very strongly tied to UIKit and Foundation, so the word "porting" may be a misnomer; I'll actually be completely rewriting it for Android. No code reuse. Also, I'm doing this to learn Android, so I'd rather fail at the port and learn Android than take a shortcut. * * * As a bit of background, this question was prompted by the types of questions I see on Stackoverflow. Frequently you can tell what someone's background was (C# or Java) by what silly mistakes they make when they're trying to write Obj-C. I'd like to avoid the kinds of mistakes that make Java developers roll their eyes and say, "Silly Objective-C developers, won't they ever learn?"


title: Is it unusual for a small company (15 developers) not to use managed source/version control?

text: It's not really a technical question, but there are several other questions here about source control and best practice. The company I work for (which will remain anonymous) uses a network share to host its source code and released code. It's the responsibility of the developer or manager to manually move source code to the correct folder depending on whether it's been released and what version it is and stuff. We have various spreadsheets dotted around where we record file names and versions and what's changed, and some teams also put details of different versions at the top of each file. Each team (2-3 teams) seems to do this differently within the company. As you can imagine, it's an organised mess - organised, because the "right people" know where their stuff is, but a mess because it's all different and it relies on people remembering what to do at any one time. One good thing is that everything is backed up on a nightly basis and kept indefinitely, so if mistakes are made, snapshots can be recovered. I've been trying to push for some kind of managed source control for a while, but I can't seem to get enough support for it within the company. My main arguments are:   * We're currently vulnerable; at any point someone could forget to do one of the many release actions we have to do, which could mean whole versions are not stored correctly. It could take hours or even days to piece a version back together if necessary   * We're developing new features along with bug fixes, and often have to delay the release of one or the other because some work has not been completed yet. We also have to force customers to take versions that include new features even if they just want a bug fix, because there's only really one version we're all working on   * We're experiencing problems with Visual Studio because multiple developers are using the same projects at the same time (not the same files, but it's still causing problems)   * There are only 15 developers, but we all do stuff differently; wouldn't it be better to have a standard company-wide approach we all have to follow? My questions are:   1. Is it normal for a group of this size not to have source control?   2. I have so far been given only vague reasons for not having source control - what reasons would you suggest _could_ be valid for **not** implementing source control, given the information above?   3. Are there any more reasons **for** source control that I could add to my arsenal? I'm asking mainly to get a feel for why I have had so much resistance, so please answer honestly. I'll give the answer to the person I believe has taken the most balanced approach and has answered all three questions. Thanks in advance


title: System Programming & Object Oriented Design - what to look out for

text: Next semester (starts in just under 5 weeks), I'm taking System Programming and OOD concurrently. Apparently SP centers on working in C on Linux, and I only have Java and Python experience, so I am a little nervous about this. For those of you who've taken these at an university, what should I look out for? I've already taken Computer Organization which included an overview of Assembly. With the exception of implementing loops in assembly, I ranged from B+ to A- in the assembly projects. Building circuitry was another story, however.


title: Explicitly writing default empty constructor

text: Does it make sense to write default constructor when it has no arguments, empty body and no other constructors exist? The only benefit I can think of is reducing the risk of forgetting to add the default constructor when another one is created. But this error would show up anyway if the default constructor is actually being used (at least if the class is "internal" and not in a library), and if it isn't used it can be omitted (yagni). What benefit can this have?


title: How do you react to non-programmers with ideas of 'The Next Big Thing'?

text: Recently and quite often, people with no programming background come and say they have this great idea that can be the next big thing and that the idea(s) is worth a fortune by itself. Then as they know I'm a programmer, they ask me if I'm willing to "code it up" for them or find someone willing to do it for next to nothing. Judging from the enthusiasm, it's like they're drunk on their idea and that that by itself is the most important thing, but they just need a programmer. My response to them, depending on my mood and their general attitude towards what we do, is something along the lines of:   "Having the core of an idea is one thing. Developing it to the point that it becomes a platform that changes the world in which it lives is another, and you're going to be willing to pay proportionately to how big you think your idea is worth." Have you been approached by these business type entrepreneurs (with no technical/developer's knowledge) with such a proposal and how do you react to them?


title: What are the advantages of dynamically binding a method to class instance?

text: I came across Instagram's API client written in Python. In their class **InstagramAPI**, they bind the methods to a function in **bind.py**. When called, the function returns an instance of the class **InstagramAPIMethod** and execute the request call.   1. What are the advantages of doing it this way? (over directly creating instances of **InstagramAPIMethod** in **InstagramAPI** )?   2. What will happen if the methods in **InstagramAPI** are called numerous times? Will it create new a instance every call? Note, the only advantages I thought of are (probably I'm off track):   * The class doesn't/shouldn't care what the implementing class is.   * If a particular method is not called, we will never create an instance.


title: How should I determine my rates for writing custom software?

text: For a custom software that will likely take a year or more to develop, how would I go about determining what to charge as a consultant? I'm having a hard time coming up with a number, and searches online are providing vastly different numbers (between $55/hr and $300/hr). I don't want to shoot too low because it's going to take me so much time (and I'm deferring my education for this project). I also don't want to shoot too high and get unpleasant looks and demand for justification. FWIW I live in Canada, and have approx. 10 years of development experience. I've read the "take your salary and divide it by 1000" rule of thumb, but the thing is I don't have a salary. Currently I'm just doing fairly small programming tasks for a friend who is starting a marketing company, pricing each task fairly arbitrarily. I don't know what I would make over the course of a year doing it, but it would be incredibly low. My responsibilities for the project would be the architecture, programming, database, server, and UX to some degree. It's going to be a public facing web service so I will also need to put a lot of effort into security and scalability. Any advice or experience?


title: Building Portfolio ASP.Net MVC

text: I have been working on building a sample application to add to my portfolio (for freelancing). I am working on building a Shopping website using ASP.Net MVC. My question is - what are the good features of a portfolio? Is it to showcase your coding skills (by developing everything from scratch?) or using open-source shopping cart such as nopcommerce to quickly build soemthing that works and is fool-proof?) I am confused as to which direction to proceed. Kindly guide me. Also, what are the good features to add in my site? As I mentioned earlier, this is an ASP.Net MVC application. Thanks in advance.


title: Why do ads for s/w engineers always say they "offer a fast-paced environment"?

text: Who wants to work in a fast-paced environment? Not me! I want a civilized environment where people have a sense of balance. Higher quality work gets done that way and work life isn't full of stress and anguish.


title: A friend wants some FREE CRUD code

text: A 'friend' of mine asked me to write a complete CRUD system with AJAX for him for free. What should I do? Technically, its bread and butter for me. However, I am wondering if I should get paid for it. I mean it's a commercial project. On the other hand, I was thinking that I do not care if he pays me. Do what ever you want with my code. If it makes you more intelligent and helps you write better code, then I will sense a feeling of accomplishment... So can anyone help me decide?


title: How can I get vampire numbers

text: In class we have a big trouble, how can we get the first "n" vampire numbers, we're working on oracle SQL but in my case I am totally lost, how can i do a query to get it. > A "vampire number" is a number with an even number of digits, and half the > digits (in any order) can be multiplied by the other half of the digits (in > any order) to be equal to that number. > > For example, 1260 is a vampire number because it can be broken in half, and > the two halves rearranged (21 and 60) can be multiplied together to make > 1260


title: About C# objects and the possibilties it has

text: As a novice programmer and I always wonder about c# capabilities. I know it is still early to judge that but all i want to know is can c# do complex stuffs or something outside windows OS.   1. I think C# is a proprietary language (I don't know if I said that right) meaning you can't do it outside Visual Studio or Windows.   2. Also you can't create your own controller (called object right?) like you are forced to use these available in toolbox and their properties and methods.   3. Can C# be used with OpenGL API or DirectX API    4. Finally it always bothers me when I think I start doing things in Visual Studio, I know it sounds arrogant to say but sometimes I feel that I don't like to be forced to use something even if its helpful, like I feel (do I have the right to feel?) that I want to do all things by myself? Don't laugh I just feel that this will give me a better understanding.   5. Is Visual C# like using MaxScript inside 3ds max in that C# is exclusive to do Windows and Forms and Components that are Windows related and maxscript is only for 3d editing and manipulation for various things in the software. If it is too difficult for a beginner I hope you don't answer the fourth question as I don't have enough motivation and I want to keep the little I have. Note:   1. Sorry for my English, I am self taught and never used the language with native speakers so expect so errors.   2. I have a lot of questions regarding many things, what is the daily ratio you think for asking (number of questions) that would not bother the admins of the site and the members here. Thank you for your time.


title: What are the consequences of GPL dependencies?

text: I am developing software for my company and I would like to use some libraries under GPL license. What could be the consequences? Does it mean that the code developed above these GPL dependencies will also be under GPL? Do I have the obligation to publish the source code of these products?


title: Steps in creating a Complex Web Application

text: Hey guys I have this great idea for a web application, but I am unsure on how to develop it. I know I need a team of people to make it, Developers and Designers, but where do I start? Eventually I know I will need everyone, but for a startup, who are the people you need first, and who can you add on as time goes by. So first of, I know exactly what every web page will do, I know what elements each page should have and roughly the layout. So, I thought the best use of my time would to draw out Wire Frames of every page, and then use cases to describe the user interactions. So thats everything I think I can possibly do. The first set of people that come to my mind to hire would be a database designer, since I already know what information we need from the users and how their information and data collected from third parties. Also, they already know how data is going to be displayed from the Wireframes and use cases. Then I thought I would need to hire a designer, to design the web layout and interface. Then I thought I would need a Developer to connect everything together. If you were a small startup and could only hire 1 person at a time, is this the way you would go?


title: What should I be focusing on when building a development PC?

text: I've beeen given a budget for building a desktop PC for app and game development. What components should I consider to be a priority when selecting parts for the computer, and which should I ignore or pay less attention to? Additional Information:   * Budget: $900   * Wish to use by two users at the same time, via two monitors and keyboard/mice


title: What should be done with code that has reached end of life?

text: When a project has reached end of life and is being retired, either because the technology is obsolete, a newer version of the program has been rewritten, or it no longer solves a problem that is needed to be solved, what should be done with the code? Should it be deleted, or kept for future reference? This also applies to projects that someone might develop as a contractor, and the company which needed them goes out of business.


title: How to show data to the user using PHP?

text: I'm always trying to find new methods on development. So I looked into some websites and analyzed their ways of presentation.   1. Returning part of the page using AJAX Normally I will use an array to return values, for example:               //GET User details           $user_id = $_POST['user_id'];           $user_details = $this->get_user($user_id);           if ($user_details['status'] == true) {          exit(json_encode(array('status'=>true, 'data'=>$user_details['data'])));      } else {          exit(json_encode(array('status'=>false, 'reason'=>'SomeReasons....')));      }       But I see that some sites returning `HTML'. Is this preferable in any reason? Also what is the best method to use: `AJAX` or an `iframe`?


title: Debug PHP: is XDebug worthwhile? Are there any alternatives?

text: How do you debug PHP? Just with debug-prints in your script? Or is it worth installing XDebug? Is there any better debugging possiblity?


title: Password hashing and support to your user

text: We've recently moved to a better password storage strategy, with it came all the good stuff:   * Passwords are stored after going through bCrypt   * User is sent an activation link on account creation to confirm ownership of address   * Forgot password without security question, a link is sent to their email.   * The link expires after 24 hours, at which point they will need to request a new one.   * If the account is created from our staff, an email is sent with a random strong password in it. Upon login in the user has to reset it to something we don't know and that is bCrypt'd. Now this is in accordance with the "best-practice" around, but this increased our amount of support request a lot from regular users who don't understand all this, they just want to login. We often get request from users who complain about:   * Incorrect password (from the one that they need to reset they often paste it with a space at the end). They tell us what they are using but we have no way of telling them what their actual password is.   * Saying they aren't receiving the email we send them (activation, reset, etc.). This is often not the case, after much troubleshooting we usually found out they did a typo in the email, that they aren't checking the right email account or that it simply went in the spam folder. We of course can not try it for them as we don't have the password. We are logging the failed attempts but we also clear the password they used since it's likely to be the password used for another account and we didn't want to store in a plain text log file. This leaves us with pretty much nothing to help them when they report problems. I’m curious as to how most people deal with issues like these?


title: Usage of repository between EF model and code consumer

text: I have binary data in my database that I'll have to convert to bitmap at some point. I was thinking whether or not it's appropriate to use a repository and do it there. My consumer, which is a presentation layer, will use this repository. For example:               // This is a class I created for modeling the item as is.     public class RealItem     {         public string Name { get; set; }         public Bitmap Image { get; set; }     }          public abstract class BaseRepository     {         //using Unity (http://unity.codeplex.com) to inject the dependancy of entity context.         [Dependency]         public Context { get; set; }     }          public calss ItemRepository : BaseRepository     {         public List<Items> Select()         {             IEnumerable<Items> items = from item in Context.Items select item;             List<RealItem> lst = new List<RealItem>();             foreach(itm in items)             {                 MemoryStream stream = new MemoryStream(itm.Image);                 Bitmap image = (Bitmap)Image.FromStream(stream);                 RealItem ritem = new RealItem{ Name=item.Name, Image=image };                 lst.Add(ritem);             }                  return lst;         }     }      Is this a correct way to use the repository pattern? I'm learning this pattern and I've seen a lot of examples online that are using a repository but when I looked at their source code... for example:               public IQueryable<object> Select     {         return from q in base.Context select q;     }      as you can see no behavior is added to the system by their approach, so I was confused that maybe repository is something else and I got it all wrong. At the end there should be extra benifits of using them right?


title: Raise a ticket to issue tracking from external web application

text: I don't know if it's the right place to post this question but, to improve my productivity I need to install an open source issue-tracking system to keep tracks of all bugs and information about the completion. There are a lot of open source systems to do that but I'm looking for one which could be hosted on PHP / MySql / Linux server and, in particular allows to raise a ticket via rest or soap from my Spring webapp (I thought to create a simple form in my webApp to submit a ticket). I took a look to The Bug Genie, Mantis and WebIssues and the first two are very hard to be used by non IT user. WebIssues seems to be very easy also for my customers that just need to take a look to the ticket resolution status. Any tips? * * * Note I prefer to install my own system in order to pay only one hosting service.


title: What are known approaches to graphing algebraic expressions?

text: I am planning to build an expression parser that will be used to graph algebraic functions ( think TI-83 ) with JavaScript. Functions will take the form of `f(x)=` Aside from typical operators such as: `+ - * / ^` I'd also like to add support for inline functions such as: `sin()`, `cos()`, `log()` and `random()`. I have looked at implementing the Shunting Yard algorithm for parsing expressions, but it does not look like an efficient approach to evaluating a function with a hundreds or thousands of inputs. What other known algorithms exist for this task?


title: Finding the possible combinations of x switches out of y being true

text: I am working on an algorithm to find possible fills for gaps in text. My function will receive as input: (example)               [false,"o",false,"b",false,"r"]      representing the string "foobar" with some values cut out. My function should find opportunies for the possible ways to fill the gaps given a set maximum characters (and a minimum of one blank filled). so, given a maximum of 2 it should return:               [     [true,"o",false,"b",false,"r"],     [false,"o",true,"b",false,"r"],     [false,"o",false,"b",true,"r"],     [true,"o",true,"b",false,"r"],     [true,"o",false,"b",true,"r"],     [false,"o",true,"b",true,"r"]     ]      Can anyone give me a shove in the right direction? Oh, and I planned to run the results through another function to sort these out, but if I can NOT get results where there is a false between the blanks (ie, from the above, `[true,"o",false,"b",true,"r"]`) it would be a huge bonus. This is in a javascript/jQuery environment


title: Forking an open source project: should one create a new changelog file? Should restart version number?

text: I am going to fork an open source project. Would you recommend to create a new changelog file or to update the original one? Would it be reasonable to increment its version number or would it be better to reset it?


title: How can I prove Google Chrome Web Store that I'm a developer and not a spammer in order to be able to publish my extenssions?

text: I have some _chrome extenssions_ to publish, but when I log into my Chrome Webstore account it says: > Before you publish your first item, you must pay a one-time US$5.00 > developer registration fee. We charge this fee in order to verify developer > accounts and better protect users against fraudulent activity. As it says, this charge is to verify my account. My problem is that due to US sanctions on my country, google doesn't provide any financial trades with us, and so **I have no means to pay this 5$** , so I can not publish any extenssions :( My question is, by what other way I can verify my account? Any kind of help would be appreciated. **Edit** : My question is not about bypassing law, It is about finding a legal way. And I'm trying to develop opensource extenssions without any commercial use. **I don't want to do payments, I know this is not possible for Google.** But There must be some other way of verification.


title: Rails and Mongoid best way to implement sharing system

text: I have to model **User** and **Board** in rails using mongoid as ODM. Each board is referenced to an user through a foreign key **user_id** and now I want to add the ability to share a board with other users. Following CRUD I'd create a new Model called something like **Share** and it's releated Controller with the ability to create/edit/delete a Share but I have some doubts:   1. First, where to save informations about **Shares**? I think I may create a field in the Board's collection called **shared_with** including an array of user ids. in a MySQL I'd created a new table with the ids of who share, the resource shared and the user the resources is shared with but I don't think that's necessary using MongoDB.   2. Every user a Board is shared with should be able to edit the Board (but not to delete it) so the Board should have two relations one with the owner and another with the users the board is shared with, right?   3. For permission (the owner should be able to delete a board but the users it is shared with shouldn't) what to use? I'm using Devise for authentication but I think something like CanCan would fit better. but how to implement it? What do you think about this way? Do you find any problems or have better solutions?


title: Immutable Data Structure For Time Series Data

text: I'm wondering what the best data structure (for storing data on disk) is for storing immutable **time-series** data (99% of the data is truly immutable, the 1% is metadata that is separate from the immutable data). I've been looking at log-structured merge-trees in particular because of it's heavy use by Cassandra and the like.


title: Should I nest functions in languages that allow me to do that or should I rather avoid it?

text: In JavaScript, PL/SQL and some other languages, functions can be nested, i.e. declared within another function. This could be used to break a large function into smaller pieces, but keep those pieces within the context of the larger function.               function doTooMuch() {         function doSomething () {            ...         }         function doSomethingElse() {            ...         }         function doYetAnotherThing() {            ...         }              // doTooMuch body              doSomething();         doSomethingElse();         doYetAnotherThing();     }      In some cases, when those smaller functions do not use local variables of the larger function, this could easily changed to a version where all functions are unnested.               function doSomething () {        ...     }     function doSomethingElse() {        ...     }     function doYetAnotherThing() {        ...     }     function doTooMuch() {         doSomething();         doSomethingElse();         doYetAnotherThing();     }      Assuming that those nested functions are not to be used anywhere else, is it better to keep them within the context of the large function or is it bad because this is exactly what makes the large function, well, large?


title: Looking for some OO design advice

text: I'm developing an app that will be used to open and close valves in an industrial environment, and was thinking of something simple like this:-               public static void ValveController     {         public static void OpenValve(string valveName)         {             // Implementation to open the valve         }              public static void CloseValve(string valveName)         {             // Implementation to close the valve         }     }      (The implementation would write a few bytes of data to the serial port to control the valve - an "address" derived from the valve name, and either a "1" or "0" to open or close the valve). Another dev asked whether we should instead create a separate class for each physical valve, of which there are dozens. I agree it would be nicer to write code like `PlasmaValve.Open()` rather than `ValveController.OpenValve("plasma")`, but is this overkill? Also, I was wondering how best to tackle the design with a couple of hypothetical future requirements in mind:-   1. We are asked to support a new type of valve requiring different values to open and close it (not 0 and 1).   2. We are asked to support a valve that can be set to any position from 0-100, rather than simply "open" or "closed". Normally I would use inheritance for this kind of thing, but I've recently started to get my head around "composition over inheritance" and wonder if there is a slicker solution to be had using composition?


title: Preference to see if a field's value was changed js or linq object?

text: We have some requirements to send emails when various field values are changed in our system. It's an asp.net system using linq to sql with javascript/jquery. Is it preferred to check if a value is changed via js (hidden field is set if the value is changed) or is it better since we are using linq and I have access to the object in question to check that object's current value with what the user has entered (basically compare the textbox value with the object's field value before it is being updated)?


title: Python garbage collection giving me a hard time

text: **Context:** I am developing a web application using `webapp2` web-framework with python to be hosted on GAE. The web application ( _web-app_ from now on), is a chess variant. Being a first timer, I have definitely made a lot of design blunders. One of them, is what this question is regarding to, I will come to it in a short while. The aim of the web-app was to allow quite a large number of players to play 2-player chess, such that multiple games are running in parallel. While not exceeding the free quota on GAE. ( _I am a student_ ). To do that, I thought that I would create a new game object, and store its `id(game_object)` along with the `machine_id` of the two players playing on that instance, in the datastore. When querying the datastore with the `machine_id` of a player, I could get a `id()` value, and I thought could use that value as a `key` in a dictionary wherein a reference to the `game_object` forms the value. Doing this, doesn't need me to write/update the datastore, hence saving on the precious writes. I could easily modify the game-state of the `game_object`, and it could be still referenced by the `id()`. **But, now what happens is, this works fine for a few moves. After that the garbage collection takes place and the`game_object` is wiped off the memory. Raising a NameError exception.** **My question is, can this be solved by creating new game_objects in a separate module where garbage collection is turned off, and then periodically/event-triggered freeing the memory? If not? How do I come around this problem?**


title: Zero behavior objects in OOP - my design dilemma

text: The basic idea behind OOP is that data and behavior (upon that data) are inseparable and they are coupled by the idea of an object of a class. Object have data and methods that work with that (and other data). Obviously by the principles of OOP, objects that are just data (like C structs) are considered an anti-pattern. So far so good. The problem is I have noticed that my code seems to be going more and more in the direction of this anti-pattern lately. Seems to me that the more I try to achieve information hiding between classes and loosely coupled designs, the more my classes get to be a mix of pure data no behavior classes and all behavior no data classes. I generally design classes in a way which minimizes their awareness of other classes' existence and minimizes their knowledge of other classes' interfaces. I especially enforce this in a top-down fashion, lower level classes don't know about higher level classes. E.g.: Suppose you have a general card game API. You have a class `Card`. Now this `Card` class needs to determine visibility to players. One way is to have `boolean isVisible(Player p)` on `Card` class. Another is to have `boolean isVisible(Card c)` on `Player` class. I dislike the first approach in particular as it grants knowledge about higher level `Player` class to a lower level `Card` class. Instead I opted for the third option where we have a `Viewport` class which, given a `Player` and a list of cards determines which cards are visible. However this approach robs both `Card` and `Player` classes of a possible member function. Once you do this for other stuff than visibility of cards, you are left with `Card` and `Player` classes which contain purely data as all functionality is implemented in other classes, which are mostly classes with no data, just methods, like the `Viewport` above. This is clearly against the principal idea of OOP. Which is the correct way? How should I go about the task of minimizing class interdependencies and minimizing assumed knowledge and coupling, but without winding up with weird design where all the low level classes contain data only and high level classes contain all the methods? Does anyone have any third solution or perspective on class design which avoids the whole problem? P.S. Here's another example: Suppose you have class `DocumentId` which is immutable, only has a single `BigDecimal id` member and a getter for this member. Now you need to have a method somewhere, which given a `DocumentId` returns `Document` for this id from a database. Do you:   * Add `Document getDocument(SqlSession)` method to `DocumentId` class, suddenly introducing knowledge about your persistence (`"we're using a database and this query is used to retrieve document by id"`), the API used to access DB and the like. Also this class now requires persistence JAR file just to compile.   * Add a some other class with method `Document getDocument(DocumentId id)`, leaving `DocumentId` class as dead, no behavior, struct-like class.


title: Why doesn't MySQL have an explicit "No Limit" option for queries?

text: I use SQLyog Community edition and like many other SQL applications out there it puts a 1000 result limit on queries that do not have a limit provided. I am wondering why MySQL doesn't have an _explicit_ `NO LIMIT` option when it comes to writing queries. I'm sure that i'm not the only developer that ends up sticking a large limit on the end (within reason) to get a full display view of the records in the table. Providing the records in the table is sensible i'd like to be able to do: `SELECT * FROM course NO LIMIT;` instead of `SELECT * FROM COURSE LIMIT 2500;`


title: Which collection structure I should use for parametrical grouping ordering in c#?

text: I have various windows forms applications that contain various controls that build up custom "group by" and "where" clauses for my class methods. I am thinking to pass a collection structure of some kind in order for the methods to be able to build the group by's and the where clauses. Let's say a list containing the field and the value for the group by or where. Am I going to the right direction? Update: I dont have code yet but let me try to explain better:   1. We have a form with 10 dropdownlists and a checkmark beside them.   2. Also we have adatagrid on the form.   3. Every dropdownlist corresponds to a field in a table.     * If a dropdownlist has its checkbox checked means that it must be part of the group by clause in the select statement.     * The value of the dropdownlist must be part of the where clause. * **note: *** Another application could have different numbers of dropdownboxes and different corresponding fields. I want to create a common method that will retrieve data with user selectable group by and where clauses. So what i think is to pass to the method 2 lists.   * One with (fieldname, value) for the where clauses   * And one with (fieldname) for the group by depending on the logic above... I hope this is more clear.


title: Why use services (REST/SOAP) instead of a library?

text: Let's say you're looking at breaking up your applications into services. Are there any good reasons to adopt a SOA approach vs. just creating a library API that can be loaded by the applications that need it.


title: Which database should I use to manage relationship?

text: I need 2 capabilities:   * calculating mutual friends distinguishing between different types of edges, (e.g. FRIEND, ENEMY and other)   * getting relationships distinguishing between different types of edges as over My problem is speed: If I use a database as MySQL, I can get thousands of relationships in few moments, but if I need to calculate mutual friends, it costs a lot for my server, doesn't it? I've about 100,000 accounts on my site, and I want to introduce a relationship system, but obviously I have to decide the right way to develop it. Do you have any idea?


title: Is there a lightweight method to describe web services, similar to robots.txt or sitemap.xml?

text: I'd like to provide a very lightweight method to describe my web services. No WSDL, WADL or similar complex stuff. Just a mapping from the web service's base URL to a simple description which can be detected and parsed automatically. Basically   * The **name** of the service   * A **link** to some human readable documentation (optional)   * Possibly a **contact** address   * Usage conditions, URL patterns etc. are less needed to keep it simple. The best I could find is OpenSearch Description Documents, but first it could be simpler with plain text config files, and second there is no standard how to connect these service description documents to arbitrary web services (only autodiscovery in ATOM/RSS and HTML). I thought about creating my own format and provide it similar to `robots.txt`:               $ curl http://example.org/services.txt          service: http://example.org/foobar     name: Foobar API     about: http://example.org/foobar-doc.html          service: http://example.org/some/unapi     name: Example ORG's unAPI          # additional fields, to be discussed     standard: http://unapi.info     pattern: ?id={id}&format={format}      So if you know the base URL of a service, such as `http://example.org/some/unapi`, you can look up at least the name in the service description file. Instead of defining my own standard, however, I'd like to know whether there is already something similar to reuse.


title: What is the difference between Visual Studio 2010 Express and the Regular version?

text: i was wondering if i am going to have to pay for the real one. I am developing websites


title: How does a developer set up an environment to hack on an OS like Linux, Plan9 or BSD?

text: I've always found it daunting and confusing how an OS hacker sets up their workflow. As a web-developer I find it easy to set up a workflow because web- sites run on servers and as such my OS is never touched. But an OS programmer, how do you do it? Do you develop on one machine and then somehow transfer code to the other machine? Do you develop on the OS you are developing, that last option seems rife with paradoxes? So how you do it? P.S. My similar Quora question still has no answer to this question...


title: How to keep settings for C++ Unit Test modules in sync with the production code modules?

text: * Note: I'm coming from a Windows / Visual-C++ background.   * Note: I have already read Michael Feathers' Working Effectively with Legacy Code.   * **Note:** _Broad_ question, asking for _narrow_ answers, i.e. while I don't want to narrow this question down to a specific compiler/platform/make system, useful answers will likely only contain one combination. ## The C++ development model Even ideally, you have your, well organized, source files:   * Klass1.h/cpp   * Klass2.h/cpp   * CustomAlgorithms.h (header only)   * main.cpp (may not be needed for a dyn/static lib module) Then, your application consists of **n** modules (even if they are just static libraries all linked together to an executable module in the end. To get from the source to the binary module(s), you need project files / make files / whatever. These files "tell" the _compiler_ (and the linker) how to generate the binary modules from your sourcecode. ## Adding in Unit Tests Regardless of which Testing Framework you use and regardless of where you actually put your test code, **you need to produce different/additional binary modules for your test code than for your production code**. (At least for any executable or dynamic library, static libs should be a tad easier.) If you need to produce different binary modules for your test code, then you need to **maintain a separate/additional set of (compiler) settings for this test code**. With _Visual Studio_ you can try to minimize the amount of work by using vsprops files, but you still are left with a separate project file for your tests and your production modules. This can become problematic to maintain. With a make system, I'm not sure how this is done, but I explicitly want this question to encompass both, as techniques from one may translate into the other. So, **TL;DR** , how do you prevent yourself from having to manually edit two different "project files" (one for test, one for production), every time you add or change something in the production settings.(*) * * * (*) You might think you don't change things that often, but think of a real world scale project with dozens (hundreds) of modules and dozens of developers. Each tiny amount of manual work you save for the test scaffolding will multiply.


title: Flexible cloud file storage for a web.py app?

text: I'm creating a web app using web.py (although I may later rewrite it for Tornado) which involves a lot of file manipulation. One example, the app will have a git-style 'commit' operation, in which some files are sent to the server and placed in a new folder along with the unchanged files from the last version. This will involve copying the old folder to the new folder, replacing/adding/deleting the files in the commit to the new folder, then deleting all unchanged files in the old folder (as they are now in the new folder). I've decided on Heroku for the app hosting environment, and I am currently looking at cloud storage options that are built with these kinds of operations in mind. I was thinking of Amazon S3, however I'm not sure if that lets you carry out these kinds of file operations in-place. I was thinking I may have to load these files into the server's RAM and then re-insert them into the bucket, costing me a fortune. I was also thinking of Progstr Filer (http://filer.progstr.com/index.html) but that seems to only integrate with Rails apps. Can anyone help with this? Basically I want file operations to be as cheap as possible.


title: Good way to explain the need for nestable lambda expressions

text: I'm in a situation where I need to explain lambda expressions to a colleague. He's well-educated, with some programming experience, and my first time showing him lambda expressions seemed to go well. What I'm not explaining well to him is the idea that you can nest lambda expressions inside each other. I use lambdas all the time, and feel like this should be easy to explain to him, but I'm having trouble coming up with an example on the spot, so I'll just pass his question on to all of you: **Why would anyone ever need to nest lambda expressions?** I'm looking for an example sort of like this:               x.f(y => y.g(z => y+z))      where one lambda expression is nested inside another, where the innermost bit of code (`y+z` in this example) makes use of both lambda input parameters. We're using C#, but the language isn't what matters, just a situation where you'd want nested lambdas in a language that isn't mostly lambda calculus.