title: Object Initializer in C# problem with readability

text: I wonder if object initializing have some performance gain in ASP.NET website. I have an office mate that told me that object initialization is much readable and faster than constructor. But one of my office mate disagree with that and said that it always depends. For example I am doing this:               using (var dataAccess = new DatabaseAccess { ConnectionString = ConfigurationManager.ConnectionStrings["test"].ConnectionString, Query = query, IsStoredProc = true })     {         //some code here     }      Is it better if I will do this way?               using (var dataAccess = new DatabaseAccess())     {         dataAccess.ConnectionString = ConfigurationManager.ConnectionStrings["test"].ConnectionString;         dataAccess.Query = query;         dataAccess.IsStoredProc = true;     }      Thanks in advance guys! \--- **EDIT** \---- is this somehow much better:               using (         var dataAccess = new DatabaseAccess          {             ConnectionString = ConfigurationManager.ConnectionStrings["test"].ConnectionString,             Query = query,             IsStoredProc = true         }     )     {         //some code here     }


title: Similar references to themselves in two classes

text: How can I make 1 class (base, generic or something else) from these two classes?               class A     {       A Link { get; set; }     }          class B     {       B Link { get; set; }     }      **UPD:** This is what I have now:               class BSTree     {       public BSTNode Root { get; set; }     }          class AVLTree     {       public AVLNode Root { get; set; }     }          class BSTNode     {       public BSTNode Parent { get; set; }       public BSTNode Left { get; set; }       public BSTNode Right{ get; set; }       public int Key{ get; set; }     }          class AVLNode     {       public AVLNode Parent { get; set; }       public AVLNode Left { get; set; }       public AVLNode Right{ get; set; }       public int Key{ get; set; }       public int Height { get; set;}     }      And finally I want to get something like BaseNode and BaseTree.


title: What's a good notation for showing MVC interactions?

text: I'm developing various websites and functionality to cater to various different use-cases up in Django. Is there a good notation for showing what behaviour is at each stage, e.g., swimlanes. I use BPMN 2 notation for everything, but feel that I am overusing this, and probably abusing the notation :P Example: ![BPMN 2.0 diagram](http://i.stack.imgur.com/PMCzW.png) Please recommend a suitable **notation for showing the interactions between model, view and controller, as well as some of the inner business-logic in each stage**.


title: How to deal with potential enterpreneur developer in a IT startup

text: In a software startup, how can we deal with the main developers/programmers of the company who are good at design and communication, and also have entrepreneurial skills? How do we get them work for us and avoid any kind of competition from them to our business? How can we convince the lead programmer that our startup is the place for him?


title: Mahout's Flexibility for generating recommendations

text: I am currently working on a system that will generate product recommendations like those on Amazon: _"People who bought this also bought this.."_ **This is how I plan to do it** :   * Process the data using Apache Mahout and generate recommendations(data is stored in MySQL), currently item based only.   * Apply a clustering algorithm to make cluster of users and then apply the association rules subjective to each cluster. **My questions are:**   * Will Mahout provide me enough flexibility to tweak the existing algorithms according to my needs. If yes, how?    * Is there a better alternative like R?


title: Why is better to use external  JavaScript or libraries ; and is it prefered to use jquery meaning more security?

text: I read this article Unobtrusive JavaScript with jQuery and I noticed these points in the slide page **11**   * some companies strip JavaScript at the firewall   * some run the NoScript Firefox extension to protect themselves from common XSS and CSRF attacks   * many mobile devices ignore JavaScript entirely   * screen readers **do** execute JavaScript but accessibility issues mean you may not want them to I did not understand the fourth point. What does it mean? I need your comment and responses on these points. Is not using JavaScript and switching to libraries like jQuery worth it? **UPDATE 1 :** whats the meaning of **Unobtrusive JavaScript with jQuery** ? and yes it does not say we should use libraries but we should have them on external files for that reason i asked my question.


title: How easy is it to change languages/frameworks professionally?

text: Forgive me for asking a career related question - I know that they can be frowned upon here, but I think that this one is general enough to be useful to many people. My question is: How easy/difficult is it to get a job using language/frameowork B, when your current job uses language/framework A? e.g. If you use C#/ASP.NET in your current job, how difficult would it be to get a job using python/django, or PHP/Zend, or whatever (the specifics of the example don't matter). Relatedly, if you work in client side scripting, but perhaps work on server- side projects in your own time, how difficult would it be to switch to server- side professionally? So, to sum up, does the choice of which languages/frameworks use at work tend to box you in professionally?


Is Project Titan (Facebook email app) going to be a game changer from a programmers perspective? Although some details are still scarce, the internet is slowly learning more about this new software. From the perspective of a programmer, what if any functionality do you think this will bring to the mass communications sector of internet use? Will it in anyway be a "game changer" from the existing layer of highly successful web based email clients (such as hotmail, gmail, yahoo mail, etc) I'm interested if anyone thinks email fundamentally needs to change other than to add more "connectedness" to other sources of data such as social media profiles.


title: Why not Green Threads?

text: Whilst I know questions on this have been covered already (e.g. http://stackoverflow.com/questions/5713142/green-threads-vs-non-green- threads), I don't feel like I've got a satisfactory answer. The question is: _why don't JVM's support green threads anymore?_ It says this on the code-style Java FAQ: > A green thread refers to a mode of operation for the Java Virtual Machine > (JVM) in which all code is executed in a single operating system thread. And this over on java.sun.com: > The downside is that using green threads means system threads on Linux are > not taken advantage of and so the Java virtual machine is not scalable when > additional CPUs are added. It seems to me that the JVM could have a pool of system processes equal to the number of cores, and then run green threads on top of that. This could offer some big advantages when you have a very large number of threads which block often (mostly because current JVM's cap the number of threads). Thoughts?


title: Why would a video game need  main(String[] args) in its own class?

text: My teacher just told me that whenever I create a class to run something for a video game company that uses Eclipse, I should make a run class with the main and any outputs. He says any arithmetic should then be put in its own class. Here's the example he gave us.               //triangle          import java.util.Scanner;     import java.lang.Math.*;     import java.lang.String;     public class Lab03a  //this class is used to test Triangle     {     public static void main( String[] args )     {         Scanner keyboard = new Scanner(System.in);              //ask for user input         System.out.print("Enter side A ::  ");         int a = keyboard.nextInt();              System.out.print("Enter side B ::  ");         int b = keyboard.nextInt();              System.out.print("Enter side C ::  ");         int c = keyboard.nextInt();                   Triangle test = new Triangle(a, b, c);         test.calcPerimeter();         test.calcArea();         test.toString();         System.out.println("Area "+test.toString());              //ask for user input         System.out.print("Enter side A ::  ");         a = keyboard.nextInt();              System.out.print("Enter side B ::  ");         b = keyboard.nextInt();              System.out.print("Enter side C ::  ");         c = keyboard.nextInt();                   test.setSides(a,b,c);         test.calcPerimeter();         test.calcArea();         test.toString();         System.out.printf("%.3f\n",(test.toString()));              //add one more input section                         }     }      The other class:               import java.util.Scanner;     import java.lang.Math.*;          public class Triangle     {     private int sideA, sideB, sideC;     private double perimeter;     private double theArea;     private double s;     public Triangle()     {        setSides(0,0,0);        perimeter=0;        theArea=0;        s=0;     }          public Triangle(int a, int b, int c)     {         sideA=a;         sideB=b;         sideC=c;     }               public void setSides(int a, int b, int c)     {         sideA=a;         sideB=b;         sideC=c;          }          public void calcPerimeter( )     {         perimeter=sideA+sideB+sideC;          }          public void calcArea()     {         s=perimeter/2;         theArea=(Math.sqrt(s*(s-sideA)*(s-sideB)*(s-sideC)));     }          public String toString()     {         String output = ""+theArea+"\n\n";         return output;     }      } Is this universally true for gaming companys? True for some? Or would most accept this?


title: What, if anything, to do about bow-shaped burndowns?

text: I've started to notice a recurring pattern to our team's burndown charts, which I call a "bowstring" pattern. The ideal line is the "string" and the actual line starts out relatively flat, then curves down to meet the target like a bow. My theory on why they look like this is that toward the beginning of the story, we are doing a lot of debugging or exploratory work that is difficult to estimate remaining work for. Sometimes it even goes up a little as we discover a task is more difficult once we get into it. Then we get into implementation and test which is more predictable, hence the curving down graph. Note I'm not talking about a big scale like BDUF, just the natural short-term constraint that you have to find the bug before you can fix it, coupled with the fact that stories are most likely to start toward the beginning of a two-week iteration. Is this a common occurrence among scrum teams? Do people see it as a problem? If so, what is the root cause and some techniques to deal with it?


title: How loyal should I be to my present employer?

text: I come from a "3rd world country", moved a year ago to a "first world country", got a job doing customer support (networking/ management company) and web dev for my current employer. I started to cover for the main support engineer that was going for holidays; then my boss wanted an iPhone + iPad + server app for managing the employees (app on testing ground now); and gave the project to me. As I started in a new country, I got offered a very low salary, and was told it would be reviewed in a couple months, then it became "when the app is ready", and now that the app is ready, is at the end of this year (I started August last year). I was ok with the low salary as I was mostly learning (Objective-C) I come from microcontroller C and Linux background. Now my boss is in Europe for holidays and left everything (and everyone) for some weeks... I got now the need to make an average salary for a developer (mid level), and have been looking for jobs now that my boss is away. If I get a job before he comes back, I feel a bit guilty that he gave me a chance to learn and I pay him by leaving (and leave him with some web portals, and iOS apps)... But I really need to make more money for my family too, so I have clear I need to improve my conditions, but still feel thankful with the guy. But more important is my family! So how to proceed?


title: Redmine - Database Structure/Normalization

text: I am using redmine for project management and issue tracking. I was looking at the database tables and the underlying structure and was wondering if anyone who is experienced with database architecture can comment on the structure. I am concerned that once there are many users and hundreds (or thousands) of projects (each project containing many issues, with each issue containing many messages, etc.), the database structure could possibly turn out to be a weak point. How is the performance impacted by this design? I would like to hear about the Pros/cons of how the tables are laid out and how the data is separated or normalized, and whether or not it might be worth re-structuring. What would be the benefits of separating the data out to more tables (with less columns per table)


title: Types of unit tests based on usefulness

text: From value point of view I see two groups of unit tests in my practice:   1. Tests that test some non-trivial logic. Writing them (either before implementation or after) reveals some problems/potential bugs and helps to be confident in case logic is changed in the future.   2. Tests that test some very trivial logic. Those tests more like document code (typically with mocks) than test it. The maintenance workflow of those tests is not "some logic changed, test became red - thanks God I wrote this test" but "some trivial code changed, test became false negative - I have to maintain (rewrite) the test without gaining any profit". Most of the time those tests are not worth maintaining (except religious reasons). And according to my experience in many systems those tests are like 80% of all tests. I am trying to find out what other guys think on the topic of unit tests separation by value and how it corresponds to my separation. But what I mostly see is either fulltime TDD propaganda or tests-are-useless-just-write-the-code propaganda. I'm interested in something in the middle. Your own thoughts or references to articles/papers/books are welcome.


title: Simple search from an image list to bring up a specific logo

text: The current way i have my form is a user selects a drop down menu of a particular folder and it displays the current logos in that folder in a row below. These images are grabbed on page load all at once. The problem is, as of right now, i have around 700 logos totaling around 10mb, and every time the user reaches the form, it has to load all 700 images before the page loads, unless the images are already in the browser's cache. My problem isn't so much now, but later if I end up having 1500 logos, or more. I thought about 2 different ways to isolate this issue.   1. To have the drop down selected folder load the images AFTER selected. I asked how to get this accomplished in stack overflow with no success.   2. My second idea now is to create a simple search engine bar that will just show the logo they are searching for it on the fly instead of loading the images.  I know this is possible, i've seen it on a number of image search sites. my question is, does this type of search engine script already exist? if so .. could you point me in the right direction.


title: How is MTU determined and can it be changed

text: I'm developing a multi-part solution that consists of an iOS application and OS X application which communicate over Bluetooth Low Energy. Everything works fine and I can send moderate amounts of text between the iPhone and my MacBook. I would like to be able to send larger amounts of data, such as an image, from the iPhone to the MacBook. I'm able to do this but it takes about 50 minutes for the transfer of 1 image, compressed as a JPEG with a 0.2 quality (on a scale of 0-1). Part of the problem is that in the iOS application when the central connects, it reports an maximum packet length of 20 bytes (plus 3 bytes for header). In iOS 7, the changed the MTU so it's not a hardcoded 23 bytes. I cannot find anywhere that would allow me to specify a higher MTU on my MacBook or in the IOBluetooth framework. I found a constant value in one of the bluetooth header files in the framework that specifies the MTU as 23 (20 + 3 for header), which leads me to believe this is just something hard coded into the framework that should be able to be changed somehow. An alternative would be to use BLE to negotiate some other form of transfer between the systems. Ultimately, the transfer shouldn't be required to go over the Internet (the way Bump does it) but if a direct WIFI or Bluetooth connection could be used without requiring any user configuration, that would work.


title: Initializing a variable as undefined

text: Doing some refactoring, I noticed an unusual pattern I'm not familiar with. Properties and variables that do not yet have a value are initiated with `undefined` declared explicitly, despite the fact that value-less variables and object properties would evaluate to `undefined` anyways:               var foo = undefined;     this.prop = undefined;      **Is there a reason to do this?**


title: What kind of problems is an Android beginner likely to encounter in using Scala?

text: I am a hobbyist programmer who makes and maintains one production system, largely coded in Python, which now has to be ported to Android. I don't know Java at all. However, SL4A in Android makes Python a bit of a second class citizen re APIs, such as Google Cloud Messaging etc. However, for me, Java appears intimidating with its verbose syntax and strict typing. Scala's syntax is more appealing and seems like a possible compromise. From this question and this one on Stack Overflow it seems that Scala development on Android is feasible. However, as a 'beginner', I would like to know what problems I might encounter by using Scala instead of Java. The available information that I can find on the 'Net (including the question from this site cited above) is from early 2012, at the latest, and I imagine the situation has changed since then.


title: Should I use my own public API on my site (via JS)?

text: First of all, this question is far more different other 'public api questions' like this: Should a website use its own public API?, second, sorry for my English. **You can find the question summarized at the bottom of this question.** What I want to achieve is a big website with a public api, so who like programming (like me) and likes my website, can replicate my website's data with a much better approach (of course with some restrictions). Almost everything could be used by the public API. Because of this, I was thinking about making the whole website AJAX driven. There would be parts of the API which would be limited only to my website (domain), like login, registering. There would be only an INTERFACE on the client side, which would use the public and private API to make this interface working. The website would be ONLY CLIENT SIDE, well, I mean, the website would only use AJAX to use the api. * * * How do I imagine this? The website would be like a mobile application, the application only sending a request to a webserver, which returns a json, the application parses it, and uses it to advance in the application. (e.g.: login) My thoughts: **Pros** :   * The whole website is built up by javascript, this means I don't need to transfer the html to the client, saving bandwidth. (I hope so)   * Anyone can use up the data of my website to make their own cool things. (Is this a con or pro? O_O)   * The public API is always in use, so I can see if there are any error. **Cons** :   * Without Javascript the website is unusable.   * The bad guys easily can load the server with requesting too much data (like Request Per Second > 10000), but this can be countered via limiting this with some PHP code and logging.   * Probably much more work So the question in some words is: Should I build my website around my own api? Is it good to work only on the client side? Is this good for a big website? (e.x.: facebook, yeah facebook is a different story, but could it run with an 'architecture' like this?)


title: Best practice to collect information from child objects

text: I'm regularly facing following pattern:               public abstract class BaseItem     {         BaseItem[] children;              // ...              public void DoSomethingWithStuff()         {             StuffCollection collection = new StuffCollection();             foreach(child c : children) c.AddRequiredStuff(collection);             // do something with the collection ...         }              public abstract void AddRequiredStuff(StuffCollection collection);     }          public class ConcreteItem : BaseItem     {         // ...              public override void AddRequiredStuff(StuffCollection collection)         {             Stuff stuff;             // ...             collection.Add(stuff);         }     }      Where I would prefer something like this, for better information hiding:               public abstract class BaseItem     {         BaseItem[] children;              // ...              public void DoSomethingWithStuff()         {             StuffCollection collection = new StuffCollection();             foreach(child c : children) collection.AddRange(c.RequiredStuff());             // do something with the collection ...         }              public abstract StuffCollection RequiredStuff();     }          public class ConcreteItem : BaseItem     {         // ...              public override StuffCollection RequiredStuff()         {             StuffCollection stuffCollection;                  Stuff stuff;             // ...             stuffCollection.Add(stuff);                  return stuffCollection;         }     }      What are pros and cons of each solution? For me, giving the implementation access to parent's information is some how disconcerting. On the other hand, initializing a new list, just to collect the items is a useless overhead ... What is the better design? How would it change, if `DoSomethingWithStuff` wouldn't be part of `BaseItem` but a third class? PS: there might be missing semicolons, or typos; sorry for that! The above code is not meant to be executed, but just for illustration.


title: I feel unprepared to start my first job out of college... how can I improve?

text: I just graduated from university with a degree in Computer Science/Engineering and was fortunate enough to land a job working in the pharmaceutical industry as a developer. My title is System Developer I, which will require the following skills: 0-3 years development experience with C# .NET and SQL Server Experience writing T-SQL and stored procedures XML Javascript I learned of the company at a job fair and was not aware that I would need those skills for the job until after they wanted to set up an interview with me. The interview consisted of talking about my background, an almost-too- simple logic test, and a couple SQL questions that anyone with any experience should be able to answer. I was honest with them and indicated that I had absolutely no experience with SQL Server, .NET, XML, or Javascript, but they offered me the position anyway. Of course, I accepted it, but I am now extremely worried that my skills will not be up to snuff. I fully realize from reading lots of Coding Horror, Stack Overflow, and The Daily WTF that a degree in Comp Sci in no way prepares me to be a software developer; I further realize that I will be a monumental noob in the presence of people who have been doing this for years. I feel like the only thing that makes up for my lack of development experience and programming knowledge are my social skills, innate writing ability, and humility (at least compared with some of my co-graduates who fancied themselves to be the next Steve Jobs... _barf_ ) You will never find me being the prima donna constantly complaining about the system, the language, etc... I just want to do my job like I'm told, work 9 - 5, and go home with my paycheck feeling like I'm competent. If that requires home-study, I'm more than willing because I do love programming and computer science. So far, I've familiarized myself a bit on using SQL Server Management Studio, gave myself a refresher on basic SQL, and started learning more about C# and .NET using Introducing Visual C# 2010 by Adam Freeman from Apress. Can anyone recommend anything else I can do in the meantime to: A. Chill the _*_ * out and enjoy my new job without worrying so much about getting canned for incompetence B. Improve my understanding of design patterns and OOP C. Get the low-down on writing T-SQL in the most efficient way possible Thanks everyone.


title: I might be starting to do Arduino development and I would like some advice

text: So, today I looked at Arduino; seems very interesting. I still don't want to shell out the money just yet, as I have some questions, namely:   1. Should I learn something about electronics? What and with what resources?   2. What stuff should I buy? I have a limited, but not _that_ small budget (probably up to 200€, but preferably _less_ ). I'm interested in getting a screen (mustn't be complex, but I would prefer one like that), some speaker, some way for it to move and a way to remotely control it. I would also want a battery. I also wan't to be able to use my board for many things in the future, so it shouldn't be too basic, I guess. I think I will go with the MEGA, is that smart?   3. What resources do you recommend? Any books? Good tutorials besides what you find on their site?   4. What are really cool extensions (e.g. screens) which I would be adviced to get/try? Help greatly appreciated. Also, I have _never_ developed for any embedded device, but I know C and computer architecture to some degree; I'm somewhat familiar with low level stuff.


title: Scrum overestimation and replanning

text: We are in the middle of our first Sprint and something dawn on us: we over estimated! We had planned 114 ideal hours for this 2 weeks iteration and at the end of the first week we finished the whole Sprint. What do we do now? The "book" says we should, and we will, get the next high priority items from the backlog. Though, how do we add them to the burn down chart? Do we re-write it to account for those stories as if they were there from the begining? Or simply add their estimates to the y axis in the day we start working on them (showing a 90o angle jump)? Any feedback is welcome!


title: How do you name sprints in your projects?

text: Some Scrum software management tools give you this option to explicitly name your sprints. Do you have a preferred way of naming your sprints or do you just use a simple scheme like 1, 2, 3, ...?


title: Permissions and MVC

text: I’m in the progress of developing a web application. This web application is mostly a CRUD interface, although some users are only allowed to perform some actions and see only some parts of views. What would be a reasonable way to handle user permissions, given that some parts of views are not available to users? I was thinking of having a function `hasPermission(permission)` that returns `true` iff the current user has the given permission, although it would require conditionals around all parts of views that are only visible to some users. For example:               {% if has_permission('view_location') %}         {{ product.location }}     {% endif %}      I’m fearing this will become an ugly and unreadable mess, especially since these permissions can get kind of complicated. How is this problem commonly solved in web applications? I’m considering using Haskell with Happstack or Python with Django.


title: The balance between client and server functionality

text: I want to bring the discussion that started in our teams and get your opinion about it. Assume we have an user account which could have different credentials for authentication and associated email to recover. An user has possibility to do signup with an email or use his social profile to complete signup process. As an Rest API from the backend to client looks like:   1. Create account   2. Authorise   3. Update user data   4. Link social account   5. Register email   6. Verify email In addition our BE is distributed and divided between several services/servers/clusters. So different calls are related to different end points. As well we have different client - mobile native applications, web application. The usual registration flow looks for the client like this:   1. Ask user for email   2. Create account (Rest)   3. Authorise (Rest)   4. Ask user for his display name   5. Update data (Rest)   6. Register email (Rest) And future possible calls:   1. Verify email   2. Link social account to user With the Facebook signup:   1. Ask user to login to FB   2. Create account (Rest)   3. Authorise (Rest)   4. Link FB (Rest)   5. Register and verify FB user email (Rest)   6. Update user name based on FB data (Rest) But all these steps are possible to do on backend. So we proposed to have another end point which will hide/combine different calls on BE and return whole process result to the clients:   1. Ask user for FB login   2. New user with FB (proposed Rest)   3. BE is doing register/link verified email/update user data/authorise The pros for this approach:   1. No more duplication of functionality between clients   2. Speed up the networking and user experience The cons for this approach:   1. Additional work for backend   2. Probably most complex scenarios in future updates I would like to get your opinion or experience with this situation. Especially if you already experienced point "Probably most complex scenarios in future updates" from against reasons.


title: How to structure my GUI agnostic project?

text: I have a project which loads from database a XML file which defines a form for some user. XML is transformed into a collection of objects whose classes derive from single parent. Something like Control -> EditControl -> TextBox Control -> ContainterControl -> Panel Those classes are responsible for creation of GUI controls for three different enviroments: WinForms, DevExpress XtraReports and WebForms. All three frameworks share mostly the same control tree and have a common single parent (Windows.Forms.Control, XrControl and WebControl). So, how to do it? Solution a) Control class has abstract methods               Control CreateWinControl();     XrControl CreateXtraControl();     WebControl CreateWebControl();      This could work but the project has to reference all three frameworks and the classes are going to be fat with methods which would support all three implementations. Solution b) Each framework implementation is done in separate projects and have the exact class tree like the Core project. All three implementations are connected using a interface to the Core class. This seems clean but I'm having a hard time wrapping my head around it. Does anyone have a simpler solution or a suggestion how should I approach this task?


title: Inherit one instance variable from the global scope

text: I'm using Curses to create a command line GUI with Ruby. Everything's going well, but I have hit a slight snag. I don't think Curses knowledge (esoteric to be fair) is required to answer this question, just Ruby concepts such as objects and inheritance. **I'm going to explain my problem now, but if I'm banging on, just look at the example below.** Basically, every Window instance needs to have .close called on it in order to close it. Some Window instances have other Windows associated with it. When closing a Window instance, I want to be able to close all of the other Window instances associated with it at the same time. Because associated Windows are generated in a logical fashion, (I append the name with a number: `instance_variable_set(self + integer, Window.new(10,10,10,10))` ), it's easy to target generated windows, because methods can anticipate what assosiated windows will be called, `(I can recreate the instance variable name from scratch, and almost query it: instance_variable_get(self + integer)`. I have a delete method that handles this. If the delete method is just a normal, global method (called like this: `delete_window(@win543)` then everything works perfectly. However, if the delete method is an instance method, which it needs to be in-order to use the `self` keyword, it doesn't work for a very clear reason; it can 'query' the correct instance variable perfectly well (`instance_variable_get(self + integer)`), however, **because it's an instance method, the global instances aren't scoped to it!** Now, one way around this would obviously be to simply make a global method like this: `delete_window(@win543)`. But I have attributes associated with my window instances, and it all works very elegantly. This is very simplified, but it literally translates the problem exactly:               class Dog             def speak                     woof             end     end          def woof             if @dog_generic == nil                     puts "@dog_generic isn't scoped when .woof is called from a class method!\n"             else                     puts "@dog_generic is scoped when .woof is called from the global scope. See:\n" + @dog_generic             end     end          @dog_generic = "Woof!"     lassie = Dog.new     lassie.speak #=> @dog_generic isn't scoped when .woof is called from an instance method!\n          woof #=> @dog_generic is scoped when .woof is called from the global scope. See:\nWoof!      **TL/DR:** I need `lassie.speak` to return this string: `"@dog_generic is scoped when .woof is called from the global scope. See:\nWoof!"` @dog_generic must remain as an insance variable. The use of Globals or Constants is not acceptable. Could woof inherit from the Global scope? Maybe some sort of keyword:               def woof < global # This 'code' is just to conceptualise what I want to do, don't take offence!     end      Is there some way the .woof method could 'pull in' @dog_generic from the global scope? Will @dog_generic have to be passed in as a parameter?


title: How to stay in the zone after finishing a task?

text: I've noticed that while I'm programming, I divide my work into tasks and until a task is complete I cannot stop, even if it takes hours. However, once that task is complete, I find it very hard to move onto the next task. I feel the urge to spend some time having a break, surfing the web, etc, and before you know it the rest of the work day has gone by. Sometimes if it only took 1-2 hours to complete a task, this still happens. Has anyone else experienced this? How do you deal with this so you stay in the zone till all your tasks for the day are done?


title: Git: Fixing a bug affecting two branches

text: I'm basing my Git repo on A successful Git branching model and was wondering what happens if you have this situation: ![enter image description here](http://i.stack.imgur.com/lLGpu.png) Say I'm developing on two feature branches A and B, and B requires code from A. The X node introduces an error in feature A which affects branch B, but this is not detected at node Y where feature A and B were merged and testing was conducted before branching out again and working on the next iteration. As a result, the bug is found at node Z by the people working on feature B. At this stage it's decided that a bugfix is needed. This fix should be applied to both features, since the people working on feature A also need the bug fixed, since its part of their feature. Should a bugfix branch be created from the latest feature A node (the one branching from node Y) and then merged with feature A? After which both features are merged into develop again and tested before branching out? The problem with this is that it requires both branches to merge to fix the issue. Since feature B doesn't touch code in feature A, is there a way to change the history at node Y by implementing the fix and still allowing the feature B branch to remain unmerged yet have the fixed code from feature A? Mildly related: Git bug branching convention


title: Is there a reason someone would choose GPLv2 instead of GPLv3?

text: Is there any reason anyone would use GPL v2 over GPL v3 when starting a new project, or is GPL v2 still around only because older projects can't or haven't updated their license yet?


title: Proper way to implement Android XML onClick attribute in Activity

text: I have used the android:onClick attribute extensively in my XML layouts for my Android application. **Example:**               <Button         android:id="@+id/exampleButton"         android:onClick="onButtonClick" />      Is it proper to create an Interface to enforce the implementation of those onClick methods in Activities that use that layout file?               public interface MyButtonInterface {         public onButtonClick(View v);     }


title: Should I cache the data or hit the database?

text: I have not worked with any caching mechanisms and was wondering what my options are in the .net world for the following scenario. We basically have a a REST Service where the user passes an ID of a Category (think folder) and this category may have lots of sub categories and each of the sub categories could have 1000 of media containers (think file reference objects) which contain information about a file that may be on a NAS or SAN server (files are videos in this case). The relationship between these categories is stored in a database together with some permission rules and meta data about the sub categories. So from a UI perspective we have a lazy loaded tree control which is driven by the user by clicking on each sub folder (think of Windows explorer). Once they come to a URL of the video file, they then can watch the video. The number of users could grow into the 1000s and the sub categories and videos could be in the 10000s as the system grows. The question is should we carry on the way it is currently working where each request hits the database or should we think about caching the data? We are on using IIS 6/7 and Asp.net.


title: Has test driven development (TDD) actually benefited a real world project?

text: I am not new to coding. I have been coding (seriously) for over 15 years now. I have always had some testing for my code. However, over the last few months I have been learning test driven design/development (TDD) using Ruby on Rails. So far, I'm not seeing the benefit. I see some benefit to writing tests for some things, but very few. And while I like the idea of writing the test first, I find I spend substantially more time trying to debug my tests to get them to say what I really mean than I do debugging actual code. This is probably because the test code is often substantially more complicated than the code it tests. I hope this is just inexperience with the available tools (RSpec in this case). I must say though, at this point, the level of frustration mixed with the disappointing lack of performance is beyond unacceptable. So far, the only value I'm seeing from TDD is a growing library of RSpec files that serve as templates for other projects/files. Which is not much more useful, maybe less useful, than the actual project code files. In reading the available literature, I notice that TDD seems to be a massive time sink up front, but pays off in the end. I'm just wondering, are there any real world examples? Does this massive frustration ever pay off in the real world? I really hope I did not miss this question somewhere else on here. I searched, but all the questions/answers are several years old at this point. It was a rare occasion when I found a developer who would say anything bad about TDD, which is why I have spent as much time on this as I have. However, I noticed that nobody seems to point to specific real-world examples. I did read one answer that said the guy debugging the code in 2011 would thank you for have a complete unit testing suite (I think that comment was made in 2008). So, I'm just wondering, after all these years, do we finally have any examples showing the payoff is real? Has anybody actually inherited or gone back to code that was designed/developed with TDD and has a complete set of unit tests and actually felt a payoff? Or did you find that you were spending so much time trying to figure out what the test was testing (and why it was important) that you just tossed out the whole mess and dug into the code?


title: Using GPL software with closed-source hardware

text: Does it violate the GPL v3 if I were to use a gpl licensed firmware with my closed-source hardware that I am selling? Or do both have to be open-source, or do I just have to make the firmware source freely available? Thanks!


title: Should I open up to .net, c# and visual basic?

text: I am a huge linux fan and have been ignoring .net, C#, and visual basic due to their relationship with Microsoft. Am I foredooming them just for their relationship? Is there any advantage to learning them, when you are mainly a linux user?


title: Developing a Project in a Statically Typed Language Entirely in VIM

text: I've recently started taking Scala to heart (sweet Python, I still love you, but your collections just can't match Scala's), and in doing so am now using IntelliJ IDEA almost entirely for development. However, IDEA's Scala plugin is far from perfect, and there are many times I wish I could just go back to my one editor love -- VIM. Unfortunately, there are a few Intellisense-like features I still don't know how to retrieve. Namely,   1. automatic imports   2. type inconsistency recognition   3. method definition lookup   4. a list of valid methods or variables for instances Can anyone recommend any tools to get these done? While Scala is the language most preferred, these concerns are equally valid for C++ and Java. I really would like to leave IDEs behind!


title: How to make a good portfolio for IT student (who loves programming) like me?

text: I am currently a college student, and going to apply for an university in probably next month. Unlike art student who easily put on their works such as models, designs and so on on their portfolio; I am hitting a dead corner trying to find a "creative" way to showcase my work as a programmer. It would be normal if programmer shows his good project with source code and everything else. Well, it should be no problem with actual "good" projects, but all of my projects are crappy (can't help it because I am still student, and don't have much work experience) and I don't even know it's worth to show. Nonetheless, I have learned a lot in only 1 year since I started programming. I am now familiar with Java, PHP, Actionscript3, C#, Objective-C and on my way to learn Ruby. I plan to build a Flash portfolio using Actionscript with Ruby as backend to show what I have learnt. The problem is idea. How to show people that I learned a lot of useful thing? Otherwise I hit the dead end and LOL just show what I have on Github (but i certainly never want that...)


title: What is the argument for singular nouns in RESTful API resource naming?

text: I understand that when naming RESTful URI's it is commonly accepted to use plurals to represent collections of resources. I am curious as to the argument for using singular nouns instead.


title: Checklist for starting a largeish ASP.NET MVC 3 project

text: Currently I'm in the very beginnings of the planning stages of a project I was hired to take part in. It's fairly large, but small enough to be handled by 1 or 2 programmers and a handful of others (for design, marketing, etc.). Mostly the designers and marketers are working on their plans right now, but I have to start thinking about how I'm going to approach it. I think I'm going to use C# and ASP.NET MVC 3 to build it. I'm familiar with C# and the MVC pattern, but haven't done a big project with this particular technology before. I'd like to build a "checklist" of things I need to look at, buy, become familiar with, etc. before starting the project:   * **Database** : I'm assuming that MS SQL server is the standard to use with .net, but: for larger projects, do I need to upgrade from whatever is free/comes with VS2010 express? What steps do I need to take in designing the database for use with MVC? Or LINQ?   * **Testing** : What testing framework is best for this type of application? What testing methodologies should I consider for a web application? How should I approach testing the models and views? Is there a difference between testing controllers from testing a class in any other application?   * **Development** : Is there a particular pattern/patterns which mesh well with MVC development? Do I write the models first, then the controllers? The views first, then the models? Controllers first? How do I write the application to allow for easy update rollouts?   * **Deployment** : What is involved in deploying a .net web application? Do I need to purchase IIS? What should I look into before deployment, wrt configuring the production server? How do I roll out updates with minimal downtime?   * **Etc.:** Is there anything else I should be aware of? Costs? Caveats? Books/websites I should read before ever launching VS?


title: How to decide how backward-compatible my new Mac OS X application should be?

text: I'm currently contemplating writing an OS X version of my Windows software. My Windows application still supports Windows XP, and I know that if I drop support for it now, our customers will cry bloody murder. I'm new to OS X development, and as I learn the technology, APIs, etc., I realized that if I'm going to provide comparable level of backward compatibility (e.g. down to OS X 10.5), I would not be able to use many things that look very useful and relevant in my case (ARC, XPC communications, many others). This is quite different from Windows, in my opinion, where there are very little changed between Windows XP and Windows 7 from desktop application developer's standpoint. So, on one hand, it seems like a complete waste to stick to 2007 or 2009-level API in 2012. On the other hand, according to NetMarketShare report and Stat Owl report Mac OS X 10.5 and 10.6 market share is still 11% and 35%-40% respectively. However, I'm not sure if these older OS users are my target audience (buyers of software utilities) if they didn't bother to upgrade their OS... **My question** : Are there any other reasons I should take into account when deciding if I target 10.5 or 10.6 or 10.7 for a new application?


title: Could submitting a Pull Request ever constitute accepting a Contributor Licence Agreement?

text: Some software projects have a Contributor Licence Agreement. The agreement could, for instance, assign copyright of 3rd-party contributions to the original project creator. Could submitting a Pull Request on github ever constitute accepting such an agreement?


title: Why does the Lisp community prefer to accumulate all the parentheses at the end of the function?

text: Why does the Lisp community prefer to accumulate all the parentheses at the end of the function:               (defn defer-expensive [cheap expensive]       (if-let [good-enough (force cheap)]         good-enough         (force expensive)))      Why not employ a convention like C or Java?   Well ok, Lisp is much more older than those languages, but I'm talking about the contemporary Lispers.               (defn defer-expensive [cheap expensive]       (if-let [good-enough (force cheap)]         good-enough         (force expensive)       )     )      Note: Code snippet is from the book "The Joy of Clojure".


title: Is it good practice to catch a checked exception and throw a RuntimeException?

text: I read some code of a colleague and found that he often catches various exceptions and then always throws a 'RuntimeException' instead. I always thought this is very bad practice. Am I wrong?


title: Why would one transform a checked exception to an unchecked exception?

text: My buddy told me today that some programmers transform a checked exception (e.g. EJBException, SQLException...) to an unchecked (RuntimeException?) My buddy explained a call stack where if you change the bottom of the stack you would have to change every method that calls it if you change the bottom (innermost) method. Can you elaborate and/or examplify with code more in detail or did I misunderstand something? I don't think that I have had that problem since I never wrote `throws`.


title: How do programming languages benefit from being based on English?

text: I think the world now programs in English-based programming languages not only because of historical/economic circumstances, but because the English morphology in particular has some properties that suit algorithmic thinking best. But anyway it would be interesting to hear your opinions on this, especially if you are multilingual yourself. I've seen some mentioning of German-based languages (see Plankalkul for example, in fact the first ever programming language we know very little about, thanks to WW2), also a Russian-based flavor of Algol which existed back in the 80's at least on paper, not sure if it ever existed in binary or not. Both looked a bit sluggish because there were more shortened words and weird abbreviations than full words like in the EN-based languages. So if you know of any other national language-based PL's, even completely archaic and irrelevant today, purely theoretical or whatever, would be interesting to take a look at them. And back to the main question: so what, if any, makes the Shakespeare's language so good for programming? (There is actually a list of Non-English-based programming languages on Wikipedia (of course, where else?), but it would be interesting to hear opinions of native speakers of those languages on how a given "national" programming languages really feels like.)


title: Extreme Programming practices make an application more error prone?

text: I am conducting academic research on the topic of Extreme Programming and whether its practices lead to creating space for more errors and bugs in applications. From the experiences I gathered from many, I have comments that fall on both sides. Many support it and consider it a daily necessity, with dynamics that can facilitate changing project requirements. Many others argue that it leads to many problems, such as:   * Over-involvement with the customer in the process leads to the expression of customer wishes rather than needs   * Many products have multiple customers which lead to conflicting needs and opinions, creating unnecessary blockades   * Many products don’t have any external customers, where the product is made for internal use or to be sold in the future. In these cases, the team itself is playing the user as well as the developer, hence killing the effectiveness of the process.   * Not many things exist in formal documentation, this informality leads to vague vision and can create problems where the customer might say that this is not what we asked etc. etc. The questions is why such conflicting opinions exist regarding XP. Is it a matter of different scenarios? Is there something else? To what extent is the claim (as written in the title) true? I would like people who are working or have worked with XP here to contribute their learning and real world experiences. It would be ideal if you have any facts or references to support you answer.


title: Is it legal to reflector some .NET code and use it in a commercial application?

text: I'm working on a commercial application that requires .NET 4.0 **Client Profile** , but I need to make a call to `HttpUtility.ParseQueryString`, which is not included in the Client Profile but it is in the normal one. So I just figured out that I can use Reflector to get the whole method and all the other required methods for it to work and add it to my app. This way I won't need to change the requirement from Client Profile to the normal one which is a lot heavier just to call a single method. Would this be illegal? Do I **have** to change the applications target framework just for a single method?


title: Beginning programming for real clients, what copyright should I put in the code?

text: So far, I've been writing projects for my friends and friends of my friends, which required no legal stuff. Now I've moved on to freelance programming on websites like vworker.com and I'm wondering what should I put in the comments on top of the code. I'm not doing big, serious serious projects, just frontends and scrapers/bots for what I gather is personal use. Would my usual `// Written by Igor Marvinsky, 2011` be enough?


title: Should I include HTML markup in my JSON response?

text: In an e-commerce site, when adding an item to a cart, I'd like to show a popup window with the options you can choose. Imagine you're ordering an iPod Shuffle and now you have to choose the color and text to engrave. I'd like the window to be modal, so I'm using a lightbox populated by an Ajax call. Now I have two options: ### Option 1: Send only the data, and generate the HTML markup using JavaScript What's nice about this is that it trims down the Ajax request to the bear minimum and doesn't mix the data with the markup. What's not so great about this is that now I need to use JavaScript to do my rendering, instead of having a template engine on the server-side do it. I might be able to clean up the approach a bit by using a client-side templating solution. ### Option 2: Send the HTML markup What's good about this is that I can have the same server-side templating engine I'm using for the rest of my rendering tasks (Django), do the rendering of the lightbox. JavaScript is only used to insert the HTML fragment into the page. So it clearly leaves the rendering to the rendering engine. Makes sense to me. But I don't feel comfortable mixing data and markup in an Ajax call for some reason. I'm not sure what makes me feel uneasy about it. I mean, it's the same way every web page is served up -- data plus markup -- right?


title: Web Site Development Software for VirtualBox Ubuntu 11.04

text: I'm doing some development of a website on a VirtualBox guest running Ubuntu 11.04 (host is running Windows, but I want to do the web development in a Linux environment). My development languages are primarily PHP and Javascript (using Apache and node.js). The question is this: is there a good IDE for work under these conditions that can handle running virtualized? I tried Eclipse, and was not particularly thrilled with the performance; I'm wondering if there's some other way to do this than to do all my text editing in emacs.


title: Which reporting tool you prefer for a web-based application?

text: For both PHP and ASP.NET, which reporting tool you prefer to create, preview and print reports? Not just printing the web-page directly, any professional third-party or an open-source tool.


title: C# - initialize variable inside method and use in whole class

text: this is a conceptual question, but if i initialize a variable in c# as public will it be able to be used in the class as I want a variable "`player1`" and a variable "`player2`" where either could be one of the two (or more)   1. Player   2. Computer  Here is what i would like to know how I would do:               public class Game       {            //equivalent of initializing it here         public bool islogging;           public string[] log;           public int draws, round;                public Game(player p1, computer p2)           {               public player player1 = p1;               public computer player2 = p2;                                                                    }         //other overloads here...         ...     }      trying this it doesn't work as the public keyword is rejected               public Game(player p1, player p2 )     {            public  player player1, player2;          player player3 = p1;          player player4 = p2;           }


title: Are there any downsides to replacing js confirm boxes with "mark record as deleted"?

text: I believe in the user experience of always having a confirm pop-up for deletions. However (though we're very used to it), a separate small pop-up window is not ideal and for users on different browsing devices, using different input devices, they can be a nightmare. So I was thinking of changing all my 'confirm delete?' pop-ups into NOT having a pop-up, deleting the record immediately BUT then offering a link to restore the record on whatever page they user is put on after the 'delete'. This absolutely requires that I update the application so that instead of deleting the record, it is either marked as deleted, or moved to a 'deleted_original-table-name' and thus in either case can be deleted. There may then be an 'admin' process available to periodically delete them permanently. I am looking for thoughts on why this might be a bad idea and any pitfalls to watch for. I'd like to know if there are any advantages/disadvantages to moving it to a separate table vs. marking it has deleted.


title: Automatic code generators

text: One of my colleagues likes to use automatic code generators, which create large amounts of code that is poorly documented and very hard to maintain. Is the cost of using a code generator worth the hassle in maintenance, for the reduced time to creation?


title: Managing International Programmers

text: My boss recently went back to our international office in his home country to interview some potential new employees, and we have decided to hire a few as programmers. They are fresh out of college and have very limited experience (similar to me when I first started working here). I am told they are able to read English, however I looked at the code they wrote as a part of the application process and all their variable names, method names, comments, etc are in Spanish. I am having doubts that they have any ability to _write_ English. I hear they are learners though, so maybe they can learn over time as we give them small training projects. I will be working with them closely, helping them learn good design principles and other things, and I will eventually get to the point where I am producing code with them. Has anyone dealt with this sort of situation and had it end well? What kind of pitfalls should I look out for? What kinds of tools do you know of that can assist in international collaboration and training?


title: Is it possible to get probabilities from a support vector machine?

text: From what I understand, SVM's take a discrete number of x and y values from which to learn from, then when given new x values map it to one y value (category). Is it possible to use SVM's or something similar to instead map x values to probabilities of y values? Let me give you an example, say your x values are arrays of two integers: x = [[1,1],[1,0],[0,1],[0,0]], and you have two categories, a and b such that y = [a,a,b,b]. i.e. [1,1] and [1,0] map to a, [0,1] and [0,0] map to b. Given an x value of [1,0.9], the SVM would probably predict the y value to be the category a, given another x value [1,0.89], the SVM would probably still predict the y value to be a part of the a category. This is what I am looking for: Given x and y values as specified above, the "predict" function I am looking for would return an array of tuples for each category in y of the form: (category, probability x was in category). For example, with the case above, the output would look something like this: [(a,.93),(b,.07)] My application of this would be somewhat like a fuzzy logic system, using pseudocode:               if x is almost certainly in category a:         do something     if x is likely to be in category a:         do something else      Does a system like this already have a name? If not, how would I go about implementing something like this? I'm currently using scikit-learn in Python, so if there's something like this I could do with that library, that would be the best.


title: Is there a better alternative than abusing the IDisposable pattern?

text: Consider the following (Microsoft-sanctioned) code:               <% using (Html.Form<HomeController>(action=>action.Index())) { %>              <input type="text" id="search" />              <input type="button" value="Submit" />          <% } %>      The `using` statement has but one purpose here: _to add a`</form>` tag to the end of the generated HTML._ This feels dirty to me, for what I hope are obvious reasons:   1. It's not `using`'s raison d'etre.   2. It deliberately causes side-effects.   3. It's not intuitive that `Html.Form` would implement `IDisposable`.   4. The `using` statement is not actually required, but `Html.Form` will break without it (unless you emit `</form>` yourself, which kinda misses the whole point). This is not the only abuse that people have heaped onto the `using` pattern. The question is, is there a viable alternative that provides the same stylistic/readability benefits as `using`, without making you feel like taking a shower afterwards?


title: Never had a job - Will it matter for internship?

text: On my 20 years on this planet I have never had a job. I am a CS student who just finished his first year at uni with a 3.8 GPA. I will be applying for internships next fall, and I will have a nice portfolio of "stuff" I can showcase (a mix of web, mobile, and desktop applications) on my resume. But... I don't have any work experience whatsoever. No job folding shirts in the mall; no flipping burgers at Wendy's; nada. Will it be difficult for me to land an internship given that I have no prior work experience? Should I try to find any kind of job in the interval between now and next fall, so I can at least put something down? On a side note, how would it look if I marked myself as "self-employed" as a freelancer selling custom-made websites and web apps (which is something I am planning on doing with a friend)? Would that make up for my lack of real world experience? Would employers eat that kind of thing up? Any and all insight is appreciated!


title: Is Microsoft's Entity Framework a proprietary variant of NHibernate?

text: I have no knowledge of Entity Framework and NHibernate but definitely want to learn. I want to know how to start. Whether to first read documentation of NHibernate or the default Visual Studio Entity Framework? Is Microsoft's Entity Framework a variant of NHibernate?


title: Why do some programmers prefer spaces over tabs?

text: > **Possible Duplicate:**   >  Why do some languages recommend using spaces rather than tabs? While reading over the style guides for PHP   1. PSR-0   2. PSR-1   3. PSR-2 I noticed the rule > Code MUST use 4 spaces for indenting, not tabs. I'm tabs person, I prefer the faster editing that comes with using tabs. But given that the language or markup doesn't require spaces instead of tabs (ala YAML), why force spaces which are more time consuming to edit?


title: How can a computer render a CLI/console along with a GUI?

text: I'm confused when looking into graphics - specifically with operating systems. I mean, how can a computer render a CLI/console along with a GUI? GUI's are completely different from text. And how can we have GUI windows that display text interfaces, ie how can we have CLI in modern Graphics Operating system - that's what I'm mainly trying to grip on to. How does graphics get rendered to display? Is there some sort of memory address that a GPU access which holds all pixel data, and there system's within OS's that gather the pixel position of windows and widgets, along with the Z Index and rasterize them to that memory address, which then the GPU loads to the screen? How about the CLI's integrated with Graphics? How does the OS tell the GPU that a certain part of the screen wants to display text while the rest wants to display pixel data?


title: Why do git commits not contain the name of the branch they were created on?

text: When working with git in a team using feature branches, I often find it difficult to understand the branch structure in history. **Example:** Let's say there was a feature branch **feature/make-coffee** , and bugfixing continued on **master** in parallel to the feature branch. History might look like this:               *     merge feature/make-coffee     |\     | *   small bugfix     | |     * |    fix bug #1234     | |     | *    add milk and sugar     | |     * |    improve comments     | |     * |    fix bug #9434     | |     | *    make coffe (without milk or sugar)     | |     * |    improve comments     |/     *      **Problem** At first glance, I find it difficult to tell which side is the feature branch. I usually need to browse several comments on both sides to get an idea of which is which. This gets more complicated if there are multiple feature branches in parallel (particularly if they are for closely related features), or if there was merging in both directions between feature branch and master. As a contrast, in Subversion, this is significantly easier because the branch name is part of the history - so I can tell right away that a commit was originally made on "feature/make-coffee". Git _could_ make this easier by including the name of the current branch in the commit metadata when creating a commit (along with author, date etc.). However, git does not do this. _Is there some fundamental reason why this is not done? Or is it just that nobody wanted the feature? If it's the latter, are there other ways of understanding the purpose of historical branches without seeing the name?_


title: Is Google's Friend Connect tool defunct?

text: Looking at the Friend Connect sites, documentation, example, I've noticed that:   * there haven't been updates in a long time   * many of the sites used as example sites are dead or abandoned   * the community (forums, message boards, etc) is relatively silent Is google's Friend Connect set of tools defunct/abandoned, or is it still actively being used, developed and marketed?


title: Got an idea for an application, but part of it is patented, any suggestions?

text: so I've been working on developing an idea for an application that I think has the potential to be successful, however after some initial research I've discovered that at least part of my ideas are covered by a patent out there, the patent in particular is held by a really large company (I don't want to give away specifics for fear I'd draw their attention for sure). I'm debating a few options: 1) Develop patents around my ideas that don't conflict and maybe approach the company in question for a license exchange 2) Just approach them for a license outright 3) Just develop around it anyways and hope for the best :-p What have other people done in these situations? Are companies generally willing to grant patent licenses? Are they willing to grant them at reasonable prices? Thoughts?


title: Why do .NET modules separate module file names from namespaces?

text: In implementations of the Scheme programming language (R6RS standard) I can import a module as follows:               (import (abc def xyz))      The system will try to look for a file `$DIR/abc/def/xyz.sls` where `$DIR` is some directory where you keep your Scheme modules. `xyz.sls` is the source code for the module and it is compiled on the fly if necessary. The Ruby, Python, and Perl module systems are similar in this respect. C# on the other hand is a little more involved. First, you have dll files that you must reference on a per project basis. You must reference each one explicitly. This is more involved than say, dropping dll files in a directory and having C# pick them up by name. Second, There isn't a one-to-one naming correspondence between the dll filename, and the namespaces offered by the dll. I can appreciate this flexibility, but it can also get out of hand (and has). To make this concrete, it would be nice if, when I say this `using abc.def.xyz;`, C# would try to find a file `abc/def/xyz.dll`, in some directory that C# knows to look in (configurable on a per project basis). I find the Ruby, Python, Perl, Scheme way of handling modules more elegant. It seems that emerging languages tend to go with the simpler design. Why does the .NET/C# world does things in this way, with an extra level of indirection?


title: Looking for a good approach and data structure to solve this

text: C# WinForms: A Combobox with some items in in.   A spread sheet with some items in it. Each row also has a check-box so users can select them. User picks an items in the combobox and clicks a Save button. It means associate that Combobox item to those selected items in the spreadsheet. **Q1:** What's a good structure I can use to keep track of which combobox item is associated with which items from the spreadsheet? NOTE: User can also Move up or Mode Down the items in the spreadsheet. So it gets a little tricky here, they might have associated some items, then they change the order or those items but we still need to know what items are selected for each combobox item **Q2:** What's a good approach to keep track of that?


title: Should I change the name in the WTFPL?

text: I'm using the WTFPL in my personal projects published on GitHub. Currently I'm using it verbatim, but I have the suspicion I shouldn't be leaving               Copyright (C) 2004 Sam Hocevar <sam@hocevar.net>       in there, and instead should use my name. But the license is very confusing about this. Half of the WTFPL is about the WTFPL itself, so I thought that copyright might refer to a copyright on the license text itself, and not on the project this is licensing. Also, it says > Everyone is permitted to copy and distribute verbatim or modified copies of > this license document, and changing it is allowed as long as the name is > changed. So would I have to change the name, from WTFPL to, say, "WTFPL-Domenic"?


title: How to securely store user credentials from external website

text: I'm developing an application where I'd like to use credentials from external websites. This will be used to login with the website API and get information for the user. Example: I want to use the user Reddit's account to warn him if more than X people reply to one of his comment. How would I go about storing the user's Reddit credentials on my end securely so I only ask once and can automate this process. Or is that even possible?


title: Why make JavaScript class based?

text: JavaScript is a prototype language. To turn it into a class based language adds little value? I am not talking about best-practice here. I remember reading an article from way back, which claimed that the class-based worldview is perceivably more flawed than the one of prototypes. My summary can be found here: http://carnotaurus.tumblr.com/post/3248631891/class-based-javascript-or- not. I am resisting to use the class-based jQuery add-on and other attempts at faciliating class-based JavaScript. Peer pressure is strong but is there a stronger theoretical or practical reason why I should stop resisting?


title: Trying to understand Single Responsiblity Principle

text: I'm having a difficult time understanding the `Single Responsibility Principle`. What should I look for to evaluate the various sources of information on the matter?   What should I look for in examples explaining the principle?


title: Are a class's methods stored only once in memory?

text: When I create an instance of a class the system allocates memory for all instance variables of the class. Some languages may call them fields or properties. But what about the code of the class methods? Are those duplicated too or do I have the code only once in memory? I know all instances got their own values - even inside the methods - but I would like to know about the code. Do I have instance variables and separate "instance methods"?


title: Should desktop developers know some web development and/or vice versa?

text: Do you think desktop application developers should know how to do web development, and/or vice versa? In the industry, is it common for desktop developers to do web development (to some degree) and/or vice versa (again)? To what degree should one of the two parties (if at all) know the other party's job? Should you not specialize at all?


title: BackgroundWorker starting again in Completed event

text: I want a background worker to continue running and occasionally update the user interface. My first idea was to use a BackgroundWorker and in its completed event just fire it up again. **Is using a BackgroundWorker in this fashion acceptable?** Or are there potential issues from using the completed event to trigger the worker? * * * Below is some Pseudo code of what my intentions are               class Program     {         private static BackgroundWorker worker;         private static Int32 runs = 0;              static void Main(string[] args)         {             worker = new BackgroundWorker();             worker.DoWork += worker_DoWork;             worker.RunWorkerCompleted += worker_RunWorkerCompleted;             worker.RunWorkerAsync(runs);             Console.ReadLine();         }              static void worker_DoWork(object sender, DoWorkEventArgs e)         {             //Do time consuming work             Thread.Sleep(3000);         }              static void worker_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e)         {             //Update the UI and start time consuming work again             runs++;             Console.WriteLine("Completed run #" + runs);             worker.RunWorkerAsync();         }     }


title: Entities (DDD) when using CQRS on Akka

text: When using Akka, CQRS style, is still there a place for Entities? Or does everything now go to Aggregates, implemented as Actors + Value Objects. I notice that most entities are written as mutable objects with side effects - this doesn't seem to jive well with Actor based style.


title: Any patent issue if I want to call my classes "signal/slot" as in Qt?

text: I need to code a signal-like mechanism and I was thinking of using the same "slot" and "signal" terms to indicate the signal and the function that needs to be called. Since this is a commercial application I'd like to know if there might be any issue with using these names, e.g. if Qt has some sort of patent on them (I searched around but couldn't find it). I believe this is a stupid question since patenting a class name would be moronic, to say the least.. but anyway... To add some detail: my code is ENTIRELY different and has NOTHING TO DO with Qt except the above. I don't use moc or any Qt class.


title: Show "hobby" project during the interview?

text: I am developing this Android game (Technology wise 3D with OpenGLES2 and shaders, some nice AI with http://www.steeringbehaviors.de/ ) during my free time. The goal is to launched in the "Android Market" and apply for a mobile game development company.And during the interview to show my "game project". I was wondering if the company is not game company ,but a mobile development one ,is it still okay to show it even if they didn't ask about it ?


title: GPLv2 - Multiple AI chess engines to bypass GPL

text: I have gone through a number of GPL-related questions, the most recent being this one: http://stackoverflow.com/questions/3248823/legal-question-about-the-gpl- license-net-dlls/3249001#3249001 I'm trying to see how this would work, so bear with me. I have a simple GUI interface for a game of Chess. It essentially can send/receive commands to/from an external chess engine (ie: Tong, Fruit, etc). The application/GUI is similar in nature to XBoard ( http://www.gnu.org/software/xboard/ ), but was independently designed. After going through a number of threads on this topic, it seems that the FSF considers dynamically linking against a GPLv2 library as a derivative work, and that by doing so, the GPLv2 extends to my proprietary code, and I must release the source to my entire project. Other legal precedents indicate the opposite, and that dynamic linking doesn't cause the "viral" effect of the GPL to propagate to my proprietary code. Since there is no official consensus that can give a "hard-and-fast" answer to the dynamic linking question, would this be an acceptable alternative:   1. I build my chess GUI so that it sends/receives the chess engine AI logic as text commands from an external interface library that I write   2. The interface library I wrote itself is then released under the GPL   3. The interface library is only used to communicate via a generic text pipe to external command-line chess engines   4. The chess engine itself would be built as a command-line utility rather than as a library of any sort, and just sends strings in the Universal Chess Interface of Chess Engine Communication Protocol ( http://en.wikipedia.org/wiki/Chess_Engine_Communication_Protocol ) format.   5. The one "gotcha" is that the interface library should not be specific to one single GPL'ed chess engine, otherwise the entire GUI would be "entirely dependent" on it. So, I just make my interface library so that it is able to connect to any command-line chess engine that uses a specific format, rather than just one unique engine. I could then include pre-built command-line-app versions of any of the chess engines I'm using. Would that sort of approach allow me to do the following:   1. NOT release the source for my UI   2. Release the source of the interface library I built (if necessary)   3. Use one or more chess engines and bundle them as external command-line utilities that ship with a binary version of my UI Thank you. * * * Edit: For what it's worth, this is so I can keep my own code private, as I may want to re-use some of my rendering code in other independent projects. This is not a commercial attempt to just write a cheap UI to effectively "wrap" someone else's engine and profit from their hard work. In the end, I wrote my own simple chess engine (little more than a legal move validator, really) instead of using a GPL'ed component.


title: What IDE(s) or editor(s) do companies like Google, Apple, IBM, etc. use?

text: Even though I have quite some experience in using various tools, I still can't make up my mind whether I prefer using IDE or a simple editor for code editing. Most IDEs I have experienced are written in Java (like Eclipse) which makes them slow and bulky. What's good about them is that it provides lots of tools. On the other hand editors are usually VERY fast. They can also be extended to become more similar to IDEs but usually I don't do that. However, there is _Sublime Text 2_ which has some basic code completion built-in. My question would be whether most Enterprise companies like Google, Apple, IBM and etc (except Microsoft because they have AMAZING IDE which, I assume, is used by MS developers) force their workers to use IDEs and whether using plain editor with external tools is considered being not professional? P.S. Not talking about cases like Android development where working without IDE barely possible.


title: Is it reasonable to NOT provide technical documentation and unit tests to client?

text: As an independent vendor being contracted to write a product for a company, is it reasonable to ship only the source code and user documentation while leaving out design documents, architecture diagrams, unit tests etc (basically anything else not strictly needed to run the product or extend it)? The goal is to make the end product extensible for the client so they can further its development internally, but not for free. They would have dig deeply into source to make sense of some design decisions etc, and they'll be responsible for writing their own comprehensive tests to guard against regressions being introduced. The idea here is not to make the code unintelligible. I would just like to create future opportunity for being contracted to write extensions by virtue of the "inside knowledge" and expertise I have from being the original author. Would this be considered unethical? Edit: The contract is currently being negotiated, so the issue of what constitutes final deliverables hasn't been firmly decided. Additionally, I should have mentioned I will maintain ownership of the product. I will only grant to the client a usage license. Does this detail make a difference in whether this is regarded as bad form?


title: Data "unsort" / homogeneity algorithm

text: In an attempt to not reinvent a wheel, I'm asking if anyone has ideas on a data homogeneity algorithm. A brief example: My data has several elements maybe like   1. Number    2. Color   3. Fruit   4. Letter There are around a 100 of these elements in an array. The algorithm needs to _sort_ the elements so that any 2 entries with the same number are spaced out from each other as much as possible, and the same with color, fruit, etc. It'd also be nice if I could prioritize the elements. It feels like you'd never reach 100% so you'd give it a number of passes to make, check out the result, then try more passes on it. I wouldn't be surprised if there's something out here that just works that I don't have enough google-fu to find.


title: What information should a good (method- / class-) comment contain?

text: This is something that has bothering me for a while now. I guess there are a couple of obvious important things that should go into a comment, such as:   * ~~The author(s)~~   * A description of the parameters (and their types, if we are in a dynamic language)   * A short description of what the method does, e.g. "Trims leading and trailing white-spaces for unlimited length strings."   * If it throws exceptions.   * Semantics of the return value. But one could image all kinds of information that _could_ be added to such a comment, for instance:   * Usage examples   * Explanation of how the method is used in the project scope   * TODOs / Nice to haves for this method which are not yet implemented   * And probably many more Now my question is, how do you write a really good method or class comment (that is, what information do you put in it, and how do you make sure it is kept up-to-date), with just the right amount of information so that any developer who has to work with your code is up to the task, but considering the fact that as you add more and more information to your comment, the probability for it to become outdated rises (e.g. if I add pointers to where the method is / will be used in the project, it could be replaced in that location or it might very well never be used, even though it was intended to).


title: Lock-free IPC in Linux for multi-core processors

text: I'm trying to find a way to write an application with lock-free IPC on Linux, in C, with multi-core processors. Let's assume I have process 1 and process 2 that write to a FIFO or shared memory. Then process 3 and process 4 will read from that shared memory or FIFO. Is this possible with a lock-free algorithm? Your guidance is highly appreciated.


title: General Architecture with Code Tables?

text: I've only worked at once place since graduating my CS degree. This is a pretty basic architecture question but i don't know any better since i've only worked at one place. Where i work we maintain a large number of code tables. For example say you have a Sales/Order system and you have an Order Status. We would maintain an order status table that would look like the following: OrderStatus:               OrderStatusId(PK TinyInt)  OrderStatusDesc(VarChar(50))       1                         Created       2                         Submitted      3                         Processing     4                         Canceled     5                         Verified     6                         Complete      We then create an enumeration off each code table. For example:               Public Enum TblSalesOrderStatus           eosCreated = 1           eosSubmitted = 2           eosProcess = 3           eosCanceled = 4           eosVerified = 5           eosComplete = 6     End Enum      Then in our code we have code like the following:               If OrderStatus = eosCreated OrElse OrderStatus = eosSubmitted Then         ...do some work     End if      On every screen we create we have the id's stored in the controls (like comboboxes). I don't know something about this has always made me think its bad design. Maybe i'm wrong though. Especially when i started getting into REST design. i wanted to pass the Ids rather than descriptions. Of course this doesn't seem right since i'd be the only one i've ever seen pass those type of Ids in a REST service. So is this bad design? Edit:   Trying to make thing a little clearer. Are Code Tables are only stored in two places: The Enum + The Database. When we need a new Id when email our database staff which creates a new code table value for us and emails us back the Id. When then put the new value into our enumerations. We never had problems with it getting out of sync but if we have needed either delete values or change them in the past (adding is easy) which has been pain because everything in the system had to be recompiled. We have went down the route of trying to make things semi-dynamic (which doesn't work out in every case but helps in some). There are tons of examples but a simple example is we have a IsVisible flag in some of the code tables. If we ever want to obsolete or make one of the values not selectable then we set the IsVisible flag = 0. They prefer this compared to having to change code/compile/deploy. Thinking about it i think it would be preferable to have it in buisness logic and have test around it (which we don't :-( ) depending on your prospective.


title: How to handle security of temporary data on web server?

text: I'm primarily an ASP.NET developer but this question really applies regardless of language. So obviously it is a good idea to prevent external attacks that arise from session hijacking and csrf attacks as well. But what about internal attacks when the data involved is temporary, needed for the entire session but also sensitive and worth stealing? There is the naturally just only hire trustworthy people route, but lets say that doesn't apply. Say it is a given you already have code reviews and strict production data access permissions to prevent theft by developers. The application encrypts sensitive data before storing to prevent theft by dbas. How do you protect your temporary sensitive data against web server admins? It seems that they could retrieve information by inspecting web server logs, traffic sniffing and inspection of process memory contents. Naturally I would say production web server admins do not have access to the raw source code.


title: What does the term "Payload" mean in programming

text: I was going through the source code of an open source framework, where I saw a variable "payload" mentioned many times. Any ideas what "payload" stands for?


title: Best way to relate code smells to a non technical audience?

text: I have been asked to present examples of code issues that were found during a code review. My audience is mostly non-technical and I want to try to express the issues in such a way that I convey the importance of "good code" versus "bad code". But as I review my presentation it seems to me I've glossed over the reasons why it is important to write good code. I've mentioned a number of reasons including ease of maintenance, increased likelihood of bugs, but with my "non tech" hat on they seem unconvincing. What is your advice for helping a non-technical audience relate to the importance of good code?


title: Why does JSF automatically generate names for html components and can this be overridden?

text: I'm reading up on JSF. One thing that I noticed that tags such as h:inputText and h:inputTextarea auto-generate a random name. Is there any way to over-ride this?


title: Non-language-specific interview questions for a senior web developer

text: I came across a job posting for a senior web developer position. The posting said that the development will be done using **Ruby on Rails** , but no prior knowledge is required. I confirmed with a contact in that company that a PHP web developer can apply for it or even an ASP.Net developer. I also confirmed that the interview won't contain any questions specific to PHP or Ruby on Rails. Can anyone please provide a good list of questions for a senior web developer that isn't specific to a certain language? **Note** This question isn't a duplicate for similar posts asking for questions relating to PHP, .Net or Ruby. Also, I'm not looking for topics to learn as a web developer, but rather interesting questions for a technical interview given the former conditions.


title: How much should I rely on Visual Studio's Auto Generated Code?

text: I'm reading about ASP.NET (VB.NET) and I want to built my professionally website. I'm wondering though; I'm still using the basics so I'm really just a novice, but how much should I rely on Visual Studio to create my elements? Should I make my own text boxes and have my own login routine, or should I just use ASP.NET's login features? I know eventually you have to use your own classes and such which is where the real coding comes in, but I'm not sure how relaible, flexible and secure the pre-wrote elements are? Any help would be greatly appreciated.


title: How to handle "animated" game where the visual should "animate" instead of abruptly change?

text: I've been playing around and learning javascript/KineticJS by making some simple games (think like board games). I have the game model that is relatively logically simple. When a "move" is given to my game model, it updates the properties of all the pieces. However, I would like to make the view have some nice-looking animation. For example, when six pieces are taken I don't want them to disappear all at once, I'd rather have them animate out 1 by 1. To solve this problem, I basically have the game model tell my view "I updated the following pieces: [list]" And my view adds them to a "visual update queue" that a timer thread is always checking and handling one by one each time it triggers. I'm interested in any opinions on this approach, and since this has obviously been considered before, if any of you handle this problem differently. Thanks!


title: Does a code inherit GNU GPL if it just link to GPL library?

text: Sorry for bad English. Suppose there is a library `xxx` under GNU GPL, that provide a function `yyy`. Suppose my code links to the library and use this function. Does my code inherit GPL license? IANAL, but my thoughts are conflicting:   * On one hand, my code is derivative from the library, so it should inherit GPL.   * On other hand, my code just use link to the `xxx`. Maybe there are other libraries, that has the same interface (particularly, they provide `yyy` function with same functionality, but different implementation). My code may link to any. My code really doesn't _directly_ derived from `xxx`, it just use its interface. So, my code shouldn't inherit GPL. I'm confused. **ADDED.** The question is absolutely abstract. I don't mean any concrete GPL library.


title: How should I select continuous integration tool?

text: I found this cool comparison table for integration servers on Wikipedia, but I am a little uncertain how to rank the tools vs. my needs and interests. The chart itself seems to have a lot of boxes marked unknown, so if you are comfortable updating it on Wikipedia, that could be great too. Are there a few top performing products so I can quickly narrow down to four or five options? Which products seems to have the largest user communities and most ongoing enhancements and integration with new tools? Are the open source offerings best, or are there high quality tools that can be a great deal for a single user at home? Will use of multiple systems (primary desktop, local only home network server, personal and work notebooks, multiple virtual machines spread across all) create problems and how can they be managed?


title: Productivity strategies for one developer using many PCs

text: In a talk about time management, a famous computer scientist said: > "One machine in your life is the right number." He recommended a laptop with a docking station. After trying this approach for about a month, I miss my more powerful desktop (i7 quad core hyperthread), but it is not in my technology road map (or budget) to upgrade from my old Intel Core 2 Duo (2006) notebook this year. What strategies can help me use the desktop while at my desk and without much manual effort the notebook when I am on the go?


title: What are algorithmic paradigms?

text: We generally talk about paradigms of programming as functional, procedural, object oriented, imperative etc but what should I reply when I am asked the paradigms of algorithms? For example are Travelling Salesman Problem, Dijkstra Shortest Path Algorithm, Euclid GCD Algorithm, Binary search, Kruskal's Minimum Spanning Tree, Tower of Hanoi algorithmic paradigms? Or perhaps the paradigms are the data structures I would use to design these algorithms?


title: Automatically turning text into hyperlinks - good or bad UI?

text: I use Trac, a personal wiki tool. I use SVN Tortoise , the subversion tool I use Outlook, Word etc In all these pieces of software, each time I want to type an url or an email address the software turns it into a hyperlink, suddenly altering the behaviour of the text, often treating as a single entity. (i.e a single back- space deletes the whole url, text-select leaps to select the whole url instead of single letters etc ) Its as helpful to me as the Microsoft Office paper-clip. Am I the only one that gets annoyed by these things? If it is generally considered bad UI to do unexpected things. Surely its bad UI. **Update** : As Sii says below : > "Most of the time people prefer hyperlinks ... by default" I suppose that is the truism that I am doubting. Is there any research or evidence to back this up?


title: How would you explain multi threading to a seven year old kid?

text: If you have to explain the concept of multi-threading to a seven year old kid how would you do it? I recently got this question in an interview. I came up with a story using jobs (the task to be done) and workers (the threads) but it was not entirely convincing (considering the kid is too young). If you were asked to describe this, how would you do it?


title: What tool sets and applications have affinity with multiprocessor programming?

text: In grad school I took a class in multiprocessor and distributed operating systems. I think multiprocessor software development will become increasingly important and will be driven by the need to maintain the gains we are accustomed to having from Moore's law as described in an article from Herb Sutter. The Free Lunch Is Over : A Fundamental Turn Toward Concurrency in Software http://www.gotw.ca/publications/concurrency-ddj.htm From the class we learned a little about threads, processes, mutual exclusions, spin locks, p-threads, semaphores, UMA and CCNUMA architectures, and OpenMP. But I think this is just a start.   * What should I learn to better prepare for this kind of work?   * Who is doing projects in this area?   * Is this going to a a common skill soon, and if so, how can I best leverage what I know today?


title: Static functions question

text: Something came to my mind today. I have been doing a lot of the following               new Object().doSomething();      I create an object and call on of its functions, then forget about the object. I don't need it past this one instance. Does this signal a bad coding style. Is it best to convert these methods to a static function so a new object does not need to be created every time?


title: Serializing Data Structures in C

text: I've recently read three separate books on algorithms and data structures, tcp/ip socket programming, and programming with memory. The book about memory briefly discussed the topic of serializing data structures for the purposes of storing it to disk, or sending it across a network. I can't help but wonder why the the other two books didn't discuss serialization at all. After an unsuccessful web/book search I'm left wondering where I can find a good book/paper/tutorial on serializing data structures in C? Where or how did you learn it?


title: What is the general accepted way to name variables that end and start with the same letter?

text: Is something like this acceptable or is it frowned upon? String newsSymbol It just looks strange to me, but it's the best way to describe what the variable is and the data it will hold. I could rename it to something like String articleSymbol but then I'd have to rename a whole other bunch of variables. What are your thoughts? Yay or nay?


title: Tabs versus spaces—what is the proper indentation character for everything, in every situation, ever?

text: The coding standards for the code hosted in drupal.org suggest to use two spaces to indent the code; other sites suggest to use tabs to indent the code. What is the proper indentation character for everything, and in every situation? Please explain the answer you give.


title: C++: Spaces vs Tabs

text: > **Possible Duplicate:**   >  Tabs versus spaces—what is the proper indentation character for everything, > in every situation, ever? I have always used tabs in all my code (C, C++, python etc.) but I was just going through the Google C++ coding guidelines(1) and I found they they say that you _must_ use spaces and not tabs in your code. I couldn't think of a reason why they ask that. Is it because tabs show inconsistent results across different editors or something similar? Does anyone know what the reason is or might be?


title: Facebook Payments & Credits vs. Real-World & Charities

text: I am having a difficult time understanding Facebook's internal "e-commerce microcosm" and what it allows Facebook App developers to do (and what it restricts them from doing). Two use cases:   * I'm an e-com retailer selling clothes and coffee mugs (real-world goods) on my website; I want to write a Facebook App that allows Facebook users to buy my real-world goods from inside of Facebook using real money ($ USD)   * I'm highschool student trying to raise money for my senior class trip and want to build a Facebook App that allows Facebook users to donate to our class using real money ($ USD) Are these two scenarios possible? If not, why (what Facebook policies prohibit me from doing so)? If so, what APIs do I use: Payments or Credits? And how (specifically) would it work? Do Facebook Users have to first buy "credits" (which are mapped to $ USD values under the hood) and pay/donate with credits, or can they whip out their credit card and pay/donate right through my Facebook App? I think that last question really summarizes my confusion: **can Facebook users enter their credit card info directly into Facebook Apps, or do you have to go through Payments/Credits APIs as a "middleman"**?